void Game::cancelAttackAndFollow() { if(!canPerformGameAction()) return; if(isAttacking()) setAttackingCreature(nullptr); if(isFollowing()) setFollowingCreature(nullptr); m_protocolGame->sendCancelAttackAndFollow(); }
void Game::attack(const CreaturePtr& creature) { if(!canPerformGameAction() || creature == m_localPlayer) return; if(creature && creature == m_attackingCreature) { cancelAttack(); return; } if(creature && isFollowing()) cancelFollow(); setAttackingCreature(creature); m_protocolGame->sendAttack(creature ? creature->getId() : 0, ++m_seq); }
void Game::cancelAttackAndFollow() { if(!canPerformGameAction()) return; if(isFollowing()) setFollowingCreature(nullptr); if(isAttacking()) setAttackingCreature(nullptr); m_localPlayer->stopAutoWalk(); m_protocolGame->sendCancelAttackAndFollow(); g_lua.callGlobalField("g_game", "onCancelAttackAndFollow"); }
void Game::attack(CreaturePtr creature) { if(!canPerformGameAction() || creature == m_localPlayer) return; // cancel when attacking again if(creature && creature == m_attackingCreature) creature = nullptr; if(creature && isFollowing()) cancelFollow(); setAttackingCreature(creature); m_localPlayer->stopAutoWalk(); if(m_protocolVersion >= 963) { if(creature) m_seq = creature->getId(); } else m_seq++; m_protocolGame->sendAttack(creature ? creature->getId() : 0, m_seq); }
void Game::processAttackCancel(uint seq) { if(isAttacking() && (seq == 0 || m_seq == seq)) setAttackingCreature(nullptr); }