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

97 lines
3.6 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-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);
2012-01-07 06:10:02 +01:00
void forceLogout() { logout(true); }
void cleanLogout() { logout(false); }
2011-08-30 01:20:30 +02:00
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();
2012-01-07 06:10:02 +01:00
void processDeath();
2011-08-15 23:02:52 +02:00
void processTextMessage(const std::string& type, const std::string& message);
void processCreatureSpeak(const std::string& name, int level, const std::string& type, const std::string& message, int channelId, const Position& creaturePos);
2011-11-10 06:29:25 +01:00
void processInventoryChange(int slot, const ItemPtr& item);
2012-01-07 06:10:02 +01:00
void processAttackCancel();
2011-08-30 17:12:57 +02:00
void walk(Otc::Direction direction);
void turn(Otc::Direction direction);
2012-01-03 21:41:00 +01:00
void look(const ThingPtr& thing);
void use(const ThingPtr& thing);
2012-01-04 14:02:35 +01:00
void attack(const CreaturePtr& creature);
2012-01-05 15:24:38 +01:00
void cancelAttack();
2012-01-04 14:02:35 +01:00
void follow(const CreaturePtr& creature);
2012-01-05 15:24:38 +01:00
void cancelFollow();
2012-01-04 14:02:35 +01:00
void rotate(const ThingPtr& thing);
void talk(const std::string& message);
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);
2012-01-05 13:48:10 +01:00
void inviteToParty(int creatureId);
2011-11-14 23:32:55 +01:00
void openOutfitWindow();
2011-11-16 18:33:43 +01:00
void setOutfit(const Outfit& outfit);
2012-01-04 15:30:28 +01:00
void addVip(const std::string& name);
void removeVip(int playerId);
2012-01-04 14:02:35 +01:00
int getThingStackpos(const ThingPtr& thing);
2012-01-05 15:24:38 +01:00
2012-01-06 20:25:27 +01:00
bool checkBotProtection();
2011-08-15 23:02:52 +02:00
bool isOnline() { return m_online; }
2012-01-07 06:10:02 +01:00
bool isDead() { return m_dead; }
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; }
2012-01-08 16:42:23 +01:00
int getProtocolVersion() { return PROTOCOL; }
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;
2012-01-07 06:10:02 +01:00
bool m_dead;
2011-12-28 12:26:52 +01:00
int m_serverBeat;
2012-01-05 15:24:38 +01:00
2012-01-07 23:24:29 +01:00
2011-08-15 16:11:24 +02:00
};
extern Game g_game;
2011-08-15 23:02:52 +02:00
#endif