Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/Ai/Base/Actions/BattleGroundJoinAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,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);
Expand All @@ -38,12 +36,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;
Expand Down Expand Up @@ -409,8 +403,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
Expand Down Expand Up @@ -487,8 +479,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)
Expand Down
2 changes: 0 additions & 2 deletions src/Ai/Base/Actions/BattleGroundTactics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/Ai/Base/Actions/ChatShortcutActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ 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();
Expand All @@ -83,9 +82,7 @@ bool FollowChatShortcutAction::Execute(Event event)
}

if (Pet* pet = bot->GetPet())
{
botAI->PetFollow();
}

if (moved)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Ai/Base/Actions/ChooseRpgTargetAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,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())
Expand All @@ -126,7 +125,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");
Expand Down
13 changes: 0 additions & 13 deletions src/Ai/Base/Actions/ChooseTravelTargetAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Ai/Base/Actions/DebugAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());

Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ai/Base/Actions/EquipAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/Ai/Base/Actions/FishingAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/Ai/Base/Actions/GiveItemAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();
Expand Down
3 changes: 0 additions & 3 deletions src/Ai/Base/Actions/GuildCreateActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 0 additions & 2 deletions src/Ai/Base/Actions/InviteToGroupAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ std::vector<Player*> InviteGuildToGroupAction::getGuildMembers()

bool InviteGuildToGroupAction::Execute(Event event)
{
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());

for (auto& member : getGuildMembers())
{
Player* player = member;
Expand Down
2 changes: 0 additions & 2 deletions src/Ai/Base/Actions/LootRollAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -186,7 +185,6 @@ bool MasterLootRollAction::Execute(Event event)
if (!group)
return false;

RollVote vote = CalculateRollVote(proto);
group->CountRollVote(bot->GetGUID(), creatureGuid, CalculateRollVote(proto));

return true;
Expand Down
1 change: 0 additions & 1 deletion src/Ai/Base/Actions/LootStrategyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion src/Ai/Base/Actions/MailAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class TakeMailProcessor : public MailProcessor
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;
Expand Down
27 changes: 2 additions & 25 deletions src/Ai/Base/Actions/MovementActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,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);
Expand All @@ -120,7 +117,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior
return true;
}

// botAI->TellError("All paths not in LOS");
return false;
}

Expand All @@ -129,9 +125,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();
Expand Down Expand Up @@ -264,7 +257,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)
Expand Down Expand Up @@ -779,8 +771,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);
Expand Down Expand Up @@ -812,10 +802,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();
Expand Down Expand Up @@ -1417,7 +1403,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;
Expand All @@ -1438,8 +1423,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);

Expand Down Expand Up @@ -2782,9 +2765,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;
Expand Down Expand Up @@ -2906,14 +2887,10 @@ 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;
}

std::vector<Player*> debuffedPlayers;

Expand Down
1 change: 0 additions & 1 deletion src/Ai/Base/Actions/MovementActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ class MoveAwayFromPlayerWithDebuffAction : public MovementAction
private:
uint32 spellId;
float range;
bool alive;
};

#endif
1 change: 0 additions & 1 deletion src/Ai/Base/Actions/PetsAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class PetsAction : public Action
bool Execute(Event event) override;

private:
bool warningEnabled = true;
std::string defaultCmd;
};

Expand Down
1 change: 0 additions & 1 deletion src/Ai/Base/Actions/QueryQuestAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions src/Ai/Base/Actions/QuestAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,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)
{
Expand Down Expand Up @@ -405,8 +404,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];
Expand Down Expand Up @@ -446,8 +443,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)
Expand Down
2 changes: 1 addition & 1 deletion src/Ai/Base/Actions/RememberTaxiAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading
Loading