Otclient  14/8/2020
localplayer.cpp
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 #include "localplayer.h"
24 #include "map.h"
25 #include "game.h"
26 #include "tile.h"
29 
31 {
32  m_states = 0;
33  m_vocation = 0;
34  m_blessings = Otc::BlessingNone;
35  m_walkLockExpiration = 0;
36 
37  m_skillsLevel.fill(-1);
38  m_skillsBaseLevel.fill(-1);
39  m_skillsLevelPercent.fill(-1);
40 
41  m_health = -1;
42  m_maxHealth = -1;
43  m_freeCapacity = -1;
44  m_experience = -1;
45  m_level = -1;
46  m_levelPercent = -1;
47  m_mana = -1;
48  m_maxMana = -1;
49  m_magicLevel = -1;
50  m_magicLevelPercent = -1;
51  m_baseMagicLevel = -1;
52  m_soul = -1;
53  m_stamina = -1;
54  m_baseSpeed = -1;
55  m_regenerationTime = -1;
56  m_offlineTrainingTime = -1;
57  m_totalCapacity = -1;
58 }
59 
61 {
62  m_walkLockExpiration = std::max<int>(m_walkLockExpiration, (ticks_t) g_clock.millis() + millis);
63 }
64 
66 {
67  // cannot walk while locked
68  if(m_walkLockExpiration != 0 && g_clock.millis() < m_walkLockExpiration)
69  return false;
70 
71  // paralyzed
72  if(m_speed == 0)
73  return false;
74 
75  // last walk is not done yet
77  return false;
78 
79  // prewalk has a timeout, because for some reason that I don't know yet the server sometimes doesn't answer the prewalk
80  bool prewalkTimeouted = m_walking && m_preWalking && m_walkTimer.ticksElapsed() >= getStepDuration() + PREWALK_TIMEOUT;
81 
82  // avoid doing more walks than wanted when receiving a lot of walks from server
83  if(!m_lastPrewalkDone && m_preWalking && !prewalkTimeouted)
84  return false;
85 
86  // cannot walk while already walking
87  if((m_walking && !isAutoWalking()) && (!prewalkTimeouted || m_secondPreWalk))
88  return false;
89 
90  return true;
91 }
92 
93 void LocalPlayer::walk(const Position& oldPos, const Position& newPos)
94 {
95  // a prewalk was going on
96  if(m_preWalking) {
97  // switch to normal walking
98  m_preWalking = false;
99  m_secondPreWalk = false;
100  m_lastPrewalkDone = true;
101  // if is to the last prewalk destination, updates the walk preserving the animation
102  if(newPos == m_lastPrewalkDestination) {
103  updateWalk();
104  // was to another direction, replace the walk
105  } else
106  Creature::walk(oldPos, newPos);
107  }
108  // no prewalk was going on, this must be an server side automated walk
109  else {
110  m_serverWalking = true;
111  if(m_serverWalkEndEvent)
112  m_serverWalkEndEvent->cancel();
113 
114  Creature::walk(oldPos, newPos);
115  }
116 }
117 
119 {
120  Position newPos = m_position.translatedToDirection(direction);
121 
122  // avoid reanimating prewalks
123  if(m_preWalking) {
124  m_secondPreWalk = true;
125  return;
126  }
127 
128  m_preWalking = true;
129 
130  if(m_serverWalkEndEvent)
131  m_serverWalkEndEvent->cancel();
132 
133  // start walking to direction
134  m_lastPrewalkDone = false;
135  m_lastPrewalkDestination = newPos;
136  Creature::walk(m_position, newPos);
137 }
138 
140 {
141  // only cancel client side walks
142  if(m_walking && m_preWalking)
143  stopWalk();
144 
145  m_lastPrewalkDone = true;
146  m_idleTimer.restart();
147  lockWalk();
148 
149  if(m_autoWalkDestination.isValid()) {
150  g_game.stop();
151  auto self = asLocalPlayer();
152  if(m_autoWalkContinueEvent)
153  m_autoWalkContinueEvent->cancel();
154  m_autoWalkContinueEvent = g_dispatcher.scheduleEvent([self]() {
155  if(self->m_autoWalkDestination.isValid())
156  self->autoWalk(self->m_autoWalkDestination);
157  }, 500);
158  }
159 
160  // turn to the cancel direction
161  if(direction != Otc::InvalidDirection)
162  setDirection(direction);
163 
164  callLuaField("onCancelWalk", direction);
165 }
166 
167 bool LocalPlayer::autoWalk(const Position& destination)
168 {
169  if(g_game.getClientVersion() <= 740 && m_position.isInRange(destination, 1, 1))
170  return g_game.walk(m_position.getDirectionFromPosition(destination));
171 
172  bool tryKnownPath = false;
173  if(destination != m_autoWalkDestination) {
174  m_knownCompletePath = false;
175  tryKnownPath = true;
176  }
177 
178  std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> result;
179  std::vector<Otc::Direction> limitedPath;
180 
181  if(destination == m_position)
182  return true;
183 
184  // try to find a path that we know
185  if(tryKnownPath || m_knownCompletePath) {
186  result = g_map.findPath(m_position, destination, 50000, 0);
187  if(std::get<1>(result) == Otc::PathFindResultOk) {
188  limitedPath = std::get<0>(result);
189  // limit to 127 steps
190  if(limitedPath.size() > 127)
191  limitedPath.resize(127);
192  m_knownCompletePath = true;
193  }
194  }
195 
196  // no known path found, try to discover one
197  if(limitedPath.empty()) {
198  result = g_map.findPath(m_position, destination, 50000, Otc::PathFindAllowNotSeenTiles);
199  if(std::get<1>(result) != Otc::PathFindResultOk) {
200  callLuaField("onAutoWalkFail", std::get<1>(result));
201  stopAutoWalk();
202  return false;
203  }
204 
205  Position currentPos = m_position;
206  for(auto dir : std::get<0>(result)) {
207  currentPos = currentPos.translatedToDirection(dir);
208  if(!hasSight(currentPos))
209  break;
210  else
211  limitedPath.push_back(dir);
212  }
213  }
214 
215  m_autoWalkDestination = destination;
216  m_lastAutoWalkPosition = m_position.translatedToDirections(limitedPath).back();
217 
218  /*
219  // debug calculated path using minimap
220  for(auto pos : m_position.translatedToDirections(limitedPath)) {
221  g_map.getOrCreateTile(pos)->overwriteMinimapColor(215);
222  g_map.notificateTileUpdate(pos);
223  }
224  */
225 
226  g_game.autoWalk(limitedPath);
227  return true;
228 }
229 
231 {
232  m_autoWalkDestination = Position();
233  m_lastAutoWalkPosition = Position();
234  m_knownCompletePath = false;
235 
236  if(m_autoWalkContinueEvent)
237  m_autoWalkContinueEvent->cancel();
238 }
239 
241 {
242  Creature::stopWalk(); // will call terminateWalk
243 
244  m_lastPrewalkDone = true;
245  m_lastPrewalkDestination = Position();
246 }
247 
248 void LocalPlayer::updateWalkOffset(int totalPixelsWalked)
249 {
250  // pre walks offsets are calculated in the oposite direction
251  if(m_preWalking) {
252  m_walkOffset = Point(0,0);
254  m_walkOffset.y = -totalPixelsWalked;
256  m_walkOffset.y = totalPixelsWalked;
257 
259  m_walkOffset.x = totalPixelsWalked;
261  m_walkOffset.x = -totalPixelsWalked;
262  } else
263  Creature::updateWalkOffset(totalPixelsWalked);
264 }
265 
267 {
268  int stepDuration = getStepDuration();
269  float walkTicksPerPixel = getStepDuration(true) / 32.0f;
270  int totalPixelsWalked = std::min<int>(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f);
271 
272  // update walk animation and offsets
273  updateWalkAnimation(totalPixelsWalked);
274  updateWalkOffset(totalPixelsWalked);
276 
277  // terminate walk only when client and server side walk are completed
278  if(m_walking && !m_preWalking && m_walkTimer.ticksElapsed() >= stepDuration)
279  terminateWalk();
280 }
281 
283 {
285  m_preWalking = false;
286  m_secondPreWalk = false;
287  m_idleTimer.restart();
288 
289  auto self = asLocalPlayer();
290 
291  if(m_serverWalking) {
292  if(m_serverWalkEndEvent)
293  m_serverWalkEndEvent->cancel();
294  m_serverWalkEndEvent = g_dispatcher.scheduleEvent([self] {
295  self->m_serverWalking = false;
296  }, 100);
297  }
298 }
299 
301 {
303 
304  /* Does not seem to be needed anymore
305  // on teleports lock the walk
306  if(!m_oldPosition.isInRange(m_position,1,1))
307  lockWalk();
308  */
309 }
310 
311 void LocalPlayer::onPositionChange(const Position& newPos, const Position& oldPos)
312 {
313  Creature::onPositionChange(newPos, oldPos);
314 
315  if(newPos == m_autoWalkDestination)
316  stopAutoWalk();
317  else if(m_autoWalkDestination.isValid() && newPos == m_lastAutoWalkPosition)
318  autoWalk(m_autoWalkDestination);
319 }
320 
321 void LocalPlayer::setStates(int states)
322 {
323  if(m_states != states) {
324  int oldStates = m_states;
325  m_states = states;
326 
327  callLuaField("onStatesChange", states, oldStates);
328  }
329 }
330 
331 void LocalPlayer::setSkill(Otc::Skill skill, int level, int levelPercent)
332 {
333  if(skill >= Otc::LastSkill) {
334  g_logger.traceError("invalid skill");
335  return;
336  }
337 
338  int oldLevel = m_skillsLevel[skill];
339  int oldLevelPercent = m_skillsLevelPercent[skill];
340 
341  if(level != oldLevel || levelPercent != oldLevelPercent) {
342  m_skillsLevel[skill] = level;
343  m_skillsLevelPercent[skill] = levelPercent;
344 
345  callLuaField("onSkillChange", skill, level, levelPercent, oldLevel, oldLevelPercent);
346  }
347 }
348 
349 void LocalPlayer::setBaseSkill(Otc::Skill skill, int baseLevel)
350 {
351  if(skill >= Otc::LastSkill) {
352  g_logger.traceError("invalid skill");
353  return;
354  }
355 
356  int oldBaseLevel = m_skillsBaseLevel[skill];
357  if(baseLevel != oldBaseLevel) {
358  m_skillsBaseLevel[skill] = baseLevel;
359 
360  callLuaField("onBaseSkillChange", skill, baseLevel, oldBaseLevel);
361  }
362 }
363 
364 void LocalPlayer::setHealth(double health, double maxHealth)
365 {
366  if(m_health != health || m_maxHealth != maxHealth) {
367  double oldHealth = m_health;
368  double oldMaxHealth = m_maxHealth;
369  m_health = health;
370  m_maxHealth = maxHealth;
371 
372  callLuaField("onHealthChange", health, maxHealth, oldHealth, oldMaxHealth);
373 
374  // cannot walk while dying
375  if(health == 0) {
376  if(isPreWalking())
377  stopWalk();
378  lockWalk();
379  }
380  }
381 }
382 
383 void LocalPlayer::setFreeCapacity(double freeCapacity)
384 {
385  if(m_freeCapacity != freeCapacity) {
386  double oldFreeCapacity = m_freeCapacity;
387  m_freeCapacity = freeCapacity;
388 
389  callLuaField("onFreeCapacityChange", freeCapacity, oldFreeCapacity);
390  }
391 }
392 
393 void LocalPlayer::setTotalCapacity(double totalCapacity)
394 {
395  if(m_totalCapacity != totalCapacity) {
396  double oldTotalCapacity = m_totalCapacity;
397  m_totalCapacity = totalCapacity;
398 
399  callLuaField("onTotalCapacityChange", totalCapacity, oldTotalCapacity);
400  }
401 }
402 
403 void LocalPlayer::setExperience(double experience)
404 {
405  if(m_experience != experience) {
406  double oldExperience = m_experience;
407  m_experience = experience;
408 
409  callLuaField("onExperienceChange", experience, oldExperience);
410  }
411 }
412 
413 void LocalPlayer::setLevel(double level, double levelPercent)
414 {
415  if(m_level != level || m_levelPercent != levelPercent) {
416  double oldLevel = m_level;
417  double oldLevelPercent = m_levelPercent;
418  m_level = level;
419  m_levelPercent = levelPercent;
420 
421  callLuaField("onLevelChange", level, levelPercent, oldLevel, oldLevelPercent);
422  }
423 }
424 
425 void LocalPlayer::setMana(double mana, double maxMana)
426 {
427  if(m_mana != mana || m_maxMana != maxMana) {
428  double oldMana = m_mana;
429  double oldMaxMana;
430  m_mana = mana;
431  m_maxMana = maxMana;
432 
433  callLuaField("onManaChange", mana, maxMana, oldMana, oldMaxMana);
434  }
435 }
436 
437 void LocalPlayer::setMagicLevel(double magicLevel, double magicLevelPercent)
438 {
439  if(m_magicLevel != magicLevel || m_magicLevelPercent != magicLevelPercent) {
440  double oldMagicLevel = m_magicLevel;
441  double oldMagicLevelPercent = m_magicLevelPercent;
442  m_magicLevel = magicLevel;
443  m_magicLevelPercent = magicLevelPercent;
444 
445  callLuaField("onMagicLevelChange", magicLevel, magicLevelPercent, oldMagicLevel, oldMagicLevelPercent);
446  }
447 }
448 
449 void LocalPlayer::setBaseMagicLevel(double baseMagicLevel)
450 {
451  if(m_baseMagicLevel != baseMagicLevel) {
452  double oldBaseMagicLevel = m_baseMagicLevel;
453  m_baseMagicLevel = baseMagicLevel;
454 
455  callLuaField("onBaseMagicLevelChange", baseMagicLevel, oldBaseMagicLevel);
456  }
457 }
458 
459 void LocalPlayer::setSoul(double soul)
460 {
461  if(m_soul != soul) {
462  double oldSoul = m_soul;
463  m_soul = soul;
464 
465  callLuaField("onSoulChange", soul, oldSoul);
466  }
467 }
468 
469 void LocalPlayer::setStamina(double stamina)
470 {
471  if(m_stamina != stamina) {
472  double oldStamina = m_stamina;
473  m_stamina = stamina;
474 
475  callLuaField("onStaminaChange", stamina, oldStamina);
476  }
477 }
478 
480 {
481  if(inventory >= Otc::LastInventorySlot) {
482  g_logger.traceError("invalid slot");
483  return;
484  }
485 
486  if(m_inventoryItems[inventory] != item) {
487  ItemPtr oldItem = m_inventoryItems[inventory];
488  m_inventoryItems[inventory] = item;
489 
490  callLuaField("onInventoryChange", inventory, item, oldItem);
491  }
492 }
493 
494 void LocalPlayer::setVocation(int vocation)
495 {
496  if(m_vocation != vocation) {
497  int oldVocation = m_vocation;
498  m_vocation = vocation;
499 
500  callLuaField("onVocationChange", vocation, oldVocation);
501  }
502 }
503 
504 void LocalPlayer::setPremium(bool premium)
505 {
506  if(m_premium != premium) {
507  m_premium = premium;
508 
509  callLuaField("onPremiumChange", premium);
510  }
511 }
512 
513 void LocalPlayer::setRegenerationTime(double regenerationTime)
514 {
515  if(m_regenerationTime != regenerationTime) {
516  double oldRegenerationTime = m_regenerationTime;
517  m_regenerationTime = regenerationTime;
518 
519  callLuaField("onRegenerationChange", regenerationTime, oldRegenerationTime);
520  }
521 }
522 
523 void LocalPlayer::setOfflineTrainingTime(double offlineTrainingTime)
524 {
525  if(m_offlineTrainingTime != offlineTrainingTime) {
526  double oldOfflineTrainingTime = m_offlineTrainingTime;
527  m_offlineTrainingTime = offlineTrainingTime;
528 
529  callLuaField("onOfflineTrainingChange", offlineTrainingTime, oldOfflineTrainingTime);
530  }
531 }
532 
533 void LocalPlayer::setSpells(const std::vector<int>& spells)
534 {
535  if(m_spells != spells) {
536  std::vector<int> oldSpells = m_spells;
537  m_spells = spells;
538 
539  callLuaField("onSpellsChange", spells, oldSpells);
540  }
541 }
542 
543 void LocalPlayer::setBlessings(int blessings)
544 {
545  if(blessings != m_blessings) {
546  int oldBlessings = m_blessings;
547  m_blessings = blessings;
548 
549  callLuaField("onBlessingsChange", blessings, oldBlessings);
550  }
551 }
552 
554 {
556 }
stdext::millis
ticks_t millis()
Definition: time.cpp:37
Otc::InvalidDirection
@ InvalidDirection
Definition: const.h:170
Position::translatedToDirection
Position translatedToDirection(Otc::Direction direction)
Definition: position.h:41
Position::isInRange
bool isInRange(const Position &pos, int xRange, int yRange) const
Definition: position.h:200
LocalPlayer::setHealth
void setHealth(double health, double maxHealth)
Definition: localplayer.cpp:364
Creature::terminateWalk
virtual void terminateWalk()
Definition: creature.cpp:604
LocalPlayer::setRegenerationTime
void setRegenerationTime(double regenerationTime)
Definition: localplayer.cpp:513
eventdispatcher.h
graphics.h
LocalPlayer::cancelWalk
void cancelWalk(Otc::Direction direction=Otc::InvalidDirection)
Definition: localplayer.cpp:139
g_map
Map g_map
Definition: map.cpp:36
LocalPlayer::canWalk
bool canWalk(Otc::Direction direction)
Definition: localplayer.cpp:65
LocalPlayer::updateWalkOffset
void updateWalkOffset(int totalPixelsWalked)
Definition: localplayer.cpp:248
LocalPlayer::setMana
void setMana(double mana, double maxMana)
Definition: localplayer.cpp:425
LocalPlayer::stopWalk
void stopWalk()
Definition: localplayer.cpp:240
TPoint::y
T y
Definition: point.h:83
Timer::ticksElapsed
ticks_t ticksElapsed()
Definition: timer.cpp:33
Otc::North
@ North
Definition: const.h:162
LocalPlayer::onAppear
virtual void onAppear()
Definition: localplayer.cpp:300
LocalPlayer::lockWalk
void lockWalk(int millis=250)
Definition: localplayer.cpp:60
Creature::onAppear
virtual void onAppear()
Definition: creature.cpp:431
g_dispatcher
EventDispatcher g_dispatcher
Definition: eventdispatcher.cpp:28
Position::isValid
bool isValid() const
Definition: position.h:182
Game::stop
void stop()
Definition: game.cpp:776
Creature::setDirection
void setDirection(Otc::Direction direction)
Definition: creature.cpp:659
LocalPlayer::setLevel
void setLevel(double level, double levelPercent)
Definition: localplayer.cpp:413
Position::translatedToDirections
std::vector< Position > translatedToDirections(const std::vector< Otc::Direction > &dirs) const
Definition: position.h:115
Otc::LastInventorySlot
@ LastInventorySlot
Definition: const.h:125
LocalPlayer::asLocalPlayer
LocalPlayerPtr asLocalPlayer()
Definition: localplayer.h:100
LocalPlayer::autoWalk
bool autoWalk(const Position &destination)
Definition: localplayer.cpp:167
Creature::onPositionChange
virtual void onPositionChange(const Position &newPos, const Position &oldPos)
Definition: creature.cpp:426
Game::getClientVersion
int getClientVersion()
Definition: game.h:316
Creature::updateWalkingTile
void updateWalkingTile()
Definition: creature.cpp:535
ticks_t
int64 ticks_t
Definition: types.h:43
LocalPlayer::setInventoryItem
void setInventoryItem(Otc::InventorySlot inventory, const ItemPtr &item)
Definition: localplayer.cpp:479
g_game
Game g_game
Definition: game.cpp:37
Point
TPoint< int > Point
Definition: point.h:86
Game::walk
bool walk(Otc::Direction direction, bool dash=false)
Definition: game.cpp:577
LocalPlayer::hasSight
bool hasSight(const Position &pos)
Definition: localplayer.cpp:553
Creature::m_baseSpeed
double m_baseSpeed
Definition: creature.h:155
Map::findPath
std::tuple< std::vector< Otc::Direction >, Otc::PathFindResult > findPath(const Position &start, const Position &goal, int maxComplexity, int flags=0)
Definition: map.cpp:715
Otc::LastSkill
@ LastSkill
Definition: const.h:158
Otc::Skill
Skill
Definition: const.h:144
LocalPlayer::setBaseMagicLevel
void setBaseMagicLevel(double baseMagicLevel)
Definition: localplayer.cpp:449
Thing::m_position
Position m_position
Definition: thing.h:131
LocalPlayer::preWalk
void preWalk(Otc::Direction direction)
Definition: localplayer.cpp:118
Otc::NorthEast
@ NorthEast
Definition: const.h:166
Otc::PathFindResultOk
@ PathFindResultOk
Definition: const.h:425
Otc::Direction
Direction
Definition: const.h:161
LocalPlayer::stopAutoWalk
void stopAutoWalk()
Definition: localplayer.cpp:230
localplayer.h
LocalPlayer::setMagicLevel
void setMagicLevel(double magicLevel, double magicLevelPercent)
Definition: localplayer.cpp:437
LocalPlayer::setStates
void setStates(int states)
Definition: localplayer.cpp:321
LuaObject::callLuaField
R callLuaField(const std::string &field, const T &... args)
Definition: luaobject.h:172
LocalPlayer::setPremium
void setPremium(bool premium)
Definition: localplayer.cpp:504
g_logger
Logger g_logger
Definition: logger.cpp:35
LocalPlayer::setExperience
void setExperience(double experience)
Definition: localplayer.cpp:403
Otc::West
@ West
Definition: const.h:165
LocalPlayer::terminateWalk
void terminateWalk()
Definition: localplayer.cpp:282
LocalPlayer::setSoul
void setSoul(double soul)
Definition: localplayer.cpp:459
Creature::walk
virtual void walk(const Position &oldPos, const Position &newPos)
Definition: creature.cpp:335
Position
Definition: position.h:33
Creature::m_walkOffset
Point m_walkOffset
Definition: creature.h:195
LocalPlayer::onPositionChange
virtual void onPositionChange(const Position &newPos, const Position &oldPos)
Definition: localplayer.cpp:311
LocalPlayer::setVocation
void setVocation(int vocation)
Definition: localplayer.cpp:494
Otc::BlessingNone
@ BlessingNone
Definition: const.h:476
map.h
Timer::restart
void restart()
Definition: timer.cpp:27
Creature::updateWalkOffset
virtual void updateWalkOffset(int totalPixelsWalked)
Definition: creature.cpp:521
TPoint::x
T x
Definition: point.h:83
Otc::PathFindAllowNotSeenTiles
@ PathFindAllowNotSeenTiles
Definition: const.h:433
LocalPlayer::isAutoWalking
bool isAutoWalking()
Definition: localplayer.h:95
Creature::m_walkTimer
Timer m_walkTimer
Definition: creature.h:186
LocalPlayer::LocalPlayer
LocalPlayer()
Definition: localplayer.cpp:30
Otc::SouthEast
@ SouthEast
Definition: const.h:167
Position::getDirectionFromPosition
Otc::Direction getDirectionFromPosition(const Position &position) const
Definition: position.h:177
Creature::m_direction
Otc::Direction m_direction
Definition: creature.h:151
Otc::PathFindResult
PathFindResult
Definition: const.h:424
LocalPlayer::setOfflineTrainingTime
void setOfflineTrainingTime(double offlineTrainingTime)
Definition: localplayer.cpp:523
Otc::South
@ South
Definition: const.h:164
Creature::updateWalkAnimation
virtual void updateWalkAnimation(int totalPixelsWalked)
Definition: creature.cpp:486
LocalPlayer::setTotalCapacity
void setTotalCapacity(double totalCapacity)
Definition: localplayer.cpp:393
Otc::InventorySlot
InventorySlot
Definition: const.h:109
AwareRange::left
int left
Definition: map.h:132
Otc::NorthWest
@ NorthWest
Definition: const.h:169
LocalPlayer::setBaseSkill
void setBaseSkill(Otc::Skill skill, int baseLevel)
Definition: localplayer.cpp:349
LocalPlayer::isPreWalking
bool isPreWalking()
Definition: localplayer.h:94
stdext::shared_object_ptr< Item >
LocalPlayer::setStamina
void setStamina(double stamina)
Definition: localplayer.cpp:469
Otc::East
@ East
Definition: const.h:163
LocalPlayer::setSpells
void setSpells(const std::vector< int > &spells)
Definition: localplayer.cpp:533
Creature::m_walking
stdext::boolean< false > m_walking
Definition: creature.h:189
Creature::stopWalk
virtual void stopWalk()
Definition: creature.cpp:365
Creature::getStepDuration
int getStepDuration(bool ignoreDiagonal=false, Otc::Direction dir=Otc::InvalidDirection)
Definition: creature.cpp:855
game.h
Clock::millis
ticks_t millis()
Definition: clock.h:37
LocalPlayer::setBlessings
void setBlessings(int blessings)
Definition: localplayer.cpp:543
LocalPlayer::walk
void walk(const Position &oldPos, const Position &newPos)
Definition: localplayer.cpp:93
EventDispatcher::scheduleEvent
ScheduledEventPtr scheduleEvent(const std::function< void()> &callback, int delay)
Definition: eventdispatcher.cpp:82
tile.h
Event::cancel
void cancel()
Definition: event.cpp:49
LocalPlayer::setFreeCapacity
void setFreeCapacity(double freeCapacity)
Definition: localplayer.cpp:383
g_clock
Clock g_clock
Definition: clock.cpp:25
AwareRange::top
int top
Definition: map.h:129
Game::autoWalk
void autoWalk(std::vector< Otc::Direction > dirs)
Definition: game.cpp:678
Creature::m_speed
int m_speed
Definition: creature.h:154
Otc::SouthWest
@ SouthWest
Definition: const.h:168
Map::getAwareRange
AwareRange getAwareRange()
Definition: map.h:233
LocalPlayer::setSkill
void setSkill(Otc::Skill skill, int level, int levelPercent)
Definition: localplayer.cpp:331
LocalPlayer::updateWalk
void updateWalk()
Definition: localplayer.cpp:266