Merge branch 'liyunfan1223:master' into locale_fix

This commit is contained in:
Atidote
2024-07-25 17:02:33 +02:00
committed by GitHub
14 changed files with 68 additions and 34 deletions

View File

@@ -4,17 +4,24 @@
#include "AcceptInvitationAction.h"
#include "Event.h"
#include "ObjectAccessor.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h"
#include "PlayerbotSecurity.h"
#include "WorldPacket.h"
bool AcceptInvitationAction::Execute(Event event)
{
Group* grp = bot->GetGroupInvite();
if (!grp)
return false;
WorldPacket packet = event.getPacket();
uint8 flag;
std::string name;
packet >> flag >> name;
Player* inviter = ObjectAccessor::FindPlayer(grp->GetLeaderGUID());
// Player* inviter = ObjectAccessor::FindPlayer(grp->GetLeaderGUID());
Player* inviter = ObjectAccessor::FindPlayerByName(name, true);
if (!inviter)
return false;

View File

@@ -2390,19 +2390,19 @@ static std::pair<uint32, uint32> AV_AllianceDefendObjectives[] =
static uint32 AB_AttackObjectives[] =
{
// Attack
{ BG_AB_NODE_STABLES },
{ BG_AB_NODE_BLACKSMITH },
{ BG_AB_NODE_FARM },
{ BG_AB_NODE_LUMBER_MILL },
{ BG_AB_NODE_GOLD_MINE }
BG_AB_NODE_STABLES,
BG_AB_NODE_BLACKSMITH,
BG_AB_NODE_FARM,
BG_AB_NODE_LUMBER_MILL,
BG_AB_NODE_GOLD_MINE
};
static uint32 EY_AttackObjectives[] =
{
{ POINT_FEL_REAVER },
{ POINT_BLOOD_ELF },
{ POINT_DRAENEI_RUINS },
{ POINT_MAGE_TOWER }
POINT_FEL_REAVER,
POINT_BLOOD_ELF,
POINT_DRAENEI_RUINS,
POINT_MAGE_TOWER
};
// useful commands for fixing BG bugs and checking waypoints/paths

View File

@@ -447,7 +447,7 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
case TEXT_EMOTE_RASP:
emoteId = EMOTE_ONESHOT_RUDE;
textEmote = TEXT_EMOTE_RASP;
emoteText = "Right back at you, bub!", LANG_UNIVERSAL;
emoteText = "Right back at you, bub!"; // , LANG_UNIVERSAL;
break;
case TEXT_EMOTE_ROAR:
case TEXT_EMOTE_THREATEN:

View File

@@ -20,6 +20,7 @@ bool TogglePetSpellAutoCastAction::Execute(Event event) {
if (!pet) {
return false;
}
bool toggled = false;
for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
{
if(itr->second.state == PETSPELL_REMOVED)
@@ -29,17 +30,29 @@ bool TogglePetSpellAutoCastAction::Execute(Event event) {
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo->IsPassive())
continue;
bool shouldApply = true;
// imp's spell, felhunte's intelligence, ghoul's leap, cat stealth
if (spellId == 4511 || spellId == 1742 ||
spellId == 54424 || spellId == 57564 || spellId == 57565 || spellId == 57566 || spellId == 57567 ||
spellId == 47482 || spellId == 24450) {
pet->ToggleAutocast(spellInfo, false);
} else {
pet->ToggleAutocast(spellInfo, true);
shouldApply = false;
}
bool isAutoCast = false;
for (unsigned int &m_autospell : pet->m_autospells)
{
if (m_autospell == spellId)
{
isAutoCast = true;
break;
}
}
if (shouldApply != isAutoCast) {
pet->ToggleAutocast(spellInfo, shouldApply);
toggled = true;
}
}
return true;
return toggled;
}
bool PetAttackAction::Execute(Event event)

View File

@@ -1595,7 +1595,7 @@ bool AvoidAoeAction::AvoidGameObjectWithDamage()
continue;
}
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo->IsPositive()) {
if (!spellInfo || spellInfo->IsPositive()) {
continue;
}
float radius = (float)goInfo->trap.diameter / 2;

View File

@@ -6,6 +6,7 @@
#include "Event.h"
#include "ChatHelper.h"
#include "Playerbots.h"
#include "World.h"
bool TellLosAction::Execute(Event event)
{
@@ -52,7 +53,7 @@ void TellLosAction::ListUnits(std::string const title, GuidVector units)
for (ObjectGuid const guid : units)
{
if (Unit* unit = botAI->GetUnit(guid)) {
botAI->TellMaster(unit->GetName());
botAI->TellMaster(unit->GetNameForLocaleIdx(sWorld->GetDefaultDbcLocale()));
}
}

View File

@@ -206,7 +206,8 @@ bool SummonAction::Teleport(Player* summoner, Player* player)
return false;
}
if (bot->isDead() && sPlayerbotAIConfig->reviveBotWhenSummoned)
bool revive = sPlayerbotAIConfig->reviveBotWhenSummoned == 2 || (sPlayerbotAIConfig->reviveBotWhenSummoned == 1 && !master->IsInCombat());
if (bot->isDead() && revive)
{
bot->ResurrectPlayer(1.0f, false);
botAI->TellMasterNoFacing("I live, again!");