Otclient  14/8/2020
game.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #ifndef GAME_H
24 #define GAME_H
25 
26 #include "declarations.h"
27 #include "item.h"
28 #include "animatedtext.h"
29 #include "effect.h"
30 #include "creature.h"
31 #include "container.h"
32 #include "protocolgame.h"
33 #include "localplayer.h"
34 #include "outfit.h"
35 #include <framework/core/timer.h>
36 
37 #include <bitset>
38 
40  bool operator==(const UnjustifiedPoints& other) {
41  return killsDay == other.killsDay &&
43  killsWeek == other.killsWeek &&
45  killsMonth == other.killsMonth &&
47  skullTime == other.skullTime;
48  }
56 };
57 
58 typedef std::tuple<std::string, uint, std::string, int, bool> Vip;
59 
60 //@bindsingleton g_game
61 class Game
62 {
63 public:
64  Game();
65 
66  void init();
67  void terminate();
68 
69 private:
70  void resetGameStates();
71 
72 protected:
73  void processConnectionError(const boost::system::error_code& ec);
74  void processDisconnect();
75  void processPing();
76  void processPingBack();
77 
78  void processUpdateNeeded(const std::string& signature);
79  void processLoginError(const std::string& error);
80  void processLoginAdvice(const std::string& message);
81  void processLoginWait(const std::string& message, int time);
82  void processLoginToken(bool unknown);
83  void processLogin();
84  void processPendingGame();
85  void processEnterGame();
86 
87  void processGameStart();
88  void processGameEnd();
89  void processDeath(int deathType, int penality);
90 
91  void processGMActions(const std::vector<uint8>& actions);
92  void processInventoryChange(int slot, const ItemPtr& item);
93  void processAttackCancel(uint seq);
94  void processWalkCancel(Otc::Direction direction);
95 
96  void processPlayerHelpers(int helpers);
97  void processPlayerModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeMode, Otc::PVPModes pvpMode);
98 
99  // message related
100  void processTextMessage(Otc::MessageMode mode, const std::string& text);
101  void processTalk(const std::string& name, int level, Otc::MessageMode mode, const std::string& text, int channelId, const Position& pos);
102 
103  // container related
104  void processOpenContainer(int containerId, const ItemPtr& containerItem, const std::string& name, int capacity, bool hasParent, const std::vector<ItemPtr>& items, bool isUnlocked, bool hasPages, int containerSize, int firstIndex);
105  void processCloseContainer(int containerId);
106  void processContainerAddItem(int containerId, const ItemPtr& item, int slot);
107  void processContainerUpdateItem(int containerId, int slot, const ItemPtr& item);
108  void processContainerRemoveItem(int containerId, int slot, const ItemPtr& lastItem);
109 
110  // channel related
111  void processChannelList(const std::vector<std::tuple<int, std::string> >& channelList);
112  void processOpenChannel(int channelId, const std::string& name);
113  void processOpenPrivateChannel(const std::string& name);
114  void processOpenOwnPrivateChannel(int channelId, const std::string& name);
115  void processCloseChannel(int channelId);
116 
117  // rule violations
118  void processRuleViolationChannel(int channelId);
119  void processRuleViolationRemove(const std::string& name);
120  void processRuleViolationCancel(const std::string& name);
122 
123  // vip related
124  void processVipAdd(uint id, const std::string& name, uint status, const std::string& description, int iconId, bool notifyLogin);
125  void processVipStateChange(uint id, uint status);
126 
127  // tutorial hint
128  void processTutorialHint(int id);
129  void processAddAutomapFlag(const Position& pos, int icon, const std::string& message);
130  void processRemoveAutomapFlag(const Position& pos, int icon, const std::string& message);
131 
132  // outfit
133  void processOpenOutfitWindow(const Outfit& currentOutfit, const std::vector<std::tuple<int, std::string, int> >& outfitList,
134  const std::vector<std::tuple<int, std::string> >& mountList);
135 
136  // npc trade
137  void processOpenNpcTrade(const std::vector<std::tuple<ItemPtr, std::string, int, int, int> >& items);
138  void processPlayerGoods(int money, const std::vector<std::tuple<ItemPtr, int> >& goods);
139  void processCloseNpcTrade();
140 
141  // player trade
142  void processOwnTrade(const std::string& name, const std::vector<ItemPtr>& items);
143  void processCounterTrade(const std::string& name, const std::vector<ItemPtr>& items);
144  void processCloseTrade();
145 
146  // edit text/list
147  void processEditText(uint id, int itemId, int maxLength, const std::string& text, const std::string& writer, const std::string& date);
148  void processEditList(uint id, int doorId, const std::string& text);
149 
150  // questlog
151  void processQuestLog(const std::vector<std::tuple<int, std::string, bool> >& questList);
152  void processQuestLine(int questId, const std::vector<std::tuple<std::string, std::string> >& questMissions);
153 
154  // modal dialogs >= 970
155  void processModalDialog(uint32 id, std::string title, std::string message, std::vector<std::tuple<int, std::string> > buttonList, int enterButton, int escapeButton, std::vector<std::tuple<int, std::string> > choiceList, bool priority);
156 
157  friend class ProtocolGame;
158  friend class Map;
159 
160 public:
161  // login related
162  void loginWorld(const std::string& account, const std::string& password, const std::string& worldName, const std::string& worldHost, int worldPort, const std::string& characterName, const std::string& authenticatorToken, const std::string& sessionKey);
163  void cancelLogin();
164  void forceLogout();
165  void safeLogout();
166 
167  // walk related
168  bool walk(Otc::Direction direction, bool dash = false);
169  bool dashWalk(Otc::Direction direction);
170  void autoWalk(std::vector<Otc::Direction> dirs);
171  void forceWalk(Otc::Direction direction);
172  void turn(Otc::Direction direction);
173  void stop();
174 
175  // item related
176  void look(const ThingPtr& thing, bool isBattleList = false);
177  void move(const ThingPtr &thing, const Position& toPos, int count);
178  void moveToParentContainer(const ThingPtr& thing, int count);
179  void rotate(const ThingPtr& thing);
180  void use(const ThingPtr& thing);
181  void useWith(const ItemPtr& item, const ThingPtr& toThing);
182  void useInventoryItem(int itemId);
183  void useInventoryItemWith(int itemId, const ThingPtr& toThing);
184  ItemPtr findItemInContainers(uint itemId, int subType);
185 
186  // container related
187  int open(const ItemPtr& item, const ContainerPtr& previousContainer);
188  void openParent(const ContainerPtr& container);
189  void close(const ContainerPtr& container);
190  void refreshContainer(const ContainerPtr& container);
191 
192  // attack/follow related
193  void attack(CreaturePtr creature);
194  void cancelAttack() { attack(nullptr); }
195  void follow(CreaturePtr creature);
196  void cancelFollow() { follow(nullptr); }
197  void cancelAttackAndFollow();
198 
199  // talk related
200  void talk(const std::string& message);
201  void talkChannel(Otc::MessageMode mode, int channelId, const std::string& message);
202  void talkPrivate(Otc::MessageMode mode, const std::string& receiver, const std::string& message);
203 
204  // channel related
205  void openPrivateChannel(const std::string& receiver);
206  void requestChannels();
207  void joinChannel(int channelId);
208  void leaveChannel(int channelId);
209  void closeNpcChannel();
210  void openOwnChannel();
211  void inviteToOwnChannel(const std::string& name);
212  void excludeFromOwnChannel(const std::string& name);
213 
214  // party related
215  void partyInvite(int creatureId);
216  void partyJoin(int creatureId);
217  void partyRevokeInvitation(int creatureId);
218  void partyPassLeadership(int creatureId);
219  void partyLeave();
220  void partyShareExperience(bool active);
221 
222  // outfit related
223  void requestOutfit();
224  void changeOutfit(const Outfit& outfit);
225 
226  // vip related
227  void addVip(const std::string& name);
228  void removeVip(int playerId);
229  void editVip(int playerId, const std::string& description, int iconId, bool notifyLogin);
230 
231  // fight modes related
232  void setChaseMode(Otc::ChaseModes chaseMode);
233  void setFightMode(Otc::FightModes fightMode);
234  void setSafeFight(bool on);
235  void setPVPMode(Otc::PVPModes pvpMode);
236  Otc::ChaseModes getChaseMode() { return m_chaseMode; }
237  Otc::FightModes getFightMode() { return m_fightMode; }
238  bool isSafeFight() { return m_safeFight; }
239  Otc::PVPModes getPVPMode() { return m_pvpMode; }
240 
241  // pvp related
242  void setUnjustifiedPoints(UnjustifiedPoints unjustifiedPoints);
243  UnjustifiedPoints getUnjustifiedPoints() { return m_unjustifiedPoints; };
244  void setOpenPvpSituations(int openPvpSituations);
245  int getOpenPvpSituations() { return m_openPvpSituations; }
246 
247  // npc trade related
248  void inspectNpcTrade(const ItemPtr& item);
249  void buyItem(const ItemPtr& item, int amount, bool ignoreCapacity, bool buyWithBackpack);
250  void sellItem(const ItemPtr& item, int amount, bool ignoreEquipped);
251  void closeNpcTrade();
252 
253  // player trade related
254  void requestTrade(const ItemPtr& item, const CreaturePtr& creature);
255  void inspectTrade(bool counterOffer, int index);
256  void acceptTrade();
257  void rejectTrade();
258 
259  // house window and editable items related
260  void editText(uint id, const std::string& text);
261  void editList(uint id, int doorId, const std::string& text);
262 
263  // rule violations (only gms)
264  void openRuleViolation(const std::string& reporter);
265  void closeRuleViolation(const std::string& reporter);
266  void cancelRuleViolation();
267 
268  // reports
269  void reportBug(const std::string& comment);
270  void reportRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
271  void debugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d);
272 
273  // questlog related
274  void requestQuestLog();
275  void requestQuestLine(int questId);
276 
277  // 870 only
278  void equipItem(const ItemPtr& item);
279  void mount(bool mount);
280 
281  // 910 only
282  void requestItemInfo(const ItemPtr& item, int index);
283 
284  // >= 970 modal dialog
285  void answerModalDialog(uint32 dialog, int button, int choice);
286 
287  // >= 984 browse field
288  void browseField(const Position& position);
289  void seekInContainer(int cid, int index);
290 
291  // >= 1080 ingame store
292  void buyStoreOffer(int offerId, int productType, const std::string& name = "");
293  void requestTransactionHistory(int page, int entriesPerPage);
294  void requestStoreOffers(const std::string& categoryName, int serviceType = 0);
295  void openStore(int serviceType = 0, const std::string& category = "");
296  void transferCoins(const std::string& recipient, int amount);
297  void openTransactionHistory(int entriesPerPage);
298 
299  //void reportRuleViolation2();
300  void ping();
301  void setPingDelay(int delay) { m_pingDelay = delay; }
302 
303  // otclient only
304  void changeMapAwareRange(int xrange, int yrange);
305 
306  // dynamic support for game features
307  void enableFeature(Otc::GameFeature feature) { m_features.set(feature, true); }
308  void disableFeature(Otc::GameFeature feature) { m_features.set(feature, false); }
309  void setFeature(Otc::GameFeature feature, bool enabled) { m_features.set(feature, enabled); }
310  bool getFeature(Otc::GameFeature feature) { return m_features.test(feature); }
311 
312  void setProtocolVersion(int version);
313  int getProtocolVersion() { return m_protocolVersion; }
314 
315  void setClientVersion(int version);
316  int getClientVersion() { return m_clientVersion; }
317 
318  void setCustomOs(int os) { m_clientCustomOs = os; }
319  int getOs();
320 
321  bool canPerformGameAction();
322  bool checkBotProtection();
323 
324  bool isOnline() { return m_online; }
325  bool isLogging() { return !m_online && m_protocolGame; }
326  bool isDead() { return m_dead; }
327  bool isAttacking() { return !!m_attackingCreature && !m_attackingCreature->isRemoved(); }
328  bool isFollowing() { return !!m_followingCreature && !m_followingCreature->isRemoved(); }
329  bool isConnectionOk() { return m_protocolGame && m_protocolGame->getElapsedTicksSinceLastRead() < 5000; }
330 
331  int getPing() { return m_ping >= 0 ? std::max<int>(m_ping, m_pingTimer.elapsed_millis()) : -1; }
332  ContainerPtr getContainer(int index) { return m_containers[index]; }
333  std::map<int, ContainerPtr> getContainers() { return m_containers; }
334  std::map<int, Vip> getVips() { return m_vips; }
335  CreaturePtr getAttackingCreature() { return m_attackingCreature; }
336  CreaturePtr getFollowingCreature() { return m_followingCreature; }
337  void setServerBeat(int beat) { m_serverBeat = beat; }
338  int getServerBeat() { return m_serverBeat; }
339  void setCanReportBugs(bool enable) { m_canReportBugs = enable; }
340  bool canReportBugs() { return m_canReportBugs; }
341  void setExpertPvpMode(bool enable) { m_expertPvpMode = enable; }
342  bool getExpertPvpMode() { return m_expertPvpMode; }
343  LocalPlayerPtr getLocalPlayer() { return m_localPlayer; }
344  ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
345  std::string getCharacterName() { return m_characterName; }
346  std::string getWorldName() { return m_worldName; }
347  std::vector<uint8> getGMActions() { return m_gmActions; }
348  bool isGM() { return !m_gmActions.empty(); }
349  Otc::Direction getLastWalkDir() { return m_lastWalkDir; }
350 
351  std::string formatCreatureName(const std::string &name);
352  int findEmptyContainerId();
353 
354 protected:
355  void enableBotCall() { m_denyBotCall = false; }
356  void disableBotCall() { m_denyBotCall = true; }
357 
358 private:
359  void setAttackingCreature(const CreaturePtr& creature);
360  void setFollowingCreature(const CreaturePtr& creature);
361 
362  LocalPlayerPtr m_localPlayer;
363  CreaturePtr m_attackingCreature;
364  CreaturePtr m_followingCreature;
365  ProtocolGamePtr m_protocolGame;
366  std::map<int, ContainerPtr> m_containers;
367  std::map<int, Vip> m_vips;
368 
369  bool m_online;
370  bool m_denyBotCall;
371  bool m_dead;
372  bool m_expertPvpMode;
373  int m_serverBeat;
374  ticks_t m_ping;
375  uint m_pingSent;
376  uint m_pingReceived;
377  stdext::timer m_pingTimer;
378  Timer m_dashTimer;
379  uint m_seq;
380  int m_pingDelay;
381  Otc::FightModes m_fightMode;
382  Otc::ChaseModes m_chaseMode;
383  Otc::PVPModes m_pvpMode;
384  Otc::Direction m_lastWalkDir;
385  UnjustifiedPoints m_unjustifiedPoints;
386  int m_openPvpSituations;
387  bool m_safeFight;
388  bool m_canReportBugs;
389  std::vector<uint8> m_gmActions;
390  std::string m_characterName;
391  std::string m_worldName;
392  std::bitset<Otc::LastGameFeature> m_features;
393  ScheduledEventPtr m_pingEvent;
394  ScheduledEventPtr m_walkEvent;
395  ScheduledEventPtr m_checkConnectionEvent;
396  bool m_connectionFailWarned;
397  int m_protocolVersion;
398  int m_clientVersion;
399  std::string m_clientSignature;
400  int m_clientCustomOs;
401 };
402 
403 extern Game g_game;
404 
405 #endif
Game::openRuleViolation
void openRuleViolation(const std::string &reporter)
Definition: game.cpp:1311
Game::findEmptyContainerId
int findEmptyContainerId()
Definition: game.cpp:1731
Game::setCanReportBugs
void setCanReportBugs(bool enable)
Definition: game.h:339
Game::editList
void editList(uint id, int doorId, const std::string &text)
Definition: game.cpp:1304
Game::look
void look(const ThingPtr &thing, bool isBattleList=false)
Definition: game.cpp:787
Game::loginWorld
void loginWorld(const std::string &account, const std::string &password, const std::string &worldName, const std::string &worldHost, int worldPort, const std::string &characterName, const std::string &authenticatorToken, const std::string &sessionKey)
Definition: game.cpp:531
Game::cancelRuleViolation
void cancelRuleViolation()
Definition: game.cpp:1325
Game::getGMActions
std::vector< uint8 > getGMActions()
Definition: game.h:347
stdext::timer
Definition: time.h:36
Game::close
void close(const ContainerPtr &container)
Definition: game.cpp:921
Game::processQuestLine
void processQuestLine(int questId, const std::vector< std::tuple< std::string, std::string > > &questMissions)
Definition: game.cpp:510
Game::processModalDialog
void processModalDialog(uint32 id, std::string title, std::string message, std::vector< std::tuple< int, std::string > > buttonList, int enterButton, int escapeButton, std::vector< std::tuple< int, std::string > > choiceList, bool priority)
Definition: game.cpp:515
Game::rejectTrade
void rejectTrade()
Definition: game.cpp:1290
Game::getPing
int getPing()
Definition: game.h:331
Game::processWalkCancel
void processWalkCancel(Otc::Direction direction)
Definition: game.cpp:526
Game::safeLogout
void safeLogout()
Definition: game.cpp:569
Game::leaveChannel
void leaveChannel(int channelId)
Definition: game.cpp:1043
Game::getFollowingCreature
CreaturePtr getFollowingCreature()
Definition: game.h:336
Game::processOpenChannel
void processOpenChannel(int channelId, const std::string &name)
Definition: game.cpp:367
Game::mount
void mount(bool mount)
Definition: game.cpp:1372
Game::processTextMessage
void processTextMessage(Otc::MessageMode mode, const std::string &text)
Definition: game.cpp:287
Game::browseField
void browseField(const Position &position)
Definition: game.cpp:1393
Game::processOpenOutfitWindow
void processOpenOutfitWindow(const Outfit &currentOutfit, const std::vector< std::tuple< int, std::string, int > > &outfitList, const std::vector< std::tuple< int, std::string > > &mountList)
Definition: game.cpp:434
Game::processPing
void processPing()
Definition: game.cpp:263
Game::closeRuleViolation
void closeRuleViolation(const std::string &reporter)
Definition: game.cpp:1318
UnjustifiedPoints::operator==
bool operator==(const UnjustifiedPoints &other)
Definition: game.h:40
Game::processLogin
void processLogin()
Definition: game.cpp:164
Game::inspectNpcTrade
void inspectNpcTrade(const ItemPtr &item)
Definition: game.cpp:1241
Game::processDeath
void processDeath(int deathType, int penality)
Definition: game.cpp:231
Game::isAttacking
bool isAttacking()
Definition: game.h:327
Game::processEditList
void processEditList(uint id, int doorId, const std::string &text)
Definition: game.cpp:500
Otc::ChaseModes
ChaseModes
Definition: const.h:211
UnjustifiedPoints::killsDayRemaining
uint8 killsDayRemaining
Definition: game.h:50
Game::setPingDelay
void setPingDelay(int delay)
Definition: game.h:301
Game::processQuestLog
void processQuestLog(const std::vector< std::tuple< int, std::string, bool > > &questList)
Definition: game.cpp:505
Game::inviteToOwnChannel
void inviteToOwnChannel(const std::string &name)
Definition: game.cpp:1064
Game::processDisconnect
void processDisconnect()
Definition: game.cpp:128
UnjustifiedPoints::killsDay
uint8 killsDay
Definition: game.h:49
ProtocolGame
Definition: protocolgame.h:31
Game::setClientVersion
void setClientVersion(int version)
Definition: game.cpp:1514
Game::processRuleViolationChannel
void processRuleViolationChannel(int channelId)
Definition: game.cpp:387
Game::setProtocolVersion
void setProtocolVersion(int version)
Definition: game.cpp:1496
Game::isFollowing
bool isFollowing()
Definition: game.h:328
Game::requestItemInfo
void requestItemInfo(const ItemPtr &item, int index)
Definition: game.cpp:1379
Game::move
void move(const ThingPtr &thing, const Position &toPos, int count)
Definition: game.cpp:798
uint32
uint32_t uint32
Definition: types.h:35
Game::stop
void stop()
Definition: game.cpp:776
Game::setFeature
void setFeature(Otc::GameFeature feature, bool enabled)
Definition: game.h:309
Game::getContainers
std::map< int, ContainerPtr > getContainers()
Definition: game.h:333
Game::processInventoryChange
void processInventoryChange(int slot, const ItemPtr &item)
Definition: game.cpp:354
Game::processTutorialHint
void processTutorialHint(int id)
Definition: game.cpp:419
UnjustifiedPoints::killsWeek
uint8 killsWeek
Definition: game.h:51
Game::processPlayerGoods
void processPlayerGoods(int money, const std::vector< std::tuple< ItemPtr, int > > &goods)
Definition: game.cpp:470
Game::cancelFollow
void cancelFollow()
Definition: game.h:196
Game::processEditText
void processEditText(uint id, int itemId, int maxLength, const std::string &text, const std::string &writer, const std::string &date)
Definition: game.cpp:495
Game::openParent
void openParent(const ContainerPtr &container)
Definition: game.cpp:913
Game::forceLogout
void forceLogout()
Definition: game.cpp:560
Game::processGMActions
void processGMActions(const std::vector< uint8 > &actions)
Definition: game.cpp:239
Game::setPVPMode
void setPVPMode(Otc::PVPModes pvpMode)
Definition: game.cpp:1203
Game::processLoginToken
void processLoginToken(bool unknown)
Definition: game.cpp:159
Game::openPrivateChannel
void openPrivateChannel(const std::string &receiver)
Definition: game.cpp:1022
Game::getClientVersion
int getClientVersion()
Definition: game.h:316
Game::processAddAutomapFlag
void processAddAutomapFlag(const Position &pos, int icon, const std::string &message)
Definition: game.cpp:424
Game::setFightMode
void setFightMode(Otc::FightModes fightMode)
Definition: game.cpp:1181
ticks_t
int64 ticks_t
Definition: types.h:43
Game::turn
void turn(Otc::Direction direction)
Definition: game.cpp:753
Game::useInventoryItem
void useInventoryItem(int itemId)
Definition: game.cpp:846
Game::useWith
void useWith(const ItemPtr &item, const ThingPtr &toThing)
Definition: game.cpp:856
Game::requestOutfit
void requestOutfit()
Definition: game.cpp:1120
Game::setCustomOs
void setCustomOs(int os)
Definition: game.h:318
Game::processCloseTrade
void processCloseTrade()
Definition: game.cpp:490
Game::processLoginAdvice
void processLoginAdvice(const std::string &message)
Definition: game.cpp:149
Game::processOpenOwnPrivateChannel
void processOpenOwnPrivateChannel(int channelId, const std::string &name)
Definition: game.cpp:377
Game::equipItem
void equipItem(const ItemPtr &item)
Definition: game.cpp:1365
Game::getVips
std::map< int, Vip > getVips()
Definition: game.h:334
Game::processLoginError
void processLoginError(const std::string &error)
Definition: game.cpp:144
Game::cancelLogin
void cancelLogin()
Definition: game.cpp:551
Game::isConnectionOk
bool isConnectionOk()
Definition: game.h:329
Game::walk
bool walk(Otc::Direction direction, bool dash=false)
Definition: game.cpp:577
Game::partyInvite
void partyInvite(int creatureId)
Definition: game.cpp:1078
Game::isLogging
bool isLogging()
Definition: game.h:325
Game::processCloseNpcTrade
void processCloseNpcTrade()
Definition: game.cpp:475
stdext::time
ticks_t time()
Definition: time.cpp:33
Game::Game
Game()
Definition: game.cpp:39
Game::processPendingGame
void processPendingGame()
Definition: game.cpp:169
Game::findItemInContainers
ItemPtr findItemInContainers(uint itemId, int subType)
Definition: game.cpp:884
Game::processRemoveAutomapFlag
void processRemoveAutomapFlag(const Position &pos, int icon, const std::string &message)
Definition: game.cpp:429
creature.h
Game::disableFeature
void disableFeature(Otc::GameFeature feature)
Definition: game.h:308
Game::enableBotCall
void enableBotCall()
Definition: game.h:355
Game::requestStoreOffers
void requestStoreOffers(const std::string &categoryName, int serviceType=0)
Definition: game.cpp:1421
Game::open
int open(const ItemPtr &item, const ContainerPtr &previousContainer)
Definition: game.cpp:898
Game::setServerBeat
void setServerBeat(int beat)
Definition: game.h:337
Game::partyShareExperience
void partyShareExperience(bool active)
Definition: game.cpp:1113
UnjustifiedPoints::skullTime
uint8 skullTime
Definition: game.h:55
Game::partyJoin
void partyJoin(int creatureId)
Definition: game.cpp:1085
Game::init
void init()
Definition: game.cpp:58
Game::requestTrade
void requestTrade(const ItemPtr &item, const CreaturePtr &creature)
Definition: game.cpp:1269
Game::getExpertPvpMode
bool getExpertPvpMode()
Definition: game.h:342
Game::getProtocolVersion
int getProtocolVersion()
Definition: game.h:313
Game::getAttackingCreature
CreaturePtr getAttackingCreature()
Definition: game.h:335
Game::requestQuestLine
void requestQuestLine(int questId)
Definition: game.cpp:1358
Game::processContainerRemoveItem
void processContainerRemoveItem(int containerId, int slot, const ItemPtr &lastItem)
Definition: game.cpp:344
Otc::Direction
Direction
Definition: const.h:161
Game::processEnterGame
void processEnterGame()
Definition: game.cpp:176
Game::getServerBeat
int getServerBeat()
Definition: game.h:338
localplayer.h
Outfit
Definition: outfit.h:29
Game::buyItem
void buyItem(const ItemPtr &item, int amount, bool ignoreCapacity, bool buyWithBackpack)
Definition: game.cpp:1248
declarations.h
uint
unsigned int uint
Definition: types.h:31
Otc::MessageMode
MessageMode
Definition: const.h:286
Game::requestQuestLog
void requestQuestLog()
Definition: game.cpp:1351
Game::use
void use(const ThingPtr &thing)
Definition: game.cpp:832
timer.h
Game::isOnline
bool isOnline()
Definition: game.h:324
Game::answerModalDialog
void answerModalDialog(uint32 dialog, int button, int choice)
Definition: game.cpp:1386
Game::getCharacterName
std::string getCharacterName()
Definition: game.h:345
Game::canReportBugs
bool canReportBugs()
Definition: game.h:340
Game::setUnjustifiedPoints
void setUnjustifiedPoints(UnjustifiedPoints unjustifiedPoints)
Definition: game.cpp:1216
container.h
Game::closeNpcChannel
void closeNpcChannel()
Definition: game.cpp:1050
Game::processOpenContainer
void processOpenContainer(int containerId, const ItemPtr &containerItem, const std::string &name, int capacity, bool hasParent, const std::vector< ItemPtr > &items, bool isUnlocked, bool hasPages, int containerSize, int firstIndex)
Definition: game.cpp:297
Game::setChaseMode
void setChaseMode(Otc::ChaseModes chaseMode)
Definition: game.cpp:1170
Position
Definition: position.h:33
Game::inspectTrade
void inspectTrade(bool counterOffer, int index)
Definition: game.cpp:1276
Game::follow
void follow(CreaturePtr creature)
Definition: game.cpp:960
UnjustifiedPoints::killsMonthRemaining
uint8 killsMonthRemaining
Definition: game.h:54
Game::acceptTrade
void acceptTrade()
Definition: game.cpp:1283
Game::talkPrivate
void talkPrivate(Otc::MessageMode mode, const std::string &receiver, const std::string &message)
Definition: game.cpp:1015
UnjustifiedPoints::killsWeekRemaining
uint8 killsWeekRemaining
Definition: game.h:52
Game::processCloseContainer
void processCloseContainer(int containerId)
Definition: game.cpp:313
Game::forceWalk
void forceWalk(Otc::Direction direction)
Definition: game.cpp:716
Game::getFeature
bool getFeature(Otc::GameFeature feature)
Definition: game.h:310
Protocol::getElapsedTicksSinceLastRead
ticks_t getElapsedTicksSinceLastRead()
Definition: protocol.h:45
Otc::GameFeature
GameFeature
Definition: const.h:345
Game::talkChannel
void talkChannel(Otc::MessageMode mode, int channelId, const std::string &message)
Definition: game.cpp:1008
Otc::PVPModes
PVPModes
Definition: const.h:216
Game::openOwnChannel
void openOwnChannel()
Definition: game.cpp:1057
Game::dashWalk
bool dashWalk(Otc::Direction direction)
Definition: game.cpp:673
Game::processConnectionError
void processConnectionError(const boost::system::error_code &ec)
Definition: game.cpp:116
Game::openStore
void openStore(int serviceType=0, const std::string &category="")
Definition: game.cpp:1428
Game::getLastWalkDir
Otc::Direction getLastWalkDir()
Definition: game.h:349
Game::editVip
void editVip(int playerId, const std::string &description, int iconId, bool notifyLogin)
Definition: game.cpp:1153
Game::processRuleViolationLock
void processRuleViolationLock()
Definition: game.cpp:402
Game::processContainerAddItem
void processContainerAddItem(int containerId, const ItemPtr &item, int slot)
Definition: game.cpp:324
Game::sellItem
void sellItem(const ItemPtr &item, int amount, bool ignoreEquipped)
Definition: game.cpp:1255
outfit.h
Game::excludeFromOwnChannel
void excludeFromOwnChannel(const std::string &name)
Definition: game.cpp:1071
Game::processVipAdd
void processVipAdd(uint id, const std::string &name, uint status, const std::string &description, int iconId, bool notifyLogin)
Definition: game.cpp:407
Game::closeNpcTrade
void closeNpcTrade()
Definition: game.cpp:1262
Game::getFightMode
Otc::FightModes getFightMode()
Definition: game.h:237
Game::processPingBack
void processPingBack()
Definition: game.cpp:271
g_game
Game g_game
Definition: game.cpp:37
Game::terminate
void terminate()
Definition: game.cpp:63
Game::refreshContainer
void refreshContainer(const ContainerPtr &container)
Definition: game.cpp:929
Game::enableFeature
void enableFeature(Otc::GameFeature feature)
Definition: game.h:307
Game::partyRevokeInvitation
void partyRevokeInvitation(int creatureId)
Definition: game.cpp:1092
Game::processOpenPrivateChannel
void processOpenPrivateChannel(const std::string &name)
Definition: game.cpp:372
Game::talk
void talk(const std::string &message)
Definition: game.cpp:1001
Game::processChannelList
void processChannelList(const std::vector< std::tuple< int, std::string > > &channelList)
Definition: game.cpp:362
Game::isGM
bool isGM()
Definition: game.h:348
Game::setOpenPvpSituations
void setOpenPvpSituations(int openPvpSituations)
Definition: game.cpp:1229
Game::changeMapAwareRange
void changeMapAwareRange(int xrange, int yrange)
Definition: game.cpp:1464
Game::transferCoins
void transferCoins(const std::string &recipient, int amount)
Definition: game.cpp:1435
Game::processRuleViolationRemove
void processRuleViolationRemove(const std::string &name)
Definition: game.cpp:392
effect.h
Game::isSafeFight
bool isSafeFight()
Definition: game.h:238
Game::partyLeave
void partyLeave()
Definition: game.cpp:1106
Game::formatCreatureName
std::string formatCreatureName(const std::string &name)
Definition: game.cpp:1713
Game::getPVPMode
Otc::PVPModes getPVPMode()
Definition: game.h:239
stdext::shared_object_ptr< Item >
Game::getUnjustifiedPoints
UnjustifiedPoints getUnjustifiedPoints()
Definition: game.h:243
Game::getProtocolGame
ProtocolGamePtr getProtocolGame()
Definition: game.h:344
Game::processContainerUpdateItem
void processContainerUpdateItem(int containerId, int slot, const ItemPtr &item)
Definition: game.cpp:334
Game::setSafeFight
void setSafeFight(bool on)
Definition: game.cpp:1192
Game::getLocalPlayer
LocalPlayerPtr getLocalPlayer()
Definition: game.h:343
stdext::timer::elapsed_millis
ticks_t elapsed_millis()
Definition: time.h:40
Game::buyStoreOffer
void buyStoreOffer(int offerId, int productType, const std::string &name="")
Definition: game.cpp:1407
Game::processCounterTrade
void processCounterTrade(const std::string &name, const std::vector< ItemPtr > &items)
Definition: game.cpp:485
Creature::isRemoved
bool isRemoved()
Definition: creature.h:122
Game::requestChannels
void requestChannels()
Definition: game.cpp:1029
Game::getOs
int getOs()
Definition: game.cpp:1739
Vip
std::tuple< std::string, uint, std::string, int, bool > Vip
Definition: game.h:58
Game::processVipStateChange
void processVipStateChange(uint id, uint status)
Definition: game.cpp:413
Game::processGameEnd
void processGameEnd()
Definition: game.cpp:211
Game::cancelAttack
void cancelAttack()
Definition: game.h:194
UnjustifiedPoints::killsMonth
uint8 killsMonth
Definition: game.h:53
Timer
Definition: timer.h:28
Game::openTransactionHistory
void openTransactionHistory(int entriesPerPage)
Definition: game.cpp:1442
Game::reportBug
void reportBug(const std::string &comment)
Definition: game.cpp:1332
Game::processRuleViolationCancel
void processRuleViolationCancel(const std::string &name)
Definition: game.cpp:397
Game::changeOutfit
void changeOutfit(const Outfit &outfit)
Definition: game.cpp:1127
Game::disableBotCall
void disableBotCall()
Definition: game.h:356
Game::processGameStart
void processGameStart()
Definition: game.cpp:182
Game::removeVip
void removeVip(int playerId)
Definition: game.cpp:1141
Game::getChaseMode
Otc::ChaseModes getChaseMode()
Definition: game.h:236
Game::getContainer
ContainerPtr getContainer(int index)
Definition: game.h:332
protocolgame.h
Game::processTalk
void processTalk(const std::string &name, int level, Otc::MessageMode mode, const std::string &text, int channelId, const Position &pos)
Definition: game.cpp:292
Game::getWorldName
std::string getWorldName()
Definition: game.h:346
Game::canPerformGameAction
bool canPerformGameAction()
Definition: game.cpp:1484
Game::processUpdateNeeded
void processUpdateNeeded(const std::string &signature)
Definition: game.cpp:139
Game::cancelAttackAndFollow
void cancelAttackAndFollow()
Definition: game.cpp:984
Otc::FightModes
FightModes
Definition: const.h:205
Game::processAttackCancel
void processAttackCancel(uint seq)
Definition: game.cpp:520
Game::seekInContainer
void seekInContainer(int cid, int index)
Definition: game.cpp:1400
animatedtext.h
Game::joinChannel
void joinChannel(int channelId)
Definition: game.cpp:1036
Game::isDead
bool isDead()
Definition: game.h:326
UnjustifiedPoints
Definition: game.h:39
Game::requestTransactionHistory
void requestTransactionHistory(int page, int entriesPerPage)
Definition: game.cpp:1414
Game::rotate
void rotate(const ThingPtr &thing)
Definition: game.cpp:824
Game::editText
void editText(uint id, const std::string &text)
Definition: game.cpp:1297
Game::setExpertPvpMode
void setExpertPvpMode(bool enable)
Definition: game.h:341
Game::checkBotProtection
bool checkBotProtection()
Definition: game.cpp:1471
Game::processLoginWait
void processLoginWait(const std::string &message, int time)
Definition: game.cpp:154
Game::moveToParentContainer
void moveToParentContainer(const ThingPtr &thing, int count)
Definition: game.cpp:815
Game::attack
void attack(CreaturePtr creature)
Definition: game.cpp:936
Game::reportRuleViolation
void reportRuleViolation(const std::string &target, int reason, int action, const std::string &comment, const std::string &statement, int statementId, bool ipBanishment)
Definition: game.cpp:1339
Game::processPlayerHelpers
void processPlayerHelpers(int helpers)
Definition: game.cpp:245
Game::ping
void ping()
Definition: game.cpp:1449
Game::useInventoryItemWith
void useInventoryItemWith(int itemId, const ThingPtr &toThing)
Definition: game.cpp:871
Game::processOwnTrade
void processOwnTrade(const std::string &name, const std::vector< ItemPtr > &items)
Definition: game.cpp:480
Game::debugReport
void debugReport(const std::string &a, const std::string &b, const std::string &c, const std::string &d)
Definition: game.cpp:1346
Game::autoWalk
void autoWalk(std::vector< Otc::Direction > dirs)
Definition: game.cpp:678
Game::processOpenNpcTrade
void processOpenNpcTrade(const std::vector< std::tuple< ItemPtr, std::string, int, int, int > > &items)
Definition: game.cpp:465
uint8
uint8_t uint8
Definition: types.h:37
Game::addVip
void addVip(const std::string &name)
Definition: game.cpp:1134
Map
Definition: map.h:139
Game::processCloseChannel
void processCloseChannel(int channelId)
Definition: game.cpp:382
Game::processPlayerModes
void processPlayerModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeMode, Otc::PVPModes pvpMode)
Definition: game.cpp:250
Game::partyPassLeadership
void partyPassLeadership(int creatureId)
Definition: game.cpp:1099
Game::getOpenPvpSituations
int getOpenPvpSituations()
Definition: game.h:245
Game
Definition: game.h:61
item.h