Minor fixes to spell and mount init (#863)

* Make summon imp non-temporary

* Remove horse mount from troll

* Set facing to during spell casting

* Allow rpg status command

* Init unarmed skill and fix skill clear

* Cast delay after interrupt spell
This commit is contained in:
Yunfan Li
2025-01-13 01:03:27 +08:00
committed by GitHub
parent 4311dabe24
commit 568592f188
5 changed files with 24 additions and 12 deletions

View File

@@ -328,13 +328,14 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
if (currentSpell && currentSpell->GetSpellInfo() && currentSpell->getState() == SPELL_STATE_PREPARING)
{
const SpellInfo* spellInfo = currentSpell->GetSpellInfo();
Unit* spellTarget = currentSpell->m_targets.GetUnitTarget();
// interrupt if target is dead
if (currentSpell->m_targets.GetUnitTarget() && !currentSpell->m_targets.GetUnitTarget()->IsAlive() &&
if (spellTarget && !spellTarget->IsAlive() &&
!spellInfo->IsAllowingDeadTarget())
{
InterruptSpell();
SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
YieldThread(GetReactDelay());
return;
}
bool isHeal = false;
@@ -357,10 +358,16 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
}
}
// interrupt if target ally has full health (heal by other member)
if (isHeal && isSingleTarget && currentSpell->m_targets.GetUnitTarget() && currentSpell->m_targets.GetUnitTarget()->IsFullHealth())
if (isHeal && isSingleTarget && spellTarget && spellTarget->IsFullHealth())
{
InterruptSpell();
SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
YieldThread(GetReactDelay());
return;
}
if (spellTarget && !bot->HasInArc(CAST_ANGLE_IN_FRONT, spellTarget) && (spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT))
{
sServerFacade->SetFacingTo(bot, spellTarget);
}
// wait for spell cast
@@ -817,6 +824,7 @@ bool PlayerbotAI::IsAllowedCommand(std::string const text)
unsecuredCommands.insert("sendmail");
unsecuredCommands.insert("invite");
unsecuredCommands.insert("leave");
unsecuredCommands.insert("rpg status");
}
for (std::set<std::string>::iterator i = unsecuredCommands.begin(); i != unsecuredCommands.end(); ++i)

View File

@@ -1510,7 +1510,7 @@ void RandomPlayerbotMgr::PrepareTeleportCache()
}
LOG_INFO("playerbots", ">> {} locations for level collected.", collected_locs);
LOG_INFO("playerbots", "Preparing innkeepers locations for level collected...");
LOG_INFO("playerbots", "Preparing innkeepers locations for level...");
if (sPlayerbotAIConfig->enableNewRpgStrategy)
{
results = WorldDatabase.Query(

View File

@@ -2185,6 +2185,7 @@ void PlayerbotFactory::InitSkills()
uint32 skillLevel = bot->GetLevel() < 40 ? 0 : 1;
uint32 dualWieldLevel = bot->GetLevel() < 20 ? 0 : 1;
SetRandomSkill(SKILL_DEFENSE);
SetRandomSkill(SKILL_UNARMED);
switch (bot->getClass())
{
case CLASS_DRUID:
@@ -2328,7 +2329,7 @@ void PlayerbotFactory::SetRandomSkill(uint16 id)
uint16 step = bot->GetSkillValue(id) ? bot->GetSkillStep(id) : 1;
if (!bot->HasSkill(id) || value > curValue)
// if (!bot->HasSkill(id) || value > curValue)
bot->SetSkill(id, step, value, maxValue);
}
@@ -2475,7 +2476,7 @@ void PlayerbotFactory::InitClassSpells()
case CLASS_WARLOCK:
bot->learnSpell(687, true);
bot->learnSpell(686, true);
bot->learnSpell(688, true); // summon imp
bot->learnSpell(688, false); // summon imp
if (level >= 10)
{
bot->learnSpell(697, false); // summon voidwalker
@@ -2867,7 +2868,7 @@ void PlayerbotFactory::InitMounts()
fast = {23225, 23223, 23222};
break;
case RACE_TROLL:
slow = {10796, 10799, 8395, 472};
slow = {10796, 10799, 8395};
fast = {23241, 23242, 23243};
break;
case RACE_DRAENEI:

View File

@@ -18,8 +18,11 @@
bool TellRpgStatusAction::Execute(Event event)
{
Player* owner = event.getOwner();
if (!owner)
return false;
std::string out = botAI->rpgInfo.ToString();
botAI->TellMasterNoFacing(out);
bot->Whisper(out.c_str(), LANG_UNIVERSAL, owner);
return true;
}

View File

@@ -24,7 +24,7 @@ protected:
// const int32 setGrindInterval = 5 * 60 * 1000;
// const int32 setNpcInterval = 1 * 60 * 1000;
const int32 statusNearNpcDuration = 5 * 60 * 1000;
const int32 statusNearRandomDuration = 2 * 60 * 1000;
const int32 statusNearRandomDuration = 5 * 60 * 1000;
const int32 statusRestDuration = 30 * 1000;
WorldPosition SelectRandomGrindPos();
WorldPosition SelectRandomInnKeeperPos();