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)
{
SpellInfo const* spellInfo = spell->GetSpellInfo();
float castTime = spell->GetCastTime();
uint32 castTime = spellInfo->CalcCastTime(bot, spell);
// float castTime = spell->GetCastTime();
// if (spellInfo->IsChanneled())
// {
// int32 duration = spellInfo->GetDuration();
@@ -2973,9 +2973,9 @@ void PlayerbotAI::WaitForSpellCast(Spell* spell)
// castTime += duration;
// }
castTime = ceil(castTime);
// castTime = ceil(castTime);
uint32 globalCooldown = CalculateGlobalCooldown(spellInfo->Id);
// uint32 globalCooldown = CalculateGlobalCooldown(spellInfo->Id);
// if (castTime < globalCooldown)
// castTime = globalCooldown;

View File

@@ -2616,8 +2616,7 @@ void PlayerbotFactory::InitFood()
j--;
continue;
}
// bot->StoreNewItemInBestSlots(itemId, urand(1, proto->GetMaxStackSize()));
bot->StoreNewItemInBestSlots(itemId, proto->GetMaxStackSize());
StoreItem(itemId, proto->GetMaxStackSize());
}
}
}
@@ -2662,21 +2661,17 @@ void PlayerbotFactory::InitReagents()
break;
case CLASS_PRIEST:
if (level >= 48 && level < 60) {
items.push_back({17028, 40});
// bot->StoreNewItemInBestSlots(17028, 40); // Wild Berries
items.push_back({17028, 40}); // Wild Berries
} else if (level >= 60 && level < 80) {
items.push_back({17029, 40});
// bot->StoreNewItemInBestSlots(17029, 40); // Wild Berries
items.push_back({17029, 40}); // Wild Berries
} else if (level >= 80) {
items.push_back({44615, 40});
// bot->StoreNewItemInBestSlots(44615, 40); // Wild Berries
items.push_back({44615, 40}); // Wild Berries
}
break;
case CLASS_MAGE:
items.push_back({17020, 40});
items.push_back({17020, 40}); // Arcane Powder
items.push_back({17031, 40}); // portal
items.push_back({17032, 40}); // portal
// bot->StoreNewItemInBestSlots(17020, 40); // Arcane Powder
break;
case CLASS_DRUID:
if (level >= 20 && level < 30) {
@@ -2715,7 +2710,7 @@ void PlayerbotFactory::InitReagents()
break;
}
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())
{
// bot->StopMoving();
bot->StopMoving();
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
return false;
// return false;
}
bot->SetStandState(UNIT_STAND_STATE_SIT);
botAI->InterruptSpell();
@@ -78,9 +78,9 @@ bool EatAction::Execute(Event event)
if (bot->isMoving())
{
// bot->StopMoving();
bot->StopMoving();
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
return false;
// return false;
}
bot->SetStandState(UNIT_STAND_STATE_SIT);

View File

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