tibia-client/src/otclient/core/game.h

76 lines
2.8 KiB
C
Raw Normal View History

2011-08-28 15:17:58 +02:00
/*
2012-01-02 17:58:37 +01:00
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
2011-08-28 15:17:58 +02:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
2011-08-15 16:11:24 +02:00
#ifndef GAME_H
#define GAME_H
2011-08-15 23:02:52 +02:00
#include "declarations.h"
#include <otclient/net/declarations.h>
2011-11-10 06:29:25 +01:00
#include <otclient/core/item.h>
2011-11-16 18:33:43 +01:00
#include <otclient/core/outfit.h>
2011-08-15 16:11:24 +02:00
class Game
{
public:
2011-08-30 17:12:57 +02:00
// login/logout related
2011-08-16 02:30:31 +02:00
void loginWorld(const std::string& account,
const std::string& password,
2011-08-26 20:00:22 +02:00
const std::string& worldHost, int worldPort,
2011-08-16 02:30:31 +02:00
const std::string& characterName);
void cancelLogin();
2011-08-30 01:20:30 +02:00
void logout(bool force);
void processLoginError(const std::string& error);
2011-08-29 20:38:01 +02:00
void processConnectionError(const boost::system::error_code& error);
void processLogin(const LocalPlayerPtr& localPlayer);
void processLogout();
2011-08-15 23:02:52 +02:00
2011-09-04 19:21:42 +02:00
void processTextMessage(int type, const std::string& message);
2011-11-10 06:29:25 +01:00
void processInventoryChange(int slot, const ItemPtr& item);
2011-08-30 17:12:57 +02:00
void walk(Otc::Direction direction);
void turn(Otc::Direction direction);
2012-01-03 01:10:39 +01:00
void lookAtMap(const Position& position);
2012-01-03 14:13:54 +01:00
void lookAtInventory(int thingId, Otc::InventorySlots slot);
2011-11-03 17:26:17 +01:00
void talkChannel(int channelType, int channelId, const std::string& message);
void talkPrivate(int channelType, const std::string& receiver, const std::string& message);
2011-11-14 23:32:55 +01:00
void openOutfitWindow();
2011-11-16 18:33:43 +01:00
void setOutfit(const Outfit& outfit);
2011-08-15 23:02:52 +02:00
bool isOnline() { return m_online; }
2011-08-15 16:11:24 +02:00
2011-12-28 12:26:52 +01:00
void setServerBeat(int serverBeat) { m_serverBeat = serverBeat; }
int getServerBeat() { return m_serverBeat; }
2011-08-15 23:02:52 +02:00
LocalPlayerPtr getLocalPlayer() { return m_localPlayer; }
2011-08-16 02:30:31 +02:00
ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
2011-08-15 16:11:24 +02:00
private:
2011-08-15 23:02:52 +02:00
LocalPlayerPtr m_localPlayer;
2011-08-15 16:11:24 +02:00
ProtocolGamePtr m_protocolGame;
bool m_online;
2011-12-28 12:26:52 +01:00
int m_serverBeat;
2011-08-15 16:11:24 +02:00
};
extern Game g_game;
2011-08-15 23:02:52 +02:00
#endif