Spell cast time calculation

This commit is contained in:
Yunfan Li
2024-02-07 21:37:19 +08:00
parent 1a11ec0717
commit 5e2497bf7e
4 changed files with 15 additions and 20 deletions

View File

@@ -2963,8 +2963,8 @@ bool PlayerbotAI::IsInVehicle(bool canControl, bool canCast, bool canAttack, boo
void PlayerbotAI::WaitForSpellCast(Spell* spell) void PlayerbotAI::WaitForSpellCast(Spell* spell)
{ {
SpellInfo const* spellInfo = spell->GetSpellInfo(); SpellInfo const* spellInfo = spell->GetSpellInfo();
uint32 castTime = spellInfo->CalcCastTime(bot, spell);
float castTime = spell->GetCastTime(); // float castTime = spell->GetCastTime();
// if (spellInfo->IsChanneled()) // if (spellInfo->IsChanneled())
// { // {
// int32 duration = spellInfo->GetDuration(); // int32 duration = spellInfo->GetDuration();
@@ -2973,9 +2973,9 @@ void PlayerbotAI::WaitForSpellCast(Spell* spell)
// castTime += duration; // castTime += duration;
// } // }
castTime = ceil(castTime); // castTime = ceil(castTime);
uint32 globalCooldown = CalculateGlobalCooldown(spellInfo->Id); // uint32 globalCooldown = CalculateGlobalCooldown(spellInfo->Id);
// if (castTime < globalCooldown) // if (castTime < globalCooldown)
// castTime = globalCooldown; // castTime = globalCooldown;

View File

@@ -2616,8 +2616,7 @@ void PlayerbotFactory::InitFood()
j--; j--;
continue; continue;
} }
// bot->StoreNewItemInBestSlots(itemId, urand(1, proto->GetMaxStackSize())); StoreItem(itemId, proto->GetMaxStackSize());
bot->StoreNewItemInBestSlots(itemId, proto->GetMaxStackSize());
} }
} }
} }
@@ -2662,21 +2661,17 @@ void PlayerbotFactory::InitReagents()
break; break;
case CLASS_PRIEST: case CLASS_PRIEST:
if (level >= 48 && level < 60) { if (level >= 48 && level < 60) {
items.push_back({17028, 40}); items.push_back({17028, 40}); // Wild Berries
// bot->StoreNewItemInBestSlots(17028, 40); // Wild Berries
} else if (level >= 60 && level < 80) { } else if (level >= 60 && level < 80) {
items.push_back({17029, 40}); items.push_back({17029, 40}); // Wild Berries
// bot->StoreNewItemInBestSlots(17029, 40); // Wild Berries
} else if (level >= 80) { } else if (level >= 80) {
items.push_back({44615, 40}); items.push_back({44615, 40}); // Wild Berries
// bot->StoreNewItemInBestSlots(44615, 40); // Wild Berries
} }
break; break;
case CLASS_MAGE: case CLASS_MAGE:
items.push_back({17020, 40}); items.push_back({17020, 40}); // Arcane Powder
items.push_back({17031, 40}); // portal items.push_back({17031, 40}); // portal
items.push_back({17032, 40}); // portal items.push_back({17032, 40}); // portal
// bot->StoreNewItemInBestSlots(17020, 40); // Arcane Powder
break; break;
case CLASS_DRUID: case CLASS_DRUID:
if (level >= 20 && level < 30) { if (level >= 20 && level < 30) {
@@ -2715,7 +2710,7 @@ void PlayerbotFactory::InitReagents()
break; break;
} }
for (std::pair item : items) { for (std::pair item : items) {
bot->StoreNewItemInBestSlots(item.first, item.second); StoreItem(item.first, item.second);
} }
} }

View File

@@ -26,9 +26,9 @@ bool DrinkAction::Execute(Event event)
if (bot->isMoving()) if (bot->isMoving())
{ {
// bot->StopMoving(); bot->StopMoving();
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); // botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
return false; // return false;
} }
bot->SetStandState(UNIT_STAND_STATE_SIT); bot->SetStandState(UNIT_STAND_STATE_SIT);
botAI->InterruptSpell(); botAI->InterruptSpell();
@@ -78,9 +78,9 @@ bool EatAction::Execute(Event event)
if (bot->isMoving()) if (bot->isMoving())
{ {
// bot->StopMoving(); bot->StopMoving();
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); // botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
return false; // return false;
} }
bot->SetStandState(UNIT_STAND_STATE_SIT); bot->SetStandState(UNIT_STAND_STATE_SIT);

View File

@@ -293,7 +293,7 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni
if (!spellId) if (!spellId)
return false; return false;
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); // botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
botAI->TellMasterNoFacing(out.str()); botAI->TellMasterNoFacing(out.str());
bot->GetSession()->HandleUseItemOpcode(packet); bot->GetSession()->HandleUseItemOpcode(packet);
return true; return true;