mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-20 18:10:02 +01:00
Merge branch 'liyunfan1223:master' into Tame-Chat-Action-/-Pet-Chat-Action-(stances/commands)
This commit is contained in:
commit
683c6e39e4
@ -168,7 +168,7 @@ void PlayerbotHolder::HandlePlayerBotLoginCallback(PlayerbotLoginQueryHolder con
|
|||||||
uint32 botAccountId = holder.GetAccountId();
|
uint32 botAccountId = holder.GetAccountId();
|
||||||
// At login DBC locale should be what the server is set to use by default (as spells etc are hardcoded to ENUS this
|
// At login DBC locale should be what the server is set to use by default (as spells etc are hardcoded to ENUS this
|
||||||
// allows channels to work as intended)
|
// allows channels to work as intended)
|
||||||
WorldSession* botSession = new WorldSession(botAccountId, "", nullptr, SEC_PLAYER, EXPANSION_WRATH_OF_THE_LICH_KING,
|
WorldSession* botSession = new WorldSession(botAccountId, "", 0x0, nullptr, SEC_PLAYER, EXPANSION_WRATH_OF_THE_LICH_KING,
|
||||||
time_t(0), sWorld->GetDefaultDbcLocale(), 0, false, false, 0, true);
|
time_t(0), sWorld->GetDefaultDbcLocale(), 0, false, false, 0, true);
|
||||||
|
|
||||||
botSession->HandlePlayerLoginFromDB(holder); // will delete lqh
|
botSession->HandlePlayerLoginFromDB(holder); // will delete lqh
|
||||||
|
|||||||
@ -785,7 +785,7 @@ void RandomPlayerbotFactory::CreateRandomBots()
|
|||||||
LOG_DEBUG("playerbots", "Creating random bot characters for account: [{}/{}]", accountNumber + 1, totalAccountCount);
|
LOG_DEBUG("playerbots", "Creating random bot characters for account: [{}/{}]", accountNumber + 1, totalAccountCount);
|
||||||
RandomPlayerbotFactory factory(accountId);
|
RandomPlayerbotFactory factory(accountId);
|
||||||
|
|
||||||
WorldSession* session = new WorldSession(accountId, "", nullptr, SEC_PLAYER, EXPANSION_WRATH_OF_THE_LICH_KING,
|
WorldSession* session = new WorldSession(accountId, "", 0x0, nullptr, SEC_PLAYER, EXPANSION_WRATH_OF_THE_LICH_KING,
|
||||||
time_t(0), LOCALE_enUS, 0, false, false, 0, true);
|
time_t(0), LOCALE_enUS, 0, false, false, 0, true);
|
||||||
sessionBots.push_back(session);
|
sessionBots.push_back(session);
|
||||||
|
|
||||||
|
|||||||
@ -3336,7 +3336,7 @@ void TravelMgr::LoadQuestTravelTable()
|
|||||||
uint32 accountId = fields[0].Get<uint32>();
|
uint32 accountId = fields[0].Get<uint32>();
|
||||||
|
|
||||||
WorldSession* session =
|
WorldSession* session =
|
||||||
new WorldSession(accountId, "", nullptr, SEC_PLAYER, EXPANSION_WRATH_OF_THE_LICH_KING, time_t(0),
|
new WorldSession(accountId, "", 0x0, nullptr, SEC_PLAYER, EXPANSION_WRATH_OF_THE_LICH_KING, time_t(0),
|
||||||
LOCALE_enUS, 0, false, false, 0, true);
|
LOCALE_enUS, 0, false, false, 0, true);
|
||||||
|
|
||||||
std::vector<std::pair<std::pair<uint32, uint32>, uint32>> classSpecLevel;
|
std::vector<std::pair<std::pair<uint32, uint32>, uint32>> classSpecLevel;
|
||||||
|
|||||||
@ -59,9 +59,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
bool sameTarget = oldTarget == target && bot->GetVictim() == target;
|
bool sameTarget = oldTarget == target && bot->GetVictim() == target;
|
||||||
bool inCombat = botAI->GetState() == BOT_STATE_COMBAT;
|
bool inCombat = botAI->GetState() == BOT_STATE_COMBAT;
|
||||||
bool sameAttackMode = bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING) == shouldMelee;
|
bool sameAttackMode = bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING) == shouldMelee;
|
||||||
// there's no reason to do attack again
|
|
||||||
if (sameTarget && inCombat && sameAttackMode)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE ||
|
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE ||
|
||||||
bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||||
@ -82,52 +79,53 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
|
|
||||||
if (!target->IsInWorld())
|
if (!target->IsInWorld())
|
||||||
{
|
{
|
||||||
|
if (verbose)
|
||||||
|
botAI->TellError(std::string(target->GetName()) + " is no longer in the world.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()) ||
|
||||||
|
sPlayerbotAIConfig->IsInPvpProhibitedArea(bot->GetAreaId()))
|
||||||
|
&& (target->IsPlayer() || target->IsPet()))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
botAI->TellError("I cannot attack other players in PvP prohibited areas.");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bot->IsFriendlyTo(target))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
botAI->TellError(std::string(target->GetName()) + " is friendly to me.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target->isDead())
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
botAI->TellError(std::string(target->GetName()) + " is dead.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bot->IsWithinLOSInMap(target))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
botAI->TellError(std::string(target->GetName()) + " is not in my sight.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sameTarget && inCombat && sameAttackMode)
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
botAI->TellError("I am already attacking " + std::string(target->GetName()) + ".");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bot->IsValidAttackTarget(target))
|
if (!bot->IsValidAttackTarget(target))
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
botAI->TellError("I cannot attack an invalid target");
|
botAI->TellError("I cannot attack an invalid target.");
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostringstream msg;
|
|
||||||
msg << target->GetName();
|
|
||||||
|
|
||||||
if (bot->IsFriendlyTo(target))
|
|
||||||
{
|
|
||||||
msg << " is friendly to me";
|
|
||||||
if (verbose)
|
|
||||||
botAI->TellError(msg.str());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bot->IsWithinLOSInMap(target))
|
|
||||||
{
|
|
||||||
msg << " is not in my sight";
|
|
||||||
if (verbose)
|
|
||||||
botAI->TellError(msg.str());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target->isDead())
|
|
||||||
{
|
|
||||||
msg << " is dead";
|
|
||||||
if (verbose)
|
|
||||||
botAI->TellError(msg.str());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId())
|
|
||||||
&& (target->IsPlayer() || target->IsPet()))
|
|
||||||
{
|
|
||||||
if (verbose)
|
|
||||||
botAI->TellError("I cannot attack others in PvP prohibited zones");
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -141,9 +139,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
ObjectGuid guid = target->GetGUID();
|
ObjectGuid guid = target->GetGUID();
|
||||||
bot->SetSelection(target->GetGUID());
|
bot->SetSelection(target->GetGUID());
|
||||||
|
|
||||||
|
context->GetValue<Unit*>("old target")->Set(oldTarget);
|
||||||
|
|
||||||
context->GetValue<Unit*>("old target")->Set(oldTarget);
|
|
||||||
|
|
||||||
context->GetValue<Unit*>("current target")->Set(target);
|
context->GetValue<Unit*>("current target")->Set(target);
|
||||||
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
|
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
|
||||||
@ -157,7 +153,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
bot->StopMoving();
|
bot->StopMoving();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target))
|
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target))
|
||||||
{
|
{
|
||||||
sServerFacade->SetFacingTo(bot, target);
|
sServerFacade->SetFacingTo(bot, target);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user