mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-25 22:46:25 +00:00
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
/*
|
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
*/
|
|
|
|
#include "FishValues.h"
|
|
#include "PlayerbotAI.h"
|
|
#include "RandomPlayerbotMgr.h"
|
|
#include "Map.h"
|
|
#include "Spell.h"
|
|
#include "FishingAction.h"
|
|
|
|
bool CanFishValue::Calculate()
|
|
{
|
|
int32 SkillFishing = bot->GetSkillValue(SKILL_FISHING);
|
|
|
|
if (SkillFishing == 0)
|
|
return false;
|
|
|
|
if (bot->isSwimming())
|
|
return false;
|
|
|
|
if (bot->IsInCombat())
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
bool CanUseFishingBobberValue::Calculate()
|
|
{
|
|
GuidVector gos = AI_VALUE(GuidVector, "nearest game objects no los");
|
|
for (auto const& guid : gos)
|
|
{
|
|
if (GameObject* go = botAI->GetGameObject(guid))
|
|
{
|
|
if (go->GetEntry() != FISHING_BOBBER)
|
|
continue;
|
|
if (go->GetOwnerGUID() != bot->GetGUID())
|
|
continue;
|
|
|
|
if (go->getLootState() == GO_READY)
|
|
return true;
|
|
|
|
// Not ready yet → delay next check
|
|
time_t bobberActiveTime = go->GetRespawnTime() - FISHING_BOBBER_READY_TIME;
|
|
if (bobberActiveTime > time(0))
|
|
botAI->SetNextCheckDelay((bobberActiveTime - time(0)) * IN_MILLISECONDS + 500);
|
|
else
|
|
botAI->SetNextCheckDelay(1000);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
return false;
|
|
}
|