mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-16 08:36:10 +00:00
Removed unnecessary spaces
This commit is contained in:
@@ -55,11 +55,11 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
{
|
||||
Unit* oldTarget = context->GetValue<Unit*>("current target")->Get();
|
||||
bool shouldMelee = bot->IsWithinMeleeRange(target) || botAI->IsMelee(bot);
|
||||
|
||||
|
||||
bool sameTarget = oldTarget == target && bot->GetVictim() == target;
|
||||
bool inCombat = botAI->GetState() == BOT_STATE_COMBAT;
|
||||
bool sameAttackMode = bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING) == shouldMelee;
|
||||
|
||||
|
||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE ||
|
||||
bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||
{
|
||||
@@ -84,7 +84,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()) ||
|
||||
if ((sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()) ||
|
||||
sPlayerbotAIConfig->IsInPvpProhibitedArea(bot->GetAreaId()))
|
||||
&& (target->IsPlayer() || target->IsPet()))
|
||||
{
|
||||
@@ -158,7 +158,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
sServerFacade->SetFacingTo(bot, target);
|
||||
}
|
||||
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
||||
|
||||
|
||||
bot->Attack(target, shouldMelee);
|
||||
/* prevent pet dead immediately in group */
|
||||
// if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) {
|
||||
|
||||
@@ -158,7 +158,7 @@ void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
return;
|
||||
|
||||
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
|
||||
// Clean up old consumables before adding new ones
|
||||
|
||||
@@ -543,7 +543,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
}
|
||||
|
||||
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(0);
|
||||
|
||||
|
||||
if (!isArena)
|
||||
{
|
||||
WorldPacket* packet = new WorldPacket(CMSG_BATTLEMASTER_JOIN, 20);
|
||||
|
||||
@@ -2903,7 +2903,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
{
|
||||
// just make bot stay where it is if already close
|
||||
// (stops them shifting around between the random spots)
|
||||
if (bot->GetDistance(IC_GATE_ATTACK_POS_HORDE) < 8.0f)
|
||||
if (bot->GetDistance(IC_GATE_ATTACK_POS_HORDE) < 8.0f)
|
||||
pos.Set(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), bot->GetMapId());
|
||||
else
|
||||
pos.Set(IC_GATE_ATTACK_POS_HORDE.GetPositionX() + frand(-5.0f, +5.0f),
|
||||
@@ -3213,7 +3213,7 @@ bool BGTactics::moveToObjective(bool ignoreDist)
|
||||
// sServerFacade->GetDistance2d(bot, pos.x, pos.y); bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
|
||||
// dont increase from 1.5 will cause bugs with horde capping AV towers
|
||||
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z, 1.5f);
|
||||
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z, 1.5f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -3549,14 +3549,14 @@ bool BGTactics::startNewPathFree(std::vector<BattleBotPath*> const& vPaths)
|
||||
|
||||
/**
|
||||
* @brief Handles flag/base capturing gameplay in battlegrounds
|
||||
*
|
||||
*
|
||||
* This function manages the logic for capturing flags and bases in various battlegrounds.
|
||||
* It handles:
|
||||
* - Enemy detection and combat near objectives
|
||||
* - Coordination with friendly players who are capturing
|
||||
* - Different capture mechanics for each battleground type
|
||||
* - Proper positioning and movement
|
||||
*
|
||||
*
|
||||
* @param vPaths Vector of possible paths the bot can take
|
||||
* @param vFlagIds Vector of flag/base GameObjects that can be captured
|
||||
* @return true if handling a flag/base action, false otherwise
|
||||
@@ -3687,7 +3687,7 @@ bool BGTactics::atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<ui
|
||||
float y = bot->GetPositionY() + 5.0f * sin(angle);
|
||||
MoveTo(bot->GetMapId(), x, y, bot->GetPositionZ());
|
||||
}
|
||||
|
||||
|
||||
// Reset objective and take new path for defending
|
||||
resetObjective();
|
||||
if (!startNewPathBegin(vPaths))
|
||||
@@ -3895,7 +3895,7 @@ bool BGTactics::protectFC()
|
||||
float fcY = teamFC->GetPositionY();
|
||||
float fcZ = teamFC->GetPositionZ();
|
||||
uint32 mapId = bot->GetMapId();
|
||||
|
||||
|
||||
return MoveNear(mapId, fcX, fcY, fcZ, 5.0f, MovementPriority::MOVEMENT_NORMAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,14 +67,14 @@ bool BuyAction::Execute(Event event)
|
||||
calculator.SetOverflowPenalty(false);
|
||||
|
||||
std::sort(m_items_sorted.begin(), m_items_sorted.end(),
|
||||
[&calculator](VendorItem* i, VendorItem* j)
|
||||
[&calculator](VendorItem* i, VendorItem* j)
|
||||
{
|
||||
ItemTemplate const* item1 = sObjectMgr->GetItemTemplate(i->item);
|
||||
ItemTemplate const* item2 = sObjectMgr->GetItemTemplate(j->item);
|
||||
|
||||
|
||||
if (!item1 || !item2)
|
||||
return false;
|
||||
|
||||
|
||||
float score1 = calculator.CalculateItem(item1->ItemId);
|
||||
float score2 = calculator.CalculateItem(item2->ItemId);
|
||||
|
||||
@@ -88,19 +88,19 @@ bool BuyAction::Execute(Event event)
|
||||
});
|
||||
|
||||
std::unordered_map<uint32, float> bestPurchasedItemScore; // Track best item score per InventoryType
|
||||
|
||||
|
||||
for (auto& tItem : m_items_sorted)
|
||||
{
|
||||
uint32 maxPurchases = 1; // Default to buying once
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(tItem->item);
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
|
||||
if (proto->Class == ITEM_CLASS_CONSUMABLE || proto->Class == ITEM_CLASS_PROJECTILE)
|
||||
{
|
||||
maxPurchases = 10; // Allow up to 10 purchases if it's a consumable or projectile
|
||||
}
|
||||
|
||||
|
||||
for (uint32 i = 0; i < maxPurchases; i++)
|
||||
{
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", tItem->item);
|
||||
|
||||
@@ -47,10 +47,10 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
{
|
||||
if (!target)
|
||||
target = botAI->GetUnit(go);
|
||||
|
||||
|
||||
if (!botAI->GetUnit(go) || !botAI->GetUnit(go)->IsInWorld())
|
||||
continue;
|
||||
|
||||
|
||||
chat->eraseAllSubStr(text, chat->FormatWorldobject(botAI->GetUnit(go)));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "Playerbots.h"
|
||||
#include "AiObjectContext.h"
|
||||
#include "Log.h"
|
||||
#include "Log.h"
|
||||
|
||||
bool ChangeTalentsAction::Execute(Event event)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ bool CheckMountStateAction::isUseful()
|
||||
|
||||
// Get shapeshift states, only applicable when there's a master
|
||||
if (master)
|
||||
{
|
||||
{
|
||||
botInShapeshiftForm = bot->GetShapeshiftForm();
|
||||
masterInShapeshiftForm = master->GetShapeshiftForm();
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ bool ChooseRpgTargetAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (possiblePlayers.size() > 200 || HasSameTarget(guidP, urand(5, 15), possiblePlayers))
|
||||
// continue;
|
||||
|
||||
|
||||
@@ -86,11 +86,11 @@ bool DropTargetAction::Execute(Event event)
|
||||
if (bot->getClass() == CLASS_HUNTER) // Check for Hunter Class
|
||||
{
|
||||
Spell const* spell = bot->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL); // Get the current spell being cast by the bot
|
||||
if (spell && spell->m_spellInfo->Id == 75) //Check spell is not nullptr before accessing m_spellInfo
|
||||
if (spell && spell->m_spellInfo->Id == 75) //Check spell is not nullptr before accessing m_spellInfo
|
||||
{
|
||||
bot->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); // Interrupt Auto Shot
|
||||
}
|
||||
}
|
||||
}
|
||||
bot->AttackStop();
|
||||
|
||||
// if (Pet* pet = bot->GetPet())
|
||||
|
||||
@@ -16,7 +16,7 @@ bool ChooseTravelTargetAction::Execute(Event event)
|
||||
//Get the current travel target. This target is no longer active.
|
||||
TravelTarget* oldTarget = context->GetValue<TravelTarget*>("travel target")->Get();
|
||||
|
||||
//Select a new target to travel to.
|
||||
//Select a new target to travel to.
|
||||
TravelTarget newTarget = TravelTarget(botAI);
|
||||
|
||||
if (!oldTarget) return false;
|
||||
@@ -146,7 +146,7 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
foundTarget = SetBossTarget(newTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Do quests (start, do, end) 95% chance
|
||||
if (!foundTarget && urand(1, 100) > 5)
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ void EquipAction::EquipItem(Item* item)
|
||||
WorldPackets::Item::AutoEquipItemSlot nicePacket(std::move(packet));
|
||||
nicePacket.Read();
|
||||
bot->GetSession()->HandleAutoEquipItemSlotOpcode(nicePacket);
|
||||
|
||||
|
||||
std::ostringstream out;
|
||||
out << "Equipping " << chat->FormatItem(itemProto) << " in ranged slot";
|
||||
botAI->TellMaster(out);
|
||||
@@ -123,7 +123,7 @@ void EquipAction::EquipItem(Item* item)
|
||||
bool isWeapon = (itemProto->Class == ITEM_CLASS_WEAPON);
|
||||
bool canTitanGrip = bot->CanTitanGrip();
|
||||
bool canDualWield = bot->CanDualWield();
|
||||
|
||||
|
||||
bool isTwoHander = (invType == INVTYPE_2HWEAPON);
|
||||
bool isValidTGWeapon = false;
|
||||
if (canTitanGrip && isTwoHander)
|
||||
@@ -208,24 +208,24 @@ void EquipAction::EquipItem(Item* item)
|
||||
nicePacket.Read();
|
||||
bot->GetSession()->HandleAutoEquipItemSlotOpcode(nicePacket);
|
||||
}
|
||||
|
||||
|
||||
// Try moving old main hand weapon to offhand if beneficial
|
||||
if (mainHandItem && mainHandCanGoOff && (!offHandItem || mainHandScore > offHandScore))
|
||||
{
|
||||
const ItemTemplate* oldMHProto = mainHandItem->GetTemplate();
|
||||
|
||||
|
||||
WorldPacket offhandPacket(CMSG_AUTOEQUIP_ITEM_SLOT, 2);
|
||||
ObjectGuid oldMHGuid = mainHandItem->GetGUID();
|
||||
offhandPacket << oldMHGuid << uint8(EQUIPMENT_SLOT_OFFHAND);
|
||||
WorldPackets::Item::AutoEquipItemSlot nicePacket(std::move(offhandPacket));
|
||||
nicePacket.Read();
|
||||
bot->GetSession()->HandleAutoEquipItemSlotOpcode(nicePacket);
|
||||
|
||||
|
||||
std::ostringstream moveMsg;
|
||||
moveMsg << "Main hand upgrade found. Moving " << chat->FormatItem(oldMHProto) << " to offhand";
|
||||
botAI->TellMaster(moveMsg);
|
||||
}
|
||||
|
||||
|
||||
std::ostringstream out;
|
||||
out << "Equipping " << chat->FormatItem(itemProto) << " in main hand";
|
||||
botAI->TellMaster(out);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "SpellMgr.h"
|
||||
#include "DBCStores.h"
|
||||
#include "AiObjectContext.h"
|
||||
#include "Log.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <sstream>
|
||||
@@ -154,6 +154,6 @@ bool EquipGlyphsAction::Execute(Event event)
|
||||
// Flag for custom glyphs
|
||||
botAI->GetAiObjectContext()->GetValue<bool>("custom_glyphs")->Set(true);
|
||||
LOG_INFO("playerbots", "Custom Glyph Flag set to ON");
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,13 +30,13 @@ bool FollowAction::Execute(Event event)
|
||||
WorldLocation loc = formation->GetLocation();
|
||||
if (Formation::IsNullLocation(loc) || loc.GetMapId() == -1)
|
||||
return false;
|
||||
|
||||
|
||||
MovementPriority priority = botAI->GetState() == BOT_STATE_COMBAT ? MovementPriority::MOVEMENT_COMBAT : MovementPriority::MOVEMENT_NORMAL;
|
||||
moved = MoveTo(loc.GetMapId(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), false, false, false,
|
||||
true, priority, true);
|
||||
}
|
||||
|
||||
// This section has been commented out because it was forcing the pet to
|
||||
// This section has been commented out because it was forcing the pet to
|
||||
// follow the bot on every "follow" action tick, overriding any attack or
|
||||
// stay commands that might have been issued by the player.
|
||||
// if (Pet* pet = bot->GetPet())
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
|
||||
* and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
|
||||
#include "GenericBuffUtils.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace ai::buff
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return castName;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
|
||||
* and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -243,7 +243,7 @@ bool BuffOnPartyAction::Execute(Event event)
|
||||
return botAI->CastSpell(castName, GetTarget());
|
||||
}
|
||||
// End greater buff fix
|
||||
|
||||
|
||||
CastShootAction::CastShootAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "shoot")
|
||||
{
|
||||
if (Item* const pItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
|
||||
@@ -322,14 +322,14 @@ bool CastVehicleSpellAction::Execute(Event event)
|
||||
bool UseTrinketAction::Execute(Event event)
|
||||
{
|
||||
Item* trinket1 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1);
|
||||
|
||||
|
||||
if (trinket1 && UseTrinket(trinket1))
|
||||
return true;
|
||||
|
||||
Item* trinket2 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET2);
|
||||
if (trinket2 && UseTrinket(trinket2))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ bool UseTrinketAction::UseTrinket(Item* item)
|
||||
|
||||
if (!spellInfo || !spellInfo->IsPositive())
|
||||
return false;
|
||||
|
||||
|
||||
bool applyAura = false;
|
||||
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
|
||||
{
|
||||
@@ -369,12 +369,12 @@ bool UseTrinketAction::UseTrinket(Item* item)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!applyAura)
|
||||
return false;
|
||||
|
||||
|
||||
uint32 spellProcFlag = spellInfo->ProcFlags;
|
||||
|
||||
|
||||
// Handle items with procflag "if you kill a target that grants honor or experience"
|
||||
// Bots will "learn" the trinket proc, so CanCastSpell() will be true
|
||||
// e.g. on Item https://www.wowhead.com/wotlk/item=44074/oracle-talisman-of-ablution leading to
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
NextAction** getPrerequisites() override;
|
||||
std::string const getSpell() { return spell; }
|
||||
|
||||
|
||||
protected:
|
||||
std::string spell;
|
||||
float range;
|
||||
|
||||
@@ -209,7 +209,7 @@ bool GuildManageNearbyAction::Execute(Event event)
|
||||
if (botAi->GetGuilderType() == GuilderType::SOLO && !botAi->HasRealPlayerMaster()) //Do not invite solo players.
|
||||
continue;
|
||||
|
||||
if (botAi->HasActivePlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(player)) //Do not invite alts of active players.
|
||||
if (botAi->HasActivePlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(player)) //Do not invite alts of active players.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ bool PartyCommandAction::Execute(Event event)
|
||||
Player* master = GetMaster();
|
||||
if (master && member == master->GetName())
|
||||
return Leave(bot);
|
||||
|
||||
|
||||
botAI->Reset();
|
||||
|
||||
return false;
|
||||
@@ -64,7 +64,7 @@ bool UninviteAction::Execute(Event event)
|
||||
if (bot->GetGUID() == guid)
|
||||
return Leave(bot);
|
||||
}
|
||||
|
||||
|
||||
botAI->Reset();
|
||||
|
||||
return false;
|
||||
@@ -162,7 +162,7 @@ bool LeaveFarAwayAction::isUseful()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
botAI->Reset();
|
||||
|
||||
return false;
|
||||
|
||||
@@ -151,7 +151,7 @@ bool LfgJoinAction::JoinLFG()
|
||||
|
||||
// Set RbotAId Browser comment
|
||||
std::string const _gs = std::to_string(botAI->GetEquipGearScore(bot/*, false, false*/));
|
||||
|
||||
|
||||
// JoinLfg is not threadsafe, so make packet and queue into session
|
||||
// sLFGMgr->JoinLfg(bot, roleMask, list, _gs);
|
||||
|
||||
@@ -180,7 +180,7 @@ bool LfgRoleCheckAction::Execute(Event event)
|
||||
// if (currentRoles == newRoles)
|
||||
// return false;
|
||||
|
||||
|
||||
|
||||
WorldPacket* packet = new WorldPacket(CMSG_LFG_SET_ROLES);
|
||||
*packet << (uint8)newRoles;
|
||||
bot->GetSession()->QueuePacket(packet);
|
||||
@@ -317,7 +317,7 @@ bool LfgJoinAction::isUseful()
|
||||
|
||||
if (bot->GetLevel() < 15)
|
||||
return false;
|
||||
|
||||
|
||||
// don't use if active player master
|
||||
if (GET_PLAYERBOT_AI(bot)->IsRealPlayer())
|
||||
return false;
|
||||
|
||||
@@ -139,17 +139,17 @@ std::vector<std::pair<uint32, std::string>> ListSpellsAction::GetSpellList(std::
|
||||
{
|
||||
if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->Active)
|
||||
continue;
|
||||
|
||||
|
||||
if (!(itr->second->specMask & bot->GetActiveSpecMask()))
|
||||
continue;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
|
||||
if (spellInfo->IsPassive())
|
||||
continue;
|
||||
|
||||
|
||||
SkillLineAbilityEntry const* skillLine = skillSpells[itr->first];
|
||||
if (skill != SKILL_NONE && (!skillLine || skillLine->SkillLine != skill))
|
||||
continue;
|
||||
@@ -273,7 +273,7 @@ std::vector<std::pair<uint32, std::string>> ListSpellsAction::GetSpellList(std::
|
||||
|
||||
if (out.str().empty())
|
||||
continue;
|
||||
|
||||
|
||||
if (itr->first == 0)
|
||||
{
|
||||
LOG_ERROR("playerbots", "?! {}", itr->first);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "BroadcastHelper.h"
|
||||
|
||||
bool LootAction::Execute(Event /*event*/)
|
||||
{
|
||||
{
|
||||
if (!AI_VALUE(bool, "has available loot"))
|
||||
return false;
|
||||
|
||||
@@ -156,7 +156,7 @@ bool OpenLootAction::DoLoot(LootObject& lootObject)
|
||||
uint32 spellId = GetOpeningSpell(lootObject);
|
||||
if (!spellId)
|
||||
return false;
|
||||
|
||||
|
||||
return botAI->CastSpell(spellId, bot);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ bool LootRollAction::Execute(Event event)
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
|
||||
std::string itemUsageParam;
|
||||
if (randomProperty != 0) {
|
||||
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||
@@ -47,7 +47,7 @@ bool LootRollAction::Execute(Event event)
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
}
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
|
||||
|
||||
// Armor Tokens are classed as MISC JUNK (Class 15, Subclass 0), luckily no other items I found have class bits and epic quality.
|
||||
if (proto->Class == ITEM_CLASS_MISC && proto->SubClass == ITEM_SUBCLASS_JUNK && proto->Quality == ITEM_QUALITY_EPIC)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ bool LootRollAction::Execute(Event event)
|
||||
{
|
||||
vote = PASS;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
vote = GREED;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ bool RollUniqueCheck(ItemTemplate const* proto, Player* bot)
|
||||
bool RollAction::Execute(Event event)
|
||||
{
|
||||
std::string link = event.getParam();
|
||||
|
||||
|
||||
if (link.empty())
|
||||
{
|
||||
bot->DoRandomRoll(0,100);
|
||||
@@ -245,7 +245,7 @@ bool RollAction::Execute(Event event)
|
||||
}
|
||||
std::string itemUsageParam;
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
|
||||
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
switch (proto->Class)
|
||||
{
|
||||
|
||||
@@ -1040,7 +1040,7 @@ void MovementAction::UpdateMovementState()
|
||||
|
||||
// Save current state for the next check
|
||||
wasMovementRestricted = isCurrentlyRestricted;
|
||||
|
||||
|
||||
// Temporary speed increase in group
|
||||
// if (botAI->HasRealPlayerMaster()) {
|
||||
// bot->SetSpeedRate(MOVE_RUN, 1.1f);
|
||||
@@ -2412,7 +2412,7 @@ bool TankFaceAction::Execute(Event event)
|
||||
|
||||
if (!AI_VALUE2(bool, "has aggro", "current target"))
|
||||
return false;
|
||||
|
||||
|
||||
float averageAngle = AverageGroupAngle(target, true);
|
||||
|
||||
if (averageAngle == 0.0f)
|
||||
@@ -2435,7 +2435,7 @@ bool TankFaceAction::Execute(Event event)
|
||||
std::vector<Position> availablePos;
|
||||
float x, y, z;
|
||||
target->GetNearPoint(bot, x, y, z, 0.0f, dist, goodAngle1);
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
x, y, z))
|
||||
{
|
||||
/// @todo: movement control now is a mess, prepare to rewrite
|
||||
@@ -2448,7 +2448,7 @@ bool TankFaceAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
target->GetNearPoint(bot, x, y, z, 0.0f, dist, goodAngle2);
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
x, y, z))
|
||||
{
|
||||
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
|
||||
@@ -2500,7 +2500,7 @@ bool RearFlankAction::Execute(Event event)
|
||||
{
|
||||
destination = &rightFlank;
|
||||
}
|
||||
|
||||
|
||||
return MoveTo(bot->GetMapId(), destination->GetPositionX(), destination->GetPositionY(), destination->GetPositionZ(),
|
||||
false, false, false, true, MovementPriority::MOVEMENT_COMBAT);
|
||||
}
|
||||
@@ -2666,7 +2666,7 @@ bool SetBehindTargetAction::Execute(Event event)
|
||||
std::vector<Position> availablePos;
|
||||
float x, y, z;
|
||||
target->GetNearPoint(bot, x, y, z, 0.0f, dist, goodAngle1);
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
x, y, z))
|
||||
{
|
||||
/// @todo: movement control now is a mess, prepare to rewrite
|
||||
@@ -2679,7 +2679,7 @@ bool SetBehindTargetAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
target->GetNearPoint(bot, x, y, z, 0.0f, dist, goodAngle2);
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
x, y, z))
|
||||
{
|
||||
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
|
||||
|
||||
@@ -186,7 +186,7 @@ void OutfitAction::Update(std::string const name)
|
||||
{
|
||||
ListItemsVisitor visitor;
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_EQUIP);
|
||||
|
||||
|
||||
ItemIds items;
|
||||
for (std::map<uint32, uint32>::iterator i = visitor.items.begin(); i != visitor.items.end(); ++i)
|
||||
items.insert(i->first);
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
private:
|
||||
bool warningEnabled = true;
|
||||
std::string defaultCmd;
|
||||
std::string defaultCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -113,7 +113,7 @@ bool QueryQuestAction::Execute(Event event)
|
||||
void QueryQuestAction::TellObjectives(uint32 questId)
|
||||
{
|
||||
Quest const* questTemplate = sObjectMgr->GetQuestTemplate(questId);
|
||||
|
||||
|
||||
// Checks if the questTemplate is valid
|
||||
if (!questTemplate)
|
||||
{
|
||||
|
||||
@@ -278,7 +278,7 @@ bool QuestUpdateCompleteAction::Execute(Event event)
|
||||
{
|
||||
// std::map<std::string, std::string> placeholders;
|
||||
// placeholders["%quest_link"] = format;
|
||||
|
||||
|
||||
// if (botAI->HasStrategy("debug quest", BotState::BOT_STATE_NON_COMBAT) || botAI->HasStrategy("debug rpg", BotState::BOT_STATE_COMBAT))
|
||||
// {
|
||||
// LOG_INFO("playerbots", "{} => Quest [ {} ] completed", bot->GetName(), qInfo->GetTitle());
|
||||
@@ -338,7 +338,7 @@ bool QuestUpdateAddKillAction::Execute(Event event)
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ bool QuestUpdateAddItemAction::Execute(Event event)
|
||||
|
||||
BroadcastHelper::BroadcastQuestUpdateAddItem(botAI, bot, pair.first, availableItemsCount, requiredItemsCount, itemPrototype);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ bool QuestItemPushResultAction::Execute(Event event)
|
||||
|
||||
if (guid != bot->GetGUID())
|
||||
return false;
|
||||
|
||||
|
||||
const ItemTemplate* proto = sObjectMgr->GetItemTemplate(itemEntry);
|
||||
if (!proto)
|
||||
return false;
|
||||
@@ -406,13 +406,13 @@ bool QuestItemPushResultAction::Execute(Event event)
|
||||
return false;
|
||||
|
||||
const QuestStatusData& q_status = bot->getQuestStatusMap().at(questId);
|
||||
|
||||
|
||||
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
|
||||
{
|
||||
uint32 itemId = quest->RequiredItemId[i];
|
||||
if (!itemId)
|
||||
continue;
|
||||
|
||||
|
||||
int32 previousCount = itemCount - count;
|
||||
if (itemId == itemEntry && previousCount < quest->RequiredItemCount[i])
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ bool ReleaseSpiritAction::Execute(Event event)
|
||||
{
|
||||
if (bot->IsAlive())
|
||||
{
|
||||
if (!bot->InBattleground())
|
||||
if (!bot->InBattleground())
|
||||
{
|
||||
botAI->TellMasterNoFacing("I am not dead, will wait here");
|
||||
// -follow in bg is overwriten each tick with +follow
|
||||
@@ -38,8 +38,8 @@ bool ReleaseSpiritAction::Execute(Event event)
|
||||
}
|
||||
|
||||
const WorldPacket& packet = event.getPacket();
|
||||
const std::string message = !packet.empty() && packet.GetOpcode() == CMSG_REPOP_REQUEST
|
||||
? "Releasing..."
|
||||
const std::string message = !packet.empty() && packet.GetOpcode() == CMSG_REPOP_REQUEST
|
||||
? "Releasing..."
|
||||
: "Meet me at the graveyard";
|
||||
botAI->TellMasterNoFacing(message);
|
||||
|
||||
@@ -89,7 +89,7 @@ bool AutoReleaseSpiritAction::Execute(Event event)
|
||||
bot->GetSession()->HandleRepopRequestOpcode(packet);
|
||||
|
||||
LogRelease("releases spirit", true);
|
||||
|
||||
|
||||
if (bot->InBattleground())
|
||||
{
|
||||
return HandleBattlegroundSpiritHealer();
|
||||
@@ -117,8 +117,8 @@ bool AutoReleaseSpiritAction::HandleBattlegroundSpiritHealer()
|
||||
{
|
||||
constexpr uint32_t RESURRECT_DELAY = 15;
|
||||
const time_t now = time(nullptr);
|
||||
|
||||
if ((now - m_bgGossipTime < RESURRECT_DELAY) &&
|
||||
|
||||
if ((now - m_bgGossipTime < RESURRECT_DELAY) &&
|
||||
bot->HasAura(SPELL_WAITING_FOR_RESURRECT))
|
||||
{
|
||||
return false;
|
||||
@@ -174,9 +174,9 @@ bool AutoReleaseSpiritAction::ShouldAutoRelease() const
|
||||
if (!botAI->HasActivePlayerMaster())
|
||||
return true;
|
||||
|
||||
if (botAI->HasActivePlayerMaster() &&
|
||||
if (botAI->HasActivePlayerMaster() &&
|
||||
groupMaster->GetMapId() == bot->GetMapId() &&
|
||||
bot->GetMap() &&
|
||||
bot->GetMap() &&
|
||||
(bot->GetMap()->IsRaid() || bot->GetMap()->IsDungeon()))
|
||||
{
|
||||
return false;
|
||||
@@ -218,7 +218,7 @@ bool AutoReleaseSpiritAction::ShouldDelayBattlegroundRelease() const
|
||||
bool RepopAction::Execute(Event event)
|
||||
{
|
||||
const GraveyardStruct* graveyard = GetGrave(
|
||||
AI_VALUE(uint32, "death count") > 10 ||
|
||||
AI_VALUE(uint32, "death count") > 10 ||
|
||||
CalculateDeadTime() > 30 * MINUTE
|
||||
);
|
||||
|
||||
@@ -238,7 +238,7 @@ int64 RepopAction::CalculateDeadTime() const
|
||||
{
|
||||
if (Corpse* corpse = bot->GetCorpse())
|
||||
return time(nullptr) - corpse->GetGhostTime();
|
||||
|
||||
|
||||
return bot->isDead() ? 0 : 60 * MINUTE;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ protected:
|
||||
void toxicLinks();
|
||||
void somethingToxic();
|
||||
void thunderfury();
|
||||
|
||||
|
||||
std::vector<uint32> GetIncompletedQuests();
|
||||
|
||||
private:
|
||||
|
||||
@@ -102,7 +102,7 @@ void TalkToQuestGiverAction::RewardNoItem(Quest const* quest, Object* questGiver
|
||||
{
|
||||
std::map<std::string, std::string> args;
|
||||
args["%quest"] = chat->FormatQuest(quest);
|
||||
|
||||
|
||||
if (bot->CanRewardQuest(quest, false))
|
||||
{
|
||||
out << BOT_TEXT2("quest_status_completed", args);
|
||||
|
||||
@@ -13,13 +13,13 @@ bool TeleportAction::Execute(Event event)
|
||||
{
|
||||
/*
|
||||
// List of allowed portal entries (you can populate this dynamically)
|
||||
std::vector<uint32> allowedPortals = {
|
||||
187055, 195142, 195141, 201797, 202079, 194481, 195682, 191164, 176498, 182351,
|
||||
178404, 176497, 181146, 184605, 176499, 195140, 193948, 193427, 193052, 193206,
|
||||
192786, 184594, 183384, 182352, 184604, 189994, 193053, 193207, 193956, 195139,
|
||||
176296, 194011, 194012, 189993, 176500, 176501, 193955, 193425, 193772, 193604,
|
||||
191006, 191007, 191008, 191009, 191013, 191014, 191010, 190960, 191011, 191012,
|
||||
183317, 183321, 183322, 187056, 183323, 183324, 183325, 183326, 183327, 190203,
|
||||
std::vector<uint32> allowedPortals = {
|
||||
187055, 195142, 195141, 201797, 202079, 194481, 195682, 191164, 176498, 182351,
|
||||
178404, 176497, 181146, 184605, 176499, 195140, 193948, 193427, 193052, 193206,
|
||||
192786, 184594, 183384, 182352, 184604, 189994, 193053, 193207, 193956, 195139,
|
||||
176296, 194011, 194012, 189993, 176500, 176501, 193955, 193425, 193772, 193604,
|
||||
191006, 191007, 191008, 191009, 191013, 191014, 191010, 190960, 191011, 191012,
|
||||
183317, 183321, 183322, 187056, 183323, 183324, 183325, 183326, 183327, 190203,
|
||||
190204, 190205, 190206, 193908, 181575, 181576, 181577, 181578, 202277, 202278
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ bool TeleportAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// If no portal was found, fallback to spellcaster-type game objects
|
||||
GuidVector gos = *context->GetValue<GuidVector>("nearest game objects");
|
||||
for (ObjectGuid const guid : gos)
|
||||
@@ -91,7 +91,7 @@ bool TeleportAction::Execute(Event event)
|
||||
spell->cast(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// If no game objects were found, try using the last area trigger
|
||||
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
||||
if (movement.lastAreaTrigger)
|
||||
|
||||
@@ -24,7 +24,7 @@ bool TradeStatusAction::Execute(Event event)
|
||||
return false;
|
||||
|
||||
PlayerbotAI* traderBotAI = GET_PLAYERBOT_AI(trader);
|
||||
|
||||
|
||||
// Allow the master and group members to trade
|
||||
if (trader != master && !traderBotAI && (!bot->GetGroup() || !bot->GetGroup()->IsMember(trader->GetGUID())))
|
||||
{
|
||||
@@ -181,7 +181,7 @@ bool TradeStatusAction::CheckTrade()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isGettingItem)
|
||||
{
|
||||
if (bot->GetGroup() && bot->GetGroup()->IsMember(bot->GetTrader()->GetGUID()) &&
|
||||
|
||||
@@ -66,7 +66,7 @@ bool UnlockTradedItemAction::CanUnlockItem(Item* item)
|
||||
else
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Lockpicking skill too low (" << botSkill << "/" << requiredSkill << ") to unlock: "
|
||||
out << "Lockpicking skill too low (" << botSkill << "/" << requiredSkill << ") to unlock: "
|
||||
<< item->GetTemplate()->Name1;
|
||||
botAI->TellMaster(out.str());
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ bool SummonAction::Teleport(Player* summoner, Player* player)
|
||||
// Player* master = GetMaster();
|
||||
if (!summoner)
|
||||
return false;
|
||||
|
||||
|
||||
if (player->GetVehicle())
|
||||
{
|
||||
botAI->TellError("You cannot summon me while I'm on a vehicle");
|
||||
|
||||
@@ -23,7 +23,7 @@ bool EnterVehicleAction::Execute(Event event)
|
||||
// do not switch vehicles yet
|
||||
if (bot->GetVehicle())
|
||||
return false;
|
||||
|
||||
|
||||
Player* master = botAI->GetMaster();
|
||||
// Triggered by a chat command
|
||||
if (event.getOwner() && master && master->GetTarget())
|
||||
@@ -45,7 +45,7 @@ bool EnterVehicleAction::Execute(Event event)
|
||||
Unit* vehicleBase = botAI->GetUnit(*i);
|
||||
if (!vehicleBase)
|
||||
continue;
|
||||
|
||||
|
||||
if (vehicleBase->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
creators["quest update complete"] = &WorldPacketActionContext::quest_update_complete;
|
||||
creators["turn in query quest"] = &WorldPacketActionContext::turn_in_query_quest;
|
||||
creators["quest item push result"] = &WorldPacketActionContext::quest_item_push_result;
|
||||
|
||||
|
||||
creators["party command"] = &WorldPacketActionContext::party_command;
|
||||
creators["tell cast failed"] = &WorldPacketActionContext::tell_cast_failed;
|
||||
creators["accept duel"] = &WorldPacketActionContext::accept_duel;
|
||||
|
||||
@@ -43,7 +43,7 @@ bool XpGainAction::Execute(Event event)
|
||||
// randomBotXPRate is now implemented in OnPlayerGiveXP script
|
||||
// if (!sRandomPlayerbotMgr->IsRandomBot(bot) || sPlayerbotAIConfig->randomBotXPRate == 1)
|
||||
// return true;
|
||||
|
||||
|
||||
// Unit* victim = nullptr;
|
||||
// if (guid)
|
||||
// victim = botAI->GetUnit(guid);
|
||||
|
||||
Reference in New Issue
Block a user