ignore playerbots

master
Dominik Madarász 2024-06-21 13:43:39 +02:00
parent aab757e2e3
commit c1464c55e1
1 changed files with 12 additions and 3 deletions

View File

@ -106,6 +106,11 @@ public:
void OnLogin(Player* player) override
{
if (player->GetSession()->IsBot())
{
return;
}
QueryResult result = CharacterDatabase.Query("SELECT `hunger`,`thirst` FROM `mod_needs` WHERE `guid`='{}'", player->GetGUID().GetCounter());
if (!result)
@ -120,11 +125,15 @@ public:
Field* fields = result->Fetch();
player->CustomData.Set("Needs", new PlayerNeeds(fields[0].Get<uint8>(), fields[1].Get<uint8>()));
}
}
void SaveData(Player* player)
{
if (player->GetSession()->IsBot())
{
return;
}
if (PlayerNeeds* data = player->CustomData.Get<PlayerNeeds>("Needs"))
{
CharacterDatabase.DirectExecute("REPLACE INTO `mod_needs` (`guid`,`hunger`,`thirst`) VALUES ('{}', '{}', '{}');", player->GetGUID().GetCounter(), data->hunger, data->thirst);
@ -179,7 +188,7 @@ public:
void OnSpellCast(Player* player, Spell* spell, bool /*skipCheck*/) override
{
if (!NeedsEnabled || !spell->m_CastItem)
if (!NeedsEnabled || !spell->m_CastItem || player->GetSession()->IsBot())
{
return;
}
@ -216,7 +225,7 @@ public:
void OnBeforeUpdate(Player* player, uint32 /* p_time */) override
{
if (!NeedsEnabled || !player->IsInWorld() || !player->IsAlive())
if (!NeedsEnabled || !player->IsInWorld() || !player->IsAlive() || player->GetSession()->IsBot())
{
return;
}