ignore playerbots
parent
aab757e2e3
commit
c1464c55e1
|
@ -106,6 +106,11 @@ public:
|
||||||
|
|
||||||
void OnLogin(Player* player) override
|
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());
|
QueryResult result = CharacterDatabase.Query("SELECT `hunger`,`thirst` FROM `mod_needs` WHERE `guid`='{}'", player->GetGUID().GetCounter());
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
@ -120,11 +125,15 @@ public:
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
player->CustomData.Set("Needs", new PlayerNeeds(fields[0].Get<uint8>(), fields[1].Get<uint8>()));
|
player->CustomData.Set("Needs", new PlayerNeeds(fields[0].Get<uint8>(), fields[1].Get<uint8>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveData(Player* player)
|
void SaveData(Player* player)
|
||||||
{
|
{
|
||||||
|
if (player->GetSession()->IsBot())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (PlayerNeeds* data = player->CustomData.Get<PlayerNeeds>("Needs"))
|
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);
|
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
|
void OnSpellCast(Player* player, Spell* spell, bool /*skipCheck*/) override
|
||||||
{
|
{
|
||||||
if (!NeedsEnabled || !spell->m_CastItem)
|
if (!NeedsEnabled || !spell->m_CastItem || player->GetSession()->IsBot())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +225,7 @@ public:
|
||||||
|
|
||||||
void OnBeforeUpdate(Player* player, uint32 /* p_time */) override
|
void OnBeforeUpdate(Player* player, uint32 /* p_time */) override
|
||||||
{
|
{
|
||||||
if (!NeedsEnabled || !player->IsInWorld() || !player->IsAlive())
|
if (!NeedsEnabled || !player->IsInWorld() || !player->IsAlive() || player->GetSession()->IsBot())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue