mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-03-07 17:40:28 +00:00
Warnings PR 2 clean unused variables (#2107)
# Pull Request
Removed unused variables and fixed styling issues.
## How to Test the Changes
- Step-by-step instructions to test the change
- Any required setup (e.g. multiple players, bots, specific
configuration)
- Expected behavior and how to verify it
## Complexity & Impact
- Does this change add new decision branches?
- [x] No
- [] Yes (**explain below**)
- Does this change increase per-bot or per-tick processing?
- [x] No
- [ ] Yes (**describe and justify impact**)
- Could this logic scale poorly under load?
- [x] No
- [ ] Yes (**explain why**)
---
## Defaults & Configuration
- Does this change modify default bot behavior?
- [x] No
- [ ] Yes (**explain why**)
If this introduces more advanced or AI-heavy logic:
- [ ] Lightweight mode remains the default
- [ ] More complex behavior is optional and thereby configurable
---
## AI Assistance
- Was AI assistance (e.g. ChatGPT or similar tools) used while working
on this change?
- [x] No
- [ ] Yes (**explain below**)
---
## Final Checklist
- [x] Stability is not compromised
- [x] Performance impact is understood, tested, and acceptable
- [x] Added logic complexity is justified and explained
- [x] Documentation updated if needed
---
## Notes for Reviewers
This was filtered from the code provided by SmashingQuasar. Eliminated
variables were confirmed to be not used, but unclear at times if that is
due to mistakes in writing.
---------
Co-authored-by: bashermens <31279994+hermensbas@users.noreply.github.com>
This commit is contained in:
@@ -24,8 +24,6 @@ bool BGJoinAction::Execute(Event /*event*/)
|
||||
|
||||
BattlegroundQueueTypeId queueTypeId = (BattlegroundQueueTypeId)bgList[urand(0, bgList.size() - 1)];
|
||||
BattlegroundTypeId bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
||||
BattlegroundBracketId bracketId;
|
||||
bool isArena = false;
|
||||
bool isRated = false;
|
||||
|
||||
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
|
||||
@@ -37,12 +35,8 @@ bool BGJoinAction::Execute(Event /*event*/)
|
||||
if (!pvpDiff)
|
||||
return false;
|
||||
|
||||
bracketId = pvpDiff->GetBracketId();
|
||||
|
||||
if (ArenaType type = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId)))
|
||||
{
|
||||
isArena = true;
|
||||
|
||||
std::vector<uint32>::iterator i = find(ratedList.begin(), ratedList.end(), queueTypeId);
|
||||
if (i != ratedList.end())
|
||||
isRated = true;
|
||||
@@ -408,8 +402,6 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
|
||||
bracketId = pvpDiff->GetBracketId();
|
||||
|
||||
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
|
||||
uint32 TeamSize = bg->GetMaxPlayersPerTeam();
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
|
||||
// check if already in queue
|
||||
@@ -486,8 +478,6 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
if (isArena)
|
||||
{
|
||||
isArena = true;
|
||||
BracketSize = type * 2;
|
||||
TeamSize = type;
|
||||
isRated = botAI->GetAiObjectContext()->GetValue<uint32>("arena type")->Get();
|
||||
|
||||
if (joinAsGroup)
|
||||
|
||||
@@ -2497,7 +2497,6 @@ bool BGTactics::selectObjective(bool reset)
|
||||
EYBotStrategy strategyHorde = static_cast<EYBotStrategy>(GetBotStrategyForTeam(bg, TEAM_HORDE));
|
||||
EYBotStrategy strategyAlliance = static_cast<EYBotStrategy>(GetBotStrategyForTeam(bg, TEAM_ALLIANCE));
|
||||
EYBotStrategy strategy = (team == TEAM_ALLIANCE) ? strategyAlliance : strategyHorde;
|
||||
EYBotStrategy enemyStrategy = (team == TEAM_ALLIANCE) ? strategyHorde : strategyAlliance;
|
||||
|
||||
auto IsOwned = [&](uint32 nodeId) -> bool
|
||||
{ return eyeOfTheStormBG->GetCapturePointInfo(nodeId)._ownerTeamId == team; };
|
||||
@@ -3231,7 +3230,6 @@ bool BGTactics::selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths)
|
||||
if (bgType == BATTLEGROUND_RB)
|
||||
bgType = bg->GetBgTypeID(true);
|
||||
|
||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()["bg objective"];
|
||||
if (!pos.isSet())
|
||||
return false;
|
||||
|
||||
@@ -68,9 +68,7 @@ bool FollowChatShortcutAction::Execute(Event /*event*/)
|
||||
std::string const target = formation->GetTargetName();
|
||||
bool moved = false;
|
||||
if (!target.empty())
|
||||
{
|
||||
moved = Follow(AI_VALUE(Unit*, target));
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldLocation loc = formation->GetLocation();
|
||||
@@ -83,9 +81,7 @@ bool FollowChatShortcutAction::Execute(Event /*event*/)
|
||||
}
|
||||
|
||||
if (Pet* pet = bot->GetPet())
|
||||
{
|
||||
botAI->PetFollow();
|
||||
}
|
||||
|
||||
if (moved)
|
||||
{
|
||||
|
||||
@@ -112,7 +112,6 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP)
|
||||
|
||||
bool ChooseRpgTargetAction::Execute(Event /*event*/)
|
||||
{
|
||||
//TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
||||
Player* master = botAI->GetMaster();
|
||||
GuidPosition masterRpgTarget;
|
||||
if (master && master != bot && GET_PLAYERBOT_AI(master) && master->GetMapId() == bot->GetMapId() && !master->IsBeingTeleported())
|
||||
@@ -124,7 +123,6 @@ bool ChooseRpgTargetAction::Execute(Event /*event*/)
|
||||
master = nullptr;
|
||||
|
||||
std::unordered_map<ObjectGuid, uint32> targets;
|
||||
// uint32 num = 0; //not used, line marked for removal.
|
||||
GuidVector possibleTargets = AI_VALUE(GuidVector, "possible rpg targets");
|
||||
GuidVector possibleObjects = AI_VALUE(GuidVector, "nearest game objects no los");
|
||||
GuidVector possiblePlayers = AI_VALUE(GuidVector, "nearest friendly players");
|
||||
|
||||
@@ -232,15 +232,6 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
||||
QuestTravelDestination* QuestDestination = (QuestTravelDestination*)destination;
|
||||
Quest const* quest = QuestDestination->GetQuestTemplate();
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
CreatureTemplate const* cInfo = nullptr;
|
||||
GameObjectTemplate const* gInfo = nullptr;
|
||||
|
||||
if (destination->getEntry() > 0)
|
||||
cInfo = sObjectMgr->GetCreatureTemplate(destination->getEntry());
|
||||
else
|
||||
gInfo = sObjectMgr->GetGameObjectTemplate(destination->getEntry() * -1);
|
||||
|
||||
std::string Sub;
|
||||
|
||||
if (newTarget->isGroupCopy())
|
||||
@@ -823,10 +814,6 @@ char* strstri(char const* haystack, char const* needle);
|
||||
|
||||
TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::string const name, bool zones, bool npcs, bool quests, bool mobs, bool bosses)
|
||||
{
|
||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||
|
||||
// AiObjectContext* context = botAI->GetAiObjectContext(); //not used, line marked for removal.
|
||||
|
||||
std::vector<TravelDestination*> dests;
|
||||
|
||||
//Quests
|
||||
|
||||
@@ -520,8 +520,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
bot->SummonCreature(effect, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -85,8 +85,8 @@ void EquipAction::EquipItem(Item* item)
|
||||
if (itemProto->Class == ITEM_CLASS_CONTAINER)
|
||||
{
|
||||
// Attempt to equip as a bag
|
||||
Bag* pBag = reinterpret_cast<Bag*>(item);
|
||||
uint8 newBagSlot = GetSmallestBagSlot();
|
||||
|
||||
if (newBagSlot > 0)
|
||||
{
|
||||
uint16 src = ((bagIndex << 8) | slot);
|
||||
|
||||
@@ -292,7 +292,6 @@ bool MoveNearWaterAction::isPossible()
|
||||
// Water spot is out of range, lets look for a spot to move to for the fishing hole.
|
||||
if (distance > MAX_DISTANCE_TO_WATER || distance < MIN_DISTANCE_TO_WATER)
|
||||
{
|
||||
float angle = bot->GetAngle(fishingHole.GetPositionX(), fishingHole.GetPositionY());
|
||||
WorldPosition landSpot = FindLandRadialFromPosition(botAI, fishingHole, MIN_DISTANCE_TO_WATER, MAX_DISTANCE_TO_WATER, SEARCH_INCREMENT, fishingSearchWindow, 32);
|
||||
if (landSpot.IsValid())
|
||||
{
|
||||
@@ -323,7 +322,6 @@ bool MoveNearWaterAction::isPossible()
|
||||
if (!water.IsValid())
|
||||
return false;
|
||||
|
||||
bool hasLOS = bot->IsWithinLOS(water.GetPositionX(), water.GetPositionY(), water.GetPositionZ());
|
||||
float angle = bot->GetAngle(water.GetPositionX(), water.GetPositionY());
|
||||
WorldPosition landSpot =
|
||||
FindLandFromPosition(botAI, 0.0f, MAX_DISTANCE_TO_WATER, 1.0f, angle, water, fishingSearchWindow, false);
|
||||
|
||||
@@ -28,7 +28,6 @@ bool GiveItemAction::Execute(Event /*event*/)
|
||||
if (receiverAi->GetAiObjectContext()->GetValue<uint32>("item count", item)->Get())
|
||||
return true;
|
||||
|
||||
bool moved = false;
|
||||
std::vector<Item*> items = InventoryAction::parseItems(item, ITERATE_ITEMS_IN_BAGS);
|
||||
for (Item* item : items)
|
||||
{
|
||||
@@ -42,7 +41,6 @@ bool GiveItemAction::Execute(Event /*event*/)
|
||||
bot->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true);
|
||||
item->SetOwnerGUID(target->GetGUID());
|
||||
receiver->MoveItemToInventory(dest, item, true);
|
||||
moved = true;
|
||||
|
||||
std::ostringstream out;
|
||||
out << "Got " << chat->FormatItem(item->GetTemplate(), item->GetCount()) << " from " << bot->GetName();
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
bool BuyPetitionAction::Execute(Event /*event*/)
|
||||
{
|
||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
||||
bool vendored = false, result = false;
|
||||
for (GuidVector::iterator i = vendors.begin(); i != vendors.end(); ++i)
|
||||
{
|
||||
ObjectGuid vendorguid = *i;
|
||||
@@ -97,7 +96,6 @@ bool BuyPetitionAction::canBuyPetition(Player* bot)
|
||||
|
||||
bool PetitionOfferAction::Execute(Event event)
|
||||
{
|
||||
uint32 petitionEntry = 5863; // GUILD_CHARTER
|
||||
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
|
||||
|
||||
if (petitions.empty())
|
||||
@@ -212,7 +210,6 @@ bool PetitionOfferNearbyAction::isUseful()
|
||||
bool PetitionTurnInAction::Execute(Event /*event*/)
|
||||
{
|
||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
||||
bool vendored = false, result = false;
|
||||
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
|
||||
|
||||
if (petitions.empty())
|
||||
|
||||
@@ -167,8 +167,6 @@ std::vector<Player*> InviteGuildToGroupAction::getGuildMembers()
|
||||
|
||||
bool InviteGuildToGroupAction::Execute(Event /*event*/)
|
||||
{
|
||||
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
|
||||
|
||||
for (auto& member : getGuildMembers())
|
||||
{
|
||||
Player* player = member;
|
||||
|
||||
@@ -27,7 +27,6 @@ bool LootRollAction::Execute(Event /*event*/)
|
||||
continue;
|
||||
}
|
||||
ObjectGuid guid = roll->itemGUID;
|
||||
uint32 slot = roll->itemSlot;
|
||||
uint32 itemId = roll->itemid;
|
||||
int32 randomProperty = 0;
|
||||
if (roll->itemRandomPropId)
|
||||
@@ -184,7 +183,6 @@ bool MasterLootRollAction::Execute(Event event)
|
||||
if (!group)
|
||||
return false;
|
||||
|
||||
RollVote vote = CalculateRollVote(proto);
|
||||
group->CountRollVote(bot->GetGUID(), creatureGuid, CalculateRollVote(proto));
|
||||
|
||||
return true;
|
||||
|
||||
@@ -16,7 +16,6 @@ bool LootStrategyAction::Execute(Event event)
|
||||
{
|
||||
std::string const strategy = event.getParam();
|
||||
|
||||
LootObjectStack* lootItems = AI_VALUE(LootObjectStack*, "available loot");
|
||||
std::set<uint32>& alwaysLootItems = AI_VALUE(std::set<uint32>&, "always loot list");
|
||||
Value<LootStrategy*>* lootStrategy = context->GetValue<LootStrategy*>("loot strategy");
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
private:
|
||||
bool CheckBagSpace(Player* bot)
|
||||
{
|
||||
uint32 totalused = 0, total = 16;
|
||||
uint32 totalused = 0;
|
||||
for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++)
|
||||
if (bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
++totalused;
|
||||
|
||||
@@ -93,9 +93,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior
|
||||
|
||||
distance += target->GetCombatReach();
|
||||
|
||||
float x = target->GetPositionX();
|
||||
float y = target->GetPositionY();
|
||||
float z = target->GetPositionZ();
|
||||
float followAngle = GetFollowAngle();
|
||||
|
||||
for (float angle = followAngle; angle <= followAngle + static_cast<float>(2 * M_PI);
|
||||
@@ -113,7 +110,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior
|
||||
return true;
|
||||
}
|
||||
|
||||
// botAI->TellError("All paths not in LOS");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -122,9 +118,6 @@ bool MovementAction::MoveToLOS(WorldObject* target, bool ranged)
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
// std::ostringstream out; out << "Moving to LOS!";
|
||||
// bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
|
||||
float x = target->GetPositionX();
|
||||
float y = target->GetPositionY();
|
||||
float z = target->GetPositionZ();
|
||||
@@ -257,7 +250,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// bot->CastStop();
|
||||
// botAI->InterruptSpell();
|
||||
// }
|
||||
G3D::Vector3 endP = path.back();
|
||||
DoMovePoint(bot, x, y, z, generatePath, backwards);
|
||||
float delay = 1000.0f * MoveDelay(distance, backwards);
|
||||
if (lessDelay)
|
||||
@@ -772,8 +764,6 @@ bool MovementAction::MoveTo(WorldObject* target, float distance, MovementPriorit
|
||||
float by = bot->GetPositionY();
|
||||
float bz = bot->GetPositionZ();
|
||||
|
||||
float tx = target->GetPositionX();
|
||||
float ty = target->GetPositionY();
|
||||
float tz = target->GetPositionZ();
|
||||
|
||||
float distanceToTarget = bot->GetDistance(target);
|
||||
@@ -805,10 +795,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
||||
if (!IsMovingAllowed(target))
|
||||
return false;
|
||||
|
||||
float bx = bot->GetPositionX();
|
||||
float by = bot->GetPositionY();
|
||||
float bz = bot->GetPositionZ();
|
||||
|
||||
float tx = target->GetPositionX();
|
||||
float ty = target->GetPositionY();
|
||||
float tz = target->GetPositionZ();
|
||||
@@ -1413,7 +1399,6 @@ bool MovementAction::Flee(Unit* target)
|
||||
if (botAI->IsTank(player))
|
||||
{
|
||||
float distanceToTank = ServerFacade::instance().GetDistance2d(bot, player);
|
||||
float distanceToTarget = ServerFacade::instance().GetDistance2d(bot, target);
|
||||
if (distanceToTank < fleeDistance)
|
||||
{
|
||||
fleeTarget = player;
|
||||
@@ -1434,8 +1419,6 @@ bool MovementAction::Flee(Unit* target)
|
||||
else // bot is not targeted, try to flee dps/healers
|
||||
{
|
||||
bool isHealer = botAI->IsHeal(bot);
|
||||
bool isDps = !isHealer && !botAI->IsTank(bot);
|
||||
bool isTank = botAI->IsTank(bot);
|
||||
bool needHealer = !isHealer && AI_VALUE2(uint8, "health", "self target") < 50;
|
||||
bool isRanged = botAI->IsRanged(bot);
|
||||
|
||||
@@ -2771,9 +2754,7 @@ bool MoveRandomAction::Execute(Event /*event*/)
|
||||
float angle = (float)rand_norm() * static_cast<float>(M_PI);
|
||||
x += urand(0, distance) * cos(angle);
|
||||
y += urand(0, distance) * sin(angle);
|
||||
float ox = x;
|
||||
float oy = y;
|
||||
float oz = z;
|
||||
|
||||
if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(),
|
||||
bot->GetPositionZ(), x, y, z))
|
||||
continue;
|
||||
@@ -2894,10 +2875,8 @@ bool MoveAwayFromCreatureAction::isPossible() { return bot->CanFreeMove(); }
|
||||
|
||||
bool MoveAwayFromPlayerWithDebuffAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* closestPlayer = nullptr;
|
||||
float minDistance = 0.0f;
|
||||
Group* const group = bot->GetGroup();
|
||||
|
||||
Group* group = bot->GetGroup();
|
||||
if (!group)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -332,7 +332,6 @@ public:
|
||||
private:
|
||||
uint32 spellId;
|
||||
float range;
|
||||
bool alive;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,6 @@ public:
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool warningEnabled = true;
|
||||
std::string defaultCmd;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ void QueryQuestAction::TellObjective(std::string const name, uint32 available, u
|
||||
|
||||
bool QueryQuestAction::Execute(Event event)
|
||||
{
|
||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
||||
Player* bot = botAI->GetBot();
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition* ptr_botpos = &botPos;
|
||||
|
||||
@@ -352,7 +352,6 @@ bool QuestUpdateAddItemAction::Execute(Event event)
|
||||
uint32 itemId, count;
|
||||
p >> itemId >> count;
|
||||
|
||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
||||
auto const* itemPrototype = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (itemPrototype)
|
||||
{
|
||||
@@ -407,8 +406,6 @@ bool QuestItemPushResultAction::Execute(Event event)
|
||||
if (!quest)
|
||||
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];
|
||||
@@ -448,8 +445,6 @@ bool QuestUpdateFailedTimerAction::Execute(Event event)
|
||||
uint32 questId;
|
||||
p >> questId;
|
||||
|
||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
||||
|
||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
|
||||
|
||||
if (qInfo)
|
||||
|
||||
@@ -28,7 +28,7 @@ bool RememberTaxiAction::Execute(Event event)
|
||||
case CMSG_ACTIVATETAXIEXPRESS:
|
||||
{
|
||||
ObjectGuid guid;
|
||||
uint32 node_count, totalcost;
|
||||
uint32 node_count;
|
||||
p >> guid >> node_count;
|
||||
|
||||
LastMovement& movement = context->GetValue<LastMovement&>("last taxi")->Get();
|
||||
|
||||
@@ -156,7 +156,6 @@ bool SayAction::isUseful()
|
||||
|
||||
void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint32& guid2, std::string& msg, std::string& chanName, std::string& name)
|
||||
{
|
||||
ChatReplyType replyType = REPLY_NOT_UNDERSTAND; // default not understand
|
||||
std::string respondsText = "";
|
||||
|
||||
// if we're just commanding bots around, don't respond...
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
|
||||
bool SecurityCheckAction::isUseful()
|
||||
{
|
||||
return sRandomPlayerbotMgr.IsRandomBot(bot) && botAI->GetMaster() &&
|
||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER && !GET_PLAYERBOT_AI(botAI->GetMaster());
|
||||
return RandomPlayerbotMgr::instance().IsRandomBot(bot)
|
||||
&& botAI->GetMaster()
|
||||
&& botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER
|
||||
&& !GET_PLAYERBOT_AI(botAI->GetMaster());
|
||||
}
|
||||
|
||||
bool SecurityCheckAction::Execute(Event /*event*/)
|
||||
|
||||
@@ -66,7 +66,8 @@ bool SetCraftAction::Execute(Event event)
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
if (SkillLineAbilityEntry const* skillLine = skillSpells[spellId])
|
||||
SkillLineAbilityEntry const* skillLine = skillSpells[spellId];
|
||||
if (skillLine != nullptr)
|
||||
{
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
|
||||
@@ -26,20 +26,10 @@ bool SetHomeAction::Execute(Event /*event*/)
|
||||
if (Unit* unit = botAI->GetUnit(selection))
|
||||
if (unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
|
||||
{
|
||||
if (isRpgAction)
|
||||
{
|
||||
Creature* creature = botAI->GetCreature(selection);
|
||||
bot->GetSession()->SendBindPoint(creature);
|
||||
botAI->TellMaster("This inn is my new home");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Creature* creature = botAI->GetCreature(selection);
|
||||
bot->GetSession()->SendBindPoint(creature);
|
||||
botAI->TellMaster("This inn is my new home");
|
||||
return true;
|
||||
}
|
||||
Creature* creature = botAI->GetCreature(selection);
|
||||
bot->GetSession()->SendBindPoint(creature);
|
||||
botAI->TellMaster("This inn is my new home");
|
||||
return true;
|
||||
}
|
||||
|
||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
||||
|
||||
@@ -40,9 +40,8 @@ bool ShareQuestAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutoShareQuestAction::Execute(Event event)
|
||||
bool AutoShareQuestAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
||||
bool shared = false;
|
||||
|
||||
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||
|
||||
@@ -47,7 +47,6 @@ bool StayAction::isUseful()
|
||||
PositionInfo stayPosition = AI_VALUE(PositionMap&, "position")["stay"];
|
||||
if (stayPosition.isSet())
|
||||
{
|
||||
const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z);
|
||||
if (sPlayerbotAIConfig.followDistance)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ bool SuggestWhatToDoAction::Execute(Event /*event*/)
|
||||
fnct_ptr();
|
||||
|
||||
std::string const qualifier = "suggest what to do";
|
||||
time_t lastSaid = AI_VALUE2(time_t, "last said", qualifier);
|
||||
botAI->GetAiObjectContext()->GetValue<time_t>("last said", qualifier)->Set(time(nullptr) + urand(1, 60));
|
||||
|
||||
return true;
|
||||
@@ -221,7 +220,7 @@ void SuggestWhatToDoAction::thunderfury()
|
||||
class FindTradeItemsVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
FindTradeItemsVisitor(uint32 quality) : quality(quality), IterateItemsVisitor() {}
|
||||
FindTradeItemsVisitor(uint32 quality) : IterateItemsVisitor(), quality(quality) {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
|
||||
@@ -231,7 +231,6 @@ void TalkToQuestGiverAction::AskToSelectReward(Quest const* quest, std::ostrings
|
||||
for (uint8 i = 0; i < quest->GetRewChoiceItemsCount(); ++i)
|
||||
{
|
||||
ItemTemplate const* item = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]);
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", quest->RewardChoiceItemId[i]);
|
||||
|
||||
if (!forEquip || BestRewards(quest).count(i) > 0)
|
||||
{
|
||||
@@ -248,7 +247,6 @@ bool TurnInQueryQuestAction::Execute(Event event)
|
||||
WorldPacket pakcet = event.getPacket();
|
||||
ObjectGuid guid;
|
||||
uint32 questId;
|
||||
ObjectGuid unk1;
|
||||
pakcet >> guid >> questId;
|
||||
Object* object =
|
||||
ObjectAccessor::GetObjectByTypeMask(*bot, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
||||
|
||||
@@ -51,7 +51,6 @@ bool TameAction::Execute(Event event)
|
||||
{
|
||||
std::set<std::string> normalFamilies;
|
||||
std::set<std::string> exoticFamilies;
|
||||
Player* bot = botAI->GetBot();
|
||||
|
||||
// Loop over all creature templates and collect tameable families
|
||||
CreatureTemplateContainer const* creatures = sObjectMgr->GetCreatureTemplates();
|
||||
|
||||
@@ -95,7 +95,6 @@ bool TellAuraAction::Execute(Event /*event*/)
|
||||
std::string caster_name = caster ? caster->GetName() : "unknown";
|
||||
bool is_area = aura->IsArea();
|
||||
int32 duration = aura->GetDuration();
|
||||
const SpellInfo* spellInfo = aura->GetSpellInfo();
|
||||
int32 spellId = aura->GetSpellInfo()->Id;
|
||||
bool isPositive = aura->GetSpellInfo()->IsPositive();
|
||||
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG,
|
||||
|
||||
@@ -64,8 +64,6 @@ bool TradeStatusAction::Execute(Event event)
|
||||
uint32 discount = sRandomPlayerbotMgr.GetTradeDiscount(bot, trader);
|
||||
if (CheckTrade())
|
||||
{
|
||||
int32 botMoney = CalculateCost(bot, true);
|
||||
|
||||
std::map<uint32, uint32> givenItemIds, takenItemIds;
|
||||
for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot)
|
||||
{
|
||||
@@ -161,15 +159,11 @@ bool TradeStatusAction::CheckTrade()
|
||||
|
||||
if (!botAI->HasActivePlayerMaster() && GET_PLAYERBOT_AI(bot->GetTrader()))
|
||||
{
|
||||
bool isGivingItem = false;
|
||||
for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot)
|
||||
{
|
||||
Item* item = bot->GetTradeData()->GetItem((TradeSlots)slot);
|
||||
if (item)
|
||||
{
|
||||
isGivingItem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool isGettingItem = false;
|
||||
for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot)
|
||||
|
||||
@@ -134,8 +134,6 @@ bool MoveFromDarkPortalAction::Execute(Event /*event*/)
|
||||
|
||||
if (bot->GetTeamId() == TEAM_ALLIANCE)
|
||||
return MoveTo(530, -319.261f, 1027.213, 54.172638f, false, true);
|
||||
else
|
||||
return MoveTo(530, -180.444f, 1027.947, 54.181538f, false, true);
|
||||
|
||||
return false;
|
||||
return MoveTo(530, -180.444f, 1027.947, 54.181538f, false, true);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni
|
||||
|
||||
uint8 bagIndex = item->GetBagSlot();
|
||||
uint8 slot = item->GetSlot();
|
||||
uint8 spell_index = 0;
|
||||
uint8 cast_count = 1;
|
||||
ObjectGuid item_guid = item->GetGUID();
|
||||
uint32 glyphIndex = 0;
|
||||
|
||||
@@ -108,7 +108,7 @@ std::string const WhoAction::QuerySkill(std::string const text)
|
||||
return out.str();
|
||||
}
|
||||
|
||||
std::string const WhoAction::QuerySpec(std::string const text)
|
||||
std::string const WhoAction::QuerySpec(std::string const /*text*/)
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
|
||||
bool WipeAction::Execute(Event event)
|
||||
{
|
||||
Player* master = event.getOwner();
|
||||
Player* const owner = event.getOwner();
|
||||
Player* const master = this->botAI->GetMaster();
|
||||
|
||||
if (botAI->GetMaster()->GetGUID() != event.getOwner()->GetGUID())
|
||||
if (owner != nullptr && master != nullptr && master->GetGUID() != owner->GetGUID())
|
||||
return false;
|
||||
|
||||
bot->Kill(bot, bot);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user