mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-05 20:03:49 +00:00
BattleGrounds: Refactor and Fix bots re-spawning when graveyard meanwhile gets lost (#937)
* Update ReleaseSpiritAction.cpp * Update ReleaseSpiritAction.cpp * Update ReleaseSpiritAction.cpp * Update ReleaseSpiritAction.cpp * Update ReleaseSpiritAction.h * Update ReleaseSpiritAction.h * Update ReleaseSpiritAction.cpp * Update ReleaseSpiritAction.cpp * Update ReleaseSpiritAction.cpp * Refactor (#68) * Refactored ReleaseSpiritAction.cpp * Ref ReleaseSpiritAction.h * Restore comment
This commit is contained in:
@@ -3,10 +3,8 @@
|
||||
* and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_RELEASESPIRITACTION_H
|
||||
#define _PLAYERBOT_RELEASESPIRITACTION_H
|
||||
|
||||
#include <cstdint>
|
||||
#ifndef PLAYERBOT_RELEASESPIRITACTION_H
|
||||
#define PLAYERBOT_RELEASESPIRITACTION_H
|
||||
|
||||
#include "Action.h"
|
||||
#include "ReviveFromCorpseAction.h"
|
||||
@@ -16,34 +14,46 @@ class PlayerbotAI;
|
||||
class ReleaseSpiritAction : public Action
|
||||
{
|
||||
public:
|
||||
ReleaseSpiritAction(PlayerbotAI* botAI, std::string const name = "release") : Action(botAI, name) {}
|
||||
ReleaseSpiritAction(PlayerbotAI* botAI, const std::string& name = "release")
|
||||
: Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
void LogRelease(const std::string& releaseType, bool isAutoRelease = false) const;
|
||||
|
||||
protected:
|
||||
void IncrementDeathCount() const;
|
||||
};
|
||||
|
||||
class AutoReleaseSpiritAction : public ReleaseSpiritAction
|
||||
{
|
||||
public:
|
||||
AutoReleaseSpiritAction(PlayerbotAI* botAI, std::string const name = "auto release")
|
||||
: ReleaseSpiritAction(botAI, name)
|
||||
{
|
||||
}
|
||||
AutoReleaseSpiritAction(PlayerbotAI* botAI, const std::string& name = "auto release")
|
||||
: ReleaseSpiritAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
private:
|
||||
inline static std::unordered_map<uint32_t, time_t> botReleaseTimes;
|
||||
uint32_t bg_gossip_time = 0;
|
||||
bool HandleBattlegroundSpiritHealer();
|
||||
bool ShouldAutoRelease() const;
|
||||
bool ShouldDelayBattlegroundRelease() const;
|
||||
|
||||
inline static std::unordered_map<uint32_t, time_t> m_botReleaseTimes;
|
||||
time_t m_bgGossipTime = 0;
|
||||
};
|
||||
|
||||
class RepopAction : public SpiritHealerAction
|
||||
{
|
||||
public:
|
||||
RepopAction(PlayerbotAI* botAI, std::string const name = "repop") : SpiritHealerAction(botAI, name) {}
|
||||
RepopAction(PlayerbotAI* botAI, const std::string& name = "repop")
|
||||
: SpiritHealerAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
private:
|
||||
int64 CalculateDeadTime() const;
|
||||
void PerformGraveyardTeleport(const GraveyardStruct* graveyard) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user