mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-22 13:06:23 +00:00
Merge code line
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptBattlegroundInvitationAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool AcceptBgInvitationAction::Execute(Event event)
|
||||
{
|
||||
uint8 type = 0; // arenatype if arena
|
||||
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||
uint32 bgTypeId_ = BATTLEGROUND_WS; // type id from dbc
|
||||
uint16 unk = 0x1F90; // 0x1F90 constant?*/
|
||||
uint8 type = 0; // arenatype if arena
|
||||
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||
uint32 bgTypeId_ = BATTLEGROUND_WS; // type id from dbc
|
||||
uint16 unk = 0x1F90; // 0x1F90 constant?*/
|
||||
uint8 action = 1;
|
||||
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
||||
//packet << bgTypeId_ << action;
|
||||
// packet << bgTypeId_ << action;
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ACCEPTBATTLEGROUNDINVITATIONACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptBgInvitationAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptBgInvitationAction(PlayerbotAI* botAI) : Action(botAI, "accept bg invitatio") { }
|
||||
public:
|
||||
AcceptBgInvitationAction(PlayerbotAI* botAI) : Action(botAI, "accept bg invitatio") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptDuelAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -16,7 +18,8 @@ bool AcceptDuelAction::Execute(Event event)
|
||||
p >> playerGuid;
|
||||
|
||||
// do not auto duel with low hp
|
||||
if ((!botAI->HasRealPlayerMaster() || (botAI->GetMaster() && botAI->GetMaster()->GetGUID() != playerGuid)) && AI_VALUE2(uint8, "health", "self target") < 90)
|
||||
if ((!botAI->HasRealPlayerMaster() || (botAI->GetMaster() && botAI->GetMaster()->GetGUID() != playerGuid)) &&
|
||||
AI_VALUE2(uint8, "health", "self target") < 90)
|
||||
{
|
||||
WorldPacket packet(CMSG_DUEL_CANCELLED, 8);
|
||||
packet << flagGuid;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ACCEPTDUELACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptDuelAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptDuelAction(PlayerbotAI* botAI) : Action(botAI, "accept duel") { }
|
||||
public:
|
||||
AcceptDuelAction(PlayerbotAI* botAI) : Action(botAI, "accept duel") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptInvitationAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PlayerbotSecurity.h"
|
||||
#include "Playerbots.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
bool AcceptInvitationAction::Execute(Event event)
|
||||
@@ -41,8 +43,8 @@ bool AcceptInvitationAction::Execute(Event event)
|
||||
|
||||
if (sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
botAI->SetMaster(inviter);
|
||||
//else
|
||||
//sPlayerbotDbStore->Save(botAI);
|
||||
// else
|
||||
// sPlayerbotDbStore->Save(botAI);
|
||||
|
||||
botAI->ResetStrategies();
|
||||
botAI->ChangeStrategy("+follow,-lfg,-bg", BOT_STATE_NON_COMBAT);
|
||||
@@ -50,7 +52,8 @@ bool AcceptInvitationAction::Execute(Event event)
|
||||
|
||||
botAI->TellMaster("Hello");
|
||||
|
||||
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance) {
|
||||
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance)
|
||||
{
|
||||
Teleport(inviter, bot);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ACCEPTINVITATIONACTION_H
|
||||
@@ -12,10 +13,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptInvitationAction : public SummonAction
|
||||
{
|
||||
public:
|
||||
AcceptInvitationAction(PlayerbotAI* botAI) : SummonAction(botAI, "accept invitation") { }
|
||||
public:
|
||||
AcceptInvitationAction(PlayerbotAI* botAI) : SummonAction(botAI, "accept invitation") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptQuestAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ACCEPTQUESTACTION_H
|
||||
@@ -13,25 +14,27 @@ class WorldObject;
|
||||
|
||||
class AcceptAllQuestsAction : public QuestAction
|
||||
{
|
||||
public:
|
||||
AcceptAllQuestsAction(PlayerbotAI* botAI, std::string const name = "accept all quests") : QuestAction(botAI, name) { }
|
||||
public:
|
||||
AcceptAllQuestsAction(PlayerbotAI* botAI, std::string const name = "accept all quests") : QuestAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
bool ProcessQuest(Quest const* quest, Object* questGiver) override;
|
||||
protected:
|
||||
bool ProcessQuest(Quest const* quest, Object* questGiver) override;
|
||||
};
|
||||
|
||||
class AcceptQuestAction : public AcceptAllQuestsAction
|
||||
{
|
||||
public:
|
||||
AcceptQuestAction(PlayerbotAI* botAI) : AcceptAllQuestsAction(botAI, "accept quest") { }
|
||||
bool Execute(Event event) override;
|
||||
public:
|
||||
AcceptQuestAction(PlayerbotAI* botAI) : AcceptAllQuestsAction(botAI, "accept quest") {}
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AcceptQuestShareAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptQuestShareAction(PlayerbotAI* botAI) : Action(botAI, "accept quest share") { }
|
||||
bool Execute(Event event) override;
|
||||
public:
|
||||
AcceptQuestShareAction(PlayerbotAI* botAI) : Action(botAI, "accept quest share") {}
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class ConfirmQuestAction : public Action {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptResurrectAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -18,8 +20,8 @@ bool AcceptResurrectAction::Execute(Event event)
|
||||
|
||||
WorldPacket packet(CMSG_RESURRECT_RESPONSE, 8 + 1);
|
||||
packet << guid;
|
||||
packet << uint8(1); // accept
|
||||
bot->GetSession()->HandleResurrectResponseOpcode(packet); // queue the packet to get around race condition
|
||||
packet << uint8(1); // accept
|
||||
bot->GetSession()->HandleResurrectResponseOpcode(packet); // queue the packet to get around race condition
|
||||
|
||||
botAI->ChangeEngine(BOT_STATE_NON_COMBAT);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ACCEPTRESURRECTACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptResurrectAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptResurrectAction(PlayerbotAI* botAI) : Action(botAI, "accept resurrect") { }
|
||||
public:
|
||||
AcceptResurrectAction(PlayerbotAI* botAI) : Action(botAI, "accept resurrect") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ACTIONCONTEXT_H
|
||||
@@ -10,20 +11,23 @@
|
||||
#include "AutoLearnSpellAction.h"
|
||||
#include "ShareQuestAction.h"
|
||||
#include "BattleGroundTactics.h"
|
||||
#include "AutoTeleportForLevelAction.h"
|
||||
#include "BattleGroundJoinAction.h"
|
||||
#include "BattleGroundTactics.h"
|
||||
#include "BuyAction.h"
|
||||
#include "CastCustomSpellAction.h"
|
||||
#include "ChangeStrategyAction.h"
|
||||
#include "ChangeTalentsAction.h"
|
||||
#include "CheckMailAction.h"
|
||||
#include "CheckValuesAction.h"
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "ChooseTargetActions.h"
|
||||
#include "ChooseTravelTargetAction.h"
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "CombatActions.h"
|
||||
#include "DelayAction.h"
|
||||
#include "DestroyItemAction.h"
|
||||
#include "EmoteAction.h"
|
||||
#include "FollowActions.h"
|
||||
#include "GenericActions.h"
|
||||
#include "GenericSpellActions.h"
|
||||
#include "GiveItemAction.h"
|
||||
@@ -34,15 +38,15 @@
|
||||
#include "ImbueAction.h"
|
||||
#include "InviteToGroupAction.h"
|
||||
#include "LeaveGroupAction.h"
|
||||
#include "FollowActions.h"
|
||||
#include "LootAction.h"
|
||||
#include "MovementActions.h"
|
||||
#include "MoveToRpgTargetAction.h"
|
||||
#include "MoveToTravelTargetAction.h"
|
||||
#include "MovementActions.h"
|
||||
#include "NonCombatActions.h"
|
||||
#include "OutfitAction.h"
|
||||
#include "PositionAction.h"
|
||||
#include "DropQuestAction.h"
|
||||
#include "RaidNaxxActions.h"
|
||||
#include "RandomBotUpdateAction.h"
|
||||
#include "ReachTargetActions.h"
|
||||
#include "ReleaseSpiritAction.h"
|
||||
@@ -56,358 +60,354 @@
|
||||
#include "StayActions.h"
|
||||
#include "SuggestWhatToDoAction.h"
|
||||
#include "TravelAction.h"
|
||||
#include "XpGainAction.h"
|
||||
#include "VehicleActions.h"
|
||||
#include "WorldBuffAction.h"
|
||||
#include "RaidNaxxActions.h"
|
||||
#include "AutoTeleportForLevelAction.h"
|
||||
#include "XpGainAction.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class ActionContext : public NamedObjectContext<Action>
|
||||
{
|
||||
public:
|
||||
ActionContext()
|
||||
{
|
||||
creators["mark rti"] = &ActionContext::mark_rti;
|
||||
creators["set return position"] = &ActionContext::set_return_position;
|
||||
creators["rpg"] = &ActionContext::rpg;
|
||||
creators["crpg"] = &ActionContext::crpg;
|
||||
creators["choose rpg target"] = &ActionContext::choose_rpg_target;
|
||||
creators["move to rpg target"] = &ActionContext::move_to_rpg_target;
|
||||
creators["travel"] = &ActionContext::travel;
|
||||
creators["choose travel target"] = &ActionContext::choose_travel_target;
|
||||
creators["move to travel target"] = &ActionContext::move_to_travel_target;
|
||||
creators["move out of collision"] = &ActionContext::move_out_of_collision;
|
||||
creators["move random"] = &ActionContext::move_random;
|
||||
creators["attack"] = &ActionContext::melee;
|
||||
creators["melee"] = &ActionContext::melee;
|
||||
creators["switch to melee"] = &ActionContext::switch_to_melee;
|
||||
creators["switch to ranged"] = &ActionContext::switch_to_ranged;
|
||||
creators["reach spell"] = &ActionContext::ReachSpell;
|
||||
creators["reach melee"] = &ActionContext::ReachMelee;
|
||||
creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal;
|
||||
creators["reach party member to resurrect"] = &ActionContext::reach_party_member_to_resurrect;
|
||||
creators["flee"] = &ActionContext::flee;
|
||||
creators["flee with pet"] = &ActionContext::flee_with_pet;
|
||||
creators["avoid aoe"] = &ActionContext::avoid_aoe;
|
||||
creators["combat formation move"] = &ActionContext::combat_formation_move;
|
||||
creators["disperse set"] = &ActionContext::disperse_set;
|
||||
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["lifeblood"] = &ActionContext::lifeblood;
|
||||
creators["arcane torrent"] = &ActionContext::arcane_torrent;
|
||||
creators["end pull"] = &ActionContext::end_pull;
|
||||
creators["healthstone"] = &ActionContext::healthstone;
|
||||
creators["healing potion"] = &ActionContext::healing_potion;
|
||||
creators["mana potion"] = &ActionContext::mana_potion;
|
||||
creators["food"] = &ActionContext::food;
|
||||
creators["drink"] = &ActionContext::drink;
|
||||
creators["tank assist"] = &ActionContext::tank_assist;
|
||||
creators["dps assist"] = &ActionContext::dps_assist;
|
||||
creators["dps aoe"] = &ActionContext::dps_aoe;
|
||||
creators["attack rti target"] = &ActionContext::attack_rti_target;
|
||||
creators["loot"] = &ActionContext::loot;
|
||||
creators["add loot"] = &ActionContext::add_loot;
|
||||
creators["add gathering loot"] = &ActionContext::add_gathering_loot;
|
||||
creators["add all loot"] = &ActionContext::add_all_loot;
|
||||
creators["release loot"] = &ActionContext::release_loot;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["follow"] = &ActionContext::follow;
|
||||
creators["flee to master"] = &ActionContext::flee_to_master;
|
||||
creators["runaway"] = &ActionContext::runaway;
|
||||
creators["stay"] = &ActionContext::stay;
|
||||
creators["sit"] = &ActionContext::sit;
|
||||
creators["attack anything"] = &ActionContext::attack_anything;
|
||||
creators["attack least hp target"] = &ActionContext::attack_least_hp_target;
|
||||
creators["attack enemy player"] = &ActionContext::attack_enemy_player;
|
||||
creators["emote"] = &ActionContext::emote;
|
||||
creators["talk"] = &ActionContext::talk;
|
||||
creators["suggest what to do"] = &ActionContext::suggest_what_to_do;
|
||||
creators["suggest trade"] = &ActionContext::suggest_trade;
|
||||
creators["suggest dungeon"] = &ActionContext::suggest_dungeon;
|
||||
creators["return"] = &ActionContext::_return;
|
||||
creators["move to loot"] = &ActionContext::move_to_loot;
|
||||
creators["open loot"] = &ActionContext::open_loot;
|
||||
creators["guard"] = &ActionContext::guard;
|
||||
creators["move out of enemy contact"] = &ActionContext::move_out_of_enemy_contact;
|
||||
creators["set facing"] = &ActionContext::set_facing;
|
||||
creators["set behind"] = &ActionContext::set_behind;
|
||||
creators["attack duel opponent"] = &ActionContext::attack_duel_opponent;
|
||||
creators["drop target"] = &ActionContext::drop_target;
|
||||
creators["check mail"] = &ActionContext::check_mail;
|
||||
creators["say"] = &ActionContext::say;
|
||||
creators["reveal gathering item"] = &ActionContext::reveal_gathering_item;
|
||||
creators["outfit"] = &ActionContext::outfit;
|
||||
creators["random bot update"] = &ActionContext::random_bot_update;
|
||||
creators["delay"] = &ActionContext::delay;
|
||||
creators["greet"] = &ActionContext::greet;
|
||||
creators["check values"] = &ActionContext::check_values;
|
||||
creators["ra"] = &ActionContext::ra;
|
||||
creators["apply poison"] = &ActionContext::apply_poison;
|
||||
creators["apply stone"] = &ActionContext::apply_stone;
|
||||
creators["apply oil"] = &ActionContext::apply_oil;
|
||||
creators["try emergency"] = &ActionContext::try_emergency;
|
||||
creators["give food"] = &ActionContext::give_food;
|
||||
creators["give water"] = &ActionContext::give_water;
|
||||
creators["mount"] = &ActionContext::mount;
|
||||
creators["war stomp"] = &ActionContext::war_stomp;
|
||||
creators["auto talents"] = &ActionContext::auto_talents;
|
||||
creators["auto learn spell"] = &ActionContext::auto_learn_spell;
|
||||
creators["auto share quest"] = &ActionContext::auto_share_quest;
|
||||
creators["auto teleport for level"] = &ActionContext::auto_teleport_for_level;
|
||||
creators["auto upgrade equip"] = &ActionContext::auto_upgrade_equip;
|
||||
creators["xp gain"] = &ActionContext::xp_gain;
|
||||
creators["invite nearby"] = &ActionContext::invite_nearby;
|
||||
creators["invite guild"] = &ActionContext::invite_guild;
|
||||
creators["leave far away"] = &ActionContext::leave_far_away;
|
||||
creators["move to dark portal"] = &ActionContext::move_to_dark_portal;
|
||||
creators["move from dark portal"] = &ActionContext::move_from_dark_portal;
|
||||
creators["use dark portal azeroth"] = &ActionContext::use_dark_portal_azeroth;
|
||||
creators["world buff"] = &ActionContext::world_buff;
|
||||
creators["hearthstone"] = &ActionContext::hearthstone;
|
||||
creators["cast random spell"] = &ActionContext::cast_random_spell;
|
||||
creators["free bg join"] = &ActionContext::free_bg_join;
|
||||
creators["use random recipe"] = &ActionContext::use_random_recipe;
|
||||
creators["use random quest item"] = &ActionContext::use_random_quest_item;
|
||||
creators["craft random item"] = &ActionContext::craft_random_item;
|
||||
creators["smart destroy item"] = &ActionContext::smart_destroy_item;
|
||||
creators["disenchant random item"] = &ActionContext::disenchant_random_item;
|
||||
creators["enchant random item"] = &ActionContext::enchant_random_item;
|
||||
creators["reset instances"] = &ActionContext::reset_instances;
|
||||
creators["buy petition"] = &ActionContext::buy_petition;
|
||||
creators["offer petition"] = &ActionContext::offer_petition;
|
||||
creators["offer petition nearby"] = &ActionContext::offer_petition_nearby;
|
||||
creators["turn in petition"] = &ActionContext::turn_in_petition;
|
||||
creators["buy tabard"] = &ActionContext::buy_tabard;
|
||||
creators["guild manage nearby"] = &ActionContext::guild_manage_nearby;
|
||||
creators["clean quest log"] = &ActionContext::clean_quest_log;
|
||||
|
||||
// BG Tactics
|
||||
creators["bg tactics"] = &ActionContext::bg_tactics;
|
||||
creators["bg move to start"] = &ActionContext::bg_move_to_start;
|
||||
creators["bg move to objective"] = &ActionContext::bg_move_to_objective;
|
||||
creators["bg select objective"] = &ActionContext::bg_select_objective;
|
||||
creators["bg check objective"] = &ActionContext::bg_check_objective;
|
||||
creators["bg attack fc"] = &ActionContext::bg_attack_fc;
|
||||
creators["bg protect fc"] = &ActionContext::bg_protect_fc;
|
||||
creators["bg use buff"] = &ActionContext::bg_use_buff;
|
||||
creators["attack enemy flag carrier"] = &ActionContext::attack_enemy_fc;
|
||||
creators["bg check flag"] = &ActionContext::bg_check_flag;
|
||||
|
||||
// Vehicles
|
||||
creators["enter vehicle"] = &ActionContext::enter_vehicle;
|
||||
creators["leave vehicle"] = &ActionContext::leave_vehicle;
|
||||
creators["hurl boulder"] = &ActionContext::hurl_boulder;
|
||||
creators["ram"] = &ActionContext::ram;
|
||||
creators["steam rush"] = &ActionContext::steam_rush;
|
||||
creators["steam blast"] = &ActionContext::steam_blast;
|
||||
creators["napalm"] = &ActionContext::napalm;
|
||||
creators["fire cannon"] = &ActionContext::fire_cannon;
|
||||
creators["incendiary rocket"] = &ActionContext::incendiary_rocket;
|
||||
creators["rocket blast"] = &ActionContext::rocket_blast;
|
||||
creators["blade salvo"] = &ActionContext::blade_salvo;
|
||||
creators["glaive throw"] = &ActionContext::glaive_throw;
|
||||
|
||||
//Rpg
|
||||
creators["rpg stay"] = &ActionContext::rpg_stay;
|
||||
creators["rpg work"] = &ActionContext::rpg_work;
|
||||
creators["rpg emote"] = &ActionContext::rpg_emote;
|
||||
creators["rpg cancel"] = &ActionContext::rpg_cancel;
|
||||
creators["rpg taxi"] = &ActionContext::rpg_taxi;
|
||||
creators["rpg discover"] = &ActionContext::rpg_discover;
|
||||
creators["rpg start quest"] = &ActionContext::rpg_start_quest;
|
||||
creators["rpg end quest"] = &ActionContext::rpg_end_quest;
|
||||
creators["rpg buy"] = &ActionContext::rpg_buy;
|
||||
creators["rpg sell"] = &ActionContext::rpg_sell;
|
||||
creators["rpg repair"] = &ActionContext::rpg_repair;
|
||||
creators["rpg train"] = &ActionContext::rpg_train;
|
||||
creators["rpg heal"] = &ActionContext::rpg_heal;
|
||||
creators["rpg home bind"] = &ActionContext::rpg_home_bind;
|
||||
creators["rpg queue bg"] = &ActionContext::rpg_queue_bg;
|
||||
creators["rpg buy petition"] = &ActionContext::rpg_buy_petition;
|
||||
creators["rpg use"] = &ActionContext::rpg_use;
|
||||
creators["rpg spell"] = &ActionContext::rpg_spell;
|
||||
creators["rpg craft"] = &ActionContext::rpg_craft;
|
||||
creators["rpg trade useful"] = &ActionContext::rpg_trade_useful;
|
||||
creators["rpg duel"] = &ActionContext::rpg_duel;
|
||||
creators["rpg mount anim"] = &ActionContext::rpg_mount_anim;
|
||||
|
||||
creators["toggle pet spell"] = &ActionContext::toggle_pet_spell;
|
||||
creators["pet attack"] = &ActionContext::pet_attack;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
static Action* give_water(PlayerbotAI* botAI) { return new GiveWaterAction(botAI); }
|
||||
static Action* give_food(PlayerbotAI* botAI) { return new GiveFoodAction(botAI); }
|
||||
static Action* ra(PlayerbotAI* botAI) { return new RemoveAuraAction(botAI); }
|
||||
static Action* mark_rti(PlayerbotAI* botAI) { return new MarkRtiAction(botAI); }
|
||||
static Action* set_return_position(PlayerbotAI* botAI) { return new SetReturnPositionAction(botAI); }
|
||||
static Action* rpg(PlayerbotAI* botAI) { return new RpgAction(botAI); }
|
||||
static Action* crpg(PlayerbotAI* botAI) { return new CRpgAction(botAI); }
|
||||
static Action* choose_rpg_target(PlayerbotAI* botAI) { return new ChooseRpgTargetAction(botAI); }
|
||||
static Action* move_to_rpg_target(PlayerbotAI* botAI) { return new MoveToRpgTargetAction(botAI); }
|
||||
static Action* travel(PlayerbotAI* botAI) { return new TravelAction(botAI); }
|
||||
static Action* choose_travel_target(PlayerbotAI* botAI) { return new ChooseTravelTargetAction(botAI); }
|
||||
static Action* move_to_travel_target(PlayerbotAI* botAI) { return new MoveToTravelTargetAction(botAI); }
|
||||
static Action* move_out_of_collision(PlayerbotAI* botAI) { return new MoveOutOfCollisionAction(botAI); }
|
||||
static Action* move_random(PlayerbotAI* botAI) { return new MoveRandomAction(botAI); }
|
||||
static Action* check_values(PlayerbotAI* botAI) { return new CheckValuesAction(botAI); }
|
||||
static Action* greet(PlayerbotAI* botAI) { return new GreetAction(botAI); }
|
||||
static Action* check_mail(PlayerbotAI* botAI) { return new CheckMailAction(botAI); }
|
||||
static Action* drop_target(PlayerbotAI* botAI) { return new DropTargetAction(botAI); }
|
||||
static Action* attack_duel_opponent(PlayerbotAI* botAI) { return new AttackDuelOpponentAction(botAI); }
|
||||
static Action* guard(PlayerbotAI* botAI) { return new GuardAction(botAI); }
|
||||
static Action* open_loot(PlayerbotAI* botAI) { return new OpenLootAction(botAI); }
|
||||
static Action* move_to_loot(PlayerbotAI* botAI) { return new MoveToLootAction(botAI); }
|
||||
static Action* _return(PlayerbotAI* botAI) { return new ReturnAction(botAI); }
|
||||
static Action* shoot(PlayerbotAI* botAI) { return new CastShootAction(botAI); }
|
||||
static Action* melee(PlayerbotAI* botAI) { return new MeleeAction(botAI); }
|
||||
static Action* switch_to_melee(PlayerbotAI* botAI) { return new SwitchToMeleeAction(botAI); }
|
||||
static Action* switch_to_ranged(PlayerbotAI* botAI) { return new SwitchToRangedAction(botAI); }
|
||||
static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); }
|
||||
static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(botAI); }
|
||||
static Action* reach_party_member_to_heal(PlayerbotAI* botAI) { return new ReachPartyMemberToHealAction(botAI); }
|
||||
static Action* reach_party_member_to_resurrect(PlayerbotAI* botAI) { return new ReachPartyMemberToResurrectAction(botAI); }
|
||||
static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); }
|
||||
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
|
||||
static Action* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeAction(botAI); }
|
||||
static Action* combat_formation_move(PlayerbotAI* botAI) { return new CombatFormationMoveAction(botAI); }
|
||||
static Action* disperse_set(PlayerbotAI* botAI) { return new DisperseSetAction(botAI); }
|
||||
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }
|
||||
static Action* lifeblood(PlayerbotAI* botAI) { return new CastLifeBloodAction(botAI); }
|
||||
static Action* arcane_torrent(PlayerbotAI* botAI) { return new CastArcaneTorrentAction(botAI); }
|
||||
static Action* mana_tap(PlayerbotAI* botAI) { return new CastManaTapAction(botAI); }
|
||||
static Action* end_pull(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI, "-pull"); }
|
||||
|
||||
static Action* emote(PlayerbotAI* botAI) { return new EmoteAction(botAI); }
|
||||
static Action* talk(PlayerbotAI* botAI) { return new TalkAction(botAI); }
|
||||
static Action* suggest_what_to_do(PlayerbotAI* botAI) { return new SuggestWhatToDoAction(botAI); }
|
||||
static Action* suggest_trade(PlayerbotAI* botAI) { return new SuggestTradeAction(botAI); }
|
||||
static Action* suggest_dungeon(PlayerbotAI* botAI) { return new SuggestDungeonAction(botAI); }
|
||||
static Action* attack_anything(PlayerbotAI* botAI) { return new AttackAnythingAction(botAI); }
|
||||
static Action* attack_least_hp_target(PlayerbotAI* botAI) { return new AttackLeastHpTargetAction(botAI); }
|
||||
static Action* attack_enemy_player(PlayerbotAI* botAI) { return new AttackEnemyPlayerAction(botAI); }
|
||||
static Action* stay(PlayerbotAI* botAI) { return new StayAction(botAI); }
|
||||
static Action* sit(PlayerbotAI* botAI) { return new SitAction(botAI); }
|
||||
static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); }
|
||||
static Action* follow(PlayerbotAI* botAI) { return new FollowAction(botAI); }
|
||||
static Action* flee_to_master(PlayerbotAI* botAI) { return new FleeToMasterAction(botAI); }
|
||||
static Action* add_gathering_loot(PlayerbotAI* botAI) { return new AddGatheringLootAction(botAI); }
|
||||
static Action* add_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* loot(PlayerbotAI* botAI) { return new LootAction(botAI); }
|
||||
static Action* release_loot(PlayerbotAI* botAI) { return new ReleaseLootAction(botAI); }
|
||||
static Action* dps_assist(PlayerbotAI* botAI) { return new DpsAssistAction(botAI); }
|
||||
static Action* dps_aoe(PlayerbotAI* botAI) { return new DpsAoeAction(botAI); }
|
||||
static Action* attack_rti_target(PlayerbotAI* botAI) { return new AttackRtiTargetAction(botAI); }
|
||||
static Action* tank_assist(PlayerbotAI* botAI) { return new TankAssistAction(botAI); }
|
||||
static Action* drink(PlayerbotAI* botAI) { return new DrinkAction(botAI); }
|
||||
static Action* food(PlayerbotAI* botAI) { return new EatAction(botAI); }
|
||||
static Action* mana_potion(PlayerbotAI* botAI) { return new UseManaPotion(botAI); }
|
||||
static Action* healing_potion(PlayerbotAI* botAI) { return new UseHealingPotion(botAI); }
|
||||
static Action* healthstone(PlayerbotAI* botAI) { return new UseItemAction(botAI, "healthstone"); }
|
||||
static Action* move_out_of_enemy_contact(PlayerbotAI* botAI) { return new MoveOutOfEnemyContactAction(botAI); }
|
||||
static Action* set_facing(PlayerbotAI* botAI) { return new SetFacingTargetAction(botAI); }
|
||||
static Action* set_behind(PlayerbotAI* botAI) { return new SetBehindTargetAction(botAI); }
|
||||
static Action* say(PlayerbotAI* botAI) { return new SayAction(botAI); }
|
||||
static Action* reveal_gathering_item(PlayerbotAI* botAI) { return new RevealGatheringItemAction(botAI); }
|
||||
static Action* outfit(PlayerbotAI* botAI) { return new OutfitAction(botAI); }
|
||||
static Action* random_bot_update(PlayerbotAI* botAI) { return new RandomBotUpdateAction(botAI); }
|
||||
static Action* delay(PlayerbotAI* botAI) { return new DelayAction(botAI); }
|
||||
|
||||
static Action* apply_poison(PlayerbotAI* botAI) { return new ImbueWithPoisonAction(botAI); }
|
||||
static Action* apply_oil(PlayerbotAI* botAI) { return new ImbueWithOilAction(botAI); }
|
||||
static Action* apply_stone(PlayerbotAI* botAI) { return new ImbueWithStoneAction(botAI); }
|
||||
static Action* try_emergency(PlayerbotAI* botAI) { return new TryEmergencyAction(botAI); }
|
||||
static Action* mount(PlayerbotAI* botAI) { return new CastSpellAction(botAI, "mount"); }
|
||||
static Action* war_stomp(PlayerbotAI* botAI) { return new CastWarStompAction(botAI); }
|
||||
static Action* auto_talents(PlayerbotAI* botAI) { return new AutoSetTalentsAction(botAI); }
|
||||
static Action* auto_learn_spell(PlayerbotAI* botAI) { return new AutoLearnSpellAction(botAI); }
|
||||
static Action* auto_share_quest(PlayerbotAI* ai) { return new AutoShareQuestAction(ai); }
|
||||
static Action* auto_teleport_for_level(PlayerbotAI* botAI) { return new AutoTeleportForLevelAction(botAI); }
|
||||
static Action* auto_upgrade_equip(PlayerbotAI* botAI) { return new AutoUpgradeEquipAction(botAI); }
|
||||
static Action* xp_gain(PlayerbotAI* botAI) { return new XpGainAction(botAI); }
|
||||
static Action* invite_nearby(PlayerbotAI* botAI) { return new InviteNearbyToGroupAction(botAI); }
|
||||
static Action* invite_guild(PlayerbotAI* botAI) { return new InviteGuildToGroupAction(botAI); }
|
||||
static Action* leave_far_away(PlayerbotAI* botAI) { return new LeaveFarAwayAction(botAI); }
|
||||
static Action* move_to_dark_portal(PlayerbotAI* botAI) { return new MoveToDarkPortalAction(botAI); }
|
||||
static Action* use_dark_portal_azeroth(PlayerbotAI* botAI) { return new DarkPortalAzerothAction(botAI); }
|
||||
static Action* move_from_dark_portal(PlayerbotAI* botAI) { return new MoveFromDarkPortalAction(botAI); }
|
||||
static Action* world_buff(PlayerbotAI* botAI) { return new WorldBuffAction(botAI); }
|
||||
static Action* hearthstone(PlayerbotAI* botAI) { return new UseHearthStone(botAI); }
|
||||
static Action* cast_random_spell(PlayerbotAI* botAI) { return new CastRandomSpellAction(botAI); }
|
||||
static Action* free_bg_join(PlayerbotAI* botAI) { return new FreeBGJoinAction(botAI); }
|
||||
|
||||
static Action* use_random_recipe(PlayerbotAI* botAI) { return new UseRandomRecipe(botAI); }
|
||||
static Action* use_random_quest_item(PlayerbotAI* botAI) { return new UseRandomQuestItem(botAI); }
|
||||
static Action* craft_random_item(PlayerbotAI* botAI) { return new CraftRandomItemAction(botAI); }
|
||||
static Action* smart_destroy_item(PlayerbotAI* botAI) { return new SmartDestroyItemAction(botAI); }
|
||||
static Action* disenchant_random_item(PlayerbotAI* botAI) { return new DisEnchantRandomItemAction(botAI); }
|
||||
static Action* enchant_random_item(PlayerbotAI* botAI) { return new EnchantRandomItemAction(botAI); }
|
||||
static Action* reset_instances(PlayerbotAI* botAI) { return new ResetInstancesAction(botAI); }
|
||||
static Action* buy_petition(PlayerbotAI* botAI) { return new BuyPetitionAction(botAI); }
|
||||
static Action* offer_petition(PlayerbotAI* botAI) { return new PetitionOfferAction(botAI); }
|
||||
static Action* offer_petition_nearby(PlayerbotAI* botAI) { return new PetitionOfferNearbyAction(botAI); }
|
||||
static Action* turn_in_petition(PlayerbotAI* botAI) { return new PetitionTurnInAction(botAI); }
|
||||
static Action* buy_tabard(PlayerbotAI* botAI) { return new BuyTabardAction(botAI); }
|
||||
static Action* guild_manage_nearby(PlayerbotAI* botAI) { return new GuildManageNearbyAction(botAI); }
|
||||
static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); }
|
||||
public:
|
||||
ActionContext()
|
||||
{
|
||||
creators["mark rti"] = &ActionContext::mark_rti;
|
||||
creators["set return position"] = &ActionContext::set_return_position;
|
||||
creators["rpg"] = &ActionContext::rpg;
|
||||
creators["crpg"] = &ActionContext::crpg;
|
||||
creators["choose rpg target"] = &ActionContext::choose_rpg_target;
|
||||
creators["move to rpg target"] = &ActionContext::move_to_rpg_target;
|
||||
creators["travel"] = &ActionContext::travel;
|
||||
creators["choose travel target"] = &ActionContext::choose_travel_target;
|
||||
creators["move to travel target"] = &ActionContext::move_to_travel_target;
|
||||
creators["move out of collision"] = &ActionContext::move_out_of_collision;
|
||||
creators["move random"] = &ActionContext::move_random;
|
||||
creators["attack"] = &ActionContext::melee;
|
||||
creators["melee"] = &ActionContext::melee;
|
||||
creators["switch to melee"] = &ActionContext::switch_to_melee;
|
||||
creators["switch to ranged"] = &ActionContext::switch_to_ranged;
|
||||
creators["reach spell"] = &ActionContext::ReachSpell;
|
||||
creators["reach melee"] = &ActionContext::ReachMelee;
|
||||
creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal;
|
||||
creators["reach party member to resurrect"] = &ActionContext::reach_party_member_to_resurrect;
|
||||
creators["flee"] = &ActionContext::flee;
|
||||
creators["flee with pet"] = &ActionContext::flee_with_pet;
|
||||
creators["avoid aoe"] = &ActionContext::avoid_aoe;
|
||||
creators["combat formation move"] = &ActionContext::combat_formation_move;
|
||||
creators["disperse set"] = &ActionContext::disperse_set;
|
||||
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["lifeblood"] = &ActionContext::lifeblood;
|
||||
creators["arcane torrent"] = &ActionContext::arcane_torrent;
|
||||
creators["end pull"] = &ActionContext::end_pull;
|
||||
creators["healthstone"] = &ActionContext::healthstone;
|
||||
creators["healing potion"] = &ActionContext::healing_potion;
|
||||
creators["mana potion"] = &ActionContext::mana_potion;
|
||||
creators["food"] = &ActionContext::food;
|
||||
creators["drink"] = &ActionContext::drink;
|
||||
creators["tank assist"] = &ActionContext::tank_assist;
|
||||
creators["dps assist"] = &ActionContext::dps_assist;
|
||||
creators["dps aoe"] = &ActionContext::dps_aoe;
|
||||
creators["attack rti target"] = &ActionContext::attack_rti_target;
|
||||
creators["loot"] = &ActionContext::loot;
|
||||
creators["add loot"] = &ActionContext::add_loot;
|
||||
creators["add gathering loot"] = &ActionContext::add_gathering_loot;
|
||||
creators["add all loot"] = &ActionContext::add_all_loot;
|
||||
creators["release loot"] = &ActionContext::release_loot;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["follow"] = &ActionContext::follow;
|
||||
creators["flee to master"] = &ActionContext::flee_to_master;
|
||||
creators["runaway"] = &ActionContext::runaway;
|
||||
creators["stay"] = &ActionContext::stay;
|
||||
creators["sit"] = &ActionContext::sit;
|
||||
creators["attack anything"] = &ActionContext::attack_anything;
|
||||
creators["attack least hp target"] = &ActionContext::attack_least_hp_target;
|
||||
creators["attack enemy player"] = &ActionContext::attack_enemy_player;
|
||||
creators["emote"] = &ActionContext::emote;
|
||||
creators["talk"] = &ActionContext::talk;
|
||||
creators["suggest what to do"] = &ActionContext::suggest_what_to_do;
|
||||
creators["suggest trade"] = &ActionContext::suggest_trade;
|
||||
creators["suggest dungeon"] = &ActionContext::suggest_dungeon;
|
||||
creators["return"] = &ActionContext::_return;
|
||||
creators["move to loot"] = &ActionContext::move_to_loot;
|
||||
creators["open loot"] = &ActionContext::open_loot;
|
||||
creators["guard"] = &ActionContext::guard;
|
||||
creators["move out of enemy contact"] = &ActionContext::move_out_of_enemy_contact;
|
||||
creators["set facing"] = &ActionContext::set_facing;
|
||||
creators["set behind"] = &ActionContext::set_behind;
|
||||
creators["attack duel opponent"] = &ActionContext::attack_duel_opponent;
|
||||
creators["drop target"] = &ActionContext::drop_target;
|
||||
creators["check mail"] = &ActionContext::check_mail;
|
||||
creators["say"] = &ActionContext::say;
|
||||
creators["reveal gathering item"] = &ActionContext::reveal_gathering_item;
|
||||
creators["outfit"] = &ActionContext::outfit;
|
||||
creators["random bot update"] = &ActionContext::random_bot_update;
|
||||
creators["delay"] = &ActionContext::delay;
|
||||
creators["greet"] = &ActionContext::greet;
|
||||
creators["check values"] = &ActionContext::check_values;
|
||||
creators["ra"] = &ActionContext::ra;
|
||||
creators["apply poison"] = &ActionContext::apply_poison;
|
||||
creators["apply stone"] = &ActionContext::apply_stone;
|
||||
creators["apply oil"] = &ActionContext::apply_oil;
|
||||
creators["try emergency"] = &ActionContext::try_emergency;
|
||||
creators["give food"] = &ActionContext::give_food;
|
||||
creators["give water"] = &ActionContext::give_water;
|
||||
creators["mount"] = &ActionContext::mount;
|
||||
creators["war stomp"] = &ActionContext::war_stomp;
|
||||
creators["auto talents"] = &ActionContext::auto_talents;
|
||||
creators["auto learn spell"] = &ActionContext::auto_learn_spell;
|
||||
creators["auto share quest"] = &ActionContext::auto_share_quest;
|
||||
creators["auto teleport for level"] = &ActionContext::auto_teleport_for_level;
|
||||
creators["auto upgrade equip"] = &ActionContext::auto_upgrade_equip;
|
||||
creators["xp gain"] = &ActionContext::xp_gain;
|
||||
creators["invite nearby"] = &ActionContext::invite_nearby;
|
||||
creators["invite guild"] = &ActionContext::invite_guild;
|
||||
creators["leave far away"] = &ActionContext::leave_far_away;
|
||||
creators["move to dark portal"] = &ActionContext::move_to_dark_portal;
|
||||
creators["move from dark portal"] = &ActionContext::move_from_dark_portal;
|
||||
creators["use dark portal azeroth"] = &ActionContext::use_dark_portal_azeroth;
|
||||
creators["world buff"] = &ActionContext::world_buff;
|
||||
creators["hearthstone"] = &ActionContext::hearthstone;
|
||||
creators["cast random spell"] = &ActionContext::cast_random_spell;
|
||||
creators["free bg join"] = &ActionContext::free_bg_join;
|
||||
creators["use random recipe"] = &ActionContext::use_random_recipe;
|
||||
creators["use random quest item"] = &ActionContext::use_random_quest_item;
|
||||
creators["craft random item"] = &ActionContext::craft_random_item;
|
||||
creators["smart destroy item"] = &ActionContext::smart_destroy_item;
|
||||
creators["disenchant random item"] = &ActionContext::disenchant_random_item;
|
||||
creators["enchant random item"] = &ActionContext::enchant_random_item;
|
||||
creators["reset instances"] = &ActionContext::reset_instances;
|
||||
creators["buy petition"] = &ActionContext::buy_petition;
|
||||
creators["offer petition"] = &ActionContext::offer_petition;
|
||||
creators["offer petition nearby"] = &ActionContext::offer_petition_nearby;
|
||||
creators["turn in petition"] = &ActionContext::turn_in_petition;
|
||||
creators["buy tabard"] = &ActionContext::buy_tabard;
|
||||
creators["guild manage nearby"] = &ActionContext::guild_manage_nearby;
|
||||
creators["clean quest log"] = &ActionContext::clean_quest_log;
|
||||
|
||||
// BG Tactics
|
||||
static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); }
|
||||
static Action* bg_move_to_start(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to start"); }
|
||||
static Action* bg_move_to_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to objective"); }
|
||||
static Action* bg_select_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "select objective"); }
|
||||
static Action* bg_check_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "check objective"); }
|
||||
static Action* bg_attack_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "attack fc"); }
|
||||
static Action* bg_protect_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "protect fc"); }
|
||||
static Action* attack_enemy_fc(PlayerbotAI* botAI) { return new AttackEnemyFlagCarrierAction(botAI); }
|
||||
static Action* bg_use_buff(PlayerbotAI* botAI) { return new BGTactics(botAI, "use buff"); }
|
||||
static Action* bg_check_flag(PlayerbotAI* botAI) { return new BGTactics(botAI, "check flag"); }
|
||||
creators["bg tactics"] = &ActionContext::bg_tactics;
|
||||
creators["bg move to start"] = &ActionContext::bg_move_to_start;
|
||||
creators["bg move to objective"] = &ActionContext::bg_move_to_objective;
|
||||
creators["bg select objective"] = &ActionContext::bg_select_objective;
|
||||
creators["bg check objective"] = &ActionContext::bg_check_objective;
|
||||
creators["bg attack fc"] = &ActionContext::bg_attack_fc;
|
||||
creators["bg protect fc"] = &ActionContext::bg_protect_fc;
|
||||
creators["bg use buff"] = &ActionContext::bg_use_buff;
|
||||
creators["attack enemy flag carrier"] = &ActionContext::attack_enemy_fc;
|
||||
creators["bg check flag"] = &ActionContext::bg_check_flag;
|
||||
|
||||
// Vehicles
|
||||
static Action* enter_vehicle(PlayerbotAI* botAI) { return new EnterVehicleAction(botAI); }
|
||||
static Action* leave_vehicle(PlayerbotAI* botAI) { return new LeaveVehicleAction(botAI); }
|
||||
static Action* hurl_boulder(PlayerbotAI* botAI) { return new CastHurlBoulderAction(botAI); }
|
||||
static Action* ram(PlayerbotAI* botAI) { return new CastRamAction(botAI); }
|
||||
static Action* steam_blast(PlayerbotAI* botAI) { return new CastSteamBlastAction(botAI); }
|
||||
static Action* steam_rush(PlayerbotAI* botAI) { return new CastSteamRushAction(botAI); }
|
||||
static Action* napalm(PlayerbotAI* botAI) { return new CastNapalmAction(botAI); }
|
||||
static Action* fire_cannon(PlayerbotAI* botAI) { return new CastFireCannonAction(botAI); }
|
||||
static Action* incendiary_rocket(PlayerbotAI* botAI) { return new CastIncendiaryRocketAction(botAI); }
|
||||
static Action* rocket_blast(PlayerbotAI* botAI) { return new CastRocketBlastAction(botAI); }
|
||||
static Action* glaive_throw(PlayerbotAI* botAI) { return new CastGlaiveThrowAction(botAI); }
|
||||
static Action* blade_salvo(PlayerbotAI* botAI) { return new CastBladeSalvoAction(botAI); }
|
||||
creators["enter vehicle"] = &ActionContext::enter_vehicle;
|
||||
creators["leave vehicle"] = &ActionContext::leave_vehicle;
|
||||
creators["hurl boulder"] = &ActionContext::hurl_boulder;
|
||||
creators["ram"] = &ActionContext::ram;
|
||||
creators["steam rush"] = &ActionContext::steam_rush;
|
||||
creators["steam blast"] = &ActionContext::steam_blast;
|
||||
creators["napalm"] = &ActionContext::napalm;
|
||||
creators["fire cannon"] = &ActionContext::fire_cannon;
|
||||
creators["incendiary rocket"] = &ActionContext::incendiary_rocket;
|
||||
creators["rocket blast"] = &ActionContext::rocket_blast;
|
||||
creators["blade salvo"] = &ActionContext::blade_salvo;
|
||||
creators["glaive throw"] = &ActionContext::glaive_throw;
|
||||
|
||||
//Rpg
|
||||
static Action* rpg_stay(PlayerbotAI* botAI) { return new RpgStayAction(botAI); }
|
||||
static Action* rpg_work(PlayerbotAI* botAI) { return new RpgWorkAction(botAI); }
|
||||
static Action* rpg_emote(PlayerbotAI* botAI) { return new RpgEmoteAction(botAI); }
|
||||
static Action* rpg_cancel(PlayerbotAI* botAI) { return new RpgCancelAction(botAI); }
|
||||
static Action* rpg_taxi(PlayerbotAI* botAI) { return new RpgTaxiAction(botAI); }
|
||||
static Action* rpg_discover(PlayerbotAI* botAI) { return new RpgDiscoverAction(botAI); }
|
||||
static Action* rpg_start_quest(PlayerbotAI* botAI) { return new RpgStartQuestAction(botAI); }
|
||||
static Action* rpg_end_quest(PlayerbotAI* botAI) { return new RpgEndQuestAction(botAI); }
|
||||
static Action* rpg_buy(PlayerbotAI* botAI) { return new RpgBuyAction(botAI); }
|
||||
static Action* rpg_sell(PlayerbotAI* botAI) { return new RpgSellAction(botAI); }
|
||||
static Action* rpg_repair(PlayerbotAI* botAI) { return new RpgRepairAction(botAI); }
|
||||
static Action* rpg_train(PlayerbotAI* botAI) { return new RpgTrainAction(botAI); }
|
||||
static Action* rpg_heal(PlayerbotAI* botAI) { return new RpgHealAction(botAI); }
|
||||
static Action* rpg_home_bind(PlayerbotAI* botAI) { return new RpgHomeBindAction(botAI); }
|
||||
static Action* rpg_queue_bg(PlayerbotAI* botAI) { return new RpgQueueBgAction(botAI); }
|
||||
static Action* rpg_buy_petition(PlayerbotAI* botAI) { return new RpgBuyPetitionAction(botAI); }
|
||||
static Action* rpg_use(PlayerbotAI* botAI) { return new RpgUseAction(botAI); }
|
||||
static Action* rpg_spell(PlayerbotAI* botAI) { return new RpgSpellAction(botAI); }
|
||||
static Action* rpg_craft(PlayerbotAI* botAI) { return new RpgCraftAction(botAI); }
|
||||
static Action* rpg_trade_useful(PlayerbotAI* botAI) { return new RpgTradeUsefulAction(botAI); }
|
||||
static Action* rpg_duel(PlayerbotAI* botAI) { return new RpgDuelAction(botAI); }
|
||||
static Action* rpg_mount_anim(PlayerbotAI* botAI) { return new RpgMountAnimAction(botAI); }
|
||||
creators["rpg stay"] = &ActionContext::rpg_stay;
|
||||
creators["rpg work"] = &ActionContext::rpg_work;
|
||||
creators["rpg emote"] = &ActionContext::rpg_emote;
|
||||
creators["rpg cancel"] = &ActionContext::rpg_cancel;
|
||||
creators["rpg taxi"] = &ActionContext::rpg_taxi;
|
||||
creators["rpg discover"] = &ActionContext::rpg_discover;
|
||||
creators["rpg start quest"] = &ActionContext::rpg_start_quest;
|
||||
creators["rpg end quest"] = &ActionContext::rpg_end_quest;
|
||||
creators["rpg buy"] = &ActionContext::rpg_buy;
|
||||
creators["rpg sell"] = &ActionContext::rpg_sell;
|
||||
creators["rpg repair"] = &ActionContext::rpg_repair;
|
||||
creators["rpg train"] = &ActionContext::rpg_train;
|
||||
creators["rpg heal"] = &ActionContext::rpg_heal;
|
||||
creators["rpg home bind"] = &ActionContext::rpg_home_bind;
|
||||
creators["rpg queue bg"] = &ActionContext::rpg_queue_bg;
|
||||
creators["rpg buy petition"] = &ActionContext::rpg_buy_petition;
|
||||
creators["rpg use"] = &ActionContext::rpg_use;
|
||||
creators["rpg spell"] = &ActionContext::rpg_spell;
|
||||
creators["rpg craft"] = &ActionContext::rpg_craft;
|
||||
creators["rpg trade useful"] = &ActionContext::rpg_trade_useful;
|
||||
creators["rpg duel"] = &ActionContext::rpg_duel;
|
||||
creators["rpg mount anim"] = &ActionContext::rpg_mount_anim;
|
||||
|
||||
static Action* toggle_pet_spell(PlayerbotAI* ai) { return new TogglePetSpellAutoCastAction(ai); }
|
||||
static Action* pet_attack(PlayerbotAI* ai) { return new PetAttackAction(ai); }
|
||||
|
||||
creators["toggle pet spell"] = &ActionContext::toggle_pet_spell;
|
||||
creators["pet attack"] = &ActionContext::pet_attack;
|
||||
}
|
||||
|
||||
private:
|
||||
static Action* give_water(PlayerbotAI* botAI) { return new GiveWaterAction(botAI); }
|
||||
static Action* give_food(PlayerbotAI* botAI) { return new GiveFoodAction(botAI); }
|
||||
static Action* ra(PlayerbotAI* botAI) { return new RemoveAuraAction(botAI); }
|
||||
static Action* mark_rti(PlayerbotAI* botAI) { return new MarkRtiAction(botAI); }
|
||||
static Action* set_return_position(PlayerbotAI* botAI) { return new SetReturnPositionAction(botAI); }
|
||||
static Action* rpg(PlayerbotAI* botAI) { return new RpgAction(botAI); }
|
||||
static Action* crpg(PlayerbotAI* botAI) { return new CRpgAction(botAI); }
|
||||
static Action* choose_rpg_target(PlayerbotAI* botAI) { return new ChooseRpgTargetAction(botAI); }
|
||||
static Action* move_to_rpg_target(PlayerbotAI* botAI) { return new MoveToRpgTargetAction(botAI); }
|
||||
static Action* travel(PlayerbotAI* botAI) { return new TravelAction(botAI); }
|
||||
static Action* choose_travel_target(PlayerbotAI* botAI) { return new ChooseTravelTargetAction(botAI); }
|
||||
static Action* move_to_travel_target(PlayerbotAI* botAI) { return new MoveToTravelTargetAction(botAI); }
|
||||
static Action* move_out_of_collision(PlayerbotAI* botAI) { return new MoveOutOfCollisionAction(botAI); }
|
||||
static Action* move_random(PlayerbotAI* botAI) { return new MoveRandomAction(botAI); }
|
||||
static Action* check_values(PlayerbotAI* botAI) { return new CheckValuesAction(botAI); }
|
||||
static Action* greet(PlayerbotAI* botAI) { return new GreetAction(botAI); }
|
||||
static Action* check_mail(PlayerbotAI* botAI) { return new CheckMailAction(botAI); }
|
||||
static Action* drop_target(PlayerbotAI* botAI) { return new DropTargetAction(botAI); }
|
||||
static Action* attack_duel_opponent(PlayerbotAI* botAI) { return new AttackDuelOpponentAction(botAI); }
|
||||
static Action* guard(PlayerbotAI* botAI) { return new GuardAction(botAI); }
|
||||
static Action* open_loot(PlayerbotAI* botAI) { return new OpenLootAction(botAI); }
|
||||
static Action* move_to_loot(PlayerbotAI* botAI) { return new MoveToLootAction(botAI); }
|
||||
static Action* _return(PlayerbotAI* botAI) { return new ReturnAction(botAI); }
|
||||
static Action* shoot(PlayerbotAI* botAI) { return new CastShootAction(botAI); }
|
||||
static Action* melee(PlayerbotAI* botAI) { return new MeleeAction(botAI); }
|
||||
static Action* switch_to_melee(PlayerbotAI* botAI) { return new SwitchToMeleeAction(botAI); }
|
||||
static Action* switch_to_ranged(PlayerbotAI* botAI) { return new SwitchToRangedAction(botAI); }
|
||||
static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); }
|
||||
static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(botAI); }
|
||||
static Action* reach_party_member_to_heal(PlayerbotAI* botAI) { return new ReachPartyMemberToHealAction(botAI); }
|
||||
static Action* reach_party_member_to_resurrect(PlayerbotAI* botAI) { return new ReachPartyMemberToResurrectAction(botAI); }
|
||||
static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); }
|
||||
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
|
||||
static Action* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeAction(botAI); }
|
||||
static Action* combat_formation_move(PlayerbotAI* botAI) { return new CombatFormationMoveAction(botAI); }
|
||||
static Action* disperse_set(PlayerbotAI* botAI) { return new DisperseSetAction(botAI); }
|
||||
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }
|
||||
static Action* lifeblood(PlayerbotAI* botAI) { return new CastLifeBloodAction(botAI); }
|
||||
static Action* arcane_torrent(PlayerbotAI* botAI) { return new CastArcaneTorrentAction(botAI); }
|
||||
static Action* mana_tap(PlayerbotAI* botAI) { return new CastManaTapAction(botAI); }
|
||||
static Action* end_pull(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI, "-pull"); }
|
||||
|
||||
static Action* emote(PlayerbotAI* botAI) { return new EmoteAction(botAI); }
|
||||
static Action* talk(PlayerbotAI* botAI) { return new TalkAction(botAI); }
|
||||
static Action* suggest_what_to_do(PlayerbotAI* botAI) { return new SuggestWhatToDoAction(botAI); }
|
||||
static Action* suggest_trade(PlayerbotAI* botAI) { return new SuggestTradeAction(botAI); }
|
||||
static Action* suggest_dungeon(PlayerbotAI* botAI) { return new SuggestDungeonAction(botAI); }
|
||||
static Action* attack_anything(PlayerbotAI* botAI) { return new AttackAnythingAction(botAI); }
|
||||
static Action* attack_least_hp_target(PlayerbotAI* botAI) { return new AttackLeastHpTargetAction(botAI); }
|
||||
static Action* attack_enemy_player(PlayerbotAI* botAI) { return new AttackEnemyPlayerAction(botAI); }
|
||||
static Action* stay(PlayerbotAI* botAI) { return new StayAction(botAI); }
|
||||
static Action* sit(PlayerbotAI* botAI) { return new SitAction(botAI); }
|
||||
static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); }
|
||||
static Action* follow(PlayerbotAI* botAI) { return new FollowAction(botAI); }
|
||||
static Action* flee_to_master(PlayerbotAI* botAI) { return new FleeToMasterAction(botAI); }
|
||||
static Action* add_gathering_loot(PlayerbotAI* botAI) { return new AddGatheringLootAction(botAI); }
|
||||
static Action* add_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* loot(PlayerbotAI* botAI) { return new LootAction(botAI); }
|
||||
static Action* release_loot(PlayerbotAI* botAI) { return new ReleaseLootAction(botAI); }
|
||||
static Action* dps_assist(PlayerbotAI* botAI) { return new DpsAssistAction(botAI); }
|
||||
static Action* dps_aoe(PlayerbotAI* botAI) { return new DpsAoeAction(botAI); }
|
||||
static Action* attack_rti_target(PlayerbotAI* botAI) { return new AttackRtiTargetAction(botAI); }
|
||||
static Action* tank_assist(PlayerbotAI* botAI) { return new TankAssistAction(botAI); }
|
||||
static Action* drink(PlayerbotAI* botAI) { return new DrinkAction(botAI); }
|
||||
static Action* food(PlayerbotAI* botAI) { return new EatAction(botAI); }
|
||||
static Action* mana_potion(PlayerbotAI* botAI) { return new UseManaPotion(botAI); }
|
||||
static Action* healing_potion(PlayerbotAI* botAI) { return new UseHealingPotion(botAI); }
|
||||
static Action* healthstone(PlayerbotAI* botAI) { return new UseItemAction(botAI, "healthstone"); }
|
||||
static Action* move_out_of_enemy_contact(PlayerbotAI* botAI) { return new MoveOutOfEnemyContactAction(botAI); }
|
||||
static Action* set_facing(PlayerbotAI* botAI) { return new SetFacingTargetAction(botAI); }
|
||||
static Action* set_behind(PlayerbotAI* botAI) { return new SetBehindTargetAction(botAI); }
|
||||
static Action* say(PlayerbotAI* botAI) { return new SayAction(botAI); }
|
||||
static Action* reveal_gathering_item(PlayerbotAI* botAI) { return new RevealGatheringItemAction(botAI); }
|
||||
static Action* outfit(PlayerbotAI* botAI) { return new OutfitAction(botAI); }
|
||||
static Action* random_bot_update(PlayerbotAI* botAI) { return new RandomBotUpdateAction(botAI); }
|
||||
static Action* delay(PlayerbotAI* botAI) { return new DelayAction(botAI); }
|
||||
|
||||
static Action* apply_poison(PlayerbotAI* botAI) { return new ImbueWithPoisonAction(botAI); }
|
||||
static Action* apply_oil(PlayerbotAI* botAI) { return new ImbueWithOilAction(botAI); }
|
||||
static Action* apply_stone(PlayerbotAI* botAI) { return new ImbueWithStoneAction(botAI); }
|
||||
static Action* try_emergency(PlayerbotAI* botAI) { return new TryEmergencyAction(botAI); }
|
||||
static Action* mount(PlayerbotAI* botAI) { return new CastSpellAction(botAI, "mount"); }
|
||||
static Action* war_stomp(PlayerbotAI* botAI) { return new CastWarStompAction(botAI); }
|
||||
static Action* auto_talents(PlayerbotAI* botAI) { return new AutoSetTalentsAction(botAI); }
|
||||
static Action* auto_learn_spell(PlayerbotAI* botAI) { return new AutoLearnSpellAction(botAI); }
|
||||
static Action* auto_share_quest(PlayerbotAI* ai) { return new AutoShareQuestAction(ai); }
|
||||
static Action* auto_teleport_for_level(PlayerbotAI* botAI) { return new AutoTeleportForLevelAction(botAI); }
|
||||
static Action* auto_upgrade_equip(PlayerbotAI* botAI) { return new AutoUpgradeEquipAction(botAI); }
|
||||
static Action* xp_gain(PlayerbotAI* botAI) { return new XpGainAction(botAI); }
|
||||
static Action* invite_nearby(PlayerbotAI* botAI) { return new InviteNearbyToGroupAction(botAI); }
|
||||
static Action* invite_guild(PlayerbotAI* botAI) { return new InviteGuildToGroupAction(botAI); }
|
||||
static Action* leave_far_away(PlayerbotAI* botAI) { return new LeaveFarAwayAction(botAI); }
|
||||
static Action* move_to_dark_portal(PlayerbotAI* botAI) { return new MoveToDarkPortalAction(botAI); }
|
||||
static Action* use_dark_portal_azeroth(PlayerbotAI* botAI) { return new DarkPortalAzerothAction(botAI); }
|
||||
static Action* move_from_dark_portal(PlayerbotAI* botAI) { return new MoveFromDarkPortalAction(botAI); }
|
||||
static Action* world_buff(PlayerbotAI* botAI) { return new WorldBuffAction(botAI); }
|
||||
static Action* hearthstone(PlayerbotAI* botAI) { return new UseHearthStone(botAI); }
|
||||
static Action* cast_random_spell(PlayerbotAI* botAI) { return new CastRandomSpellAction(botAI); }
|
||||
static Action* free_bg_join(PlayerbotAI* botAI) { return new FreeBGJoinAction(botAI); }
|
||||
|
||||
static Action* use_random_recipe(PlayerbotAI* botAI) { return new UseRandomRecipe(botAI); }
|
||||
static Action* use_random_quest_item(PlayerbotAI* botAI) { return new UseRandomQuestItem(botAI); }
|
||||
static Action* craft_random_item(PlayerbotAI* botAI) { return new CraftRandomItemAction(botAI); }
|
||||
static Action* smart_destroy_item(PlayerbotAI* botAI) { return new SmartDestroyItemAction(botAI); }
|
||||
static Action* disenchant_random_item(PlayerbotAI* botAI) { return new DisEnchantRandomItemAction(botAI); }
|
||||
static Action* enchant_random_item(PlayerbotAI* botAI) { return new EnchantRandomItemAction(botAI); }
|
||||
static Action* reset_instances(PlayerbotAI* botAI) { return new ResetInstancesAction(botAI); }
|
||||
static Action* buy_petition(PlayerbotAI* botAI) { return new BuyPetitionAction(botAI); }
|
||||
static Action* offer_petition(PlayerbotAI* botAI) { return new PetitionOfferAction(botAI); }
|
||||
static Action* offer_petition_nearby(PlayerbotAI* botAI) { return new PetitionOfferNearbyAction(botAI); }
|
||||
static Action* turn_in_petition(PlayerbotAI* botAI) { return new PetitionTurnInAction(botAI); }
|
||||
static Action* buy_tabard(PlayerbotAI* botAI) { return new BuyTabardAction(botAI); }
|
||||
static Action* guild_manage_nearby(PlayerbotAI* botAI) { return new GuildManageNearbyAction(botAI); }
|
||||
static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); }
|
||||
|
||||
// BG Tactics
|
||||
static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); }
|
||||
static Action* bg_move_to_start(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to start"); }
|
||||
static Action* bg_move_to_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to objective"); }
|
||||
static Action* bg_select_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "select objective"); }
|
||||
static Action* bg_check_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "check objective"); }
|
||||
static Action* bg_attack_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "attack fc"); }
|
||||
static Action* bg_protect_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "protect fc"); }
|
||||
static Action* attack_enemy_fc(PlayerbotAI* botAI) { return new AttackEnemyFlagCarrierAction(botAI); }
|
||||
static Action* bg_use_buff(PlayerbotAI* botAI) { return new BGTactics(botAI, "use buff"); }
|
||||
static Action* bg_check_flag(PlayerbotAI* botAI) { return new BGTactics(botAI, "check flag"); }
|
||||
|
||||
// Vehicles
|
||||
static Action* enter_vehicle(PlayerbotAI* botAI) { return new EnterVehicleAction(botAI); }
|
||||
static Action* leave_vehicle(PlayerbotAI* botAI) { return new LeaveVehicleAction(botAI); }
|
||||
static Action* hurl_boulder(PlayerbotAI* botAI) { return new CastHurlBoulderAction(botAI); }
|
||||
static Action* ram(PlayerbotAI* botAI) { return new CastRamAction(botAI); }
|
||||
static Action* steam_blast(PlayerbotAI* botAI) { return new CastSteamBlastAction(botAI); }
|
||||
static Action* steam_rush(PlayerbotAI* botAI) { return new CastSteamRushAction(botAI); }
|
||||
static Action* napalm(PlayerbotAI* botAI) { return new CastNapalmAction(botAI); }
|
||||
static Action* fire_cannon(PlayerbotAI* botAI) { return new CastFireCannonAction(botAI); }
|
||||
static Action* incendiary_rocket(PlayerbotAI* botAI) { return new CastIncendiaryRocketAction(botAI); }
|
||||
static Action* rocket_blast(PlayerbotAI* botAI) { return new CastRocketBlastAction(botAI); }
|
||||
static Action* glaive_throw(PlayerbotAI* botAI) { return new CastGlaiveThrowAction(botAI); }
|
||||
static Action* blade_salvo(PlayerbotAI* botAI) { return new CastBladeSalvoAction(botAI); }
|
||||
|
||||
// Rpg
|
||||
static Action* rpg_stay(PlayerbotAI* botAI) { return new RpgStayAction(botAI); }
|
||||
static Action* rpg_work(PlayerbotAI* botAI) { return new RpgWorkAction(botAI); }
|
||||
static Action* rpg_emote(PlayerbotAI* botAI) { return new RpgEmoteAction(botAI); }
|
||||
static Action* rpg_cancel(PlayerbotAI* botAI) { return new RpgCancelAction(botAI); }
|
||||
static Action* rpg_taxi(PlayerbotAI* botAI) { return new RpgTaxiAction(botAI); }
|
||||
static Action* rpg_discover(PlayerbotAI* botAI) { return new RpgDiscoverAction(botAI); }
|
||||
static Action* rpg_start_quest(PlayerbotAI* botAI) { return new RpgStartQuestAction(botAI); }
|
||||
static Action* rpg_end_quest(PlayerbotAI* botAI) { return new RpgEndQuestAction(botAI); }
|
||||
static Action* rpg_buy(PlayerbotAI* botAI) { return new RpgBuyAction(botAI); }
|
||||
static Action* rpg_sell(PlayerbotAI* botAI) { return new RpgSellAction(botAI); }
|
||||
static Action* rpg_repair(PlayerbotAI* botAI) { return new RpgRepairAction(botAI); }
|
||||
static Action* rpg_train(PlayerbotAI* botAI) { return new RpgTrainAction(botAI); }
|
||||
static Action* rpg_heal(PlayerbotAI* botAI) { return new RpgHealAction(botAI); }
|
||||
static Action* rpg_home_bind(PlayerbotAI* botAI) { return new RpgHomeBindAction(botAI); }
|
||||
static Action* rpg_queue_bg(PlayerbotAI* botAI) { return new RpgQueueBgAction(botAI); }
|
||||
static Action* rpg_buy_petition(PlayerbotAI* botAI) { return new RpgBuyPetitionAction(botAI); }
|
||||
static Action* rpg_use(PlayerbotAI* botAI) { return new RpgUseAction(botAI); }
|
||||
static Action* rpg_spell(PlayerbotAI* botAI) { return new RpgSpellAction(botAI); }
|
||||
static Action* rpg_craft(PlayerbotAI* botAI) { return new RpgCraftAction(botAI); }
|
||||
static Action* rpg_trade_useful(PlayerbotAI* botAI) { return new RpgTradeUsefulAction(botAI); }
|
||||
static Action* rpg_duel(PlayerbotAI* botAI) { return new RpgDuelAction(botAI); }
|
||||
static Action* rpg_mount_anim(PlayerbotAI* botAI) { return new RpgMountAnimAction(botAI); }
|
||||
|
||||
static Action* toggle_pet_spell(PlayerbotAI* ai) { return new TogglePetSpellAutoCastAction(ai); }
|
||||
static Action* pet_attack(PlayerbotAI* ai) { return new PetAttackAction(ai); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AddLootAction.h"
|
||||
|
||||
#include "CellImpl.h"
|
||||
#include "Event.h"
|
||||
#include "GridNotifiers.h"
|
||||
@@ -35,20 +37,11 @@ bool AddAllLootAction::Execute(Event event)
|
||||
return added;
|
||||
}
|
||||
|
||||
bool AddLootAction::isUseful()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool AddLootAction::isUseful() { return true; }
|
||||
|
||||
bool AddAllLootAction::isUseful()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool AddAllLootAction::isUseful() { return true; }
|
||||
|
||||
bool AddAllLootAction::AddLoot(ObjectGuid guid)
|
||||
{
|
||||
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
||||
}
|
||||
bool AddAllLootAction::AddLoot(ObjectGuid guid) { return AI_VALUE(LootObjectStack*, "available loot")->Add(guid); }
|
||||
|
||||
bool AddGatheringLootAction::AddLoot(ObjectGuid guid)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ADDLOOTACTION_H
|
||||
@@ -12,30 +13,30 @@ class PlayerbotAI;
|
||||
|
||||
class AddLootAction : public Action
|
||||
{
|
||||
public:
|
||||
AddLootAction(PlayerbotAI* botAI) : Action(botAI, "add loot") { }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
public:
|
||||
AddLootAction(PlayerbotAI* botAI) : Action(botAI, "add loot") {}
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class AddAllLootAction : public Action
|
||||
{
|
||||
public:
|
||||
AddAllLootAction(PlayerbotAI* botAI, std::string const name = "add all loot") : Action(botAI, name) { }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
public:
|
||||
AddAllLootAction(PlayerbotAI* botAI, std::string const name = "add all loot") : Action(botAI, name) {}
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
protected:
|
||||
virtual bool AddLoot(ObjectGuid guid);
|
||||
protected:
|
||||
virtual bool AddLoot(ObjectGuid guid);
|
||||
};
|
||||
|
||||
class AddGatheringLootAction : public AddAllLootAction
|
||||
{
|
||||
public:
|
||||
AddGatheringLootAction(PlayerbotAI* botAI) : AddAllLootAction(botAI, "add gathering loot") { }
|
||||
public:
|
||||
AddGatheringLootAction(PlayerbotAI* botAI) : AddAllLootAction(botAI, "add gathering loot") {}
|
||||
|
||||
protected:
|
||||
bool AddLoot(ObjectGuid guid) override;
|
||||
protected:
|
||||
bool AddLoot(ObjectGuid guid) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AreaTriggerAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "LastMovementValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -10,7 +12,7 @@
|
||||
|
||||
bool ReachAreaTriggerAction::Execute(Event event)
|
||||
{
|
||||
if (botAI->IsRealPlayer()) //Do not trigger own area trigger.
|
||||
if (botAI->IsRealPlayer()) // Do not trigger own area trigger.
|
||||
return false;
|
||||
|
||||
uint32 triggerId;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_AREATRIGGERACTION_H
|
||||
@@ -11,18 +12,18 @@ class PlayerbotAI;
|
||||
|
||||
class ReachAreaTriggerAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
ReachAreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "reach area trigger") { }
|
||||
public:
|
||||
ReachAreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "reach area trigger") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AreaTriggerAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
AreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "area trigger") { }
|
||||
public:
|
||||
AreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "area trigger") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ArenaTeamActions.h"
|
||||
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -38,14 +40,16 @@ bool ArenaTeamAcceptAction::Execute(Event event)
|
||||
WorldPacket data(CMSG_ARENA_TEAM_ACCEPT);
|
||||
bot->GetSession()->HandleArenaTeamAcceptOpcode(data);
|
||||
bot->Say("Thanks for the invite!", LANG_UNIVERSAL);
|
||||
LOG_INFO("playerbots", "Bot {} <{}> accepts Arena Team invite", bot->GetGUID().ToString().c_str(), bot->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Bot {} <{}> accepts Arena Team invite", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetName().c_str());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldPacket data(CMSG_ARENA_TEAM_DECLINE);
|
||||
bot->GetSession()->HandleArenaTeamDeclineOpcode(data);
|
||||
LOG_INFO("playerbots", "Bot {} <{}> declines Arena Team invite", bot->GetGUID().ToString().c_str(), bot->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Bot {} <{}> declines Arena Team invite", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetName().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ARENATEAMACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class ArenaTeamAcceptAction : public Action
|
||||
{
|
||||
public:
|
||||
ArenaTeamAcceptAction(PlayerbotAI* botAI) : Action(botAI, "arena team accept") { }
|
||||
public:
|
||||
ArenaTeamAcceptAction(PlayerbotAI* botAI) : Action(botAI, "arena team accept") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AttackAction.h"
|
||||
|
||||
#include "CreatureAI.h"
|
||||
#include "Event.h"
|
||||
#include "LootObjectStack.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "Unit.h"
|
||||
|
||||
bool AttackAction::Execute(Event event)
|
||||
@@ -15,8 +17,9 @@ bool AttackAction::Execute(Event event)
|
||||
Unit* target = GetTarget();
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (!target->IsInWorld()) {
|
||||
|
||||
if (!target->IsInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Attack(target);
|
||||
@@ -36,7 +39,7 @@ bool AttackMyTargetAction::Execute(Event event)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
botAI->GetAiObjectContext()->GetValue<GuidVector>("prioritized targets")->Set({guid});
|
||||
bool result = Attack(botAI->GetUnit(guid));
|
||||
if (result)
|
||||
@@ -47,7 +50,8 @@ bool AttackMyTargetAction::Execute(Event event)
|
||||
|
||||
bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
{
|
||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE || bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE ||
|
||||
bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||
{
|
||||
if (verbose)
|
||||
botAI->TellError("I cannot attack in flight");
|
||||
@@ -109,16 +113,18 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
|
||||
context->GetValue<Unit*>("current target")->Set(target);
|
||||
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
|
||||
|
||||
|
||||
bool melee = bot->IsWithinMeleeRange(target) || botAI->IsMelee(bot);
|
||||
bot->Attack(target, melee);
|
||||
|
||||
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) {
|
||||
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target))
|
||||
{
|
||||
sServerFacade->SetFacingTo(bot, target);
|
||||
}
|
||||
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
||||
|
||||
if (!bot->GetVictim()) {
|
||||
if (!bot->GetVictim())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/* prevent pet dead immediately in group */
|
||||
@@ -141,12 +147,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttackDuelOpponentAction::isUseful()
|
||||
{
|
||||
return AI_VALUE(Unit*, "duel target");
|
||||
}
|
||||
bool AttackDuelOpponentAction::isUseful() { return AI_VALUE(Unit*, "duel target"); }
|
||||
|
||||
bool AttackDuelOpponentAction::Execute(Event event)
|
||||
{
|
||||
return Attack(AI_VALUE(Unit*, "duel target"));
|
||||
}
|
||||
bool AttackDuelOpponentAction::Execute(Event event) { return Attack(AI_VALUE(Unit*, "duel target")); }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_ATTACKACTION_H
|
||||
@@ -11,31 +12,34 @@ class PlayerbotAI;
|
||||
|
||||
class AttackAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
AttackAction(PlayerbotAI* botAI, std::string const name) : MovementAction(botAI, name) { }
|
||||
public:
|
||||
AttackAction(PlayerbotAI* botAI, std::string const name) : MovementAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
protected:
|
||||
bool Attack(Unit* target, bool with_pet = true);
|
||||
protected:
|
||||
bool Attack(Unit* target, bool with_pet = true);
|
||||
};
|
||||
|
||||
class AttackMyTargetAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackMyTargetAction(PlayerbotAI* botAI, std::string const name = "attack my target") : AttackAction(botAI, name) { }
|
||||
public:
|
||||
AttackMyTargetAction(PlayerbotAI* botAI, std::string const name = "attack my target") : AttackAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AttackDuelOpponentAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackDuelOpponentAction(PlayerbotAI* botAI, std::string const name = "attack duel opponent")
|
||||
: AttackAction(botAI, name)
|
||||
{
|
||||
public:
|
||||
AttackDuelOpponentAction(PlayerbotAI* botAI, std::string const name = "attack duel opponent") : AttackAction(botAI, name) { }
|
||||
}
|
||||
|
||||
public:
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
public:
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AutoLearnSpellAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "Playerbots.h"
|
||||
#include "BroadcastHelper.h"
|
||||
@@ -48,7 +51,8 @@ void AutoLearnSpellAction::LearnTrainerSpells(std::ostringstream* out)
|
||||
// bot->LearnDefaultSkills();
|
||||
|
||||
// CreatureTemplateContainer const* creatureTemplateContainer = sObjectMgr->GetCreatureTemplates();
|
||||
// for (CreatureTemplateContainer::const_iterator i = creatureTemplateContainer->begin(); i != creatureTemplateContainer->end(); ++i)
|
||||
// for (CreatureTemplateContainer::const_iterator i = creatureTemplateContainer->begin(); i !=
|
||||
// creatureTemplateContainer->end(); ++i)
|
||||
// {
|
||||
// CreatureTemplate const& co = i->second;
|
||||
// if (co.trainer_type != TRAINER_TYPE_TRADESKILLS && co.trainer_type != TRAINER_TYPE_CLASS)
|
||||
@@ -57,16 +61,17 @@ void AutoLearnSpellAction::LearnTrainerSpells(std::ostringstream* out)
|
||||
// if (co.trainer_type == TRAINER_TYPE_CLASS && co.trainer_class != bot->getClass())
|
||||
// continue;
|
||||
|
||||
// uint32 trainerId = co.Entry;
|
||||
// uint32 trainerId = co.Entry;
|
||||
|
||||
// TrainerSpellData const* trainer_spells = sObjectMgr->GetNpcTrainerSpells(trainerId);
|
||||
// TrainerSpellData const* trainer_spells = sObjectMgr->GetNpcTrainerSpells(trainerId);
|
||||
// if (!trainer_spells)
|
||||
// trainer_spells = sObjectMgr->GetNpcTrainerSpells(trainerId);
|
||||
|
||||
// if (!trainer_spells)
|
||||
// continue;
|
||||
|
||||
// for (TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr != trainer_spells->spellList.end(); ++itr)
|
||||
// for (TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr !=
|
||||
// trainer_spells->spellList.end(); ++itr)
|
||||
// {
|
||||
// TrainerSpell const* tSpell = &itr->second;
|
||||
|
||||
@@ -112,7 +117,7 @@ void AutoLearnSpellAction::LearnTrainerSpells(std::ostringstream* out)
|
||||
|
||||
void AutoLearnSpellAction::LearnQuestSpells(std::ostringstream* out)
|
||||
{
|
||||
//CreatureTemplate const* co = sCreatureStorage.LookupEntry<CreatureTemplate>(id);
|
||||
// CreatureTemplate const* co = sCreatureStorage.LookupEntry<CreatureTemplate>(id);
|
||||
ObjectMgr::QuestMap const& questTemplates = sObjectMgr->GetQuestTemplates();
|
||||
for (ObjectMgr::QuestMap::const_iterator i = questTemplates.begin(); i != questTemplates.end(); ++i)
|
||||
{
|
||||
@@ -122,7 +127,8 @@ void AutoLearnSpellAction::LearnQuestSpells(std::ostringstream* out)
|
||||
if (!quest->GetRequiredClasses() || quest->IsRepeatable() || quest->GetMinLevel() < 10)
|
||||
continue;
|
||||
|
||||
if (!bot->SatisfyQuestClass(quest, false) || quest->GetMinLevel() > bot->GetLevel() || !bot->SatisfyQuestRace(quest, false))
|
||||
if (!bot->SatisfyQuestClass(quest, false) || quest->GetMinLevel() > bot->GetLevel() ||
|
||||
!bot->SatisfyQuestRace(quest, false))
|
||||
continue;
|
||||
|
||||
if (quest->GetRewSpellCast() > 0)
|
||||
@@ -182,12 +188,15 @@ void AutoLearnSpellAction::LearnSpell(uint32 spellId, std::ostringstream* out)
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoUpgradeEquipAction::Execute(Event event) {
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot)) {
|
||||
bool AutoUpgradeEquipAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE);
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel) {
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||
{
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
factory.InitAmmo();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_AUTOLEARNSPELLACTION_H
|
||||
@@ -11,24 +12,24 @@ class PlayerbotAI;
|
||||
|
||||
class AutoLearnSpellAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoLearnSpellAction(PlayerbotAI* botAI, std::string const name = "auto learn spell") : Action(botAI, name) { }
|
||||
public:
|
||||
AutoLearnSpellAction(PlayerbotAI* botAI, std::string const name = "auto learn spell") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event);
|
||||
bool Execute(Event event);
|
||||
|
||||
private:
|
||||
void LearnSpells(std::ostringstream* out);
|
||||
void LearnTrainerSpells(std::ostringstream* out);
|
||||
void LearnQuestSpells(std::ostringstream* out);
|
||||
void LearnSpell(uint32 spellId, std::ostringstream* out);
|
||||
private:
|
||||
void LearnSpells(std::ostringstream* out);
|
||||
void LearnTrainerSpells(std::ostringstream* out);
|
||||
void LearnQuestSpells(std::ostringstream* out);
|
||||
void LearnSpell(uint32 spellId, std::ostringstream* out);
|
||||
};
|
||||
|
||||
class AutoUpgradeEquipAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoUpgradeEquipAction(PlayerbotAI* botAI, std::string const name = "auto upgrade equip") : Action(botAI, name) { }
|
||||
public:
|
||||
AutoUpgradeEquipAction(PlayerbotAI* botAI, std::string const name = "auto upgrade equip") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event);
|
||||
bool Execute(Event event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
#include "AutoTeleportForLevelAction.h"
|
||||
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
#include "Playerbots.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
bool AutoTeleportForLevelAction::Execute(Event event) {
|
||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot)) {
|
||||
bool AutoTeleportForLevelAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (botAI->HasRealPlayerMaster()) {
|
||||
if (botAI->HasRealPlayerMaster())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sRandomPlayerbotMgr->RandomTeleportForLevel(bot);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_AUTOTELEPORTFORLEVELACTION_H
|
||||
@@ -11,10 +12,13 @@ class PlayerbotAI;
|
||||
|
||||
class AutoTeleportForLevelAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoTeleportForLevelAction(PlayerbotAI* botAI, std::string const name = "auto teleport for level") : Action(botAI, name) { }
|
||||
public:
|
||||
AutoTeleportForLevelAction(PlayerbotAI* botAI, std::string const name = "auto teleport for level")
|
||||
: Action(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event);
|
||||
bool Execute(Event event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BankAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -102,7 +104,7 @@ bool BankAction::Deposit(Item* pItem)
|
||||
|
||||
out << "put " << chat->FormatItem(pItem->GetTemplate(), pItem->GetCount()) << " to bank";
|
||||
botAI->TellMaster(out.str());
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void BankAction::ListItems()
|
||||
@@ -143,14 +145,14 @@ Item* BankAction::FindItemInBank(uint32 ItemId)
|
||||
if (!pItemProto)
|
||||
continue;
|
||||
|
||||
if (pItemProto->ItemId == ItemId) // have required item
|
||||
if (pItemProto->ItemId == ItemId) // have required item
|
||||
return pItem;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 bag = BANK_SLOT_BAG_START; bag < BANK_SLOT_BAG_END; ++bag)
|
||||
{
|
||||
Bag const* const pBag = (Bag *) bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag);
|
||||
Bag const* const pBag = (Bag*)bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag);
|
||||
if (pBag)
|
||||
for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_BANKACTION_H
|
||||
@@ -12,17 +13,17 @@ class PlayerbotAI;
|
||||
|
||||
class BankAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
BankAction(PlayerbotAI* botAI) : InventoryAction(botAI, "bank") { }
|
||||
public:
|
||||
BankAction(PlayerbotAI* botAI) : InventoryAction(botAI, "bank") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool ExecuteBank(std::string const text, Unit* bank);
|
||||
void ListItems();
|
||||
bool Withdraw(uint32 itemid);
|
||||
bool Deposit(Item* pItem);
|
||||
Item* FindItemInBank(uint32 ItemId);
|
||||
private:
|
||||
bool ExecuteBank(std::string const text, Unit* bank);
|
||||
void ListItems();
|
||||
bool Withdraw(uint32 itemid);
|
||||
bool Deposit(Item* pItem);
|
||||
Item* FindItemInBank(uint32 ItemId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BattleGroundJoinAction.h"
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
@@ -16,7 +18,7 @@
|
||||
bool BGJoinAction::Execute(Event event)
|
||||
{
|
||||
uint32 queueType = AI_VALUE(uint32, "bg type");
|
||||
if (!queueType) // force join to fill bg
|
||||
if (!queueType) // force join to fill bg
|
||||
{
|
||||
if (bgList.empty())
|
||||
return false;
|
||||
@@ -53,7 +55,7 @@ bool BGJoinAction::Execute(Event event)
|
||||
}
|
||||
|
||||
// set bg type and bm guid
|
||||
//botAI->GetAiObjectContext()->GetValue<ObjectGuid>("bg master")->Set(bmGUID);
|
||||
// botAI->GetAiObjectContext()->GetValue<ObjectGuid>("bg master")->Set(bmGUID);
|
||||
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(queueTypeId);
|
||||
queueType = queueTypeId;
|
||||
}
|
||||
@@ -63,19 +65,19 @@ bool BGJoinAction::Execute(Event event)
|
||||
|
||||
bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
{
|
||||
|
||||
ArenaTeam* arenateam = sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type);
|
||||
|
||||
if (!arenateam)
|
||||
return false;
|
||||
|
||||
if (arenateam->GetMembersSize() < ((uint32) arenateam->GetType()))
|
||||
if (arenateam->GetMembersSize() < ((uint32)arenateam->GetType()))
|
||||
return false;
|
||||
|
||||
GuidVector members;
|
||||
|
||||
// search for arena team members and make them online
|
||||
for (ArenaTeam::MemberList::iterator itr = arenateam->GetMembers().begin(); itr != arenateam->GetMembers().end(); ++itr)
|
||||
for (ArenaTeam::MemberList::iterator itr = arenateam->GetMembers().begin(); itr != arenateam->GetMembers().end();
|
||||
++itr)
|
||||
{
|
||||
bool offline = false;
|
||||
Player* member = ObjectAccessor::FindConnectedPlayer(itr->Guid);
|
||||
@@ -83,8 +85,8 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
{
|
||||
offline = true;
|
||||
}
|
||||
//if (!member && !sObjectMgr->GetPlayerAccountIdByGUID(itr->guid))
|
||||
// continue;
|
||||
// if (!member && !sObjectMgr->GetPlayerAccountIdByGUID(itr->guid))
|
||||
// continue;
|
||||
|
||||
if (offline)
|
||||
sRandomPlayerbotMgr->AddPlayerBot(itr->Guid, 0);
|
||||
@@ -107,10 +109,10 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
if (member->GetGUID() == bot->GetGUID())
|
||||
continue;
|
||||
|
||||
if(member->InBattleground())
|
||||
if (member->InBattleground())
|
||||
continue;
|
||||
|
||||
if(member->InBattlegroundQueue())
|
||||
if (member->InBattlegroundQueue())
|
||||
continue;
|
||||
|
||||
if (member->GetGroup())
|
||||
@@ -125,7 +127,8 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
|
||||
if (!members.size() || (int)members.size() < (int)(arenateam->GetType() - 1))
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}> has not enough members for match", arenateam->GetId(), arenateam->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Team #{} <{}> has not enough members for match", arenateam->GetId(),
|
||||
arenateam->GetName().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -137,24 +140,25 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
|
||||
if (!group->Create(bot))
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}>: Can't create group for arena queue", arenateam->GetId(), arenateam->GetName());
|
||||
LOG_INFO("playerbots", "Team #{} <{}>: Can't create group for arena queue", arenateam->GetId(),
|
||||
arenateam->GetName());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
sGroupMgr->AddGroup(group);
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Leader of <{}>", bot->GetGUID().ToString().c_str(), bot->GetName(), arenateam->GetName());
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Leader of <{}>", bot->GetGUID().ToString().c_str(), bot->GetName(),
|
||||
arenateam->GetName());
|
||||
|
||||
for (auto i = begin(members); i != end(members); ++i)
|
||||
{
|
||||
if (*i == bot->GetGUID())
|
||||
continue;
|
||||
|
||||
//if (count >= (int)arenateam->GetType())
|
||||
//break;
|
||||
// if (count >= (int)arenateam->GetType())
|
||||
// break;
|
||||
|
||||
if (group->GetMembersCount() >= (uint32) arenateam->GetType())
|
||||
if (group->GetMembersCount() >= (uint32)arenateam->GetType())
|
||||
break;
|
||||
|
||||
Player* member = ObjectAccessor::FindConnectedPlayer(*i);
|
||||
@@ -174,19 +178,20 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
memberBotAI->Reset();
|
||||
member->TeleportTo(bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), 0);
|
||||
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Member of <{}>", member->GetGUID().ToString().c_str(), member->GetName().c_str(), arenateam->GetName().c_str());
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Member of <{}>", member->GetGUID().ToString().c_str(),
|
||||
member->GetName().c_str(), arenateam->GetName().c_str());
|
||||
}
|
||||
|
||||
if (group && group->GetMembersCount() >= (uint32)arenateam->GetType())
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is ready for match", arenateam->GetId(), arenateam->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is ready for match", arenateam->GetId(),
|
||||
arenateam->GetName().c_str());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is not ready for match (not enough members)", arenateam->GetId(), arenateam->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is not ready for match (not enough members)", arenateam->GetId(),
|
||||
arenateam->GetName().c_str());
|
||||
group->Disband();
|
||||
}
|
||||
|
||||
@@ -229,7 +234,10 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
return false;
|
||||
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() ? sPlayerbotAIConfig->diffEmpty : sPlayerbotAIConfig->diffWithPlayer) * 1.1;
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty()
|
||||
? sPlayerbotAIConfig->diffEmpty
|
||||
: sPlayerbotAIConfig->diffWithPlayer) *
|
||||
1.1;
|
||||
|
||||
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
|
||||
uint32 TeamSize = bg->GetMaxPlayersPerTeam();
|
||||
@@ -251,11 +259,15 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
|
||||
// Check if bots should join Rated Arena (Only captains can queue)
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
uint32 ratedArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
|
||||
if (isRated)
|
||||
{
|
||||
@@ -269,10 +281,14 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
|
||||
// Check if bots should join Skirmish Arena
|
||||
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||
uint32 skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 skirmishArenaBotCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||
if (maxRequiredSkirmishBots != 0)
|
||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||
@@ -293,14 +309,14 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -351,9 +367,9 @@ bool BGJoinAction::isUseful()
|
||||
return false;
|
||||
|
||||
// do not try if in dungeon
|
||||
//Map* map = bot->GetMap();
|
||||
//if (map && map->Instanceable())
|
||||
// return false;
|
||||
// Map* map = bot->GetMap();
|
||||
// if (map && map->Instanceable())
|
||||
// return false;
|
||||
|
||||
bgList.clear();
|
||||
ratedList.clear();
|
||||
@@ -415,8 +431,8 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
|
||||
// get BG MapId
|
||||
uint32 bgTypeId_ = bgTypeId;
|
||||
uint32 instanceId = 0; // 0 = First Available
|
||||
|
||||
uint32 instanceId = 0; // 0 = First Available
|
||||
|
||||
bool isPremade = false;
|
||||
bool isArena = false;
|
||||
bool isRated = false;
|
||||
@@ -431,7 +447,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
isArena = true;
|
||||
|
||||
// get battlemaster
|
||||
//Unit* unit = botAI->GetUnit(AI_VALUE2(CreatureData const*, "bg master", bgTypeId));
|
||||
// Unit* unit = botAI->GetUnit(AI_VALUE2(CreatureData const*, "bg master", bgTypeId));
|
||||
Unit* unit = botAI->GetUnit(sRandomPlayerbotMgr->GetBattleMasterGUID(bot, bgTypeId));
|
||||
if (!unit && isArena)
|
||||
{
|
||||
@@ -442,10 +458,10 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
|
||||
// This breaks groups as refresh includes a remove from group function call.
|
||||
// refresh food/regs
|
||||
//sRandomPlayerbotMgr->Refresh(bot);
|
||||
// sRandomPlayerbotMgr->Refresh(bot);
|
||||
|
||||
bool joinAsGroup = bot->GetGroup() && bot->GetGroup()->GetLeaderGUID() == bot->GetGUID();
|
||||
|
||||
|
||||
// in wotlk only arena requires battlemaster guid
|
||||
ObjectGuid guid = isArena ? unit->GetGUID() : bot->GetGUID();
|
||||
|
||||
@@ -459,7 +475,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
_bgType = "AB";
|
||||
break;
|
||||
break;
|
||||
case BATTLEGROUND_EY:
|
||||
_bgType = "EotS";
|
||||
break;
|
||||
@@ -505,10 +521,11 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> queued {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _bgType.c_str(),
|
||||
isRated ? "Rated Arena" : isArena ? "Arena" : "");
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> queued {} {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _bgType.c_str(),
|
||||
isRated ? "Rated Arena"
|
||||
: isArena ? "Arena"
|
||||
: "");
|
||||
|
||||
if (isArena)
|
||||
{
|
||||
@@ -519,17 +536,19 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
}
|
||||
else if (!joinAsGroup)
|
||||
{
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount++;
|
||||
else
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount += bot->GetGroup()->GetMembersCount();
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount +=
|
||||
bot->GetGroup()->GetMembersCount();
|
||||
else
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount += bot->GetGroup()->GetMembersCount();
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount +=
|
||||
bot->GetGroup()->GetMembersCount();
|
||||
}
|
||||
|
||||
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(0);
|
||||
@@ -559,7 +578,10 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
return false;
|
||||
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() ? sPlayerbotAIConfig->diffEmpty : sPlayerbotAIConfig->diffWithPlayer) * 1.1;
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty()
|
||||
? sPlayerbotAIConfig->diffEmpty
|
||||
: sPlayerbotAIConfig->diffWithPlayer) *
|
||||
1.1;
|
||||
|
||||
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
|
||||
uint32 TeamSize = bg->GetMaxPlayersPerTeam();
|
||||
@@ -581,11 +603,15 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
|
||||
// Check if bots should join Rated Arena (Only captains can queue)
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
uint32 ratedArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
|
||||
if (isRated)
|
||||
{
|
||||
@@ -599,10 +625,14 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
|
||||
// Check if bots should join Skirmish Arena
|
||||
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||
uint32 skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 skirmishArenaBotCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||
if (maxRequiredSkirmishBots != 0)
|
||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||
@@ -623,14 +653,14 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -642,7 +672,7 @@ bool BGLeaveAction::Execute(Event event)
|
||||
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
||||
return false;
|
||||
|
||||
//botAI->ChangeStrategy("-bg", BOT_STATE_NON_COMBAT);
|
||||
// botAI->ChangeStrategy("-bg", BOT_STATE_NON_COMBAT);
|
||||
|
||||
BattlegroundQueueTypeId queueTypeId = bot->GetBattlegroundQueueTypeId(0);
|
||||
BattlegroundTypeId _bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
||||
@@ -661,8 +691,9 @@ bool BGLeaveAction::Execute(Event event)
|
||||
|
||||
if (bot->InBattleground())
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG");
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG");
|
||||
|
||||
WorldPacket leave(CMSG_LEAVE_BATTLEFIELD);
|
||||
leave << uint8(0) << uint8(0) << uint32(0) << uint16(0);
|
||||
@@ -683,8 +714,9 @@ bool BGLeaveAction::Execute(Event event)
|
||||
if (!queueType)
|
||||
return false;
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} queue",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), isArena ? "Arena" : "BG");
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} queue", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(),
|
||||
isArena ? "Arena" : "BG");
|
||||
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||
packet << type << unk2 << (uint32)_bgTypeId << unk << uint8(0);
|
||||
@@ -701,10 +733,7 @@ bool BGLeaveAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BGStatusAction::isUseful()
|
||||
{
|
||||
return bot->InBattlegroundQueue();
|
||||
}
|
||||
bool BGStatusAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||
|
||||
bool BGStatusAction::Execute(Event event)
|
||||
{
|
||||
@@ -725,7 +754,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
|
||||
WorldPacket p(event.getPacket());
|
||||
statusid = 0;
|
||||
p >> QueueSlot; // queue id (0...2) - player can be in 3 queues in time
|
||||
p >> QueueSlot; // queue id (0...2) - player can be in 3 queues in time
|
||||
p >> arenaByte;
|
||||
if (arenaByte == 0)
|
||||
return false;
|
||||
@@ -738,20 +767,20 @@ bool BGStatusAction::Execute(Event event)
|
||||
// check status
|
||||
switch (statusid)
|
||||
{
|
||||
case STATUS_WAIT_QUEUE: // status_in_queue
|
||||
p >> Time1; // average wait time, milliseconds
|
||||
p >> Time2; // time in queue, updated every minute!, milliseconds
|
||||
case STATUS_WAIT_QUEUE: // status_in_queue
|
||||
p >> Time1; // average wait time, milliseconds
|
||||
p >> Time2; // time in queue, updated every minute!, milliseconds
|
||||
break;
|
||||
case STATUS_WAIT_JOIN: // status_invite
|
||||
p >> mapId; // map id
|
||||
case STATUS_WAIT_JOIN: // status_invite
|
||||
p >> mapId; // map id
|
||||
p >> unk0;
|
||||
p >> Time1; // time to remove from queue, milliseconds
|
||||
p >> Time1; // time to remove from queue, milliseconds
|
||||
break;
|
||||
case STATUS_IN_PROGRESS: // status_in_progress
|
||||
p >> mapId; // map id
|
||||
case STATUS_IN_PROGRESS: // status_in_progress
|
||||
p >> mapId; // map id
|
||||
p >> unk0;
|
||||
p >> Time1; // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
|
||||
p >> Time2; // time from bg start, milliseconds
|
||||
p >> Time1; // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
|
||||
p >> Time2; // time from bg start, milliseconds
|
||||
p >> arenaTeam;
|
||||
break;
|
||||
default:
|
||||
@@ -773,7 +802,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
bracketId = pvpDiff->GetBracketId();
|
||||
|
||||
bool isArena = false;
|
||||
uint8 type = false; // arenatype if arena
|
||||
uint8 type = false; // arenatype if arena
|
||||
uint16 unk = 0x1F90;
|
||||
uint8 unk2 = 0x0;
|
||||
uint8 action = 0x1;
|
||||
@@ -829,10 +858,11 @@ bool BGStatusAction::Execute(Event event)
|
||||
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
|
||||
if (Time1 == TIME_TO_AUTOREMOVE) //Battleground is over, bot needs to leave
|
||||
if (Time1 == TIME_TO_AUTOREMOVE) // Battleground is over, bot needs to leave
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} <{}> ({} {}): Received BG status TIME_REMOVE for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetName(), bot->GetLevel(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetName(), bot->GetLevel(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
// remove warsong strategy
|
||||
if (IsRandomBot)
|
||||
@@ -851,12 +881,13 @@ bool BGStatusAction::Execute(Event event)
|
||||
botAI->ChangeStrategy("-arena", BOT_STATE_COMBAT);
|
||||
botAI->ChangeStrategy("-arena", BOT_STATE_NON_COMBAT);
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} - {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} - {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
WorldPacket packet(CMSG_LEAVE_BATTLEFIELD);
|
||||
packet << uint8(0);
|
||||
packet << uint8(0); // BattlegroundTypeId-1 ?
|
||||
packet << uint8(0); // BattlegroundTypeId-1 ?
|
||||
packet << uint32(0);
|
||||
packet << uint16(0);
|
||||
|
||||
@@ -872,12 +903,13 @@ bool BGStatusAction::Execute(Event event)
|
||||
posMap["bg objective"] = pos;
|
||||
}
|
||||
|
||||
if (statusid == STATUS_WAIT_QUEUE) // bot is in queue
|
||||
if (statusid == STATUS_WAIT_QUEUE) // bot is in queue
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Received BG status WAIT_QUEUE (wait time: {}) for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), Time2, isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), Time2, isArena ? "Arena" : "BG", _bgType);
|
||||
// temp fix for crash
|
||||
//return true;
|
||||
// return true;
|
||||
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(queueTypeId);
|
||||
GroupQueueInfo ginfo;
|
||||
@@ -886,7 +918,8 @@ bool BGStatusAction::Execute(Event event)
|
||||
if (ginfo.IsInvitedToBGInstanceGUID && !bot->InBattleground())
|
||||
{
|
||||
// BattlegroundMgr::GetBattleground() does not return battleground if bgTypeId==BATTLEGROUND_AA
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(
|
||||
ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
if (bg)
|
||||
{
|
||||
if (isArena)
|
||||
@@ -894,8 +927,9 @@ bool BGStatusAction::Execute(Event event)
|
||||
_bgTypeId = bg->GetBgTypeID();
|
||||
}
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Force join {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Force join {} {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG", _bgType);
|
||||
WorldPacket emptyPacket;
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
action = 0x1;
|
||||
@@ -905,8 +939,10 @@ bool BGStatusAction::Execute(Event event)
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies(false);
|
||||
if (!bot->GetBattleground()) {
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that
|
||||
if (!bot->GetBattleground())
|
||||
{
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up
|
||||
// properly, set bg for "bg strategy check" to fix that
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
}
|
||||
context->GetValue<uint32>("bg role")->Set(urand(0, 9));
|
||||
@@ -931,23 +967,26 @@ bool BGStatusAction::Execute(Event event)
|
||||
else
|
||||
timer = TIME_TO_AUTOREMOVE + 1000 * (bg->GetMaxPlayersPerTeam() * 8);
|
||||
|
||||
if (Time2 > timer && isArena) // disabled for BG
|
||||
if (Time2 > timer && isArena) // disabled for BG
|
||||
leaveQ = true;
|
||||
|
||||
if (leaveQ && ((bot->GetGroup() && bot->GetGroup()->IsLeader(bot->GetGUID())) || !(bot->GetGroup() || botAI->GetMaster())))
|
||||
if (leaveQ && ((bot->GetGroup() && bot->GetGroup()->IsLeader(bot->GetGUID())) ||
|
||||
!(bot->GetGroup() || botAI->GetMaster())))
|
||||
{
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
bool realPlayers = false;
|
||||
if (isRated)
|
||||
realPlayers = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount > 0;
|
||||
else
|
||||
realPlayers = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
||||
realPlayers =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
||||
|
||||
if (realPlayers)
|
||||
return false;
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> waited too long and leaves queue ({} {}).",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||
action = 0;
|
||||
@@ -963,17 +1002,19 @@ bool BGStatusAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
if (statusid == STATUS_IN_PROGRESS) // placeholder for Leave BG if it takes too long
|
||||
if (statusid == STATUS_IN_PROGRESS) // placeholder for Leave BG if it takes too long
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Received BG status IN_PROGRESS for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (statusid == STATUS_WAIT_JOIN) //bot may join
|
||||
if (statusid == STATUS_WAIT_JOIN) // bot may join
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Received BG status WAIT_JOIN for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
if (isArena)
|
||||
{
|
||||
@@ -984,18 +1025,21 @@ bool BGStatusAction::Execute(Event event)
|
||||
if (!bgQueue.GetPlayerGroupInfoData(bot->GetGUID(), &ginfo))
|
||||
{
|
||||
LOG_ERROR("playerbots", "Bot {} {}:{} <{}>: Missing QueueInfo for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H",
|
||||
bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
// BattlegroundMgr::GetBattleground() does not return battleground if bgTypeId==BATTLEGROUND_AA
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(
|
||||
ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
if (!bg)
|
||||
{
|
||||
LOG_ERROR("playerbots", "Bot {} {}:{} <{}>: Missing QueueInfo for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H",
|
||||
bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1003,8 +1047,9 @@ bool BGStatusAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> joined {} - {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> joined {} - {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
WorldPacket emptyPacket;
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
@@ -1016,8 +1061,10 @@ bool BGStatusAction::Execute(Event event)
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies(false);
|
||||
if (!bot->GetBattleground()) {
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that
|
||||
if (!bot->GetBattleground())
|
||||
{
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly,
|
||||
// set bg for "bg strategy check" to fix that
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
}
|
||||
context->GetValue<uint32>("bg role")->Set(urand(0, 9));
|
||||
@@ -1043,25 +1090,25 @@ bool BGStatusCheckAction::Execute(Event event)
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_STATUS);
|
||||
bot->GetSession()->HandleBattlefieldStatusOpcode(packet);
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}> ({} {}) : Checking BG invite status",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetName(), bot->GetLevel(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H");
|
||||
LOG_INFO("playerbots", "Bot {} <{}> ({} {}) : Checking BG invite status", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetName(), bot->GetLevel(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BGStatusCheckAction::isUseful()
|
||||
{
|
||||
return bot->InBattlegroundQueue();
|
||||
}
|
||||
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||
|
||||
bool BGStrategyCheckAction::Execute(Event event)
|
||||
{
|
||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();;
|
||||
if (!inside_bg && botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT)) {
|
||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
||||
;
|
||||
if (!inside_bg && botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT))
|
||||
{
|
||||
botAI->ResetStrategies();
|
||||
return true;
|
||||
}
|
||||
if (inside_bg && !botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT)) {
|
||||
if (inside_bg && !botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT))
|
||||
{
|
||||
botAI->ResetStrategies();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_BATTLEGROUNDJOINACTION_H
|
||||
@@ -18,60 +19,60 @@ enum BattlegroundBracketId : uint8;
|
||||
|
||||
class BGJoinAction : public Action
|
||||
{
|
||||
public:
|
||||
BGJoinAction(PlayerbotAI* botAI, std::string const name = "bg join") : Action(botAI, name) { }
|
||||
public:
|
||||
BGJoinAction(PlayerbotAI* botAI, std::string const name = "bg join") : Action(botAI, name) {}
|
||||
|
||||
bool isUseful() override;
|
||||
bool canJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
virtual bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
bool Execute(Event event) override;
|
||||
virtual bool gatherArenaTeam(ArenaType type);
|
||||
bool isUseful() override;
|
||||
bool canJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
virtual bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
bool Execute(Event event) override;
|
||||
virtual bool gatherArenaTeam(ArenaType type);
|
||||
|
||||
protected:
|
||||
bool JoinQueue(uint32 type);
|
||||
std::vector<uint32> bgList;
|
||||
std::vector<uint32> ratedList;
|
||||
protected:
|
||||
bool JoinQueue(uint32 type);
|
||||
std::vector<uint32> bgList;
|
||||
std::vector<uint32> ratedList;
|
||||
};
|
||||
|
||||
class FreeBGJoinAction : public BGJoinAction
|
||||
{
|
||||
public:
|
||||
FreeBGJoinAction(PlayerbotAI* botAI, std::string const name = "free bg join") : BGJoinAction(botAI, name) { }
|
||||
public:
|
||||
FreeBGJoinAction(PlayerbotAI* botAI, std::string const name = "free bg join") : BGJoinAction(botAI, name) {}
|
||||
|
||||
bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId) override;
|
||||
bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId) override;
|
||||
};
|
||||
|
||||
class BGLeaveAction : public Action
|
||||
{
|
||||
public:
|
||||
BGLeaveAction(PlayerbotAI* botAI, std::string const name = "bg leave") : Action(botAI, name) { }
|
||||
BGLeaveAction(PlayerbotAI* botAI, std::string const name = "bg leave") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class BGStatusAction : public Action
|
||||
{
|
||||
public:
|
||||
BGStatusAction(PlayerbotAI* botAI) : Action(botAI, "bg status") { }
|
||||
BGStatusAction(PlayerbotAI* botAI) : Action(botAI, "bg status") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class BGStatusCheckAction : public Action
|
||||
{
|
||||
public:
|
||||
BGStatusCheckAction(PlayerbotAI* botAI, std::string const name = "bg status check") : Action(botAI, name) { }
|
||||
public:
|
||||
BGStatusCheckAction(PlayerbotAI* botAI, std::string const name = "bg status check") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class BGStrategyCheckAction : public Action
|
||||
{
|
||||
public:
|
||||
BGStrategyCheckAction(PlayerbotAI* botAI, std::string const name = "bg strategy check") : Action(botAI, name) { }
|
||||
public:
|
||||
BGStrategyCheckAction(PlayerbotAI* botAI, std::string const name = "bg strategy check") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_BATTLEGROUNDTACTICSACTION_H
|
||||
@@ -14,11 +15,11 @@ struct Position;
|
||||
|
||||
#define SPELL_CAPTURE_BANNER 21651
|
||||
|
||||
typedef void(*BattleBotWaypointFunc)();
|
||||
typedef void (*BattleBotWaypointFunc)();
|
||||
|
||||
struct BattleBotWaypoint
|
||||
{
|
||||
BattleBotWaypoint(float x_, float y_, float z_, BattleBotWaypointFunc func) : x(x_), y(y_), z(z_), pFunc(func) { };
|
||||
BattleBotWaypoint(float x_, float y_, float z_, BattleBotWaypointFunc func) : x(x_), y(y_), z(z_), pFunc(func){};
|
||||
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
@@ -36,43 +37,43 @@ extern std::vector<BattleBotPath*> const vPaths_IC;
|
||||
|
||||
class BGTactics : public MovementAction
|
||||
{
|
||||
public:
|
||||
static bool HandleConsoleCommand(ChatHandler* handler, char const* args);
|
||||
public:
|
||||
static bool HandleConsoleCommand(ChatHandler* handler, char const* args);
|
||||
|
||||
BGTactics(PlayerbotAI* botAI, std::string const name = "bg tactics") : MovementAction(botAI, name) { }
|
||||
BGTactics(PlayerbotAI* botAI, std::string const name = "bg tactics") : MovementAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
static std::string const HandleConsoleCommandPrivate(WorldSession* session, char const* args);
|
||||
bool moveToStart(bool force = false);
|
||||
bool selectObjective(bool reset = false);
|
||||
bool moveToObjective();
|
||||
bool selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 currentPoint, bool reverse = false);
|
||||
bool startNewPathBegin(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool startNewPathFree(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool resetObjective();
|
||||
bool wsgPaths();
|
||||
bool eyJumpDown();
|
||||
bool atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<uint32> const& vFlagIds);
|
||||
bool flagTaken();
|
||||
bool teamFlagTaken();
|
||||
bool protectFC();
|
||||
bool useBuff();
|
||||
uint32 getPlayersInArea(TeamId teamId, Position point, float range, bool combat = true);
|
||||
bool IsLockedInsideKeep();
|
||||
private:
|
||||
static std::string const HandleConsoleCommandPrivate(WorldSession* session, char const* args);
|
||||
bool moveToStart(bool force = false);
|
||||
bool selectObjective(bool reset = false);
|
||||
bool moveToObjective();
|
||||
bool selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 currentPoint, bool reverse = false);
|
||||
bool startNewPathBegin(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool startNewPathFree(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool resetObjective();
|
||||
bool wsgPaths();
|
||||
bool eyJumpDown();
|
||||
bool atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<uint32> const& vFlagIds);
|
||||
bool flagTaken();
|
||||
bool teamFlagTaken();
|
||||
bool protectFC();
|
||||
bool useBuff();
|
||||
uint32 getPlayersInArea(TeamId teamId, Position point, float range, bool combat = true);
|
||||
bool IsLockedInsideKeep();
|
||||
};
|
||||
|
||||
class ArenaTactics : public MovementAction
|
||||
{
|
||||
public:
|
||||
ArenaTactics(PlayerbotAI* botAI, std::string const name = "arena tactics") : MovementAction(botAI, name) { }
|
||||
public:
|
||||
ArenaTactics(PlayerbotAI* botAI, std::string const name = "arena tactics") : MovementAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool moveToCenter(Battleground *bg);
|
||||
private:
|
||||
bool moveToCenter(Battleground* bg);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,60 +1,62 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BuffAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
class FindBuffVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
FindBuffVisitor(Player* bot) : IterateItemsVisitor(), bot(bot)
|
||||
{
|
||||
}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (bot->CanUseItem(item->GetTemplate()) != EQUIP_ERR_OK)
|
||||
return true;
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
|
||||
if (proto->Class != ITEM_CLASS_CONSUMABLE)
|
||||
return true;
|
||||
|
||||
if (proto->SubClass != ITEM_SUBCLASS_ELIXIR && proto->SubClass != ITEM_SUBCLASS_FLASK && proto->SubClass != ITEM_SUBCLASS_SCROLL &&
|
||||
proto->SubClass != ITEM_SUBCLASS_FOOD && proto->SubClass != ITEM_SUBCLASS_CONSUMABLE_OTHER && proto->SubClass != ITEM_SUBCLASS_ITEM_ENHANCEMENT)
|
||||
return true;
|
||||
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; i++)
|
||||
{
|
||||
uint32 spellId = proto->Spells[i].SpellId;
|
||||
if (!spellId)
|
||||
continue;
|
||||
|
||||
if (bot->HasAura(spellId))
|
||||
return true;
|
||||
|
||||
Item* itemForSpell = *GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<Item*>("item for spell", spellId);
|
||||
if (itemForSpell && itemForSpell->IsInWorld() && itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
|
||||
return true;
|
||||
|
||||
if (items.find(proto->SubClass) == items.end())
|
||||
items[proto->SubClass] = std::vector<Item*>();
|
||||
|
||||
items[proto->SubClass].push_back(item);
|
||||
break;
|
||||
}
|
||||
public:
|
||||
FindBuffVisitor(Player* bot) : IterateItemsVisitor(), bot(bot) {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (bot->CanUseItem(item->GetTemplate()) != EQUIP_ERR_OK)
|
||||
return true;
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
|
||||
if (proto->Class != ITEM_CLASS_CONSUMABLE)
|
||||
return true;
|
||||
|
||||
if (proto->SubClass != ITEM_SUBCLASS_ELIXIR && proto->SubClass != ITEM_SUBCLASS_FLASK &&
|
||||
proto->SubClass != ITEM_SUBCLASS_SCROLL && proto->SubClass != ITEM_SUBCLASS_FOOD &&
|
||||
proto->SubClass != ITEM_SUBCLASS_CONSUMABLE_OTHER && proto->SubClass != ITEM_SUBCLASS_ITEM_ENHANCEMENT)
|
||||
return true;
|
||||
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; i++)
|
||||
{
|
||||
uint32 spellId = proto->Spells[i].SpellId;
|
||||
if (!spellId)
|
||||
continue;
|
||||
|
||||
if (bot->HasAura(spellId))
|
||||
return true;
|
||||
|
||||
Item* itemForSpell =
|
||||
*GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<Item*>("item for spell", spellId);
|
||||
if (itemForSpell && itemForSpell->IsInWorld() && itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
|
||||
return true;
|
||||
|
||||
if (items.find(proto->SubClass) == items.end())
|
||||
items[proto->SubClass] = std::vector<Item*>();
|
||||
|
||||
items[proto->SubClass].push_back(item);
|
||||
break;
|
||||
}
|
||||
|
||||
std::map<uint32, std::vector<Item*> > items;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Player* bot;
|
||||
std::map<uint32, std::vector<Item*> > items;
|
||||
|
||||
private:
|
||||
Player* bot;
|
||||
};
|
||||
|
||||
void BuffAction::TellHeader(uint32 subClass)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_BUFFACTION_H
|
||||
@@ -11,13 +12,13 @@ class PlayerbotAI;
|
||||
|
||||
class BuffAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
BuffAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buff") { }
|
||||
public:
|
||||
BuffAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buff") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
void TellHeader(uint32 subClass);
|
||||
private:
|
||||
void TellHeader(uint32 subClass);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BuyAction.h"
|
||||
|
||||
#include "BudgetValues.h"
|
||||
#include "Event.h"
|
||||
#include "ItemVisitors.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "ItemUsageValue.h"
|
||||
#include "ItemVisitors.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool BuyAction::Execute(Event event)
|
||||
@@ -48,20 +50,26 @@ bool BuyAction::Execute(Event event)
|
||||
|
||||
VendorItemList m_items_sorted = tItems->m_items;
|
||||
|
||||
m_items_sorted.erase(std::remove_if(m_items_sorted.begin(), m_items_sorted.end(), [](VendorItem* i)
|
||||
{
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(i->item);
|
||||
return !proto;
|
||||
}), m_items_sorted.end());
|
||||
m_items_sorted.erase(std::remove_if(m_items_sorted.begin(), m_items_sorted.end(),
|
||||
[](VendorItem* i)
|
||||
{
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(i->item);
|
||||
return !proto;
|
||||
}),
|
||||
m_items_sorted.end());
|
||||
|
||||
if (m_items_sorted.empty())
|
||||
continue;
|
||||
|
||||
std::sort(m_items_sorted.begin(), m_items_sorted.end(), [](VendorItem* i, VendorItem* j) { return sObjectMgr->GetItemTemplate(i->item)->ItemLevel > sObjectMgr->GetItemTemplate(j->item)->ItemLevel; });
|
||||
std::sort(m_items_sorted.begin(), m_items_sorted.end(),
|
||||
[](VendorItem* i, VendorItem* j) {
|
||||
return sObjectMgr->GetItemTemplate(i->item)->ItemLevel >
|
||||
sObjectMgr->GetItemTemplate(j->item)->ItemLevel;
|
||||
});
|
||||
|
||||
for (auto& tItem : m_items_sorted)
|
||||
{
|
||||
for (uint32 i = 0; i < 10; i++) // Buy 10 times or until no longer usefull/possible
|
||||
for (uint32 i = 0; i < 10; i++) // Buy 10 times or until no longer usefull/possible
|
||||
{
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", tItem->item);
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(tItem->item);
|
||||
@@ -104,7 +112,8 @@ bool BuyAction::Execute(Event event)
|
||||
if (!BuyItem(tItems, vendorguid, proto))
|
||||
break;
|
||||
|
||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP) // Equip upgrades and stop buying this time.
|
||||
if (usage == ITEM_USAGE_REPLACE ||
|
||||
usage == ITEM_USAGE_EQUIP) // Equip upgrades and stop buying this time.
|
||||
{
|
||||
botAI->DoSpecificAction("equip upgrades");
|
||||
break;
|
||||
@@ -120,7 +129,7 @@ bool BuyAction::Execute(Event event)
|
||||
for (ItemIds::iterator i = itemIds.begin(); i != itemIds.end(); i++)
|
||||
{
|
||||
uint32 itemId = *i;
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
@@ -170,7 +179,10 @@ bool BuyAction::BuyItem(VendorItemData const* tItems, ObjectGuid vendorguid, Ite
|
||||
bot->SetMoney(botMoney);
|
||||
}
|
||||
|
||||
if (oldCount < AI_VALUE2(uint32, "item count", proto->Name1)) // BuyItem Always returns false (unless unique) so we have to check the item counts.
|
||||
if (oldCount <
|
||||
AI_VALUE2(
|
||||
uint32, "item count",
|
||||
proto->Name1)) // BuyItem Always returns false (unless unique) so we have to check the item counts.
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Buying " << ChatHelper::FormatItem(proto);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_BUYACTION_H
|
||||
@@ -18,16 +19,15 @@ struct VendorItemData;
|
||||
|
||||
class BuyAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
BuyAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buy") { }
|
||||
public:
|
||||
BuyAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buy") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool BuyItem(VendorItemData const* tItems, ObjectGuid vendorguid, ItemTemplate const* proto);
|
||||
bool TradeItem(FindItemVisitor* visitor, int8 slot);
|
||||
bool TradeItem(Item const* item, int8 slot);
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool BuyItem(VendorItemData const* tItems, ObjectGuid vendorguid, ItemTemplate const* proto);
|
||||
bool TradeItem(FindItemVisitor* visitor, int8 slot);
|
||||
bool TradeItem(Item const* item, int8 slot);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CastCustomSpellAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
#include "ItemUsageValue.h"
|
||||
@@ -56,10 +58,10 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
if (master && master->GetTarget())
|
||||
target = botAI->GetUnit(master->GetTarget());
|
||||
|
||||
if (!target)
|
||||
if (!target)
|
||||
target = bot;
|
||||
|
||||
if (!master) // Use self as master for permissions.
|
||||
if (!master) // Use self as master for permissions.
|
||||
master = bot;
|
||||
|
||||
Item* itemTarget = nullptr;
|
||||
@@ -136,7 +138,7 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
std::ostringstream cmd;
|
||||
cmd << castString(target) << " " << text << " " << (castCount - 1);
|
||||
botAI->HandleCommand(CHAT_MSG_WHISPER, cmd.str(), master);
|
||||
msg << "|cffffff00(x" << (castCount-1) << " left)|r";
|
||||
msg << "|cffffff00(x" << (castCount - 1) << " left)|r";
|
||||
}
|
||||
|
||||
botAI->TellMasterNoFacing(msg.str());
|
||||
@@ -150,10 +152,7 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CastCustomNcSpellAction::isUseful()
|
||||
{
|
||||
return !bot->IsInCombat();
|
||||
}
|
||||
bool CastCustomNcSpellAction::isUseful() { return !bot->IsInCombat(); }
|
||||
|
||||
std::string const CastCustomNcSpellAction::castString(WorldObject* target)
|
||||
{
|
||||
@@ -162,7 +161,8 @@ std::string const CastCustomNcSpellAction::castString(WorldObject* target)
|
||||
|
||||
bool CastRandomSpellAction::AcceptSpell(SpellInfo const* spellInfo)
|
||||
{
|
||||
bool isTradeSkill = spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM && spellInfo->ReagentCount[EFFECT_0] > 0 && spellInfo->SchoolMask == 1;
|
||||
bool isTradeSkill = spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM &&
|
||||
spellInfo->ReagentCount[EFFECT_0] > 0 && spellInfo->SchoolMask == 1;
|
||||
return !isTradeSkill && spellInfo->GetRecoveryTime() < MINUTE * IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,8 @@ bool CastRandomSpellAction::Execute(Event event)
|
||||
|
||||
if (target && botAI->CanCastSpell(spellId, target, true))
|
||||
spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, target)));
|
||||
if (got && botAI->CanCastSpell(spellId, got->GetPositionX(), got->GetPositionY(), got->GetPositionZ(), true))
|
||||
if (got &&
|
||||
botAI->CanCastSpell(spellId, got->GetPositionX(), got->GetPositionY(), got->GetPositionZ(), true))
|
||||
spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, got)));
|
||||
if (botAI->CanCastSpell(spellId, bot, true))
|
||||
spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, bot)));
|
||||
@@ -232,10 +233,9 @@ bool CastRandomSpellAction::Execute(Event event)
|
||||
|
||||
bool isCast = false;
|
||||
|
||||
std::sort(spellList.begin(), spellList.end(), [](std::pair<uint32, std::pair<uint32, WorldObject*>> i, std::pair<uint32, std::pair<uint32, WorldObject*>> j)
|
||||
{
|
||||
return i.first > j.first;
|
||||
});
|
||||
std::sort(spellList.begin(), spellList.end(),
|
||||
[](std::pair<uint32, std::pair<uint32, WorldObject*>> i,
|
||||
std::pair<uint32, std::pair<uint32, WorldObject*>> j) { return i.first > j.first; });
|
||||
|
||||
uint32 rndBound = spellList.size() / 4;
|
||||
|
||||
@@ -270,7 +270,8 @@ bool CastRandomSpellAction::Execute(Event event)
|
||||
|
||||
bool CraftRandomItemAction::AcceptSpell(SpellInfo const* spellInfo)
|
||||
{
|
||||
return spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM && spellInfo->ReagentCount[EFFECT_0] > 0 && spellInfo->SchoolMask == 0;
|
||||
return spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM && spellInfo->ReagentCount[EFFECT_0] > 0 &&
|
||||
spellInfo->SchoolMask == 0;
|
||||
}
|
||||
|
||||
uint32 CraftRandomItemAction::GetSpellPriority(SpellInfo const* spellInfo)
|
||||
@@ -282,7 +283,8 @@ uint32 CraftRandomItemAction::GetSpellPriority(SpellInfo const* spellInfo)
|
||||
{
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", newItemId);
|
||||
|
||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_AMMO || usage == ITEM_USAGE_QUEST || usage == ITEM_USAGE_SKILL || usage == ITEM_USAGE_USE)
|
||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_AMMO ||
|
||||
usage == ITEM_USAGE_QUEST || usage == ITEM_USAGE_SKILL || usage == ITEM_USAGE_USE)
|
||||
return 10;
|
||||
}
|
||||
|
||||
@@ -295,7 +297,6 @@ uint32 CraftRandomItemAction::GetSpellPriority(SpellInfo const* spellInfo)
|
||||
|
||||
bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
|
||||
{
|
||||
|
||||
if (wo->GetGUID().IsUnit())
|
||||
return botAI->CastSpell(spellId, (Unit*)(wo));
|
||||
else
|
||||
@@ -304,16 +305,19 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
|
||||
|
||||
bool DisEnchantRandomItemAction::Execute(Event event)
|
||||
{
|
||||
std::vector<Item*> items = AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||
std::vector<Item*> items =
|
||||
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||
std::reverse(items.begin(), items.end());
|
||||
|
||||
for (auto& item: items)
|
||||
for (auto& item : items)
|
||||
{
|
||||
// don't touch rare+ items if with real player/guild
|
||||
if ((botAI->HasRealPlayerMaster() || botAI->IsInRealGuild()) && item->GetTemplate()->Quality > ITEM_QUALITY_UNCOMMON)
|
||||
if ((botAI->HasRealPlayerMaster() || botAI->IsInRealGuild()) &&
|
||||
item->GetTemplate()->Quality > ITEM_QUALITY_UNCOMMON)
|
||||
return false;
|
||||
|
||||
if(CastCustomSpellAction::Execute(Event("disenchant random item", "13262 "+ chat->FormatQItem(item->GetEntry()))))
|
||||
if (CastCustomSpellAction::Execute(
|
||||
Event("disenchant random item", "13262 " + chat->FormatQItem(item->GetEntry()))))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -322,13 +326,11 @@ bool DisEnchantRandomItemAction::Execute(Event event)
|
||||
|
||||
bool DisEnchantRandomItemAction::isUseful()
|
||||
{
|
||||
return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat() && AI_VALUE2(uint32, "item count", "usage " + std::to_string(ITEM_USAGE_DISENCHANT)) > 0;
|
||||
return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat() &&
|
||||
AI_VALUE2(uint32, "item count", "usage " + std::to_string(ITEM_USAGE_DISENCHANT)) > 0;
|
||||
}
|
||||
|
||||
bool EnchantRandomItemAction::isUseful()
|
||||
{
|
||||
return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat();
|
||||
}
|
||||
bool EnchantRandomItemAction::isUseful() { return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat(); }
|
||||
|
||||
bool EnchantRandomItemAction::AcceptSpell(SpellInfo const* spellInfo)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CASTCUSTOMSPELLACTION_H
|
||||
@@ -13,11 +14,14 @@ class WorldObject;
|
||||
|
||||
class CastCustomSpellAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
CastCustomSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom spell") : InventoryAction(botAI, name) { }
|
||||
public:
|
||||
CastCustomSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom spell")
|
||||
: InventoryAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
virtual std::string const castString(WorldObject* target) { return "cast"; }
|
||||
bool Execute(Event event) override;
|
||||
virtual std::string const castString(WorldObject* target) { return "cast"; }
|
||||
|
||||
protected:
|
||||
bool ncCast = false;
|
||||
@@ -25,57 +29,60 @@ protected:
|
||||
|
||||
class CastCustomNcSpellAction : public CastCustomSpellAction
|
||||
{
|
||||
public:
|
||||
CastCustomNcSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom nc spell") : CastCustomSpellAction(botAI, name) { }
|
||||
public:
|
||||
CastCustomNcSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom nc spell")
|
||||
: CastCustomSpellAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override;
|
||||
std::string const castString(WorldObject* target) override;
|
||||
bool isUseful() override;
|
||||
std::string const castString(WorldObject* target) override;
|
||||
};
|
||||
|
||||
class CastRandomSpellAction : public ListSpellsAction
|
||||
{
|
||||
public:
|
||||
CastRandomSpellAction(PlayerbotAI* botAI, std::string const name = "cast random spell") : ListSpellsAction(botAI, name) { }
|
||||
public:
|
||||
CastRandomSpellAction(PlayerbotAI* botAI, std::string const name = "cast random spell")
|
||||
: ListSpellsAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override { return false; }
|
||||
virtual bool AcceptSpell(SpellInfo const* spellInfo);
|
||||
virtual uint32 GetSpellPriority(SpellInfo const* spellInfo) { return 1; }
|
||||
virtual bool castSpell(uint32 spellId, WorldObject* wo);
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override { return false; }
|
||||
virtual bool AcceptSpell(SpellInfo const* spellInfo);
|
||||
virtual uint32 GetSpellPriority(SpellInfo const* spellInfo) { return 1; }
|
||||
virtual bool castSpell(uint32 spellId, WorldObject* wo);
|
||||
bool Execute(Event event) override;
|
||||
|
||||
protected:
|
||||
bool MultiCast = false;
|
||||
protected:
|
||||
bool MultiCast = false;
|
||||
};
|
||||
|
||||
class CraftRandomItemAction : public CastRandomSpellAction
|
||||
{
|
||||
public:
|
||||
CraftRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "craft random item")
|
||||
{
|
||||
MultiCast = true;
|
||||
}
|
||||
public:
|
||||
CraftRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "craft random item") { MultiCast = true; }
|
||||
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
};
|
||||
|
||||
class DisEnchantRandomItemAction : public CastCustomSpellAction
|
||||
{
|
||||
public:
|
||||
DisEnchantRandomItemAction(PlayerbotAI* botAI) : CastCustomSpellAction(botAI, "disenchant random item") {}
|
||||
public:
|
||||
DisEnchantRandomItemAction(PlayerbotAI* botAI) : CastCustomSpellAction(botAI, "disenchant random item") {}
|
||||
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class EnchantRandomItemAction : public CastRandomSpellAction
|
||||
{
|
||||
public:
|
||||
EnchantRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "enchant random item") { }
|
||||
public:
|
||||
EnchantRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "enchant random item") {}
|
||||
|
||||
bool isUseful() override;
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
bool isUseful() override;
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChangeChatAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHANGECHATACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class ChangeChatAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeChatAction(PlayerbotAI* botAI) : Action(botAI, "chat") { }
|
||||
public:
|
||||
ChangeChatAction(PlayerbotAI* botAI) : Action(botAI, "chat") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChangeStrategyAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PlayerbotDbStore.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool ChangeCombatStrategyAction::Execute(Event event)
|
||||
{
|
||||
@@ -38,7 +40,8 @@ bool ChangeNonCombatStrategyAction::Execute(Event event)
|
||||
std::string const text = event.getParam();
|
||||
|
||||
uint32 account = bot->GetSession()->GetAccountId();
|
||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account) && botAI->GetMaster() && botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account) && botAI->GetMaster() &&
|
||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
{
|
||||
if (text.find("loot") != std::string::npos || text.find("gather") != std::string::npos)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHANGESTRATEGYACTION_H
|
||||
@@ -11,26 +12,26 @@ class PlayerbotAI;
|
||||
|
||||
class ChangeCombatStrategyAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeCombatStrategyAction(PlayerbotAI* botAI, std::string const name = "co") : Action(botAI, name) { }
|
||||
public:
|
||||
ChangeCombatStrategyAction(PlayerbotAI* botAI, std::string const name = "co") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class ChangeNonCombatStrategyAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeNonCombatStrategyAction(PlayerbotAI* botAI) : Action(botAI, "nc") { }
|
||||
public:
|
||||
ChangeNonCombatStrategyAction(PlayerbotAI* botAI) : Action(botAI, "nc") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class ChangeDeadStrategyAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeDeadStrategyAction(PlayerbotAI* botAI) : Action(botAI, "de") { }
|
||||
public:
|
||||
ChangeDeadStrategyAction(PlayerbotAI* botAI) : Action(botAI, "de") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChangeTalentsAction.h"
|
||||
|
||||
#include "AiFactory.h"
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
@@ -17,16 +19,22 @@ bool ChangeTalentsAction::Execute(Event event)
|
||||
std::ostringstream out;
|
||||
|
||||
TalentSpec botSpec(bot);
|
||||
|
||||
|
||||
if (!param.empty())
|
||||
{
|
||||
if (param.find("help") != std::string::npos) {
|
||||
if (param.find("help") != std::string::npos)
|
||||
{
|
||||
out << TalentsHelp();
|
||||
} else if (param.find("switch") != std::string::npos) {
|
||||
if (param.find("switch 1") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("switch") != std::string::npos)
|
||||
{
|
||||
if (param.find("switch 1") != std::string::npos)
|
||||
{
|
||||
bot->ActivateSpec(0);
|
||||
out << "Active first talent";
|
||||
} else if (param.find("switch 2") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("switch 2") != std::string::npos)
|
||||
{
|
||||
if (bot->GetSpecsCount() == 1 && bot->GetLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
|
||||
{
|
||||
bot->CastSpell(bot, 63680, true, nullptr, nullptr, bot->GetGUID());
|
||||
@@ -35,28 +43,39 @@ bool ChangeTalentsAction::Execute(Event event)
|
||||
bot->ActivateSpec(1);
|
||||
out << "Active second talent";
|
||||
}
|
||||
} else if (param.find("autopick") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("autopick") != std::string::npos)
|
||||
{
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
factory.InitTalentsTree(true);
|
||||
out << "Auto pick talents";
|
||||
} else if (param.find("spec list") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("spec list") != std::string::npos)
|
||||
{
|
||||
out << SpecList();
|
||||
} else if (param.find("spec ") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("spec ") != std::string::npos)
|
||||
{
|
||||
param = param.substr(5);
|
||||
out << SpecPick(param);
|
||||
botAI->ResetStrategies();
|
||||
} else if (param.find("apply ") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("apply ") != std::string::npos)
|
||||
{
|
||||
param = param.substr(6);
|
||||
out << SpecApply(param);
|
||||
botAI->ResetStrategies();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "Unknown command.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 tab = AiFactory::GetPlayerSpecTab(bot);
|
||||
out << "My current talent spec is: " << "|h|cffffffff";
|
||||
out << "My current talent spec is: "
|
||||
<< "|h|cffffffff";
|
||||
out << chat->FormatClass(bot, tab) << "\n";
|
||||
out << TalentsHelp();
|
||||
}
|
||||
@@ -70,7 +89,7 @@ std::string ChangeTalentsAction::TalentsHelp()
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Talents usage: talents switch <1/2>, talents autopick, talents spec list, "
|
||||
"talents spec <specName>, talents apply <link>.";
|
||||
"talents spec <specName>, talents apply <link>.";
|
||||
return out.str();
|
||||
}
|
||||
|
||||
@@ -79,8 +98,10 @@ std::string ChangeTalentsAction::SpecList()
|
||||
int cls = bot->getClass();
|
||||
int specFound = 0;
|
||||
std::ostringstream out;
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo) {
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0) {
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||
{
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
specFound++;
|
||||
@@ -88,7 +109,8 @@ std::string ChangeTalentsAction::SpecList()
|
||||
std::vector<std::vector<uint32>> parsed = sPlayerbotAIConfig->parsedSpecLinkOrder[cls][specNo][80];
|
||||
std::unordered_map<int, int> tabCount;
|
||||
tabCount[0] = tabCount[1] = tabCount[2] = 0;
|
||||
for (auto &item : parsed) {
|
||||
for (auto& item : parsed)
|
||||
{
|
||||
tabCount[item[0]] += item[3];
|
||||
}
|
||||
out << specFound << ". " << sPlayerbotAIConfig->premadeSpecName[cls][specNo] << " (";
|
||||
@@ -103,11 +125,14 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
||||
{
|
||||
int cls = bot->getClass();
|
||||
int specFound = 0;
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo) {
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0) {
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||
{
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo] == param) {
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo] == param)
|
||||
{
|
||||
PlayerbotFactory::InitTalentsBySpecNo(bot, specNo, true);
|
||||
std::ostringstream out;
|
||||
out << "Picking " << sPlayerbotAIConfig->premadeSpecName[cls][specNo];
|
||||
@@ -119,13 +144,13 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
||||
return out.str();
|
||||
}
|
||||
|
||||
|
||||
std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
{
|
||||
int cls = bot->getClass();
|
||||
std::ostringstream out;
|
||||
std::vector<std::vector<uint32>> parsedSpecLink = PlayerbotAIConfig::ParseTempTalentsOrder(cls, param);
|
||||
if (parsedSpecLink.size() == 0) {
|
||||
if (parsedSpecLink.size() == 0)
|
||||
{
|
||||
out << "Invalid link " << param;
|
||||
return out.str();
|
||||
}
|
||||
@@ -243,7 +268,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// newSpec.ApplyTalents(bot, out);
|
||||
// if (newSpec.GetTalentPoints() > 0)
|
||||
// {
|
||||
// *out << "Upgrading spec " << "|h|cffffffff" << getPremadePath(specId)->name << "" << newSpec.FormatSpec(bot);
|
||||
// *out << "Upgrading spec " << "|h|cffffffff" << getPremadePath(specId)->name << "" <<
|
||||
// newSpec.FormatSpec(bot);
|
||||
// }
|
||||
// }
|
||||
// else if (!specLink.empty())
|
||||
@@ -254,7 +280,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// if (newSpec.GetTalentPoints() > 0)
|
||||
// {
|
||||
// *out << "Upgrading saved spec "
|
||||
// << "|h|cffffffff" << chat->FormatClass(bot, newSpec.highestTree()) << " (" << newSpec.FormatSpec(bot) << ")";
|
||||
// << "|h|cffffffff" << chat->FormatClass(bot, newSpec.highestTree()) << " (" <<
|
||||
// newSpec.FormatSpec(bot) << ")";
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -278,7 +305,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// specId = -1;
|
||||
// // specLink = "";
|
||||
// }
|
||||
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig->autoPickTalents*/ && !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig->autoPickTalents*/ &&
|
||||
// !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
// {
|
||||
// *out << "Found multiple specs: ";
|
||||
// listPremadePaths(paths, out);
|
||||
@@ -294,7 +322,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// if (paths.size() > 1)
|
||||
// *out << "Found " << paths.size() << " possible specs to choose from. ";
|
||||
|
||||
// *out << "Apply spec " << "|h|cffffffff" << getPremadePath(specId)->name << " " << newSpec.FormatSpec(bot);
|
||||
// *out << "Apply spec " << "|h|cffffffff" << getPremadePath(specId)->name << " " <<
|
||||
// newSpec.FormatSpec(bot);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHANGETALENTSACTION_H
|
||||
@@ -12,31 +13,31 @@ class PlayerbotAI;
|
||||
|
||||
class ChangeTalentsAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeTalentsAction(PlayerbotAI* botAI, std::string const name = "talents") : Action(botAI, name) { }
|
||||
public:
|
||||
ChangeTalentsAction(PlayerbotAI* botAI, std::string const name = "talents") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event);
|
||||
// bool AutoSelectTalents(std::ostringstream* out);
|
||||
bool Execute(Event event);
|
||||
// bool AutoSelectTalents(std::ostringstream* out);
|
||||
|
||||
private:
|
||||
// std::vector<TalentPath*> getPremadePaths(std::string const findName);
|
||||
// std::vector<TalentPath*> getPremadePaths(TalentSpec* oldSpec);
|
||||
// TalentPath* getPremadePath(uint32 id);
|
||||
// void listPremadePaths(std::vector<TalentPath*> paths, std::ostringstream* out);
|
||||
// TalentPath* PickPremadePath(std::vector<TalentPath*> paths, bool useProbability);
|
||||
// TalentSpec* GetBestPremadeSpec(uint32 spec);
|
||||
std::string TalentsHelp();
|
||||
std::string SpecList();
|
||||
std::string SpecPick(std::string param);
|
||||
std::string SpecApply(std::string param);
|
||||
private:
|
||||
// std::vector<TalentPath*> getPremadePaths(std::string const findName);
|
||||
// std::vector<TalentPath*> getPremadePaths(TalentSpec* oldSpec);
|
||||
// TalentPath* getPremadePath(uint32 id);
|
||||
// void listPremadePaths(std::vector<TalentPath*> paths, std::ostringstream* out);
|
||||
// TalentPath* PickPremadePath(std::vector<TalentPath*> paths, bool useProbability);
|
||||
// TalentSpec* GetBestPremadeSpec(uint32 spec);
|
||||
std::string TalentsHelp();
|
||||
std::string SpecList();
|
||||
std::string SpecPick(std::string param);
|
||||
std::string SpecApply(std::string param);
|
||||
};
|
||||
|
||||
class AutoSetTalentsAction : public ChangeTalentsAction
|
||||
{
|
||||
public:
|
||||
AutoSetTalentsAction(PlayerbotAI* botAI) : ChangeTalentsAction(botAI, "auto talents") { }
|
||||
public:
|
||||
AutoSetTalentsAction(PlayerbotAI* botAI) : ChangeTalentsAction(botAI, "auto talents") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHATACTIONCONTEXTACTION_H
|
||||
@@ -12,8 +13,8 @@
|
||||
#include "BuyAction.h"
|
||||
#include "CastCustomSpellAction.h"
|
||||
#include "ChangeChatAction.h"
|
||||
#include "ChangeTalentsAction.h"
|
||||
#include "ChangeStrategyAction.h"
|
||||
#include "ChangeTalentsAction.h"
|
||||
#include "ChatShortcutActions.h"
|
||||
#include "CheatAction.h"
|
||||
#include "CustomStrategyEditAction.h"
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "DropQuestAction.h"
|
||||
#include "EquipAction.h"
|
||||
#include "FlagAction.h"
|
||||
#include "Formations.h"
|
||||
#include "GoAction.h"
|
||||
#include "GossipHelloAction.h"
|
||||
#include "GuildBankAction.h"
|
||||
@@ -35,10 +37,11 @@
|
||||
#include "LogLevelAction.h"
|
||||
#include "LootStrategyAction.h"
|
||||
#include "MailAction.h"
|
||||
#include "QueryItemUsageAction.h"
|
||||
#include "QueryQuestAction.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "PassLeadershipToMasterAction.h"
|
||||
#include "PositionAction.h"
|
||||
#include "QueryItemUsageAction.h"
|
||||
#include "QueryQuestAction.h"
|
||||
#include "RangeAction.h"
|
||||
#include "ReleaseSpiritAction.h"
|
||||
#include "RepairAllAction.h"
|
||||
@@ -49,11 +52,12 @@
|
||||
#include "RtscAction.h"
|
||||
#include "SaveManaAction.h"
|
||||
#include "SellAction.h"
|
||||
#include "SetCraftAction.h"
|
||||
#include "SendMailAction.h"
|
||||
#include "SetCraftAction.h"
|
||||
#include "SetHomeAction.h"
|
||||
#include "ShareQuestAction.h"
|
||||
#include "SkipSpellsListAction.h"
|
||||
#include "Stances.h"
|
||||
#include "StatsAction.h"
|
||||
#include "TaxiAction.h"
|
||||
#include "TeleportAction.h"
|
||||
@@ -69,206 +73,203 @@
|
||||
#include "UseMeetingStoneAction.h"
|
||||
#include "WhoAction.h"
|
||||
#include "WtsAction.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "Formations.h"
|
||||
#include "Stances.h"
|
||||
|
||||
class ChatActionContext : public NamedObjectContext<Action>
|
||||
{
|
||||
public:
|
||||
ChatActionContext()
|
||||
{
|
||||
creators["range"] = &ChatActionContext::range;
|
||||
creators["stats"] = &ChatActionContext::stats;
|
||||
creators["quests"] = &ChatActionContext::quests;
|
||||
creators["leave"] = &ChatActionContext::leave;
|
||||
creators["reputation"] = &ChatActionContext::reputation;
|
||||
creators["log"] = &ChatActionContext::log;
|
||||
creators["los"] = &ChatActionContext::los;
|
||||
creators["aura"] = &ChatActionContext::aura;
|
||||
creators["drop"] = &ChatActionContext::drop;
|
||||
creators["clean quest log"] = &ChatActionContext::clean_quest_log;
|
||||
creators["share"] = &ChatActionContext::share;
|
||||
creators["query quest"] = &ChatActionContext::query_quest;
|
||||
creators["query item usage"] = &ChatActionContext::query_item_usage;
|
||||
creators["ll"] = &ChatActionContext::ll;
|
||||
creators["ss"] = &ChatActionContext::ss;
|
||||
creators["add all loot"] = &ChatActionContext::add_all_loot;
|
||||
creators["release"] = &ChatActionContext::release;
|
||||
creators["repop"] = &ChatActionContext::repop;
|
||||
creators["teleport"] = &ChatActionContext::teleport;
|
||||
creators["taxi"] = &ChatActionContext::taxi;
|
||||
creators["repair"] = &ChatActionContext::repair;
|
||||
creators["use"] = &ChatActionContext::use;
|
||||
creators["item count"] = &ChatActionContext::item_count;
|
||||
creators["equip"] = &ChatActionContext::equip;
|
||||
creators["equip upgrades"] = &ChatActionContext::equip_upgrades;
|
||||
creators["unequip"] = &ChatActionContext::unequip;
|
||||
creators["sell"] = &ChatActionContext::sell;
|
||||
creators["buy"] = &ChatActionContext::buy;
|
||||
creators["reward"] = &ChatActionContext::reward;
|
||||
creators["trade"] = &ChatActionContext::trade;
|
||||
creators["talents"] = &ChatActionContext::talents;
|
||||
creators["spells"] = &ChatActionContext::spells;
|
||||
creators["co"] = &ChatActionContext::co;
|
||||
creators["nc"] = &ChatActionContext::nc;
|
||||
creators["de"] = &ChatActionContext::dead;
|
||||
creators["trainer"] = &ChatActionContext::trainer;
|
||||
creators["maintenance"] = &ChatActionContext::maintenance;
|
||||
creators["remove glyph"] = &ChatActionContext::remove_glyph;
|
||||
creators["autogear"] = &ChatActionContext::autogear;
|
||||
creators["equip upgrade"] = &ChatActionContext::equip_upgrade;
|
||||
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
||||
creators["chat"] = &ChatActionContext::chat;
|
||||
creators["home"] = &ChatActionContext::home;
|
||||
creators["destroy"] = &ChatActionContext::destroy;
|
||||
creators["reset botAI"] = &ChatActionContext::reset_ai;
|
||||
creators["buff"] = &ChatActionContext::buff;
|
||||
creators["help"] = &ChatActionContext::help;
|
||||
creators["gb"] = &ChatActionContext::gb;
|
||||
creators["bank"] = &ChatActionContext::bank;
|
||||
creators["follow chat shortcut"] = &ChatActionContext::follow_chat_shortcut;
|
||||
creators["stay chat shortcut"] = &ChatActionContext::stay_chat_shortcut;
|
||||
creators["flee chat shortcut"] = &ChatActionContext::flee_chat_shortcut;
|
||||
creators["runaway chat shortcut"] = &ChatActionContext::runaway_chat_shortcut;
|
||||
creators["grind chat shortcut"] = &ChatActionContext::grind_chat_shortcut;
|
||||
creators["tank attack chat shortcut"] = &ChatActionContext::tank_attack_chat_shortcut;
|
||||
creators["gossip hello"] = &ChatActionContext::gossip_hello;
|
||||
creators["cast custom spell"] = &ChatActionContext::cast_custom_spell;
|
||||
creators["cast custom nc spell"] = &ChatActionContext::cast_custom_nc_spell;
|
||||
creators["invite"] = &ChatActionContext::invite;
|
||||
creators["spell"] = &ChatActionContext::spell;
|
||||
creators["rti"] = &ChatActionContext::rti;
|
||||
creators["spirit healer"] = &ChatActionContext::spirit_healer;
|
||||
creators["position"] = &ChatActionContext::position;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["summon"] = &ChatActionContext::summon;
|
||||
creators["who"] = &ChatActionContext::who;
|
||||
creators["save mana"] = &ChatActionContext::save_mana;
|
||||
creators["max dps chat shortcut"] = &ChatActionContext::max_dps_chat_shortcut;
|
||||
creators["tell attackers"] = &ChatActionContext::tell_attackers;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["formation"] = &ChatActionContext::formation;
|
||||
creators["stance"] = &ChatActionContext::stance;
|
||||
creators["sendmail"] = &ChatActionContext::sendmail;
|
||||
creators["mail"] = &ChatActionContext::mail;
|
||||
creators["go"] = &ChatActionContext::go;
|
||||
creators["debug"] = &ChatActionContext::debug;
|
||||
creators["cdebug"] = &ChatActionContext::debug;
|
||||
creators["cs"] = &ChatActionContext::cs;
|
||||
creators["wts"] = &ChatActionContext::wts;
|
||||
creators["hire"] = &ChatActionContext::hire;
|
||||
creators["craft"] = &ChatActionContext::craft;
|
||||
creators["flag"] = &ChatActionContext::flag;
|
||||
creators["give leader"] = &ChatActionContext::give_leader;
|
||||
creators["cheat"] = &ChatActionContext::cheat;
|
||||
creators["ginvite"] = &ChatActionContext::ginvite;
|
||||
creators["guild promote"] = &ChatActionContext::guild_promote;
|
||||
creators["guild demote"] = &ChatActionContext::guild_demote;
|
||||
creators["guild remove"] = &ChatActionContext::guild_remove;
|
||||
creators["guild leave"] = &ChatActionContext::guild_leave;
|
||||
creators["rtsc"] = &ChatActionContext::rtsc;
|
||||
creators["naxx chat shortcut"] = &ChatActionContext::naxx_chat_shortcut;
|
||||
creators["bwl chat shortcut"] = &ChatActionContext::bwl_chat_shortcut;
|
||||
creators["tell expected dps"] = &ChatActionContext::tell_expected_dps;
|
||||
creators["join"] = &ChatActionContext::join;
|
||||
}
|
||||
public:
|
||||
ChatActionContext()
|
||||
{
|
||||
creators["range"] = &ChatActionContext::range;
|
||||
creators["stats"] = &ChatActionContext::stats;
|
||||
creators["quests"] = &ChatActionContext::quests;
|
||||
creators["leave"] = &ChatActionContext::leave;
|
||||
creators["reputation"] = &ChatActionContext::reputation;
|
||||
creators["log"] = &ChatActionContext::log;
|
||||
creators["los"] = &ChatActionContext::los;
|
||||
creators["aura"] = &ChatActionContext::aura;
|
||||
creators["drop"] = &ChatActionContext::drop;
|
||||
creators["clean quest log"] = &ChatActionContext::clean_quest_log;
|
||||
creators["share"] = &ChatActionContext::share;
|
||||
creators["query quest"] = &ChatActionContext::query_quest;
|
||||
creators["query item usage"] = &ChatActionContext::query_item_usage;
|
||||
creators["ll"] = &ChatActionContext::ll;
|
||||
creators["ss"] = &ChatActionContext::ss;
|
||||
creators["add all loot"] = &ChatActionContext::add_all_loot;
|
||||
creators["release"] = &ChatActionContext::release;
|
||||
creators["repop"] = &ChatActionContext::repop;
|
||||
creators["teleport"] = &ChatActionContext::teleport;
|
||||
creators["taxi"] = &ChatActionContext::taxi;
|
||||
creators["repair"] = &ChatActionContext::repair;
|
||||
creators["use"] = &ChatActionContext::use;
|
||||
creators["item count"] = &ChatActionContext::item_count;
|
||||
creators["equip"] = &ChatActionContext::equip;
|
||||
creators["equip upgrades"] = &ChatActionContext::equip_upgrades;
|
||||
creators["unequip"] = &ChatActionContext::unequip;
|
||||
creators["sell"] = &ChatActionContext::sell;
|
||||
creators["buy"] = &ChatActionContext::buy;
|
||||
creators["reward"] = &ChatActionContext::reward;
|
||||
creators["trade"] = &ChatActionContext::trade;
|
||||
creators["talents"] = &ChatActionContext::talents;
|
||||
creators["spells"] = &ChatActionContext::spells;
|
||||
creators["co"] = &ChatActionContext::co;
|
||||
creators["nc"] = &ChatActionContext::nc;
|
||||
creators["de"] = &ChatActionContext::dead;
|
||||
creators["trainer"] = &ChatActionContext::trainer;
|
||||
creators["maintenance"] = &ChatActionContext::maintenance;
|
||||
creators["remove glyph"] = &ChatActionContext::remove_glyph;
|
||||
creators["autogear"] = &ChatActionContext::autogear;
|
||||
creators["equip upgrade"] = &ChatActionContext::equip_upgrade;
|
||||
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
||||
creators["chat"] = &ChatActionContext::chat;
|
||||
creators["home"] = &ChatActionContext::home;
|
||||
creators["destroy"] = &ChatActionContext::destroy;
|
||||
creators["reset botAI"] = &ChatActionContext::reset_ai;
|
||||
creators["buff"] = &ChatActionContext::buff;
|
||||
creators["help"] = &ChatActionContext::help;
|
||||
creators["gb"] = &ChatActionContext::gb;
|
||||
creators["bank"] = &ChatActionContext::bank;
|
||||
creators["follow chat shortcut"] = &ChatActionContext::follow_chat_shortcut;
|
||||
creators["stay chat shortcut"] = &ChatActionContext::stay_chat_shortcut;
|
||||
creators["flee chat shortcut"] = &ChatActionContext::flee_chat_shortcut;
|
||||
creators["runaway chat shortcut"] = &ChatActionContext::runaway_chat_shortcut;
|
||||
creators["grind chat shortcut"] = &ChatActionContext::grind_chat_shortcut;
|
||||
creators["tank attack chat shortcut"] = &ChatActionContext::tank_attack_chat_shortcut;
|
||||
creators["gossip hello"] = &ChatActionContext::gossip_hello;
|
||||
creators["cast custom spell"] = &ChatActionContext::cast_custom_spell;
|
||||
creators["cast custom nc spell"] = &ChatActionContext::cast_custom_nc_spell;
|
||||
creators["invite"] = &ChatActionContext::invite;
|
||||
creators["spell"] = &ChatActionContext::spell;
|
||||
creators["rti"] = &ChatActionContext::rti;
|
||||
creators["spirit healer"] = &ChatActionContext::spirit_healer;
|
||||
creators["position"] = &ChatActionContext::position;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["summon"] = &ChatActionContext::summon;
|
||||
creators["who"] = &ChatActionContext::who;
|
||||
creators["save mana"] = &ChatActionContext::save_mana;
|
||||
creators["max dps chat shortcut"] = &ChatActionContext::max_dps_chat_shortcut;
|
||||
creators["tell attackers"] = &ChatActionContext::tell_attackers;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["formation"] = &ChatActionContext::formation;
|
||||
creators["stance"] = &ChatActionContext::stance;
|
||||
creators["sendmail"] = &ChatActionContext::sendmail;
|
||||
creators["mail"] = &ChatActionContext::mail;
|
||||
creators["go"] = &ChatActionContext::go;
|
||||
creators["debug"] = &ChatActionContext::debug;
|
||||
creators["cdebug"] = &ChatActionContext::debug;
|
||||
creators["cs"] = &ChatActionContext::cs;
|
||||
creators["wts"] = &ChatActionContext::wts;
|
||||
creators["hire"] = &ChatActionContext::hire;
|
||||
creators["craft"] = &ChatActionContext::craft;
|
||||
creators["flag"] = &ChatActionContext::flag;
|
||||
creators["give leader"] = &ChatActionContext::give_leader;
|
||||
creators["cheat"] = &ChatActionContext::cheat;
|
||||
creators["ginvite"] = &ChatActionContext::ginvite;
|
||||
creators["guild promote"] = &ChatActionContext::guild_promote;
|
||||
creators["guild demote"] = &ChatActionContext::guild_demote;
|
||||
creators["guild remove"] = &ChatActionContext::guild_remove;
|
||||
creators["guild leave"] = &ChatActionContext::guild_leave;
|
||||
creators["rtsc"] = &ChatActionContext::rtsc;
|
||||
creators["naxx chat shortcut"] = &ChatActionContext::naxx_chat_shortcut;
|
||||
creators["bwl chat shortcut"] = &ChatActionContext::bwl_chat_shortcut;
|
||||
creators["tell expected dps"] = &ChatActionContext::tell_expected_dps;
|
||||
creators["join"] = &ChatActionContext::join;
|
||||
}
|
||||
|
||||
private:
|
||||
static Action* range(PlayerbotAI* botAI) { return new RangeAction(botAI); }
|
||||
static Action* flag(PlayerbotAI* botAI) { return new FlagAction(botAI); }
|
||||
static Action* craft(PlayerbotAI* botAI) { return new SetCraftAction(botAI); }
|
||||
static Action* hire(PlayerbotAI* botAI) { return new HireAction(botAI); }
|
||||
static Action* wts(PlayerbotAI* botAI) { return new WtsAction(botAI); }
|
||||
static Action* cs(PlayerbotAI* botAI) { return new CustomStrategyEditAction(botAI); }
|
||||
static Action* debug(PlayerbotAI* botAI) { return new DebugAction(botAI); }
|
||||
static Action* mail(PlayerbotAI* botAI) { return new MailAction(botAI); }
|
||||
static Action* go(PlayerbotAI* botAI) { return new GoAction(botAI); }
|
||||
static Action* sendmail(PlayerbotAI* botAI) { return new SendMailAction(botAI); }
|
||||
static Action* formation(PlayerbotAI* botAI) { return new SetFormationAction(botAI); }
|
||||
static Action* stance(PlayerbotAI* botAI) { return new SetStanceAction(botAI); }
|
||||
static Action* tell_attackers(PlayerbotAI* botAI) { return new TellAttackersAction(botAI); }
|
||||
static Action* max_dps_chat_shortcut(PlayerbotAI* botAI) { return new MaxDpsChatShortcutAction(botAI); }
|
||||
static Action* save_mana(PlayerbotAI* botAI) { return new SaveManaAction(botAI); }
|
||||
static Action* who(PlayerbotAI* botAI) { return new WhoAction(botAI); }
|
||||
static Action* summon(PlayerbotAI* botAI) { return new SummonAction(botAI); }
|
||||
static Action* tell_target(PlayerbotAI* botAI) { return new TellTargetAction(botAI); }
|
||||
static Action* position(PlayerbotAI* botAI) { return new PositionAction(botAI); }
|
||||
static Action* spirit_healer(PlayerbotAI* botAI) { return new SpiritHealerAction(botAI); }
|
||||
static Action* rti(PlayerbotAI* botAI) { return new RtiAction(botAI); }
|
||||
static Action* invite(PlayerbotAI* botAI) { return new InviteToGroupAction(botAI); }
|
||||
static Action* spell(PlayerbotAI* botAI) { return new TellSpellAction(botAI); }
|
||||
static Action* cast_custom_spell(PlayerbotAI* botAI) { return new CastCustomSpellAction(botAI); }
|
||||
static Action* cast_custom_nc_spell(PlayerbotAI* botAI) { return new CastCustomNcSpellAction(botAI); }
|
||||
static Action* tank_attack_chat_shortcut(PlayerbotAI* botAI) { return new TankAttackChatShortcutAction(botAI); }
|
||||
static Action* grind_chat_shortcut(PlayerbotAI* botAI) { return new GrindChatShortcutAction(botAI); }
|
||||
static Action* flee_chat_shortcut(PlayerbotAI* botAI) { return new FleeChatShortcutAction(botAI); }
|
||||
static Action* runaway_chat_shortcut(PlayerbotAI* botAI) { return new GoawayChatShortcutAction(botAI); }
|
||||
static Action* stay_chat_shortcut(PlayerbotAI* botAI) { return new StayChatShortcutAction(botAI); }
|
||||
static Action* follow_chat_shortcut(PlayerbotAI* botAI) { return new FollowChatShortcutAction(botAI); }
|
||||
static Action* gb(PlayerbotAI* botAI) { return new GuildBankAction(botAI); }
|
||||
static Action* bank(PlayerbotAI* botAI) { return new BankAction(botAI); }
|
||||
static Action* help(PlayerbotAI* botAI) { return new HelpAction(botAI); }
|
||||
static Action* buff(PlayerbotAI* botAI) { return new BuffAction(botAI); }
|
||||
static Action* destroy(PlayerbotAI* botAI) { return new DestroyItemAction(botAI); }
|
||||
static Action* home(PlayerbotAI* botAI) { return new SetHomeAction(botAI); }
|
||||
static Action* chat(PlayerbotAI* botAI) { return new ChangeChatAction(botAI); }
|
||||
static Action* attack_my_target(PlayerbotAI* botAI) { return new AttackMyTargetAction(botAI); }
|
||||
static Action* trainer(PlayerbotAI* botAI) { return new TrainerAction(botAI); }
|
||||
static Action* maintenance(PlayerbotAI* botAI) { return new MaintenanceAction(botAI); }
|
||||
static Action* remove_glyph(PlayerbotAI* botAI) { return new RemoveGlyphAction(botAI); }
|
||||
static Action* autogear(PlayerbotAI* botAI) { return new AutoGearAction(botAI); }
|
||||
static Action* equip_upgrade(PlayerbotAI* botAI) { return new EquipUpgradeAction(botAI); }
|
||||
static Action* co(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI); }
|
||||
static Action* nc(PlayerbotAI* botAI) { return new ChangeNonCombatStrategyAction(botAI); }
|
||||
static Action* dead(PlayerbotAI* botAI) { return new ChangeDeadStrategyAction(botAI); }
|
||||
static Action* spells(PlayerbotAI* botAI) { return new ListSpellsAction(botAI); }
|
||||
static Action* talents(PlayerbotAI* botAI) { return new ChangeTalentsAction(botAI); }
|
||||
private:
|
||||
static Action* range(PlayerbotAI* botAI) { return new RangeAction(botAI); }
|
||||
static Action* flag(PlayerbotAI* botAI) { return new FlagAction(botAI); }
|
||||
static Action* craft(PlayerbotAI* botAI) { return new SetCraftAction(botAI); }
|
||||
static Action* hire(PlayerbotAI* botAI) { return new HireAction(botAI); }
|
||||
static Action* wts(PlayerbotAI* botAI) { return new WtsAction(botAI); }
|
||||
static Action* cs(PlayerbotAI* botAI) { return new CustomStrategyEditAction(botAI); }
|
||||
static Action* debug(PlayerbotAI* botAI) { return new DebugAction(botAI); }
|
||||
static Action* mail(PlayerbotAI* botAI) { return new MailAction(botAI); }
|
||||
static Action* go(PlayerbotAI* botAI) { return new GoAction(botAI); }
|
||||
static Action* sendmail(PlayerbotAI* botAI) { return new SendMailAction(botAI); }
|
||||
static Action* formation(PlayerbotAI* botAI) { return new SetFormationAction(botAI); }
|
||||
static Action* stance(PlayerbotAI* botAI) { return new SetStanceAction(botAI); }
|
||||
static Action* tell_attackers(PlayerbotAI* botAI) { return new TellAttackersAction(botAI); }
|
||||
static Action* max_dps_chat_shortcut(PlayerbotAI* botAI) { return new MaxDpsChatShortcutAction(botAI); }
|
||||
static Action* save_mana(PlayerbotAI* botAI) { return new SaveManaAction(botAI); }
|
||||
static Action* who(PlayerbotAI* botAI) { return new WhoAction(botAI); }
|
||||
static Action* summon(PlayerbotAI* botAI) { return new SummonAction(botAI); }
|
||||
static Action* tell_target(PlayerbotAI* botAI) { return new TellTargetAction(botAI); }
|
||||
static Action* position(PlayerbotAI* botAI) { return new PositionAction(botAI); }
|
||||
static Action* spirit_healer(PlayerbotAI* botAI) { return new SpiritHealerAction(botAI); }
|
||||
static Action* rti(PlayerbotAI* botAI) { return new RtiAction(botAI); }
|
||||
static Action* invite(PlayerbotAI* botAI) { return new InviteToGroupAction(botAI); }
|
||||
static Action* spell(PlayerbotAI* botAI) { return new TellSpellAction(botAI); }
|
||||
static Action* cast_custom_spell(PlayerbotAI* botAI) { return new CastCustomSpellAction(botAI); }
|
||||
static Action* cast_custom_nc_spell(PlayerbotAI* botAI) { return new CastCustomNcSpellAction(botAI); }
|
||||
static Action* tank_attack_chat_shortcut(PlayerbotAI* botAI) { return new TankAttackChatShortcutAction(botAI); }
|
||||
static Action* grind_chat_shortcut(PlayerbotAI* botAI) { return new GrindChatShortcutAction(botAI); }
|
||||
static Action* flee_chat_shortcut(PlayerbotAI* botAI) { return new FleeChatShortcutAction(botAI); }
|
||||
static Action* runaway_chat_shortcut(PlayerbotAI* botAI) { return new GoawayChatShortcutAction(botAI); }
|
||||
static Action* stay_chat_shortcut(PlayerbotAI* botAI) { return new StayChatShortcutAction(botAI); }
|
||||
static Action* follow_chat_shortcut(PlayerbotAI* botAI) { return new FollowChatShortcutAction(botAI); }
|
||||
static Action* gb(PlayerbotAI* botAI) { return new GuildBankAction(botAI); }
|
||||
static Action* bank(PlayerbotAI* botAI) { return new BankAction(botAI); }
|
||||
static Action* help(PlayerbotAI* botAI) { return new HelpAction(botAI); }
|
||||
static Action* buff(PlayerbotAI* botAI) { return new BuffAction(botAI); }
|
||||
static Action* destroy(PlayerbotAI* botAI) { return new DestroyItemAction(botAI); }
|
||||
static Action* home(PlayerbotAI* botAI) { return new SetHomeAction(botAI); }
|
||||
static Action* chat(PlayerbotAI* botAI) { return new ChangeChatAction(botAI); }
|
||||
static Action* attack_my_target(PlayerbotAI* botAI) { return new AttackMyTargetAction(botAI); }
|
||||
static Action* trainer(PlayerbotAI* botAI) { return new TrainerAction(botAI); }
|
||||
static Action* maintenance(PlayerbotAI* botAI) { return new MaintenanceAction(botAI); }
|
||||
static Action* remove_glyph(PlayerbotAI* botAI) { return new RemoveGlyphAction(botAI); }
|
||||
static Action* autogear(PlayerbotAI* botAI) { return new AutoGearAction(botAI); }
|
||||
static Action* equip_upgrade(PlayerbotAI* botAI) { return new EquipUpgradeAction(botAI); }
|
||||
static Action* co(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI); }
|
||||
static Action* nc(PlayerbotAI* botAI) { return new ChangeNonCombatStrategyAction(botAI); }
|
||||
static Action* dead(PlayerbotAI* botAI) { return new ChangeDeadStrategyAction(botAI); }
|
||||
static Action* spells(PlayerbotAI* botAI) { return new ListSpellsAction(botAI); }
|
||||
static Action* talents(PlayerbotAI* botAI) { return new ChangeTalentsAction(botAI); }
|
||||
|
||||
static Action* equip(PlayerbotAI* botAI) { return new EquipAction(botAI); }
|
||||
static Action* equip_upgrades(PlayerbotAI* botAI) { return new EquipUpgradesAction(botAI); }
|
||||
static Action* unequip(PlayerbotAI* botAI) { return new UnequipAction(botAI); }
|
||||
static Action* sell(PlayerbotAI* botAI) { return new SellAction(botAI); }
|
||||
static Action* buy(PlayerbotAI* botAI) { return new BuyAction(botAI); }
|
||||
static Action* reward(PlayerbotAI* botAI) { return new RewardAction(botAI); }
|
||||
static Action* trade(PlayerbotAI* botAI) { return new TradeAction(botAI); }
|
||||
static Action* equip(PlayerbotAI* botAI) { return new EquipAction(botAI); }
|
||||
static Action* equip_upgrades(PlayerbotAI* botAI) { return new EquipUpgradesAction(botAI); }
|
||||
static Action* unequip(PlayerbotAI* botAI) { return new UnequipAction(botAI); }
|
||||
static Action* sell(PlayerbotAI* botAI) { return new SellAction(botAI); }
|
||||
static Action* buy(PlayerbotAI* botAI) { return new BuyAction(botAI); }
|
||||
static Action* reward(PlayerbotAI* botAI) { return new RewardAction(botAI); }
|
||||
static Action* trade(PlayerbotAI* botAI) { return new TradeAction(botAI); }
|
||||
|
||||
static Action* item_count(PlayerbotAI* botAI) { return new TellItemCountAction(botAI); }
|
||||
static Action* use(PlayerbotAI* botAI) { return new UseItemAction(botAI); }
|
||||
static Action* repair(PlayerbotAI* botAI) { return new RepairAllAction(botAI); }
|
||||
static Action* taxi(PlayerbotAI* botAI) { return new TaxiAction(botAI); }
|
||||
static Action* teleport(PlayerbotAI* botAI) { return new TeleportAction(botAI); }
|
||||
static Action* release(PlayerbotAI* botAI) { return new ReleaseSpiritAction(botAI); }
|
||||
static Action* repop(PlayerbotAI* botAI) { return new RepopAction(botAI); }
|
||||
static Action* query_item_usage(PlayerbotAI* botAI) { return new QueryItemUsageAction(botAI); }
|
||||
static Action* query_quest(PlayerbotAI* botAI) { return new QueryQuestAction(botAI); }
|
||||
static Action* drop(PlayerbotAI* botAI) { return new DropQuestAction(botAI); }
|
||||
static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); }
|
||||
static Action* share(PlayerbotAI* botAI) { return new ShareQuestAction(botAI); }
|
||||
static Action* stats(PlayerbotAI* botAI) { return new StatsAction(botAI); }
|
||||
static Action* quests(PlayerbotAI* botAI) { return new ListQuestsAction(botAI); }
|
||||
static Action* leave(PlayerbotAI* botAI) { return new LeaveGroupAction(botAI); }
|
||||
static Action* reputation(PlayerbotAI* botAI) { return new TellReputationAction(botAI); }
|
||||
static Action* log(PlayerbotAI* botAI) { return new LogLevelAction(botAI); }
|
||||
static Action* los(PlayerbotAI* botAI) { return new TellLosAction(botAI); }
|
||||
static Action* aura(PlayerbotAI* ai) { return new TellAuraAction(ai); }
|
||||
static Action* ll(PlayerbotAI* botAI) { return new LootStrategyAction(botAI); }
|
||||
static Action* ss(PlayerbotAI* botAI) { return new SkipSpellsListAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* reset_ai(PlayerbotAI* botAI) { return new ResetAiAction(botAI); }
|
||||
static Action* gossip_hello(PlayerbotAI* botAI) { return new GossipHelloAction(botAI); }
|
||||
static Action* give_leader(PlayerbotAI* botAI) { return new GiveLeaderAction(botAI); }
|
||||
static Action* cheat(PlayerbotAI* botAI) { return new CheatAction(botAI); }
|
||||
static Action* ginvite(PlayerbotAI* botAI) { return new GuildInviteAction(botAI); }
|
||||
static Action* guild_promote(PlayerbotAI* botAI) { return new GuildPromoteAction(botAI); }
|
||||
static Action* guild_demote(PlayerbotAI* botAI) { return new GuildDemoteAction(botAI); }
|
||||
static Action* guild_remove(PlayerbotAI* botAI) { return new GuildRemoveAction(botAI); }
|
||||
static Action* guild_leave(PlayerbotAI* botAI) { return new GuildLeaveAction(botAI); }
|
||||
static Action* rtsc(PlayerbotAI* botAI) { return new RTSCAction(botAI); }
|
||||
static Action* naxx_chat_shortcut(PlayerbotAI* ai) { return new NaxxChatShortcutAction(ai); }
|
||||
static Action* bwl_chat_shortcut(PlayerbotAI* ai) { return new BwlChatShortcutAction(ai); }
|
||||
static Action* tell_expected_dps(PlayerbotAI* ai) { return new TellExpectedDpsAction(ai); }
|
||||
static Action* join(PlayerbotAI* ai) { return new JoinGroupAction(ai); }
|
||||
static Action* item_count(PlayerbotAI* botAI) { return new TellItemCountAction(botAI); }
|
||||
static Action* use(PlayerbotAI* botAI) { return new UseItemAction(botAI); }
|
||||
static Action* repair(PlayerbotAI* botAI) { return new RepairAllAction(botAI); }
|
||||
static Action* taxi(PlayerbotAI* botAI) { return new TaxiAction(botAI); }
|
||||
static Action* teleport(PlayerbotAI* botAI) { return new TeleportAction(botAI); }
|
||||
static Action* release(PlayerbotAI* botAI) { return new ReleaseSpiritAction(botAI); }
|
||||
static Action* repop(PlayerbotAI* botAI) { return new RepopAction(botAI); }
|
||||
static Action* query_item_usage(PlayerbotAI* botAI) { return new QueryItemUsageAction(botAI); }
|
||||
static Action* query_quest(PlayerbotAI* botAI) { return new QueryQuestAction(botAI); }
|
||||
static Action* drop(PlayerbotAI* botAI) { return new DropQuestAction(botAI); }
|
||||
static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); }
|
||||
static Action* share(PlayerbotAI* botAI) { return new ShareQuestAction(botAI); }
|
||||
static Action* stats(PlayerbotAI* botAI) { return new StatsAction(botAI); }
|
||||
static Action* quests(PlayerbotAI* botAI) { return new ListQuestsAction(botAI); }
|
||||
static Action* leave(PlayerbotAI* botAI) { return new LeaveGroupAction(botAI); }
|
||||
static Action* reputation(PlayerbotAI* botAI) { return new TellReputationAction(botAI); }
|
||||
static Action* log(PlayerbotAI* botAI) { return new LogLevelAction(botAI); }
|
||||
static Action* los(PlayerbotAI* botAI) { return new TellLosAction(botAI); }
|
||||
static Action* aura(PlayerbotAI* ai) { return new TellAuraAction(ai); }
|
||||
static Action* ll(PlayerbotAI* botAI) { return new LootStrategyAction(botAI); }
|
||||
static Action* ss(PlayerbotAI* botAI) { return new SkipSpellsListAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* reset_ai(PlayerbotAI* botAI) { return new ResetAiAction(botAI); }
|
||||
static Action* gossip_hello(PlayerbotAI* botAI) { return new GossipHelloAction(botAI); }
|
||||
static Action* give_leader(PlayerbotAI* botAI) { return new GiveLeaderAction(botAI); }
|
||||
static Action* cheat(PlayerbotAI* botAI) { return new CheatAction(botAI); }
|
||||
static Action* ginvite(PlayerbotAI* botAI) { return new GuildInviteAction(botAI); }
|
||||
static Action* guild_promote(PlayerbotAI* botAI) { return new GuildPromoteAction(botAI); }
|
||||
static Action* guild_demote(PlayerbotAI* botAI) { return new GuildDemoteAction(botAI); }
|
||||
static Action* guild_remove(PlayerbotAI* botAI) { return new GuildRemoveAction(botAI); }
|
||||
static Action* guild_leave(PlayerbotAI* botAI) { return new GuildLeaveAction(botAI); }
|
||||
static Action* rtsc(PlayerbotAI* botAI) { return new RTSCAction(botAI); }
|
||||
static Action* naxx_chat_shortcut(PlayerbotAI* ai) { return new NaxxChatShortcutAction(ai); }
|
||||
static Action* bwl_chat_shortcut(PlayerbotAI* ai) { return new BwlChatShortcutAction(ai); }
|
||||
static Action* tell_expected_dps(PlayerbotAI* ai) { return new TellExpectedDpsAction(ai); }
|
||||
static Action* join(PlayerbotAI* ai) { return new JoinGroupAction(ai); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChatShortcutActions.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Formations.h"
|
||||
#include "PositionValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
|
||||
void ReturnPositionResetAction::ResetReturnPosition()
|
||||
{
|
||||
@@ -66,7 +68,8 @@ bool FollowChatShortcutAction::Execute(Event event)
|
||||
}
|
||||
|
||||
/* Default mechanics takes care of this now.
|
||||
if (bot->GetMapId() != master->GetMapId() || (master && bot->GetDistance(master) > sPlayerbotAIConfig->sightDistance))
|
||||
if (bot->GetMapId() != master->GetMapId() || (master && bot->GetDistance(master) >
|
||||
sPlayerbotAIConfig->sightDistance))
|
||||
{
|
||||
if (bot->isDead())
|
||||
{
|
||||
@@ -76,8 +79,8 @@ bool FollowChatShortcutAction::Execute(Event event)
|
||||
else
|
||||
botAI->TellMaster("You are too far away from me! I will there soon.");
|
||||
|
||||
bot->TeleportTo(master->GetMapId(), master->GetPositionX(), master->GetPositionY(), master->GetPositionZ(), master->GetOrientation());
|
||||
return true;
|
||||
bot->TeleportTo(master->GetMapId(), master->GetPositionX(), master->GetPositionY(), master->GetPositionZ(),
|
||||
master->GetOrientation()); return true;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHATSHORTCUTACTION_H
|
||||
@@ -11,80 +12,80 @@ class PlayerbotAI;
|
||||
|
||||
class ReturnPositionResetAction : public Action
|
||||
{
|
||||
public:
|
||||
ReturnPositionResetAction(PlayerbotAI* botAI, std::string const name) : Action(botAI, name) { }
|
||||
public:
|
||||
ReturnPositionResetAction(PlayerbotAI* botAI, std::string const name) : Action(botAI, name) {}
|
||||
|
||||
void ResetReturnPosition();
|
||||
void SetReturnPosition(float x, float y, float z);
|
||||
void ResetReturnPosition();
|
||||
void SetReturnPosition(float x, float y, float z);
|
||||
};
|
||||
|
||||
class FollowChatShortcutAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
FollowChatShortcutAction(PlayerbotAI* botAI) : MovementAction(botAI, "follow chat shortcut") { }
|
||||
public:
|
||||
FollowChatShortcutAction(PlayerbotAI* botAI) : MovementAction(botAI, "follow chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class StayChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
StayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "stay chat shortcut") { }
|
||||
public:
|
||||
StayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "stay chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class FleeChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
FleeChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "flee chat shortcut") { }
|
||||
public:
|
||||
FleeChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "flee chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class GoawayChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
GoawayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "runaway chat shortcut") { }
|
||||
public:
|
||||
GoawayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "runaway chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class GrindChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
GrindChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "grind chat shortcut") { }
|
||||
public:
|
||||
GrindChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "grind chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class TankAttackChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
TankAttackChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "tank attack chat shortcut") { }
|
||||
public:
|
||||
TankAttackChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "tank attack chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class MaxDpsChatShortcutAction : public Action
|
||||
{
|
||||
public:
|
||||
MaxDpsChatShortcutAction(PlayerbotAI* botAI) : Action(botAI, "max dps chat shortcut") { }
|
||||
public:
|
||||
MaxDpsChatShortcutAction(PlayerbotAI* botAI) : Action(botAI, "max dps chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class NaxxChatShortcutAction : public Action
|
||||
{
|
||||
public:
|
||||
NaxxChatShortcutAction(PlayerbotAI* ai) : Action(ai, "naxx chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
public:
|
||||
NaxxChatShortcutAction(PlayerbotAI* ai) : Action(ai, "naxx chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
};
|
||||
|
||||
class BwlChatShortcutAction : public Action
|
||||
{
|
||||
public:
|
||||
BwlChatShortcutAction(PlayerbotAI* ai) : Action(ai, "bwl chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
public:
|
||||
BwlChatShortcutAction(PlayerbotAI* ai) : Action(ai, "bwl chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheatAction.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool CheatAction::Execute(Event event)
|
||||
@@ -36,7 +38,7 @@ bool CheatAction::Execute(Event event)
|
||||
|
||||
BotCheatMask CheatAction::GetCheatMask(std::string const cheat)
|
||||
{
|
||||
if (cheat=="taxi")
|
||||
if (cheat == "taxi")
|
||||
return BotCheatMask::taxi;
|
||||
|
||||
if (cheat == "gold")
|
||||
@@ -59,7 +61,7 @@ std::string const CheatAction::GetCheatName(BotCheatMask cheatMask)
|
||||
switch (cheatMask)
|
||||
{
|
||||
case BotCheatMask::taxi:
|
||||
return "taxi";
|
||||
return "taxi";
|
||||
case BotCheatMask::gold:
|
||||
return "gold";
|
||||
case BotCheatMask::health:
|
||||
@@ -80,9 +82,9 @@ void CheatAction::ListCheats()
|
||||
{
|
||||
BotCheatMask cheatMask = BotCheatMask(1 << i);
|
||||
if ((uint32)cheatMask & (uint32)sPlayerbotAIConfig->botCheatMask)
|
||||
out << "[conf:" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
out << "[conf:" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
else if (botAI->HasCheat(cheatMask))
|
||||
out << "[" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
out << "[" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
}
|
||||
|
||||
botAI->TellMasterNoFacing(out);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Action.h"
|
||||
@@ -10,13 +11,13 @@ enum class BotCheatMask : uint32;
|
||||
|
||||
class CheatAction : public Action
|
||||
{
|
||||
public:
|
||||
CheatAction(PlayerbotAI* botAI) : Action(botAI, "cheat") { }
|
||||
public:
|
||||
CheatAction(PlayerbotAI* botAI) : Action(botAI, "cheat") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
static BotCheatMask GetCheatMask(std::string const cheat);
|
||||
static std::string const GetCheatName(BotCheatMask cheatMask);
|
||||
void ListCheats();
|
||||
private:
|
||||
static BotCheatMask GetCheatMask(std::string const cheat);
|
||||
static std::string const GetCheatName(BotCheatMask cheatMask);
|
||||
void ListCheats();
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheckMailAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "GuildTaskMgr.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -74,7 +76,7 @@ void CheckMailAction::ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTr
|
||||
|
||||
for (MailItemInfoVec::iterator i = mail->items.begin(); i != mail->items.end(); ++i)
|
||||
{
|
||||
Item *item = bot->GetMItem(i->item_guid);
|
||||
Item* item = bot->GetMItem(i->item_guid);
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHECKMAILACTION_H
|
||||
@@ -14,14 +15,14 @@ struct Mail;
|
||||
|
||||
class CheckMailAction : public Action
|
||||
{
|
||||
public:
|
||||
CheckMailAction(PlayerbotAI* botAI) : Action(botAI, "check mail") { }
|
||||
public:
|
||||
CheckMailAction(PlayerbotAI* botAI) : Action(botAI, "check mail") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
private:
|
||||
void ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTransaction trans);
|
||||
private:
|
||||
void ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTransaction trans);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheckMountStateAction.h"
|
||||
|
||||
#include "BattlegroundWS.h"
|
||||
#include "Event.h"
|
||||
#include "PlayerbotAI.h"
|
||||
@@ -12,18 +14,23 @@
|
||||
|
||||
bool CheckMountStateAction::Execute(Event event)
|
||||
{
|
||||
bool noattackers = AI_VALUE2(bool, "combat", "self target") ? (AI_VALUE(uint8, "attacker count") > 0 ? false : true) : true;
|
||||
bool noattackers =
|
||||
AI_VALUE2(bool, "combat", "self target") ? (AI_VALUE(uint8, "attacker count") > 0 ? false : true) : true;
|
||||
bool enemy = AI_VALUE(Unit*, "enemy player target");
|
||||
// ignore grind target in BG or bots will dismount near any creature (eg: the rams in AV)
|
||||
bool dps = (AI_VALUE(Unit*, "dps target") || (!bot->InBattleground() && AI_VALUE(Unit*, "grind target")));
|
||||
bool fartarget = (enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 40.0f)) ||
|
||||
bool fartarget =
|
||||
(enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 40.0f)) ||
|
||||
(dps && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), 50.0f));
|
||||
bool attackdistance = false;
|
||||
bool chasedistance = false;
|
||||
float attack_distance = 35.0f;
|
||||
if (PlayerbotAI::IsMelee(bot)) {
|
||||
if (PlayerbotAI::IsMelee(bot))
|
||||
{
|
||||
attack_distance = 10.0f;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
attack_distance = 40.0f;
|
||||
}
|
||||
if (enemy)
|
||||
@@ -31,11 +38,15 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
|
||||
if (dps || enemy)
|
||||
{
|
||||
attackdistance = (enemy || dps) && sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "current target"), attack_distance);
|
||||
chasedistance = enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 45.0f) && AI_VALUE2(bool, "moving", "enemy player target");
|
||||
attackdistance = (enemy || dps) && sServerFacade->IsDistanceLessThan(
|
||||
AI_VALUE2(float, "distance", "current target"), attack_distance);
|
||||
chasedistance =
|
||||
enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 45.0f) &&
|
||||
AI_VALUE2(bool, "moving", "enemy player target");
|
||||
}
|
||||
|
||||
if (bot->IsMounted() && attackdistance) {
|
||||
if (bot->IsMounted() && attackdistance)
|
||||
{
|
||||
WorldPacket emptyPacket;
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
return true;
|
||||
@@ -48,7 +59,8 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
return false;
|
||||
|
||||
// bool farFromMaster = sServerFacade->GetDistance2d(bot, master) > sPlayerbotAIConfig->sightDistance;
|
||||
if (master->IsMounted() && !bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat() && botAI->GetState() != BOT_STATE_COMBAT)
|
||||
if (master->IsMounted() && !bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat() &&
|
||||
botAI->GetState() != BOT_STATE_COMBAT)
|
||||
{
|
||||
return Mount();
|
||||
}
|
||||
@@ -59,7 +71,8 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
return true;
|
||||
}
|
||||
// if (!bot->IsMounted() && (chasedistance || (farFromMaster && botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))) && !bot->IsInCombat() && !dps)
|
||||
// if (!bot->IsMounted() && (chasedistance || (farFromMaster && botAI->HasStrategy("follow",
|
||||
// BOT_STATE_NON_COMBAT))) && !bot->IsInCombat() && !dps)
|
||||
// return Mount();
|
||||
|
||||
// if (!bot->IsFlying() && ((!farFromMaster && !master->IsMounted()) || attackdistance) && bot->IsMounted())
|
||||
@@ -73,17 +86,20 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
}
|
||||
|
||||
// For random bots
|
||||
if (!bot->InBattleground() && !master) {
|
||||
if (!bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat()) {
|
||||
if (!bot->InBattleground() && !master)
|
||||
{
|
||||
if (!bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat())
|
||||
{
|
||||
return Mount();
|
||||
}
|
||||
}
|
||||
|
||||
if (bot->InBattleground() && !attackdistance && (noattackers || fartarget) && !bot->IsInCombat() && !bot->IsMounted())
|
||||
if (bot->InBattleground() && !attackdistance && (noattackers || fartarget) && !bot->IsInCombat() &&
|
||||
!bot->IsMounted())
|
||||
{
|
||||
if (bot->GetBattlegroundTypeId() == BATTLEGROUND_WS)
|
||||
{
|
||||
BattlegroundWS *bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground();
|
||||
BattlegroundWS* bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground();
|
||||
if (bot->HasAura(23333) || bot->HasAura(23335))
|
||||
{
|
||||
return false;
|
||||
@@ -97,11 +113,13 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
// {
|
||||
// if (AI_VALUE(GuidPosition, "rpg target"))
|
||||
// {
|
||||
// if (sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "rpg target"), sPlayerbotAIConfig->farDistance) && noattackers && !dps && !enemy)
|
||||
// if (sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "rpg target"),
|
||||
// sPlayerbotAIConfig->farDistance) && noattackers && !dps && !enemy)
|
||||
// return Mount();
|
||||
// }
|
||||
|
||||
// if (((!AI_VALUE(GuidVector, "possible rpg targets").empty()) && noattackers && !dps && !enemy) && urand(0, 100) > 50)
|
||||
// if (((!AI_VALUE(GuidVector, "possible rpg targets").empty()) && noattackers && !dps && !enemy) && urand(0,
|
||||
// 100) > 50)
|
||||
// return Mount();
|
||||
// }
|
||||
|
||||
@@ -175,8 +193,8 @@ bool CheckMountStateAction::Mount()
|
||||
// bot->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
|
||||
Player* master = GetMaster();
|
||||
botAI->RemoveShapeshift();
|
||||
Player* master = GetMaster();
|
||||
botAI->RemoveShapeshift();
|
||||
botAI->RemoveAura("tree of life");
|
||||
int32 masterSpeed = 59;
|
||||
SpellInfo const* masterSpell = nullptr;
|
||||
@@ -213,7 +231,7 @@ bool CheckMountStateAction::Mount()
|
||||
|
||||
bool hasSwiftMount = false;
|
||||
|
||||
//std::map<int32, std::vector<uint32> > spells;
|
||||
// std::map<int32, std::vector<uint32> > spells;
|
||||
std::map<uint32, std::map<int32, std::vector<uint32>>> allSpells;
|
||||
for (PlayerSpellMap::iterator itr = bot->GetSpellMap().begin(); itr != bot->GetSpellMap().end(); ++itr)
|
||||
{
|
||||
@@ -226,16 +244,20 @@ bool CheckMountStateAction::Mount()
|
||||
continue;
|
||||
|
||||
int32 effect = std::max(spellInfo->Effects[1].BasePoints, spellInfo->Effects[2].BasePoints);
|
||||
//if (effect < masterSpeed)
|
||||
//continue;
|
||||
// if (effect < masterSpeed)
|
||||
// continue;
|
||||
|
||||
uint32 index = (spellInfo->Effects[1].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED ||
|
||||
spellInfo->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) ? 1 : 0;
|
||||
spellInfo->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)
|
||||
? 1
|
||||
: 0;
|
||||
|
||||
if (index == 0 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 59)
|
||||
if (index == 0 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 59)
|
||||
hasSwiftMount = true;
|
||||
|
||||
if (index == 1 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 149)
|
||||
if (index == 1 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 149)
|
||||
hasSwiftMount = true;
|
||||
|
||||
allSpells[index][effect].push_back(spellId);
|
||||
@@ -245,7 +267,9 @@ bool CheckMountStateAction::Mount()
|
||||
if (masterSpell)
|
||||
{
|
||||
masterMountType = (masterSpell->Effects[1].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED ||
|
||||
masterSpell->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) ? 1 : 0;
|
||||
masterSpell->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)
|
||||
? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
std::map<int32, std::vector<uint32>>& spells = allSpells[masterMountType];
|
||||
@@ -260,10 +284,12 @@ bool CheckMountStateAction::Mount()
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
if (masterMountType == 0 && masterSpeed > 59 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 99)
|
||||
if (masterMountType == 0 && masterSpeed > 59 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 99)
|
||||
spells[59].clear();
|
||||
|
||||
if (masterMountType == 1 && masterSpeed > 149 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 279)
|
||||
if (masterMountType == 1 && masterSpeed > 149 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 279)
|
||||
spells[149].clear();
|
||||
}
|
||||
}
|
||||
@@ -276,8 +302,8 @@ bool CheckMountStateAction::Mount()
|
||||
if (index >= ids.size())
|
||||
continue;
|
||||
|
||||
|
||||
return botAI->CastSpell(ids[index], bot);;
|
||||
return botAI->CastSpell(ids[index], bot);
|
||||
;
|
||||
}
|
||||
|
||||
std::vector<Item*> items = AI_VALUE2(std::vector<Item*>, "inventory items", "mount");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHECKMOUNTSTATEACTION_H
|
||||
@@ -11,13 +12,13 @@ class PlayerbotAI;
|
||||
|
||||
class CheckMountStateAction : public UseItemAction
|
||||
{
|
||||
public:
|
||||
CheckMountStateAction(PlayerbotAI* botAI) : UseItemAction(botAI, "check mount state", true) { }
|
||||
public:
|
||||
CheckMountStateAction(PlayerbotAI* botAI) : UseItemAction(botAI, "check mount state", true) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override { return true; }
|
||||
bool Mount();
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override { return true; }
|
||||
bool Mount();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheckValuesAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values")
|
||||
{
|
||||
}
|
||||
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
||||
|
||||
bool CheckValuesAction::Execute(Event event)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHECKVALUESACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class CheckValuesAction : public Action
|
||||
{
|
||||
public:
|
||||
CheckValuesAction(PlayerbotAI* botAI);
|
||||
public:
|
||||
CheckValuesAction(PlayerbotAI* botAI);
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 <random>
|
||||
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BudgetValues.h"
|
||||
@@ -9,13 +12,11 @@
|
||||
#include "Event.h"
|
||||
#include "Formations.h"
|
||||
#include "GuildCreateActions.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "RpgSubActions.h"
|
||||
#include "Util.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
#include <random>
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
|
||||
bool ChooseRpgTargetAction::HasSameTarget(ObjectGuid guid, uint32 max, GuidVector const& nearGuids)
|
||||
{
|
||||
@@ -333,7 +334,8 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
if (realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() && bot->GetMapId() == realMaster->GetMapId())
|
||||
inDungeon = true;
|
||||
|
||||
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() && (realMaster->GetMapId() != pos.getMapId()))
|
||||
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() &&
|
||||
(realMaster->GetMapId() != pos.getMapId()))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -352,7 +354,8 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
if (!botAI->HasActivePlayerMaster() && distance < 50.0f)
|
||||
{
|
||||
Player* player = master;
|
||||
if (!master->isMoving() || PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
|
||||
if (!master->isMoving() ||
|
||||
PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHOOSERPGTARGETACTION_H
|
||||
@@ -16,29 +17,29 @@ class WorldPosition;
|
||||
|
||||
class ChooseRpgTargetAction : public Action
|
||||
{
|
||||
public:
|
||||
ChooseRpgTargetAction(PlayerbotAI* botAI, std::string const name = "choose rpg target") : Action(botAI, name) { }
|
||||
public:
|
||||
ChooseRpgTargetAction(PlayerbotAI* botAI, std::string const name = "choose rpg target") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
static bool isFollowValid(Player* bot, WorldObject* target);
|
||||
static bool isFollowValid(Player* bot, WorldPosition pos);
|
||||
static bool isFollowValid(Player* bot, WorldObject* target);
|
||||
static bool isFollowValid(Player* bot, WorldPosition pos);
|
||||
|
||||
private:
|
||||
float getMaxRelevance(GuidPosition guidP);
|
||||
bool HasSameTarget(ObjectGuid guid, uint32 max, GuidVector const& nearGuids);
|
||||
private:
|
||||
float getMaxRelevance(GuidPosition guidP);
|
||||
bool HasSameTarget(ObjectGuid guid, uint32 max, GuidVector const& nearGuids);
|
||||
|
||||
std::unordered_map <ObjectGuid, std::string> rgpActionReason;
|
||||
std::unordered_map <ObjectGuid, std::string> rgpActionReason;
|
||||
};
|
||||
|
||||
class ClearRpgTargetAction : public ChooseRpgTargetAction
|
||||
{
|
||||
public:
|
||||
ClearRpgTargetAction(PlayerbotAI* botAI) : ChooseRpgTargetAction(botAI, "clear rpg target") { }
|
||||
public:
|
||||
ClearRpgTargetAction(PlayerbotAI* botAI) : ChooseRpgTargetAction(botAI, "clear rpg target") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChooseTargetActions.h"
|
||||
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "Event.h"
|
||||
#include "LootObjectStack.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
bool AttackEnemyPlayerAction::isUseful()
|
||||
@@ -22,19 +24,21 @@ bool AttackEnemyPlayerAction::isUseful()
|
||||
bool AttackEnemyFlagCarrierAction::isUseful()
|
||||
{
|
||||
Unit* target = context->GetValue<Unit*>("enemy flag carrier")->Get();
|
||||
return target && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target), 75.0f) && (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976));
|
||||
return target && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target), 75.0f) &&
|
||||
(bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976));
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isUseful()
|
||||
{
|
||||
if (!botAI->AllowActivity(GRIND_ACTIVITY)) //Bot not allowed to be active
|
||||
if (!botAI->AllowActivity(GRIND_ACTIVITY)) // Bot not allowed to be active
|
||||
return false;
|
||||
|
||||
if (!AI_VALUE(bool, "can move around"))
|
||||
return false;
|
||||
|
||||
if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
|
||||
ChooseRpgTargetAction::isFollowValid(bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) //Bot is traveling
|
||||
if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
|
||||
ChooseRpgTargetAction::isFollowValid(
|
||||
bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) // Bot is traveling
|
||||
return false;
|
||||
// if (bot->IsInCombat()) {
|
||||
// return false;
|
||||
@@ -45,10 +49,11 @@ bool AttackAnythingAction::isUseful()
|
||||
return false;
|
||||
|
||||
std::string const name = std::string(target->GetName());
|
||||
if (!name.empty() && name.find("Dummy") != std::string::npos) // Target is not a targetdummy
|
||||
if (!name.empty() && name.find("Dummy") != std::string::npos) // Target is not a targetdummy
|
||||
return false;
|
||||
|
||||
// if (!ChooseRpgTargetAction::isFollowValid(bot, target)) //Do not grind mobs far away from master.
|
||||
// if (!ChooseRpgTargetAction::isFollowValid(bot, target)) //Do not grind mobs far
|
||||
// away from master.
|
||||
// return false;
|
||||
|
||||
return true;
|
||||
@@ -115,10 +120,7 @@ bool AttackAnythingAction::Execute(Event event)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isPossible()
|
||||
{
|
||||
return AttackAction::isPossible() && GetTarget();
|
||||
}
|
||||
bool AttackAnythingAction::isPossible() { return AttackAction::isPossible() && GetTarget(); }
|
||||
|
||||
bool DpsAssistAction::isUseful()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHOOSETARGETACTIONS_H
|
||||
@@ -11,80 +12,80 @@ class PlayerbotAI;
|
||||
|
||||
class DpsAoeAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
DpsAoeAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps aoe") { }
|
||||
public:
|
||||
DpsAoeAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps aoe") {}
|
||||
|
||||
std::string const GetTargetName() override { return "dps aoe target"; }
|
||||
std::string const GetTargetName() override { return "dps aoe target"; }
|
||||
};
|
||||
|
||||
class DpsAssistAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
DpsAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps assist") { }
|
||||
public:
|
||||
DpsAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps assist") {}
|
||||
|
||||
std::string const GetTargetName() override { return "dps target"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "dps target"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class TankAssistAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
TankAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "tank assist") { }
|
||||
public:
|
||||
TankAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "tank assist") {}
|
||||
|
||||
std::string const GetTargetName() override { return "tank target"; }
|
||||
std::string const GetTargetName() override { return "tank target"; }
|
||||
};
|
||||
|
||||
class AttackAnythingAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackAnythingAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack anything") { }
|
||||
public:
|
||||
AttackAnythingAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack anything") {}
|
||||
|
||||
std::string const GetTargetName() override { return "grind target"; }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
std::string const GetTargetName() override { return "grind target"; }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
};
|
||||
|
||||
class AttackLeastHpTargetAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackLeastHpTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack least hp target") { }
|
||||
public:
|
||||
AttackLeastHpTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack least hp target") {}
|
||||
|
||||
std::string const GetTargetName() override { return "least hp target"; }
|
||||
std::string const GetTargetName() override { return "least hp target"; }
|
||||
};
|
||||
|
||||
class AttackEnemyPlayerAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackEnemyPlayerAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy player") { }
|
||||
public:
|
||||
AttackEnemyPlayerAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy player") {}
|
||||
|
||||
std::string const GetTargetName() override { return "enemy player target"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "enemy player target"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class AttackRtiTargetAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackRtiTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack rti target") { }
|
||||
public:
|
||||
AttackRtiTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack rti target") {}
|
||||
|
||||
std::string const GetTargetName() override { return "rti target"; }
|
||||
std::string const GetTargetName() override { return "rti target"; }
|
||||
};
|
||||
|
||||
class AttackEnemyFlagCarrierAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackEnemyFlagCarrierAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy flag carrier") { }
|
||||
public:
|
||||
AttackEnemyFlagCarrierAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy flag carrier") {}
|
||||
|
||||
std::string const GetTargetName() override { return "enemy flag carrier"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "enemy flag carrier"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class DropTargetAction : public Action
|
||||
{
|
||||
public:
|
||||
DropTargetAction(PlayerbotAI* botAI) : Action(botAI, "drop target") { }
|
||||
public:
|
||||
DropTargetAction(PlayerbotAI* botAI) : Action(botAI, "drop target") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChooseTravelTargetAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "LootObjectStack.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -29,19 +31,18 @@ bool ChooseTravelTargetAction::Execute(Event event)
|
||||
return false;
|
||||
|
||||
setNewTarget(&newTarget, oldTarget);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Select a new travel target.
|
||||
//Currently this selectes mostly based on priority (current quest > new quest).
|
||||
//This works fine because destinations can be full (max 15 bots per quest giver, max 1 bot per quest mob).
|
||||
// Select a new travel target.
|
||||
// Currently this selectes mostly based on priority (current quest > new quest).
|
||||
// This works fine because destinations can be full (max 15 bots per quest giver, max 1 bot per quest mob).
|
||||
//
|
||||
//Eventually we want to rewrite this to be more intelligent.
|
||||
// Eventually we want to rewrite this to be more intelligent.
|
||||
void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
|
||||
{
|
||||
bool foundTarget = false;
|
||||
foundTarget = SetGroupTarget(newTarget); //Join groups members
|
||||
// Join groups members
|
||||
bool foundTarget = foundTarget = SetGroupTarget(newTarget);
|
||||
|
||||
//Empty bags/repair
|
||||
if (!foundTarget && urand(1, 100) > 10 && bot->GetLevel() > 5) //90% chance
|
||||
@@ -95,34 +96,40 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
|
||||
if (!foundTarget)
|
||||
{
|
||||
if (urand(1, 100) > 50) //50% Focus on active quests for money.
|
||||
// 50% Focus on active quests for money.
|
||||
if (urand(1, 100) > 50)
|
||||
{
|
||||
if (urand(1, 100) > 50) //50% Focus on active quests for money.
|
||||
// 50% Focus on active quests for money.
|
||||
if (urand(1, 100) > 50)
|
||||
{
|
||||
foundTarget = SetQuestTarget(newTarget, true, false, true, true); //Turn in quests for money.
|
||||
// Turn in quests for money.
|
||||
foundTarget = SetQuestTarget(newTarget, true, false, true, true);
|
||||
}
|
||||
|
||||
if (!foundTarget)
|
||||
{
|
||||
foundTarget = SetQuestTarget(newTarget, false, true, false, false); //Find new (low) level quests
|
||||
// Find new (low) level quests
|
||||
foundTarget = SetQuestTarget(newTarget, false, true, false, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foundTarget = SetGrindTarget(newTarget); //Go grind mobs for money
|
||||
// Go grind mobs for money
|
||||
foundTarget = SetGrindTarget(newTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Continue current target.
|
||||
if (!foundTarget && urand(1, 100) > 10) //90% chance
|
||||
//Continue current target. 90% chance
|
||||
if (!foundTarget && urand(1, 100) > 10)
|
||||
{
|
||||
foundTarget = SetCurrentTarget(newTarget, oldTarget); //Extend current target.
|
||||
// Extend current target.
|
||||
foundTarget = SetCurrentTarget(newTarget, oldTarget);
|
||||
}
|
||||
|
||||
//Get mail
|
||||
//if (!foundTarget && urand(1, 100) > 70) //30% chance
|
||||
//Get mail 30% chance
|
||||
//if (!foundTarget && urand(1, 100) > 70)
|
||||
//{
|
||||
// if (AI_VALUE(bool, "can get mail"))
|
||||
// {
|
||||
@@ -130,19 +137,21 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
// }
|
||||
//}
|
||||
|
||||
//Dungeon in group.
|
||||
if (!foundTarget && urand(1, 100) > 50) //50% chance
|
||||
//Dungeon in group. 50% chance
|
||||
if (!foundTarget && urand(1, 100) > 50)
|
||||
{
|
||||
if (AI_VALUE(bool, "can fight boss"))
|
||||
{
|
||||
foundTarget = SetBossTarget( newTarget); //Go fight a (dungeon boss)
|
||||
// Go fight a (dungeon boss)
|
||||
foundTarget = SetBossTarget(newTarget);
|
||||
}
|
||||
}
|
||||
|
||||
//Do quests (start, do, end)
|
||||
if (!foundTarget && urand(1, 100) > 5) //95% chance
|
||||
//Do quests (start, do, end) 95% chance
|
||||
if (!foundTarget && urand(1, 100) > 5)
|
||||
{
|
||||
foundTarget = SetQuestTarget(newTarget, false, true, true, true); //Do any nearby
|
||||
// Do any nearby
|
||||
foundTarget = SetQuestTarget(newTarget, false, true, true, true);
|
||||
}
|
||||
|
||||
//Explore a nearby unexplored area.
|
||||
@@ -151,8 +160,8 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
foundTarget = SetExploreTarget(newTarget);
|
||||
}
|
||||
|
||||
//Just hang with an npc
|
||||
if (!foundTarget && urand(1, 100) > 50) //50% chance
|
||||
//Just hang with an npc 50% chance
|
||||
if (!foundTarget && urand(1, 100) > 50)
|
||||
{
|
||||
foundTarget = SetRpgTarget(newTarget);
|
||||
if (foundTarget)
|
||||
@@ -164,17 +173,18 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
foundTarget = SetGrindTarget(newTarget);
|
||||
}
|
||||
|
||||
// Idle a bit.
|
||||
if (!foundTarget)
|
||||
SetNullTarget(newTarget); //Idle a bit.
|
||||
SetNullTarget(newTarget);
|
||||
}
|
||||
|
||||
void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
|
||||
{
|
||||
//Tell the master where we are going.
|
||||
// Tell the master where we are going.
|
||||
if (!bot->GetGroup() || (botAI->GetGroupMaster() == bot))
|
||||
ReportTravelTarget(newTarget, oldTarget);
|
||||
|
||||
//If we are heading to a creature/npc clear it from the ignore list.
|
||||
// If we are heading to a creature/npc clear it from the ignore list.
|
||||
if (oldTarget && oldTarget == newTarget && newTarget->getEntry())
|
||||
{
|
||||
GuidSet& ignoreList = context->GetValue<GuidSet&>("ignore rpg target")->Get();
|
||||
@@ -190,22 +200,23 @@ void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
context->GetValue<GuidSet&>("ignore rpg target")->Set(ignoreList);
|
||||
}
|
||||
|
||||
//Actually apply the new target to the travel target used by the bot.
|
||||
// Actually apply the new target to the travel target used by the bot.
|
||||
oldTarget->copyTarget(newTarget);
|
||||
|
||||
//If we are idling but have a master. Idle only 10 seconds.
|
||||
if (botAI->GetMaster() && oldTarget->isActive() && oldTarget->getDestination()->getName() == "NullTravelDestination")
|
||||
// If we are idling but have a master. Idle only 10 seconds.
|
||||
if (botAI->GetMaster() && oldTarget->isActive() &&
|
||||
oldTarget->getDestination()->getName() == "NullTravelDestination")
|
||||
oldTarget->setExpireIn(10 * IN_MILLISECONDS);
|
||||
else if (oldTarget->isForced()) // Make sure travel goes into cooldown after getting to the destination.
|
||||
else if (oldTarget->isForced()) // Make sure travel goes into cooldown after getting to the destination.
|
||||
oldTarget->setExpireIn(HOUR * IN_MILLISECONDS);
|
||||
|
||||
//Clear rpg and pull/grind target. We want to travel, not hang around some more.
|
||||
// Clear rpg and pull/grind target. We want to travel, not hang around some more.
|
||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||
RESET_AI_VALUE(ObjectGuid, "pull target");
|
||||
}
|
||||
|
||||
//Tell the master what travel target we are moving towards.
|
||||
//This should at some point be rewritten to be denser or perhaps logic moved to ->getTitle()
|
||||
// Tell the master what travel target we are moving towards.
|
||||
// This should at some point be rewritten to be denser or perhaps logic moved to ->getTitle()
|
||||
void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
|
||||
{
|
||||
TravelDestination* destination = newTarget->getDestination();
|
||||
@@ -216,7 +227,8 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
||||
if (newTarget->isForced())
|
||||
out << "(Forced) ";
|
||||
|
||||
if (destination->getName() == "QuestRelationTravelDestination" || destination->getName() == "QuestObjectiveTravelDestination")
|
||||
if (destination->getName() == "QuestRelationTravelDestination" ||
|
||||
destination->getName() == "QuestObjectiveTravelDestination")
|
||||
{
|
||||
QuestTravelDestination* QuestDestination = (QuestTravelDestination*)destination;
|
||||
Quest const* quest = QuestDestination->GetQuestTemplate();
|
||||
@@ -262,7 +274,7 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
||||
|
||||
out << round(newTarget->getDestination()->distanceTo(&botLocation)) << "y";
|
||||
|
||||
out << " for ";
|
||||
out << " for ";
|
||||
|
||||
if (AI_VALUE2(bool, "group or", "should sell,can sell"))
|
||||
out << "selling items";
|
||||
@@ -347,20 +359,22 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
||||
}
|
||||
}
|
||||
|
||||
bool ChooseTravelTargetAction::getBestDestination(std::vector<TravelDestination*>* activeDestinations, std::vector<WorldPosition*>* activePoints)
|
||||
bool ChooseTravelTargetAction::getBestDestination(std::vector<TravelDestination*>* activeDestinations,
|
||||
std::vector<WorldPosition*>* activePoints)
|
||||
{
|
||||
if (activeDestinations->empty() || activePoints->empty()) //No targets or no points.
|
||||
if (activeDestinations->empty() || activePoints->empty()) // No targets or no points.
|
||||
return false;
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
std::vector<WorldPosition*> availablePoints = sTravelMgr->getNextPoint(&botLocation, *activePoints); //Pick a good point.
|
||||
std::vector<WorldPosition*> availablePoints =
|
||||
sTravelMgr->getNextPoint(&botLocation, *activePoints); // Pick a good point.
|
||||
|
||||
if (availablePoints.empty()) //No points available.
|
||||
if (availablePoints.empty()) // No points available.
|
||||
return false;
|
||||
|
||||
TravelDestination* targetDestination;
|
||||
|
||||
for (auto activeTarget : *activeDestinations) //Pick the destination that has this point.
|
||||
for (auto activeTarget : *activeDestinations) // Pick the destination that has this point.
|
||||
if (activeTarget->distanceTo(availablePoints.front()) == 0)
|
||||
targetDestination = activeTarget;
|
||||
|
||||
@@ -402,7 +416,7 @@ bool ChooseTravelTargetAction::SetGroupTarget(TravelTarget* target)
|
||||
}
|
||||
}
|
||||
|
||||
//Find targets of the group.
|
||||
// Find targets of the group.
|
||||
for (auto& member : groupPlayers)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(member);
|
||||
@@ -424,7 +438,8 @@ bool ChooseTravelTargetAction::SetGroupTarget(TravelTarget* target)
|
||||
if (!groupTarget->isActive())
|
||||
continue;
|
||||
|
||||
if (!groupTarget->getDestination()->isActive(bot) || groupTarget->getDestination()->getName() == "RpgTravelDestination")
|
||||
if (!groupTarget->getDestination()->isActive(bot) ||
|
||||
groupTarget->getDestination()->getName() == "RpgTravelDestination")
|
||||
continue;
|
||||
|
||||
activeDestinations.push_back(groupTarget->getDestination());
|
||||
@@ -446,10 +461,10 @@ bool ChooseTravelTargetAction::SetCurrentTarget(TravelTarget* target, TravelTarg
|
||||
if (oldTarget->isMaxRetry(false))
|
||||
return false;
|
||||
|
||||
if (!oldDestination) //Does this target have a destination?
|
||||
if (!oldDestination) // Does this target have a destination?
|
||||
return false;
|
||||
|
||||
if (!oldDestination->isActive(bot)) //Is the destination still valid?
|
||||
if (!oldDestination->isActive(bot)) // Is the destination still valid?
|
||||
return false;
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
@@ -473,7 +488,8 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
||||
|
||||
if (newQuests)
|
||||
{
|
||||
activeDestinations = sTravelMgr->getQuestTravelDestinations(bot, -1, true, false, 400 + bot->GetLevel() * 10); //Prefer new quests near the player at lower levels.
|
||||
// Prefer new quests near the player at lower levels.
|
||||
activeDestinations = sTravelMgr->getQuestTravelDestinations(bot, -1, true, false, 400 + bot->GetLevel() * 10);
|
||||
}
|
||||
if (activeQuests || completedQuests)
|
||||
{
|
||||
@@ -530,12 +546,13 @@ bool ChooseTravelTargetAction::SetNewQuestTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getQuestTravelDestinations(bot, -1, botAI->HasRealPlayerMaster());
|
||||
// Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getQuestTravelDestinations(bot, -1, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -558,12 +575,13 @@ bool ChooseTravelTargetAction::SetRpgTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find rpg npcs
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
// Find rpg npcs
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -586,12 +604,13 @@ bool ChooseTravelTargetAction::SetGrindTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find grind mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
// Find grind mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -614,12 +633,13 @@ bool ChooseTravelTargetAction::SetBossTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find boss mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
// Find boss mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -642,7 +662,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find quest givers.
|
||||
// Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getExploreTravelDestinations(bot, true, true);
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
@@ -684,7 +704,8 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
||||
|
||||
char* strstri(char const* haystack, char const* needle);
|
||||
|
||||
bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags, std::string const name, std::vector<uint32> items)
|
||||
bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags,
|
||||
std::string const name, std::vector<uint32> items)
|
||||
{
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
@@ -710,7 +731,8 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
||||
if (!foundFlag)
|
||||
continue;
|
||||
|
||||
if (!name.empty() && !strstri(cInfo->Name.c_str(), name.c_str()) && !strstri(cInfo->SubName.c_str(), name.c_str()))
|
||||
if (!name.empty() && !strstri(cInfo->Name.c_str(), name.c_str()) &&
|
||||
!strstri(cInfo->SubName.c_str(), name.c_str()))
|
||||
continue;
|
||||
|
||||
if (!items.empty())
|
||||
@@ -747,10 +769,11 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
||||
|
||||
if (!dests.empty())
|
||||
{
|
||||
TravelDestination* dest = *std::min_element(dests.begin(), dests.end(), [botPos](TravelDestination* i, TravelDestination* j)
|
||||
{
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) < j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
TravelDestination* dest = *std::min_element(dests.begin(), dests.end(),
|
||||
[botPos](TravelDestination* i, TravelDestination* j) {
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) <
|
||||
j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
|
||||
std::vector<WorldPosition*> points = dest->nextPoint(const_cast<WorldPosition*>(&botPos), true);
|
||||
if (points.empty())
|
||||
@@ -765,7 +788,8 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<TravelDestination*> TravelMgr::getBossTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance)
|
||||
std::vector<TravelDestination*> TravelMgr::getBossTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive,
|
||||
float maxDistance)
|
||||
{
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
@@ -861,12 +885,11 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
if (dests.empty())
|
||||
return nullptr;
|
||||
|
||||
TravelDestination* dest = *std::min_element(dests.begin(), dests.end(), [botPos](TravelDestination* i, TravelDestination* j)
|
||||
{
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) < j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
|
||||
return dest;
|
||||
return *std::min_element(dests.begin(), dests.end(),
|
||||
[botPos](TravelDestination* i, TravelDestination* j)
|
||||
{
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) < j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
};
|
||||
|
||||
bool ChooseTravelTargetAction::isUseful()
|
||||
@@ -874,7 +897,8 @@ bool ChooseTravelTargetAction::isUseful()
|
||||
if (!botAI->AllowActivity(TRAVEL_ACTIVITY))
|
||||
return false;
|
||||
|
||||
return !context->GetValue<TravelTarget*>("travel target")->Get()->isActive() && !context->GetValue<LootObject>("loot target")->Get().IsLootPossible(bot) && !bot->IsInCombat();
|
||||
return !context->GetValue<TravelTarget*>("travel target")->Get()->isActive() &&
|
||||
!context->GetValue<LootObject>("loot target")->Get().IsLootPossible(bot) && !bot->IsInCombat();
|
||||
}
|
||||
|
||||
bool ChooseTravelTargetAction::needForQuest(Unit* target)
|
||||
@@ -918,7 +942,7 @@ bool ChooseTravelTargetAction::needForQuest(Unit* target)
|
||||
int required = questTemplate->RequiredNpcOrGoCount[j];
|
||||
int available = questStatus.CreatureOrGOCount[j];
|
||||
|
||||
if(required && available < required && (target->GetEntry() == entry || justCheck))
|
||||
if (required && available < required && (target->GetEntry() == entry || justCheck))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -949,12 +973,12 @@ bool ChooseTravelTargetAction::needForQuest(Unit* target)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChooseTravelTargetAction::needItemForQuest(uint32 itemId, const Quest* questTemplate, const QuestStatusData* questStatus)
|
||||
bool ChooseTravelTargetAction::needItemForQuest(uint32 itemId, const Quest* questTemplate,
|
||||
const QuestStatusData* questStatus)
|
||||
{
|
||||
for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CHOOSETRAVELTARGETACTION_H
|
||||
@@ -16,34 +17,37 @@ struct QuestStatusData;
|
||||
|
||||
class ChooseTravelTargetAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
ChooseTravelTargetAction(PlayerbotAI* botAI, std::string const name = "choose travel target") : MovementAction(botAI, name) { }
|
||||
public:
|
||||
ChooseTravelTargetAction(PlayerbotAI* botAI, std::string const name = "choose travel target")
|
||||
: MovementAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
static TravelDestination* FindDestination(Player* bot, std::string const name, bool zones = true, bool npcs = true, bool quests = true, bool mobs = true, bool bosses = true);
|
||||
static TravelDestination* FindDestination(Player* bot, std::string const name, bool zones = true, bool npcs = true, bool quests = true, bool mobs = true, bool bosses = true);
|
||||
|
||||
protected:
|
||||
void getNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void ReportTravelTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
protected:
|
||||
void getNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void ReportTravelTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
|
||||
bool getBestDestination(std::vector<TravelDestination*>* activeDestinations, std::vector<WorldPosition*>* activePoints);
|
||||
bool SetGroupTarget(TravelTarget* target);
|
||||
bool SetCurrentTarget(TravelTarget* target, TravelTarget* oldTarget);
|
||||
bool SetQuestTarget(TravelTarget* target, bool onlyCompleted = false, bool newQuests = true, bool activeQuests = true, bool completedQuests = true);
|
||||
bool SetNewQuestTarget(TravelTarget* target);
|
||||
bool SetRpgTarget(TravelTarget* target);
|
||||
bool SetGrindTarget(TravelTarget* target);
|
||||
bool SetBossTarget(TravelTarget* target);
|
||||
bool SetExploreTarget(TravelTarget* target);
|
||||
bool SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags, std::string const name = "", std::vector<uint32> items = { });
|
||||
bool SetNullTarget(TravelTarget* target);
|
||||
bool getBestDestination(std::vector<TravelDestination*>* activeDestinations, std::vector<WorldPosition*>* activePoints);
|
||||
bool SetGroupTarget(TravelTarget* target);
|
||||
bool SetCurrentTarget(TravelTarget* target, TravelTarget* oldTarget);
|
||||
bool SetQuestTarget(TravelTarget* target, bool onlyCompleted = false, bool newQuests = true, bool activeQuests = true, bool completedQuests = true);
|
||||
bool SetNewQuestTarget(TravelTarget* target);
|
||||
bool SetRpgTarget(TravelTarget* target);
|
||||
bool SetGrindTarget(TravelTarget* target);
|
||||
bool SetBossTarget(TravelTarget* target);
|
||||
bool SetExploreTarget(TravelTarget* target);
|
||||
bool SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags, std::string const name = "", std::vector<uint32> items = { });
|
||||
bool SetNullTarget(TravelTarget* target);
|
||||
|
||||
private:
|
||||
virtual bool needForQuest(Unit* target);
|
||||
virtual bool needItemForQuest(uint32 itemId, Quest const* questTemplate, QuestStatusData const* questStatus);
|
||||
private:
|
||||
virtual bool needForQuest(Unit* target);
|
||||
virtual bool needItemForQuest(uint32 itemId, Quest const* questTemplate, QuestStatusData const* questStatus);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CombatActions.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "LastMovementValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -10,7 +12,7 @@
|
||||
|
||||
bool SwitchToMeleeAction::Execute(Event event)
|
||||
{
|
||||
//botAI->TellMasterNoFacing("Switching to melee!");
|
||||
// botAI->TellMasterNoFacing("Switching to melee!");
|
||||
return ChangeCombatStrategyAction::Execute(event);
|
||||
}
|
||||
|
||||
@@ -20,8 +22,11 @@ bool SwitchToMeleeAction::isUseful()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
time_t lastFlee = AI_VALUE(LastMovement&, "last movement").lastFlee;
|
||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) && ((bot->IsInCombat() && target && (target->GetVictim() == bot && (!bot->GetGroup() || lastFlee) &&
|
||||
sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) || (!bot->IsInCombat()));
|
||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) &&
|
||||
((bot->IsInCombat() && target &&
|
||||
(target->GetVictim() == bot && (!bot->GetGroup() || lastFlee) &&
|
||||
sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
(!bot->IsInCombat()));
|
||||
}
|
||||
|
||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT);
|
||||
@@ -29,7 +34,7 @@ bool SwitchToMeleeAction::isUseful()
|
||||
|
||||
bool SwitchToRangedAction::Execute(Event event)
|
||||
{
|
||||
//botAI->TellMasterNoFacing("Switching to ranged!");
|
||||
// botAI->TellMasterNoFacing("Switching to ranged!");
|
||||
return ChangeCombatStrategyAction::Execute(event);
|
||||
}
|
||||
|
||||
@@ -39,8 +44,11 @@ bool SwitchToRangedAction::isUseful()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
bool hasAmmo = AI_VALUE2(uint32, "item count", "ammo");
|
||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT) && hasAmmo && ((bot->IsInCombat() && target && ((target->GetVictim() != bot || target->GetTarget() != bot->GetGUID()) ||
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) || (!bot->IsInCombat()));
|
||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT) && hasAmmo &&
|
||||
((bot->IsInCombat() && target &&
|
||||
((target->GetVictim() != bot || target->GetTarget() != bot->GetGUID()) ||
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
(!bot->IsInCombat()));
|
||||
}
|
||||
|
||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_COMBATACTIONS_H
|
||||
@@ -11,20 +12,20 @@ class PlayerbotAI;
|
||||
|
||||
class SwitchToMeleeAction : public ChangeCombatStrategyAction
|
||||
{
|
||||
public:
|
||||
SwitchToMeleeAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-ranged,+close") { }
|
||||
public:
|
||||
SwitchToMeleeAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-ranged,+close") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class SwitchToRangedAction : public ChangeCombatStrategyAction
|
||||
{
|
||||
public:
|
||||
SwitchToRangedAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-close,+ranged") { }
|
||||
public:
|
||||
SwitchToRangedAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-close,+ranged") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CustomStrategyEditAction.h"
|
||||
|
||||
#include "CustomStrategy.h"
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -33,7 +35,8 @@ bool CustomStrategyEditAction::PrintHelp()
|
||||
|
||||
uint32 owner = botAI->GetBot()->GetGUID().GetCounter();
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER);
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER);
|
||||
stmt->SetData(0, owner);
|
||||
if (PreparedQueryResult result = PlayerbotsDatabase.Query(stmt))
|
||||
{
|
||||
@@ -42,8 +45,7 @@ bool CustomStrategyEditAction::PrintHelp()
|
||||
Field* fields = result->Fetch();
|
||||
std::string const name = fields[0].Get<std::string>();
|
||||
botAI->TellMaster(name);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
botAI->TellMaster("Usage: cs <name> <idx> <command>");
|
||||
@@ -58,7 +60,8 @@ bool CustomStrategyEditAction::Print(std::string const name)
|
||||
|
||||
uint32 owner = botAI->GetBot()->GetGUID().GetCounter();
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME);
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME);
|
||||
stmt->SetData(0, owner);
|
||||
stmt->SetData(1, name);
|
||||
if (PreparedQueryResult result = PlayerbotsDatabase.Query(stmt))
|
||||
@@ -70,8 +73,7 @@ bool CustomStrategyEditAction::Print(std::string const name)
|
||||
std::string const action = fields[1].Get<std::string>();
|
||||
|
||||
PrintActionLine(idx, action);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -81,7 +83,8 @@ bool CustomStrategyEditAction::Edit(std::string const name, uint32 idx, std::str
|
||||
{
|
||||
uint32 owner = botAI->GetBot()->GetGUID().GetCounter();
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME_AND_IDX);
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME_AND_IDX);
|
||||
stmt->SetData(0, owner);
|
||||
stmt->SetData(1, name);
|
||||
stmt->SetData(2, idx);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_CUSTOMSTRATEGYEDITACTION_H
|
||||
@@ -11,16 +12,16 @@ class PlayerbotAI;
|
||||
|
||||
class CustomStrategyEditAction : public Action
|
||||
{
|
||||
public:
|
||||
CustomStrategyEditAction(PlayerbotAI* botAI) : Action(botAI, "cs") { }
|
||||
public:
|
||||
CustomStrategyEditAction(PlayerbotAI* botAI) : Action(botAI, "cs") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool PrintHelp();
|
||||
bool PrintActionLine(uint32 idx, std::string const command);
|
||||
bool Print(std::string const name);
|
||||
bool Edit(std::string const name, uint32 idx, std::string const command);
|
||||
private:
|
||||
bool PrintHelp();
|
||||
bool PrintActionLine(uint32 idx, std::string const command);
|
||||
bool Print(std::string const name);
|
||||
bool Edit(std::string const name, uint32 idx, std::string const command);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DebugAction.h"
|
||||
|
||||
#include "ChooseTravelTargetAction.h"
|
||||
#include "MapMgr.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -26,7 +28,8 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
uint32 areaId = 0;
|
||||
uint32 zoneId = 0;
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(), pos.getZ());
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(),
|
||||
pos.getZ());
|
||||
|
||||
std::ostringstream out;
|
||||
out << zoneId << "," << areaId << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ",";
|
||||
@@ -71,7 +74,8 @@ bool DebugAction::Execute(Event event)
|
||||
std::vector<WorldPosition> beginPath, endPath;
|
||||
TravelNodeRoute route = sTravelNodeMap->getRoute(botPos, *points.front(), beginPath, bot);
|
||||
|
||||
std::ostringstream out; out << "Traveling to " << dest->getTitle() << ": ";
|
||||
std::ostringstream out;
|
||||
out << "Traveling to " << dest->getTitle() << ": ";
|
||||
|
||||
for (auto node : route.getNodes())
|
||||
{
|
||||
@@ -228,18 +232,19 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
else if (text.find("reset node") != std::string::npos)
|
||||
{
|
||||
for (auto& node : sTravelNodeMap->getNodes()) node->setLinked(false);
|
||||
for (auto& node : sTravelNodeMap->getNodes())
|
||||
node->setLinked(false);
|
||||
return true;
|
||||
}
|
||||
else if (text.find("reset path") != std::string::npos)
|
||||
{
|
||||
for (auto& node : sTravelNodeMap->getNodes())
|
||||
for (auto& path : *node->getLinks()) node->removeLinkTo(path.first, true);
|
||||
for (auto& path : *node->getLinks())
|
||||
node->removeLinkTo(path.first, true);
|
||||
return true;
|
||||
}
|
||||
else if (text.find("gen node") != std::string::npos)
|
||||
{
|
||||
|
||||
// Pathfinder
|
||||
sTravelNodeMap->generateNodes();
|
||||
return true;
|
||||
@@ -262,11 +267,12 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
else if (text.find("load node") != std::string::npos)
|
||||
{
|
||||
std::thread t([]
|
||||
{
|
||||
sTravelNodeMap->removeNodes();
|
||||
sTravelNodeMap->loadNodeStore();
|
||||
});
|
||||
std::thread t(
|
||||
[]
|
||||
{
|
||||
sTravelNodeMap->removeNodes();
|
||||
sTravelNodeMap->loadNodeStore();
|
||||
});
|
||||
|
||||
t.detach();
|
||||
|
||||
@@ -282,7 +288,7 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (auto& l : *node->getLinks())
|
||||
{
|
||||
Unit* start = nullptr;
|
||||
Unit* start = nullptr;
|
||||
GuidVector units;
|
||||
|
||||
uint32 time = 60 * IN_MILLISECONDS;
|
||||
@@ -291,15 +297,16 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (auto p : ppath)
|
||||
{
|
||||
Creature* wpCreature = bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
//addAura(246, wpCreature);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
// addAura(246, wpCreature);
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
|
||||
if (!start)
|
||||
start = wpCreature;
|
||||
}
|
||||
|
||||
//FakeSpell(1064, bot, start, units.front(), units, {}, pos, pos);
|
||||
// FakeSpell(1064, bot, start, units.front(), units, {}, pos, pos);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -312,7 +319,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -322,7 +329,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
FakeSpell(spellEffect, wpCreature, wpCreature, prev->GetGUID(), {}, {}, botPos, botPos);
|
||||
|
||||
@@ -338,7 +346,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -348,13 +356,14 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
data << wpCreature->GetGUID();
|
||||
data << uint32(spellEffect); // index from SpellVisualKit.dbc
|
||||
data << uint32(spellEffect); // index from SpellVisualKit.dbc
|
||||
wpCreature->SendMessageToSet(&data, true);
|
||||
}
|
||||
}
|
||||
@@ -368,7 +377,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -378,7 +387,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -396,7 +406,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -405,7 +415,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
}
|
||||
@@ -438,12 +449,12 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
|
||||
{
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
data << bot->GetPackGUID();
|
||||
data << bot->GetPackGUID();
|
||||
data << uint32(spellEffect); // spellID
|
||||
data << uint8(0) << uint8(1); // flags
|
||||
data << uint8(1); // amount of targets
|
||||
data << uint32(spellEffect); // spellID
|
||||
data << uint8(0) << uint8(1); // flags
|
||||
data << uint8(1); // amount of targets
|
||||
data << master->GetGUID();
|
||||
data << uint8(0);
|
||||
data << uint16(2);
|
||||
@@ -465,15 +476,17 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -495,15 +508,16 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -514,8 +528,8 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
@@ -534,26 +548,28 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
data << wpCreature->GetGUID();
|
||||
data << uint32(effect);
|
||||
; // index from SpellVisualKit.dbc
|
||||
; // index from SpellVisualKit.dbc
|
||||
// wpCreature->SendMessageToSet(&data, true);
|
||||
datMap.push_back(data);
|
||||
|
||||
//wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true, true);
|
||||
// wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true,
|
||||
// true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -580,21 +596,23 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); // visual effect on player
|
||||
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); // visual effect on player
|
||||
data << wpCreature->GetGUID();
|
||||
data << uint32(effect); // index from SpellVisualKit.dbc
|
||||
data << uint32(effect); // index from SpellVisualKit.dbc
|
||||
// wpCreature->SendMessageToSet(&data, true);
|
||||
datMap.push_back(data);
|
||||
}
|
||||
@@ -619,20 +637,21 @@ bool DebugAction::Execute(Event event)
|
||||
else if (text.find("cspellmap") != std::string::npos)
|
||||
{
|
||||
Creature* wpCreature = nullptr;
|
||||
Creature* lCreature = nullptr;
|
||||
Creature* lCreature = nullptr;
|
||||
for (int32 dx = 0; dx < 10; dx++)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(),
|
||||
botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature && lCreature)
|
||||
{
|
||||
@@ -652,15 +671,16 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -672,7 +692,7 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
else if (text.find("gspellmap") != std::string::npos)
|
||||
{
|
||||
GuidVector all_targets; // = { bot->GetGUID(), master->GetGUID() };
|
||||
GuidVector all_targets; // = { bot->GetGUID(), master->GetGUID() };
|
||||
// std::GuidVector all_dummies = { bot->GetGUID(), master->GetGUID() };
|
||||
|
||||
/*GuidVector a_targets = *context->GetValue<GuidVector >("all targets");
|
||||
@@ -692,7 +712,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
}
|
||||
@@ -709,9 +730,9 @@ bool DebugAction::Execute(Event event)
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
|
||||
uint32 i = dx + dy * 10;
|
||||
uint32 i = dx + dy * 10;
|
||||
GuidVector hits, miss;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effect);
|
||||
@@ -722,21 +743,23 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
switch (urand(0, 10))
|
||||
{
|
||||
case 0:
|
||||
hits.push_back(tar);
|
||||
break;
|
||||
case 1:
|
||||
miss.push_back(tar);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
case 0:
|
||||
hits.push_back(tar);
|
||||
break;
|
||||
case 1:
|
||||
miss.push_back(tar);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Unit* realCaster = botAI->GetUnit(all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* target = botAI->GetUnit(all_targets[i + 1]);
|
||||
Unit* realCaster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* target = botAI->GetUnit(all_targets[i + 1]);
|
||||
|
||||
if (!realCaster)
|
||||
realCaster = bot;
|
||||
@@ -747,7 +770,8 @@ bool DebugAction::Execute(Event event)
|
||||
if (!target)
|
||||
target = master;
|
||||
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster), WorldPosition(target));
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster),
|
||||
WorldPosition(target));
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
@@ -768,7 +792,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
}
|
||||
@@ -808,8 +833,10 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
Unit* realCaster = botAI->GetUnit(all_targets[i]);//botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(all_targets[i]);//botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* realCaster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* target = botAI->GetUnit(all_targets[i + 1]);
|
||||
|
||||
if (!realCaster)
|
||||
@@ -822,13 +849,14 @@ bool DebugAction::Execute(Event event)
|
||||
target = master;
|
||||
|
||||
master->SendPlaySpellVisual(caster->GetGUID(), 5036);
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster), WorldPosition(target));
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster),
|
||||
WorldPosition(target));
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else if (text.find("soundmap") != std::string::npos)
|
||||
{
|
||||
@@ -844,7 +872,9 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
wpCreature->PlayDistanceSound(effect);
|
||||
}
|
||||
@@ -886,33 +916,35 @@ bool DebugAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, GuidVector otherTargets, GuidVector missTargets, WorldPosition source, WorldPosition dest, bool forceDest)
|
||||
void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, GuidVector otherTargets,
|
||||
GuidVector missTargets, WorldPosition source, WorldPosition dest, bool forceDest)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
{
|
||||
uint32 castFlags = CAST_FLAG_HAS_TRAJECTORY;
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) ||
|
||||
spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
castFlags |= CAST_FLAG_PROJECTILE;
|
||||
|
||||
WorldPacket data(SMSG_SPELL_START, (8 + 8 + 4 + 2 + 4));
|
||||
|
||||
data << truecaster->GetPackGUID(); //truecaster
|
||||
data << truecaster->GetPackGUID(); // truecaster
|
||||
|
||||
if (caster)
|
||||
data << caster->GetPackGUID(); //m_caster->GetPackGUID();
|
||||
data << caster->GetPackGUID(); // m_caster->GetPackGUID();
|
||||
else
|
||||
data << ObjectGuid::Empty;
|
||||
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
data << uint32(1000.0f); // delay?
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
data << uint32(1000.0f); // delay?
|
||||
|
||||
SpellCastTargets m_targets;
|
||||
|
||||
m_targets.Write(data);
|
||||
|
||||
//projectile info
|
||||
// projectile info
|
||||
if (castFlags & CAST_FLAG_PROJECTILE)
|
||||
{
|
||||
data << uint32(5996);
|
||||
@@ -935,16 +967,18 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
|
||||
m_targets.SetSrc(source.getX(), source.getY(), source.getZ());
|
||||
|
||||
if (!forceDest && target)
|
||||
if (!spellInfo || !(spellInfo->Targets & TARGET_FLAG_DEST_LOCATION && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION))
|
||||
if (!spellInfo ||
|
||||
!(spellInfo->Targets & TARGET_FLAG_DEST_LOCATION && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION))
|
||||
m_targets.SetUnitTarget(botAI->GetUnit(target));
|
||||
|
||||
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) ||
|
||||
spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
|
||||
|
||||
if (spellInfo->HasEffect(SPELL_EFFECT_ACTIVATE_RUNE))
|
||||
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
|
||||
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
|
||||
|
||||
if (m_targets.HasTraj())
|
||||
castFlags |= CAST_FLAG_ADJUST_MISSILE;
|
||||
@@ -952,43 +986,43 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
|
||||
if (!spellInfo->StartRecoveryTime)
|
||||
castFlags |= CAST_FLAG_NO_GCD;
|
||||
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
|
||||
data << truecaster->GetPackGUID(); //truecaster
|
||||
data << truecaster->GetPackGUID(); // truecaster
|
||||
|
||||
if (caster)
|
||||
data << caster->GetPackGUID(); //m_caster->GetPackGUID();
|
||||
data << caster->GetPackGUID(); // m_caster->GetPackGUID();
|
||||
else
|
||||
data << ObjectGuid::Empty;
|
||||
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
|
||||
//WriteSpellGoTargets
|
||||
// WriteSpellGoTargets
|
||||
uint32 hits = otherTargets.size() + (target ? 1 : 0);
|
||||
|
||||
data << uint8(hits); // Hits
|
||||
data << uint8(hits); // Hits
|
||||
|
||||
if (target)
|
||||
data << target;
|
||||
|
||||
//Hit targets here.
|
||||
// Hit targets here.
|
||||
for (auto otherTarget : otherTargets)
|
||||
data << otherTarget;
|
||||
|
||||
data << (uint8)missTargets.size(); //miss
|
||||
data << (uint8)missTargets.size(); // miss
|
||||
|
||||
for (auto missTarget : missTargets)
|
||||
{
|
||||
data << missTarget;
|
||||
|
||||
data << uint8(SPELL_MISS_RESIST); //Miss condition
|
||||
data << uint8(SPELL_MISS_NONE); //Miss condition
|
||||
data << uint8(SPELL_MISS_RESIST); // Miss condition
|
||||
data << uint8(SPELL_MISS_NONE); // Miss condition
|
||||
}
|
||||
|
||||
m_targets.Write(data);
|
||||
|
||||
//projectile info
|
||||
// projectile info
|
||||
if (castFlags & CAST_FLAG_PROJECTILE)
|
||||
{
|
||||
data << uint32(5996);
|
||||
@@ -1011,7 +1045,8 @@ void DebugAction::addAura(uint32 spellId, Unit* target)
|
||||
if (!spellInfo)
|
||||
return;
|
||||
|
||||
if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
|
||||
if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) &&
|
||||
!spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
|
||||
return;
|
||||
|
||||
target->AddAura(spellInfo, MAX_EFFECT_MASK, target);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_DEBUGACTION_H
|
||||
@@ -14,13 +15,15 @@ class Unit;
|
||||
|
||||
class DebugAction : public Action
|
||||
{
|
||||
public:
|
||||
DebugAction(PlayerbotAI* botAI) : Action(botAI, "Debug") { }
|
||||
public:
|
||||
DebugAction(PlayerbotAI* botAI) : Action(botAI, "Debug") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
void FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target = ObjectGuid::Empty, GuidVector otherTargets = {}, GuidVector missTargets = {}, WorldPosition source = WorldPosition(), WorldPosition dest = WorldPosition(), bool forceDest = false);
|
||||
void addAura(uint32 spellId, Unit* target);
|
||||
void FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target = ObjectGuid::Empty,
|
||||
GuidVector otherTargets = {}, GuidVector missTargets = {}, WorldPosition source = WorldPosition(),
|
||||
WorldPosition dest = WorldPosition(), bool forceDest = false);
|
||||
void addAura(uint32 spellId, Unit* target);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DelayAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -15,7 +17,4 @@ bool DelayAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DelayAction::isUseful()
|
||||
{
|
||||
return !botAI->AllowActivity(ALL_ACTIVITY);
|
||||
}
|
||||
bool DelayAction::isUseful() { return !botAI->AllowActivity(ALL_ACTIVITY); }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_DELAYACTION_H
|
||||
@@ -11,11 +12,11 @@ class PlayerbotAI;
|
||||
|
||||
class DelayAction : public Action
|
||||
{
|
||||
public:
|
||||
DelayAction(PlayerbotAI* botAI) : Action(botAI, "delay") { }
|
||||
public:
|
||||
DelayAction(PlayerbotAI* botAI) : Action(botAI, "delay") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DestroyItemAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -25,20 +27,17 @@ void DestroyItemAction::DestroyItem(FindItemVisitor* visitor)
|
||||
{
|
||||
IterateItems(visitor);
|
||||
std::vector<Item*> items = visitor->GetResult();
|
||||
for (Item* item : items)
|
||||
for (Item* item : items)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << chat->FormatItem(item->GetTemplate()) << " destroyed";
|
||||
botAI->TellMaster(out);
|
||||
|
||||
bot->DestroyItem(item->GetBagSlot(),item->GetSlot(), true);
|
||||
bot->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||
}
|
||||
}
|
||||
|
||||
bool SmartDestroyItemAction::isUseful()
|
||||
{
|
||||
return !botAI->HasActivePlayerMaster();
|
||||
}
|
||||
bool SmartDestroyItemAction::isUseful() { return !botAI->HasActivePlayerMaster(); }
|
||||
|
||||
bool SmartDestroyItemAction::Execute(Event event)
|
||||
{
|
||||
@@ -68,19 +67,23 @@ bool SmartDestroyItemAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<uint32> bestToDestroy = { ITEM_USAGE_NONE }; //First destroy anything useless.
|
||||
std::vector<uint32> bestToDestroy = {ITEM_USAGE_NONE}; // First destroy anything useless.
|
||||
|
||||
if (!AI_VALUE(bool, "can sell") && AI_VALUE(bool, "should get money")) // We need money so quest items are less important since they can't directly be sold.
|
||||
if (!AI_VALUE(bool, "can sell") &&
|
||||
AI_VALUE(
|
||||
bool,
|
||||
"should get money")) // We need money so quest items are less important since they can't directly be sold.
|
||||
bestToDestroy.push_back(ITEM_USAGE_QUEST);
|
||||
else // We don't need money so destroy the cheapest stuff.
|
||||
else // We don't need money so destroy the cheapest stuff.
|
||||
{
|
||||
bestToDestroy.push_back(ITEM_USAGE_VENDOR);
|
||||
bestToDestroy.push_back(ITEM_USAGE_AH);
|
||||
}
|
||||
|
||||
// If we still need room
|
||||
bestToDestroy.push_back(ITEM_USAGE_SKILL); // Items that might help tradeskill are more important than above but still expenable.
|
||||
bestToDestroy.push_back(ITEM_USAGE_USE); // These are more likely to be usefull 'soon' but still expenable.
|
||||
bestToDestroy.push_back(
|
||||
ITEM_USAGE_SKILL); // Items that might help tradeskill are more important than above but still expenable.
|
||||
bestToDestroy.push_back(ITEM_USAGE_USE); // These are more likely to be usefull 'soon' but still expenable.
|
||||
|
||||
for (auto& usage : bestToDestroy)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_DESTROYITEMACTION_H
|
||||
@@ -12,22 +13,22 @@ class PlayerbotAI;
|
||||
|
||||
class DestroyItemAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
DestroyItemAction(PlayerbotAI* botAI, std::string const name = "destroy") : InventoryAction(botAI, name) { }
|
||||
public:
|
||||
DestroyItemAction(PlayerbotAI* botAI, std::string const name = "destroy") : InventoryAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
protected:
|
||||
void DestroyItem(FindItemVisitor* visitor);
|
||||
protected:
|
||||
void DestroyItem(FindItemVisitor* visitor);
|
||||
};
|
||||
|
||||
class SmartDestroyItemAction : public DestroyItemAction
|
||||
{
|
||||
public:
|
||||
SmartDestroyItemAction(PlayerbotAI* botAI) : DestroyItemAction(botAI, "smart destroy") { }
|
||||
public:
|
||||
SmartDestroyItemAction(PlayerbotAI* botAI) : DestroyItemAction(botAI, "smart destroy") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DropQuestAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -64,35 +66,40 @@ bool CleanQuestLogAction::Execute(Event event)
|
||||
return false;
|
||||
|
||||
uint8 totalQuests = 0;
|
||||
|
||||
DropQuestType(totalQuests); //Count the total quests
|
||||
// Count the total quests
|
||||
DropQuestType(totalQuests);
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 6)
|
||||
{
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE, true, true); //Drop failed quests
|
||||
// Drop failed quests
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE, true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (AI_VALUE(bool, "can fight equal")) //Only drop gray quests when able to fight proper lvl quests.
|
||||
// Only drop gray quests when able to fight proper lvl quests.
|
||||
if (AI_VALUE(bool, "can fight equal"))
|
||||
{
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6); //Drop gray/red quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true); //Drop gray/red quests with progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true, true); //Drop gray/red completed quests.
|
||||
// Drop gray/red quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6);
|
||||
// Drop gray/red quests with progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true);
|
||||
// Drop gray/red completed quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true, true);
|
||||
}
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 4)
|
||||
return true;
|
||||
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 4, true); //Drop quests without progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 4, true); // Drop quests without progress.
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 2)
|
||||
return true;
|
||||
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 2, true, true); //Drop quests with progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 2, true, true); // Drop quests with progress.
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 0)
|
||||
return true;
|
||||
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 1, true, true, true); //Drop completed quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 1, true, true, true); // Drop completed quests.
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 0)
|
||||
return true;
|
||||
@@ -132,13 +139,14 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
|
||||
numQuest++;
|
||||
|
||||
int32 lowLevelDiff = sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF);
|
||||
if (lowLevelDiff < 0 || bot->GetLevel() <= bot->GetQuestLevel(quest) + uint32(lowLevelDiff)) // Quest is not gray
|
||||
if (lowLevelDiff < 0 ||
|
||||
bot->GetLevel() <= bot->GetQuestLevel(quest) + uint32(lowLevelDiff)) // Quest is not gray
|
||||
{
|
||||
if (bot->GetLevel() + 5 > bot->GetQuestLevel(quest)) // Quest is not red
|
||||
if (bot->GetLevel() + 5 > bot->GetQuestLevel(quest)) // Quest is not red
|
||||
if (!isGreen)
|
||||
continue;
|
||||
}
|
||||
else // Quest is gray
|
||||
else // Quest is gray
|
||||
{
|
||||
if (isGreen)
|
||||
continue;
|
||||
@@ -150,13 +158,14 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
|
||||
if (bot->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE && !isComplete)
|
||||
continue;
|
||||
|
||||
// Always drop failed quests
|
||||
if (numQuest <= wantNum && bot->GetQuestStatus(questId) != QUEST_STATUS_FAILED)
|
||||
continue;
|
||||
|
||||
//Drop quest.
|
||||
// Drop quest.
|
||||
bot->SetQuestSlot(slot, 0);
|
||||
|
||||
//We ignore unequippable quest items in this case, its' still be equipped
|
||||
// We ignore unequippable quest items in this case, its' still be equipped
|
||||
bot->TakeQuestSourceItem(questId, false);
|
||||
|
||||
bot->SetQuestStatus(questId, QUEST_STATUS_NONE);
|
||||
@@ -190,7 +199,7 @@ bool CleanQuestLogAction::HasProgress(Player* bot, Quest const* quest)
|
||||
|
||||
if (quest->RequiredItemId[i])
|
||||
{
|
||||
int required = quest->RequiredItemCount[i];
|
||||
int required = quest->RequiredItemCount[i];
|
||||
int available = questStatus.ItemCount[i];
|
||||
if (available > 0 && required > 0)
|
||||
return true;
|
||||
@@ -198,7 +207,7 @@ bool CleanQuestLogAction::HasProgress(Player* bot, Quest const* quest)
|
||||
|
||||
if (quest->RequiredNpcOrGo[i])
|
||||
{
|
||||
int required = quest->RequiredNpcOrGoCount[i];
|
||||
int required = quest->RequiredNpcOrGoCount[i];
|
||||
int available = questStatus.CreatureOrGOCount[i];
|
||||
|
||||
if (available > 0 && required > 0)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_DROPQUESTACTION_H
|
||||
@@ -13,22 +14,22 @@ class Quest;
|
||||
|
||||
class DropQuestAction : public Action
|
||||
{
|
||||
public:
|
||||
DropQuestAction(PlayerbotAI* botAI) : Action(botAI, "drop quest") { }
|
||||
public:
|
||||
DropQuestAction(PlayerbotAI* botAI) : Action(botAI, "drop quest") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class CleanQuestLogAction : public Action
|
||||
{
|
||||
public:
|
||||
CleanQuestLogAction(PlayerbotAI* botAI) : Action(botAI, "clean quest log") { }
|
||||
public:
|
||||
CleanQuestLogAction(PlayerbotAI* botAI) : Action(botAI, "clean quest log") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
void DropQuestType(uint8& numQuest, uint8 wantNum = 100, bool isGreen = false, bool hasProgress = false, bool isComplete = false);
|
||||
bool Execute(Event event) override;
|
||||
void DropQuestType(uint8& numQuest, uint8 wantNum = 100, bool isGreen = false, bool hasProgress = false,
|
||||
bool isComplete = false);
|
||||
|
||||
static bool HasProgress(Player* bot, Quest const* quest);
|
||||
static bool HasProgress(Player* bot, Quest const* quest);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "EmoteAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "PlayerbotTextMgr.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "PlayerbotTextMgr.h"
|
||||
|
||||
std::map<std::string, uint32> EmoteActionBase::emotes;
|
||||
std::map<std::string, uint32> EmoteActionBase::textEmotes;
|
||||
@@ -18,9 +20,7 @@ EmoteActionBase::EmoteActionBase(PlayerbotAI* botAI, std::string const name) : A
|
||||
InitEmotes();
|
||||
}
|
||||
|
||||
EmoteAction::EmoteAction(PlayerbotAI* botAI) : EmoteActionBase(botAI, "emote"), Qualified()
|
||||
{
|
||||
}
|
||||
EmoteAction::EmoteAction(PlayerbotAI* botAI) : EmoteActionBase(botAI, "emote"), Qualified() {}
|
||||
|
||||
void EmoteActionBase::InitEmotes()
|
||||
{
|
||||
@@ -67,10 +67,10 @@ void EmoteActionBase::InitEmotes()
|
||||
textEmotes["congratulate"] = TEXT_EMOTE_CONGRATULATE;
|
||||
textEmotes["hello"] = TEXT_EMOTE_HELLO;
|
||||
textEmotes["no"] = TEXT_EMOTE_NO;
|
||||
textEmotes["nod"] = TEXT_EMOTE_NOD; // yes
|
||||
textEmotes["nod"] = TEXT_EMOTE_NOD; // yes
|
||||
textEmotes["sigh"] = TEXT_EMOTE_SIGH;
|
||||
textEmotes["thank"] = TEXT_EMOTE_THANK;
|
||||
textEmotes["welcome"] = TEXT_EMOTE_WELCOME; // you are welcome
|
||||
textEmotes["welcome"] = TEXT_EMOTE_WELCOME; // you are welcome
|
||||
textEmotes["whistle"] = TEXT_EMOTE_WHISTLE;
|
||||
textEmotes["yawn"] = TEXT_EMOTE_YAWN;
|
||||
textEmotes["oom"] = 323;
|
||||
@@ -196,7 +196,7 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_BLUSH:
|
||||
case TEXT_EMOTE_SMILE:
|
||||
case TEXT_EMOTE_LOVE:
|
||||
//case TEXT_EMOTE_HOLDHAND:
|
||||
// case TEXT_EMOTE_HOLDHAND:
|
||||
emoteText = "Awwwww...";
|
||||
emoteId = EMOTE_ONESHOT_SHY;
|
||||
textEmote = TEXT_EMOTE_SHY;
|
||||
@@ -207,13 +207,13 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
textEmote = TEXT_EMOTE_APPLAUD;
|
||||
break;
|
||||
case TEXT_EMOTE_ANGRY:
|
||||
//case TEXT_EMOTE_FACEPALM:
|
||||
// case TEXT_EMOTE_FACEPALM:
|
||||
case TEXT_EMOTE_GLARE:
|
||||
case TEXT_EMOTE_BLAME:
|
||||
//case TEXT_EMOTE_FAIL:
|
||||
//case TEXT_EMOTE_REGRET:
|
||||
//case TEXT_EMOTE_SCOLD:
|
||||
//case TEXT_EMOTE_CROSSARMS:
|
||||
// case TEXT_EMOTE_FAIL:
|
||||
// case TEXT_EMOTE_REGRET:
|
||||
// case TEXT_EMOTE_SCOLD:
|
||||
// case TEXT_EMOTE_CROSSARMS:
|
||||
emoteText = "Did I do thaaaaat?";
|
||||
emoteId = EMOTE_ONESHOT_QUESTION;
|
||||
textEmote = TEXT_EMOTE_SHRUG;
|
||||
@@ -247,7 +247,7 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_CLAP:
|
||||
case TEXT_EMOTE_CONGRATULATE:
|
||||
case TEXT_EMOTE_HAPPY:
|
||||
//case TEXT_EMOTE_GOLFCLAP:
|
||||
// case TEXT_EMOTE_GOLFCLAP:
|
||||
emoteId = EMOTE_ONESHOT_BOW;
|
||||
textEmote = TEXT_EMOTE_BOW;
|
||||
emoteText = "Thank you.. Thank you.. I'm here all week.";
|
||||
@@ -262,8 +262,8 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_BITE:
|
||||
case TEXT_EMOTE_POKE:
|
||||
case TEXT_EMOTE_SCRATCH:
|
||||
//case TEXT_EMOTE_PINCH:
|
||||
//case TEXT_EMOTE_PUNCH:
|
||||
// case TEXT_EMOTE_PINCH:
|
||||
// case TEXT_EMOTE_PUNCH:
|
||||
emoteId = EMOTE_ONESHOT_ROAR;
|
||||
textEmote = TEXT_EMOTE_ROAR;
|
||||
emoteYell = "OUCH! Dammit, that hurt!";
|
||||
@@ -300,9 +300,9 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_PRAISE:
|
||||
case TEXT_EMOTE_SCARED:
|
||||
case TEXT_EMOTE_COMMEND:
|
||||
//case TEXT_EMOTE_AWE:
|
||||
//case TEXT_EMOTE_JEALOUS:
|
||||
//case TEXT_EMOTE_PROUD:
|
||||
// case TEXT_EMOTE_AWE:
|
||||
// case TEXT_EMOTE_JEALOUS:
|
||||
// case TEXT_EMOTE_PROUD:
|
||||
emoteId = EMOTE_ONESHOT_FLEX;
|
||||
textEmote = TEXT_EMOTE_FLEX;
|
||||
emoteText = "Yes, Yes. I know I'm amazing..";
|
||||
@@ -310,8 +310,8 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_BLEED:
|
||||
case TEXT_EMOTE_MOURN:
|
||||
case TEXT_EMOTE_FLOP:
|
||||
//case TEXT_EMOTE_FAINT:
|
||||
//case TEXT_EMOTE_PULSE:
|
||||
// case TEXT_EMOTE_FAINT:
|
||||
// case TEXT_EMOTE_PULSE:
|
||||
emoteId = EMOTE_ONESHOT_KNEEL;
|
||||
textEmote = TEXT_EMOTE_KNEEL;
|
||||
emoteText = "MEDIC! Stat!";
|
||||
@@ -338,7 +338,7 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_GUFFAW:
|
||||
case TEXT_EMOTE_ROFL:
|
||||
case TEXT_EMOTE_SNICKER:
|
||||
//case TEXT_EMOTE_SNORT:
|
||||
// case TEXT_EMOTE_SNORT:
|
||||
emoteId = EMOTE_ONESHOT_LAUGH;
|
||||
textEmote = TEXT_EMOTE_LAUGH;
|
||||
emoteText = "Wait... what are we laughing at again?";
|
||||
@@ -368,8 +368,8 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_SPIT:
|
||||
case TEXT_EMOTE_LICK:
|
||||
case TEXT_EMOTE_BREATH:
|
||||
//case TEXT_EMOTE_SNEEZE:
|
||||
//case TEXT_EMOTE_SWEAT:
|
||||
// case TEXT_EMOTE_SNEEZE:
|
||||
// case TEXT_EMOTE_SWEAT:
|
||||
emoteId = EMOTE_ONESHOT_POINT;
|
||||
textEmote = TEXT_EMOTE_POINT;
|
||||
emoteText = "Ewww! Keep your nasty germs over there!";
|
||||
@@ -420,7 +420,7 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_SHIMMY:
|
||||
case TEXT_EMOTE_SMIRK:
|
||||
case TEXT_EMOTE_WINK:
|
||||
//case TEXT_EMOTE_CHARM:
|
||||
// case TEXT_EMOTE_CHARM:
|
||||
emoteId = EMOTE_ONESHOT_NO;
|
||||
textEmote = TEXT_EMOTE_NO;
|
||||
emoteText = "Keep it in your pants, boss..";
|
||||
@@ -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:
|
||||
@@ -456,17 +456,17 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_TAUNT:
|
||||
case TEXT_EMOTE_PITY:
|
||||
case TEXT_EMOTE_GROWL:
|
||||
//case TEXT_EMOTE_TRAIN:
|
||||
//case TEXT_EMOTE_INCOMING:
|
||||
//case TEXT_EMOTE_CHARGE:
|
||||
//case TEXT_EMOTE_FLEE:
|
||||
//case TEXT_EMOTE_ATTACKMYTARGET:
|
||||
// case TEXT_EMOTE_TRAIN:
|
||||
// case TEXT_EMOTE_INCOMING:
|
||||
// case TEXT_EMOTE_CHARGE:
|
||||
// case TEXT_EMOTE_FLEE:
|
||||
// case TEXT_EMOTE_ATTACKMYTARGET:
|
||||
case TEXT_EMOTE_OPENFIRE:
|
||||
case TEXT_EMOTE_ENCOURAGE:
|
||||
case TEXT_EMOTE_ENEMY:
|
||||
//case TEXT_EMOTE_CHALLENGE:
|
||||
//case TEXT_EMOTE_REVENGE:
|
||||
//case TEXT_EMOTE_SHAKEFIST:
|
||||
// case TEXT_EMOTE_CHALLENGE:
|
||||
// case TEXT_EMOTE_REVENGE:
|
||||
// case TEXT_EMOTE_SHAKEFIST:
|
||||
emoteId = EMOTE_ONESHOT_ROAR;
|
||||
textEmote = TEXT_EMOTE_ROAR;
|
||||
emoteYell = "RAWR!";
|
||||
@@ -493,8 +493,8 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_VICTORY:
|
||||
case TEXT_EMOTE_CHEER:
|
||||
case TEXT_EMOTE_TOAST:
|
||||
//case TEXT_EMOTE_HIGHFIVE:
|
||||
//case TEXT_EMOTE_DING:
|
||||
// case TEXT_EMOTE_HIGHFIVE:
|
||||
// case TEXT_EMOTE_DING:
|
||||
emoteId = EMOTE_ONESHOT_CHEER;
|
||||
textEmote = TEXT_EMOTE_CHEER;
|
||||
emoteText = "Yay!";
|
||||
@@ -502,9 +502,9 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
case TEXT_EMOTE_COLD:
|
||||
case TEXT_EMOTE_SHIVER:
|
||||
case TEXT_EMOTE_THIRSTY:
|
||||
//case TEXT_EMOTE_OOM:
|
||||
//case TEXT_EMOTE_HEALME:
|
||||
//case TEXT_EMOTE_POUT:
|
||||
// case TEXT_EMOTE_OOM:
|
||||
// case TEXT_EMOTE_HEALME:
|
||||
// case TEXT_EMOTE_POUT:
|
||||
emoteId = EMOTE_ONESHOT_QUESTION;
|
||||
textEmote = TEXT_EMOTE_PUZZLE;
|
||||
emoteText = "And what exactly am I supposed to do about that?";
|
||||
@@ -542,7 +542,7 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
emoteText = "Shoo yourself!";
|
||||
break;
|
||||
case TEXT_EMOTE_SLAP:
|
||||
//case TEXT_EMOTE_SMACK:
|
||||
// case TEXT_EMOTE_SMACK:
|
||||
emoteId = EMOTE_ONESHOT_CRY;
|
||||
textEmote = TEXT_EMOTE_CRY;
|
||||
emoteText = "What did I do to deserve that?";
|
||||
@@ -562,18 +562,18 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
textEmote = TEXT_EMOTE_SIGH;
|
||||
emoteText = "Har Har.. very funny..";
|
||||
break;
|
||||
//case TEXT_EMOTE_HELPME:
|
||||
// bot->HandleEmoteCommand(EMOTE_ONESHOT_POINT);
|
||||
// bot->Yell("Quick! Someone HELP!", LANG_UNIVERSAL);
|
||||
// break;
|
||||
// case TEXT_EMOTE_HELPME:
|
||||
// bot->HandleEmoteCommand(EMOTE_ONESHOT_POINT);
|
||||
// bot->Yell("Quick! Someone HELP!", LANG_UNIVERSAL);
|
||||
// break;
|
||||
case TEXT_EMOTE_GOODLUCK:
|
||||
//case TEXT_EMOTE_LUCK:
|
||||
// case TEXT_EMOTE_LUCK:
|
||||
emoteId = EMOTE_ONESHOT_TALK;
|
||||
textEmote = TEXT_EMOTE_THANK;
|
||||
emoteText = "Thanks... I'll need it..";
|
||||
break;
|
||||
case TEXT_EMOTE_BRANDISH:
|
||||
//case TEXT_EMOTE_MERCY:
|
||||
// case TEXT_EMOTE_MERCY:
|
||||
emoteId = EMOTE_ONESHOT_BEG;
|
||||
textEmote = TEXT_EMOTE_BEG;
|
||||
emoteText = "Please don't kill me!";
|
||||
@@ -612,9 +612,9 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
bot->Yell("You think that's going to help you?!", LANG_UNIVERSAL);
|
||||
break;*/
|
||||
default:
|
||||
//return false;
|
||||
//bot->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION);
|
||||
//bot->Say("Mmmmmkaaaaaay...", LANG_UNIVERSAL);
|
||||
// return false;
|
||||
// bot->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION);
|
||||
// bot->Say("Mmmmmkaaaaaay...", LANG_UNIVERSAL);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -668,8 +668,9 @@ bool EmoteAction::Execute(Event event)
|
||||
p >> nam;
|
||||
|
||||
pSource = ObjectAccessor::FindPlayer(source);
|
||||
if (pSource && (pSource->GetGUID() != bot->GetGUID()) && ((urand(0, 1) && bot->HasInArc(static_cast<float>(M_PI), pSource, 10.0f)) ||
|
||||
(namlen > 1 && strstri(bot->GetName().c_str(), nam.c_str()))))
|
||||
if (pSource && (pSource->GetGUID() != bot->GetGUID()) &&
|
||||
((urand(0, 1) && bot->HasInArc(static_cast<float>(M_PI), pSource, 10.0f)) ||
|
||||
(namlen > 1 && strstri(bot->GetName().c_str(), nam.c_str()))))
|
||||
{
|
||||
/*LOG_INFO("playerbots", "Bot {} {}:{} <{}> received SMSG_TEXT_EMOTE {} from player {} <{}>",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
@@ -688,14 +689,16 @@ bool EmoteAction::Execute(Event event)
|
||||
p >> emoteId >> source;
|
||||
|
||||
pSource = ObjectAccessor::FindPlayer(source);
|
||||
if (pSource && pSource != bot && sServerFacade->GetDistance2d(bot, pSource) < sPlayerbotAIConfig->farDistance && emoteId != EMOTE_ONESHOT_NONE)
|
||||
if (pSource && pSource != bot && sServerFacade->GetDistance2d(bot, pSource) < sPlayerbotAIConfig->farDistance &&
|
||||
emoteId != EMOTE_ONESHOT_NONE)
|
||||
{
|
||||
if ((pSource->GetGUID() != bot->GetGUID()) && (pSource->GetTarget() == bot->GetGUID() ||
|
||||
(urand(0, 1) && bot->HasInArc(static_cast<float>(M_PI), pSource, 10.0f))))
|
||||
if ((pSource->GetGUID() != bot->GetGUID()) &&
|
||||
(pSource->GetTarget() == bot->GetGUID() ||
|
||||
(urand(0, 1) && bot->HasInArc(static_cast<float>(M_PI), pSource, 10.0f))))
|
||||
{
|
||||
/*LOG_INFO("playerbots", "Bot {} {}:{} <{}> received SMSG_EMOTE {} from player {} <{}>",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
emoteId, pSource->GetGUID().ToString().c_str(), pSource->GetName());*/
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), emoteId, pSource->GetGUID().ToString().c_str(), pSource->GetName());*/
|
||||
|
||||
std::vector<uint32> types;
|
||||
for (int32 i = sEmotesTextStore.GetNumRows(); i >= 0; --i)
|
||||
@@ -732,7 +735,9 @@ bool EmoteAction::Execute(Event event)
|
||||
if ((!isReact && param.empty()) || emote)
|
||||
{
|
||||
time_t lastEmote = AI_VALUE2(time_t, "last emote", qualifier);
|
||||
botAI->GetAiObjectContext()->GetValue<time_t>("last emote", qualifier)->Set(time(nullptr) + urand(1000, sPlayerbotAIConfig->repeatDelay) / 1000);
|
||||
botAI->GetAiObjectContext()
|
||||
->GetValue<time_t>("last emote", qualifier)
|
||||
->Set(time(nullptr) + urand(1000, sPlayerbotAIConfig->repeatDelay) / 1000);
|
||||
param = qualifier;
|
||||
}
|
||||
|
||||
@@ -832,7 +837,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote)
|
||||
types.push_back(TEXT_EMOTE_TALKEX);
|
||||
types.push_back(TEXT_EMOTE_TALKQ);
|
||||
|
||||
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
|
||||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
{
|
||||
types.push_back(TEXT_EMOTE_SALUTE);
|
||||
}
|
||||
@@ -858,7 +864,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote)
|
||||
types.push_back(EMOTE_ONESHOT_EXCLAMATION);
|
||||
types.push_back(EMOTE_ONESHOT_QUESTION);
|
||||
|
||||
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
|
||||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
{
|
||||
types.push_back(EMOTE_ONESHOT_SALUTE);
|
||||
}
|
||||
@@ -1272,24 +1279,24 @@ uint32 EmoteActionBase::GetNumberOfEmoteVariants(TextEmotes emote, uint8 Race, u
|
||||
{
|
||||
switch (Race)
|
||||
{
|
||||
case RACE_HUMAN:
|
||||
case RACE_DWARF:
|
||||
case RACE_NIGHTELF:
|
||||
case RACE_GNOME:
|
||||
case RACE_ORC:
|
||||
case RACE_TAUREN:
|
||||
case RACE_TROLL:
|
||||
{
|
||||
if (Gender == GENDER_MALE)
|
||||
case RACE_HUMAN:
|
||||
case RACE_DWARF:
|
||||
case RACE_NIGHTELF:
|
||||
case RACE_GNOME:
|
||||
case RACE_ORC:
|
||||
case RACE_TAUREN:
|
||||
case RACE_TROLL:
|
||||
{
|
||||
if (Gender == GENDER_MALE)
|
||||
return 3;
|
||||
return 3;
|
||||
return 3;
|
||||
}
|
||||
case RACE_UNDEAD_PLAYER:
|
||||
{
|
||||
if (Gender == GENDER_MALE)
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
case RACE_UNDEAD_PLAYER:
|
||||
{
|
||||
if (Gender == GENDER_MALE)
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (emote == TEXT_EMOTE_CONGRATULATE)
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_EMOTEACTION_H
|
||||
#define _PLAYERBOT_EMOTEACTION_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "Action.h"
|
||||
#include "NamedObjectContext.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
class Player;
|
||||
class PlayerbotAI;
|
||||
class Unit;
|
||||
@@ -18,36 +19,36 @@ enum TextEmotes : uint32;
|
||||
|
||||
class EmoteActionBase : public Action
|
||||
{
|
||||
public:
|
||||
EmoteActionBase(PlayerbotAI* botAI, std::string const name);
|
||||
public:
|
||||
EmoteActionBase(PlayerbotAI* botAI, std::string const name);
|
||||
|
||||
static uint32 GetNumberOfEmoteVariants(TextEmotes emote, uint8 race, uint8 gender);
|
||||
static uint32 GetNumberOfEmoteVariants(TextEmotes emote, uint8 race, uint8 gender);
|
||||
|
||||
protected:
|
||||
bool Emote(Unit* target, uint32 type, bool textEmote = false);
|
||||
bool ReceiveEmote(Player* source, uint32 emote, bool verbal = false);
|
||||
Unit* GetTarget();
|
||||
void InitEmotes();
|
||||
static std::map<std::string, uint32> emotes;
|
||||
static std::map<std::string, uint32> textEmotes;
|
||||
protected:
|
||||
bool Emote(Unit* target, uint32 type, bool textEmote = false);
|
||||
bool ReceiveEmote(Player* source, uint32 emote, bool verbal = false);
|
||||
Unit* GetTarget();
|
||||
void InitEmotes();
|
||||
static std::map<std::string, uint32> emotes;
|
||||
static std::map<std::string, uint32> textEmotes;
|
||||
};
|
||||
|
||||
class EmoteAction : public EmoteActionBase, public Qualified
|
||||
{
|
||||
public:
|
||||
EmoteAction(PlayerbotAI* botAI);
|
||||
public:
|
||||
EmoteAction(PlayerbotAI* botAI);
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class TalkAction : public EmoteActionBase
|
||||
{
|
||||
public:
|
||||
TalkAction(PlayerbotAI* botAI) : EmoteActionBase(botAI, "talk") { }
|
||||
public:
|
||||
TalkAction(PlayerbotAI* botAI) : EmoteActionBase(botAI, "talk") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
static uint32 GetRandomEmote(Unit* unit, bool textEmote = false);
|
||||
bool Execute(Event event) override;
|
||||
static uint32 GetRandomEmote(Unit* unit, bool textEmote = false);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "EquipAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "ItemUsageValue.h"
|
||||
@@ -18,14 +20,14 @@ bool EquipAction::Execute(Event event)
|
||||
|
||||
void EquipAction::EquipItems(ItemIds ids)
|
||||
{
|
||||
for (ItemIds::iterator i =ids.begin(); i != ids.end(); i++)
|
||||
for (ItemIds::iterator i = ids.begin(); i != ids.end(); i++)
|
||||
{
|
||||
FindItemByIdVisitor visitor(*i);
|
||||
EquipItem(&visitor);
|
||||
}
|
||||
}
|
||||
|
||||
//Return bagslot with smalest bag.
|
||||
// Return bagslot with smalest bag.
|
||||
uint8 EquipAction::GetSmallestBagSlot()
|
||||
{
|
||||
int8 curBag = 0;
|
||||
@@ -52,7 +54,7 @@ void EquipAction::EquipItem(FindItemVisitor* visitor)
|
||||
{
|
||||
IterateItems(visitor);
|
||||
std::vector<Item*> items = visitor->GetResult();
|
||||
if (!items.empty())
|
||||
if (!items.empty())
|
||||
EquipItem(*items.begin());
|
||||
}
|
||||
|
||||
@@ -120,7 +122,9 @@ bool EquipUpgradesAction::Execute(Event event)
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", i->first);
|
||||
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||
{
|
||||
// LOG_INFO("playerbots", "Bot {} <{}> auto equips item {} ({})", bot->GetGUID().ToString().c_str(), bot->GetName().c_str(), i->first, usage == 1 ? "no item in slot" : usage == 2 ? "replace" : usage == 3 ? "wrong item but empty slot" : "");
|
||||
// LOG_INFO("playerbots", "Bot {} <{}> auto equips item {} ({})", bot->GetGUID().ToString().c_str(),
|
||||
// bot->GetName().c_str(), i->first, usage == 1 ? "no item in slot" : usage == 2 ? "replace" : usage == 3 ?
|
||||
// "wrong item but empty slot" : "");
|
||||
items.insert(i->first);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_EQUIPACTION_H
|
||||
@@ -14,33 +15,32 @@ class PlayerbotAI;
|
||||
|
||||
class EquipAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
EquipAction(PlayerbotAI* botAI, std::string const name = "equip") : InventoryAction(botAI, name) { }
|
||||
public:
|
||||
EquipAction(PlayerbotAI* botAI, std::string const name = "equip") : InventoryAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
void EquipItems(ItemIds ids);
|
||||
bool Execute(Event event) override;
|
||||
void EquipItems(ItemIds ids);
|
||||
|
||||
private:
|
||||
void EquipItem(FindItemVisitor* visitor);
|
||||
uint8 GetSmallestBagSlot();
|
||||
void EquipItem(Item* item);
|
||||
private:
|
||||
void EquipItem(FindItemVisitor* visitor);
|
||||
uint8 GetSmallestBagSlot();
|
||||
void EquipItem(Item* item);
|
||||
};
|
||||
|
||||
class EquipUpgradesAction : public EquipAction
|
||||
{
|
||||
public:
|
||||
EquipUpgradesAction(PlayerbotAI* botAI, std::string const name = "equip upgrades") : EquipAction(botAI, name) { }
|
||||
public:
|
||||
EquipUpgradesAction(PlayerbotAI* botAI, std::string const name = "equip upgrades") : EquipAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class EquipUpgradeAction : public EquipAction
|
||||
{
|
||||
public:
|
||||
EquipUpgradeAction(PlayerbotAI* botAI, std::string const name = "equip upgrade") : EquipAction(botAI, name) { }
|
||||
public:
|
||||
EquipUpgradeAction(PlayerbotAI* botAI, std::string const name = "equip upgrade") : EquipAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "FlagAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -58,4 +60,3 @@ bool FlagAction::Execute(Event event)
|
||||
botAI->TellMaster(out.str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_FLAGACTION_H
|
||||
@@ -11,13 +12,13 @@ class PlayerbotAI;
|
||||
|
||||
class FlagAction : public Action
|
||||
{
|
||||
public:
|
||||
FlagAction(PlayerbotAI* botAI) : Action(botAI, "flag") { }
|
||||
public:
|
||||
FlagAction(PlayerbotAI* botAI) : Action(botAI, "flag") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool TellUsage();
|
||||
private:
|
||||
bool TellUsage();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "FollowActions.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "Event.h"
|
||||
#include "Formations.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <cstddef>
|
||||
|
||||
bool FollowAction::Execute(Event event)
|
||||
{
|
||||
@@ -44,19 +47,21 @@ bool FollowAction::Execute(Event event)
|
||||
// pet->GetMotionMaster()->MoveFollow(bot, PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
}
|
||||
}
|
||||
//if (moved)
|
||||
//botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
||||
// if (moved)
|
||||
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
||||
|
||||
return moved;
|
||||
}
|
||||
|
||||
bool FollowAction::isUseful()
|
||||
{
|
||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr) {
|
||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Formation* formation = AI_VALUE(Formation*, "formation");
|
||||
if (!formation) {
|
||||
if (!formation)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::string const target = formation->GetTargetName();
|
||||
@@ -111,7 +116,7 @@ bool FleeToMasterAction::Execute(Event event)
|
||||
bool canFollow = Follow(fTarget);
|
||||
if (!canFollow)
|
||||
{
|
||||
//botAI->SetNextCheckDelay(5000);
|
||||
// botAI->SetNextCheckDelay(5000);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -129,9 +134,8 @@ bool FleeToMasterAction::Execute(Event event)
|
||||
if (!urand(0, 10))
|
||||
botAI->TellMaster("I heading to your position.");
|
||||
}
|
||||
else
|
||||
if (!urand(0,20))
|
||||
botAI->TellMaster("I am traveling to your position.");
|
||||
else if (!urand(0, 20))
|
||||
botAI->TellMaster("I am traveling to your position.");
|
||||
|
||||
botAI->SetNextCheckDelay(3000);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_FOLLOWACTIONS_H
|
||||
@@ -11,21 +12,21 @@ class PlayerbotAI;
|
||||
|
||||
class FollowAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
FollowAction(PlayerbotAI* botAI, std::string const name = "follow") : MovementAction(botAI, name) { }
|
||||
public:
|
||||
FollowAction(PlayerbotAI* botAI, std::string const name = "follow") : MovementAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool CanDeadFollow(Unit* target);
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool CanDeadFollow(Unit* target);
|
||||
};
|
||||
|
||||
class FleeToMasterAction : public FollowAction
|
||||
{
|
||||
public:
|
||||
FleeToMasterAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to master") { }
|
||||
public:
|
||||
FleeToMasterAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to master") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GenericActions.h"
|
||||
|
||||
#include "CreatureAI.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -15,54 +17,59 @@ bool MeleeAction::isUseful()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TogglePetSpellAutoCastAction::Execute(Event event) {
|
||||
bool TogglePetSpellAutoCastAction::Execute(Event event)
|
||||
{
|
||||
Pet* pet = bot->GetPet();
|
||||
if (!pet) {
|
||||
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)
|
||||
if (itr->second.state == PETSPELL_REMOVED)
|
||||
continue;
|
||||
|
||||
uint32 spellId = itr->first;
|
||||
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) {
|
||||
if (spellId == 4511 || spellId == 1742 || spellId == 54424 || spellId == 57564 || spellId == 57565 ||
|
||||
spellId == 57566 || spellId == 57567 || spellId == 47482 || spellId == 24450)
|
||||
{
|
||||
shouldApply = false;
|
||||
}
|
||||
bool isAutoCast = false;
|
||||
for (unsigned int &m_autospell : pet->m_autospells)
|
||||
{
|
||||
if (m_autospell == spellId)
|
||||
{
|
||||
isAutoCast = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shouldApply != isAutoCast) {
|
||||
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 toggled;
|
||||
return toggled;
|
||||
}
|
||||
|
||||
bool PetAttackAction::Execute(Event event)
|
||||
{
|
||||
Guardian* pet = bot->GetGuardianPet();
|
||||
if (!pet) {
|
||||
if (!pet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
if (!target) {
|
||||
if (!target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// pet->SetReactState(REACT_DEFENSIVE);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GENERICACTIONS_H
|
||||
@@ -11,26 +12,25 @@ class PlayerbotAI;
|
||||
|
||||
class MeleeAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
MeleeAction(PlayerbotAI* botAI) : AttackAction(botAI, "melee") { }
|
||||
public:
|
||||
MeleeAction(PlayerbotAI* botAI) : AttackAction(botAI, "melee") {}
|
||||
|
||||
std::string const GetTargetName() override { return "current target"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "current target"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class TogglePetSpellAutoCastAction: public Action
|
||||
class TogglePetSpellAutoCastAction : public Action
|
||||
{
|
||||
public:
|
||||
TogglePetSpellAutoCastAction(PlayerbotAI* ai): Action(ai, "toggle pet spell") {}
|
||||
TogglePetSpellAutoCastAction(PlayerbotAI* ai) : Action(ai, "toggle pet spell") {}
|
||||
virtual bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class PetAttackAction: public Action
|
||||
class PetAttackAction : public Action
|
||||
{
|
||||
public:
|
||||
PetAttackAction(PlayerbotAI* ai): Action(ai, "pet attack") {}
|
||||
PetAttackAction(PlayerbotAI* ai) : Action(ai, "pet attack") {}
|
||||
virtual bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GenericSpellActions.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell) : Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
||||
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell)
|
||||
: Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,9 +18,9 @@ bool CastSpellAction::Execute(Event event)
|
||||
{
|
||||
if (spell == "conjure food" || spell == "conjure water")
|
||||
{
|
||||
//uint32 id = AI_VALUE2(uint32, "spell id", spell);
|
||||
//if (!id)
|
||||
// return false;
|
||||
// uint32 id = AI_VALUE2(uint32, "spell id", spell);
|
||||
// if (!id)
|
||||
// return false;
|
||||
|
||||
uint32 castId = 0;
|
||||
|
||||
@@ -62,10 +65,11 @@ bool CastSpellAction::Execute(Event event)
|
||||
|
||||
bool CastSpellAction::isPossible()
|
||||
{
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true)) {
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster())) {
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}",
|
||||
bot->GetName());
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}", bot->GetName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -75,9 +79,9 @@ bool CastSpellAction::isPossible()
|
||||
|
||||
if (spell == "mount" && bot->IsInCombat())
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster())) {
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}",
|
||||
bot->GetName());
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}", bot->GetName());
|
||||
}
|
||||
bot->Dismount();
|
||||
return false;
|
||||
@@ -112,7 +116,9 @@ bool CastSpellAction::isUseful()
|
||||
// if (!botAI->IsRanged(bot))
|
||||
// combatReach += 4.0f / 3.0f;
|
||||
|
||||
return spellTarget && AI_VALUE2(bool, "spell cast useful", spell); // && sServerFacade->GetDistance2d(bot, spellTarget) <= (range + combatReach);
|
||||
return spellTarget &&
|
||||
AI_VALUE2(bool, "spell cast useful",
|
||||
spell); // && sServerFacade->GetDistance2d(bot, spellTarget) <= (range + combatReach);
|
||||
}
|
||||
|
||||
CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||
@@ -127,10 +133,12 @@ CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const
|
||||
|
||||
bool CastAuraSpellAction::isUseful()
|
||||
{
|
||||
return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget(), false, isOwner);
|
||||
return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() &&
|
||||
!botAI->HasAura(spell, GetTarget(), false, isOwner);
|
||||
}
|
||||
|
||||
CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||
CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string const spell)
|
||||
: CastSpellAction(botAI, spell)
|
||||
{
|
||||
range = botAI->GetRange("spell");
|
||||
}
|
||||
@@ -138,34 +146,30 @@ CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string con
|
||||
bool CastEnchantItemAction::isPossible()
|
||||
{
|
||||
// if (!CastSpellAction::isPossible()) {
|
||||
|
||||
|
||||
// botAI->TellMasterNoFacing("Impossible: " + spell);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
uint32 spellId = AI_VALUE2(uint32, "spell id", spell);
|
||||
|
||||
|
||||
// bool ok = AI_VALUE2(Item*, "item for spell", spellId);
|
||||
// Item* item = AI_VALUE2(Item*, "item for spell", spellId);
|
||||
// botAI->TellMasterNoFacing("spell: " + spell + ", spell id: " + std::to_string(spellId) + " item for spell: " + std::to_string(ok));
|
||||
// botAI->TellMasterNoFacing("spell: " + spell + ", spell id: " + std::to_string(spellId) + " item for spell: " +
|
||||
// std::to_string(ok));
|
||||
return spellId && AI_VALUE2(Item*, "item for spell", spellId);
|
||||
}
|
||||
|
||||
CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount, HealingManaEfficiency manaEfficiency)
|
||||
CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount,
|
||||
HealingManaEfficiency manaEfficiency)
|
||||
: CastAuraSpellAction(botAI, spell, true), estAmount(estAmount), manaEfficiency(manaEfficiency)
|
||||
{
|
||||
range = botAI->GetRange("heal");
|
||||
}
|
||||
|
||||
bool CastHealingSpellAction::isUseful()
|
||||
{
|
||||
return CastAuraSpellAction::isUseful();
|
||||
}
|
||||
bool CastHealingSpellAction::isUseful() { return CastAuraSpellAction::isUseful(); }
|
||||
|
||||
bool CastAoeHealSpellAction::isUseful()
|
||||
{
|
||||
return CastSpellAction::isUseful();
|
||||
}
|
||||
bool CastAoeHealSpellAction::isUseful() { return CastSpellAction::isUseful(); }
|
||||
|
||||
CastCureSpellAction::CastCureSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||
{
|
||||
@@ -211,9 +215,11 @@ NextAction** CastSpellAction::getPrerequisites()
|
||||
if (range > botAI->GetRange("spell"))
|
||||
return nullptr;
|
||||
else if (range > ATTACK_DISTANCE)
|
||||
return NextAction::merge(NextAction::array(0, new NextAction("reach spell"), nullptr), Action::getPrerequisites());
|
||||
return NextAction::merge(NextAction::array(0, new NextAction("reach spell"), nullptr),
|
||||
Action::getPrerequisites());
|
||||
else
|
||||
return NextAction::merge(NextAction::array(0, new NextAction("reach melee"), nullptr), Action::getPrerequisites());
|
||||
return NextAction::merge(NextAction::array(0, new NextAction("reach melee"), nullptr),
|
||||
Action::getPrerequisites());
|
||||
}
|
||||
|
||||
Value<Unit*>* CastDebuffSpellOnAttackerAction::GetTargetValue()
|
||||
@@ -226,7 +232,8 @@ Value<Unit*>* CastDebuffSpellOnMeleeAttackerAction::GetTargetValue()
|
||||
return context->GetValue<Unit*>("melee attacker without aura", spell);
|
||||
}
|
||||
|
||||
CastBuffSpellAction::CastBuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner) : CastAuraSpellAction(botAI, spell, checkIsOwner)
|
||||
CastBuffSpellAction::CastBuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner)
|
||||
: CastAuraSpellAction(botAI, spell, checkIsOwner)
|
||||
{
|
||||
range = botAI->GetRange("spell");
|
||||
}
|
||||
@@ -236,40 +243,19 @@ Value<Unit*>* CastSpellOnEnemyHealerAction::GetTargetValue()
|
||||
return context->GetValue<Unit*>("enemy healer target", spell);
|
||||
}
|
||||
|
||||
Value<Unit*>* CastSnareSpellAction::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>("snare target", spell);
|
||||
}
|
||||
Value<Unit*>* CastSnareSpellAction::GetTargetValue() { return context->GetValue<Unit*>("snare target", spell); }
|
||||
|
||||
Value<Unit*>* CastCrowdControlSpellAction::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>("cc target", getName());
|
||||
}
|
||||
Value<Unit*>* CastCrowdControlSpellAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
||||
|
||||
bool CastCrowdControlSpellAction::Execute(Event event)
|
||||
{
|
||||
return botAI->CastSpell(getName(), GetTarget());
|
||||
}
|
||||
bool CastCrowdControlSpellAction::Execute(Event event) { return botAI->CastSpell(getName(), GetTarget()); }
|
||||
|
||||
bool CastCrowdControlSpellAction::isPossible()
|
||||
{
|
||||
return botAI->CanCastSpell(getName(), GetTarget());
|
||||
}
|
||||
bool CastCrowdControlSpellAction::isPossible() { return botAI->CanCastSpell(getName(), GetTarget()); }
|
||||
|
||||
bool CastCrowdControlSpellAction::isUseful()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool CastCrowdControlSpellAction::isUseful() { return true; }
|
||||
|
||||
std::string const CastProtectSpellAction::GetTargetName()
|
||||
{
|
||||
return "party member to protect";
|
||||
}
|
||||
std::string const CastProtectSpellAction::GetTargetName() { return "party member to protect"; }
|
||||
|
||||
bool CastProtectSpellAction::isUseful()
|
||||
{
|
||||
return GetTarget() && !botAI->HasAura(spell, GetTarget());
|
||||
}
|
||||
bool CastProtectSpellAction::isUseful() { return GetTarget() && !botAI->HasAura(spell, GetTarget()); }
|
||||
|
||||
bool CastVehicleSpellAction::isPossible()
|
||||
{
|
||||
@@ -277,10 +263,7 @@ bool CastVehicleSpellAction::isPossible()
|
||||
return botAI->CanCastVehicleSpell(spellId, GetTarget());
|
||||
}
|
||||
|
||||
bool CastVehicleSpellAction::isUseful()
|
||||
{
|
||||
return botAI->IsInVehicle(false, true);
|
||||
}
|
||||
bool CastVehicleSpellAction::isUseful() { return botAI->IsInVehicle(false, true); }
|
||||
|
||||
bool CastVehicleSpellAction::Execute(Event event)
|
||||
{
|
||||
@@ -288,16 +271,15 @@ bool CastVehicleSpellAction::Execute(Event event)
|
||||
return botAI->CastVehicleSpell(spellId, GetTarget());
|
||||
}
|
||||
|
||||
Value<Unit*>* BuffOnMainTankAction::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>("main tank", spell);
|
||||
}
|
||||
Value<Unit*>* BuffOnMainTankAction::GetTargetValue() { return context->GetValue<Unit*>("main tank", spell); }
|
||||
|
||||
bool CastDebuffSpellAction::isUseful()
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (!target || !target->IsAlive() || !target->IsInWorld()) {
|
||||
if (!target || !target->IsAlive() || !target->IsInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return CastAuraSpellAction::isUseful() && (target->GetHealth() / AI_VALUE(float, "expected group dps")) >= needLifeTime;
|
||||
return CastAuraSpellAction::isUseful() &&
|
||||
(target->GetHealth() / AI_VALUE(float, "expected group dps")) >= needLifeTime;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GENERICSPELLACTIONS_H
|
||||
@@ -16,341 +17,363 @@ class WorldObject;
|
||||
|
||||
class CastSpellAction : public Action
|
||||
{
|
||||
public:
|
||||
CastSpellAction(PlayerbotAI* botAI, std::string const spell);
|
||||
public:
|
||||
CastSpellAction(PlayerbotAI* botAI, std::string const spell);
|
||||
|
||||
std::string const GetTargetName() override { return "current target"; };
|
||||
bool Execute(Event event) override;
|
||||
bool isPossible() override;
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::Single; }
|
||||
std::string const GetTargetName() override { return "current target"; };
|
||||
bool Execute(Event event) override;
|
||||
bool isPossible() override;
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::Single; }
|
||||
|
||||
NextAction** getPrerequisites() override;
|
||||
NextAction** getPrerequisites() override;
|
||||
|
||||
protected:
|
||||
std::string spell;
|
||||
float range;
|
||||
protected:
|
||||
std::string spell;
|
||||
float range;
|
||||
};
|
||||
|
||||
class CastAuraSpellAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastAuraSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false) : CastSpellAction(botAI, spell) { this->isOwner = isOwner; }
|
||||
public:
|
||||
CastAuraSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false)
|
||||
: CastSpellAction(botAI, spell)
|
||||
{
|
||||
this->isOwner = isOwner;
|
||||
}
|
||||
|
||||
bool isUseful() override;
|
||||
bool isUseful() override;
|
||||
|
||||
protected:
|
||||
bool isOwner;
|
||||
protected:
|
||||
bool isOwner;
|
||||
};
|
||||
|
||||
class CastMeleeSpellAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastMeleeSpellAction(PlayerbotAI* botAI, std::string const spell);
|
||||
public:
|
||||
CastMeleeSpellAction(PlayerbotAI* botAI, std::string const spell);
|
||||
};
|
||||
|
||||
class CastDebuffSpellAction : public CastAuraSpellAction
|
||||
{
|
||||
public:
|
||||
CastDebuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false, float needLifeTime = 8.0f) : CastAuraSpellAction(botAI, spell, isOwner), needLifeTime(needLifeTime) { }
|
||||
bool isUseful() override;
|
||||
private:
|
||||
float needLifeTime;
|
||||
public:
|
||||
CastDebuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false, float needLifeTime = 8.0f)
|
||||
: CastAuraSpellAction(botAI, spell, isOwner), needLifeTime(needLifeTime)
|
||||
{
|
||||
}
|
||||
bool isUseful() override;
|
||||
|
||||
private:
|
||||
float needLifeTime;
|
||||
};
|
||||
|
||||
class CastDebuffSpellOnAttackerAction : public CastDebuffSpellAction
|
||||
{
|
||||
public:
|
||||
CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true, float needLifeTime = 8.0f) : CastDebuffSpellAction(botAI, spell, isOwner, needLifeTime) { }
|
||||
public:
|
||||
CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true,
|
||||
float needLifeTime = 8.0f)
|
||||
: CastDebuffSpellAction(botAI, spell, isOwner, needLifeTime)
|
||||
{
|
||||
}
|
||||
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on attacker"; }
|
||||
// ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on attacker"; }
|
||||
// ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
||||
};
|
||||
|
||||
class CastDebuffSpellOnMeleeAttackerAction : public CastDebuffSpellAction
|
||||
{
|
||||
public:
|
||||
CastDebuffSpellOnMeleeAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true, float needLifeTime = 8.0f) : CastDebuffSpellAction(botAI, spell, isOwner, needLifeTime) { }
|
||||
public:
|
||||
CastDebuffSpellOnMeleeAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true,
|
||||
float needLifeTime = 8.0f)
|
||||
: CastDebuffSpellAction(botAI, spell, isOwner, needLifeTime)
|
||||
{
|
||||
}
|
||||
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on attacker"; }
|
||||
// ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on attacker"; }
|
||||
// ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
||||
};
|
||||
|
||||
class CastBuffSpellAction : public CastAuraSpellAction
|
||||
{
|
||||
public:
|
||||
CastBuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = false);
|
||||
public:
|
||||
CastBuffSpellAction(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = false);
|
||||
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
};
|
||||
|
||||
class CastEnchantItemAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastEnchantItemAction(PlayerbotAI* botAI, std::string const spell);
|
||||
public:
|
||||
CastEnchantItemAction(PlayerbotAI* botAI, std::string const spell);
|
||||
|
||||
bool isPossible() override;
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
bool isPossible() override;
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
};
|
||||
|
||||
class CastHealingSpellAction : public CastAuraSpellAction
|
||||
{
|
||||
public:
|
||||
CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f, HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM);
|
||||
public:
|
||||
CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f,
|
||||
HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM);
|
||||
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
||||
// Yunfan: Mana efficiency tell the bot how to save mana. The higher the better.
|
||||
HealingManaEfficiency manaEfficiency;
|
||||
uint8 estAmount;
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
||||
// Yunfan: Mana efficiency tell the bot how to save mana. The higher the better.
|
||||
HealingManaEfficiency manaEfficiency;
|
||||
uint8 estAmount;
|
||||
|
||||
// protected:
|
||||
};
|
||||
|
||||
class CastAoeHealSpellAction : public CastHealingSpellAction
|
||||
{
|
||||
public:
|
||||
CastAoeHealSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f, HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM)
|
||||
: CastHealingSpellAction(botAI, spell, estAmount, manaEfficiency) { }
|
||||
public:
|
||||
CastAoeHealSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f,
|
||||
HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM)
|
||||
: CastHealingSpellAction(botAI, spell, estAmount, manaEfficiency)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const GetTargetName() override { return "party member to heal"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "party member to heal"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class CastCureSpellAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastCureSpellAction(PlayerbotAI* botAI, std::string const spell);
|
||||
public:
|
||||
CastCureSpellAction(PlayerbotAI* botAI, std::string const spell);
|
||||
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
std::string const GetTargetName() override { return "self target"; }
|
||||
};
|
||||
|
||||
class PartyMemberActionNameSupport
|
||||
{
|
||||
public:
|
||||
PartyMemberActionNameSupport(std::string const spell)
|
||||
{
|
||||
name = std::string(spell + " on party");
|
||||
}
|
||||
public:
|
||||
PartyMemberActionNameSupport(std::string const spell) { name = std::string(spell + " on party"); }
|
||||
|
||||
std::string const getName() { return name; }
|
||||
std::string const getName() { return name; }
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
private:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class HealPartyMemberAction : public CastHealingSpellAction, public PartyMemberActionNameSupport
|
||||
{
|
||||
public:
|
||||
HealPartyMemberAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f, HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM) :
|
||||
CastHealingSpellAction(botAI, spell, estAmount, manaEfficiency), PartyMemberActionNameSupport(spell) { }
|
||||
public:
|
||||
HealPartyMemberAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount = 15.0f,
|
||||
HealingManaEfficiency manaEfficiency = HealingManaEfficiency::MEDIUM)
|
||||
: CastHealingSpellAction(botAI, spell, estAmount, manaEfficiency), PartyMemberActionNameSupport(spell)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const GetTargetName() override { return "party member to heal"; }
|
||||
std::string const getName() override { return PartyMemberActionNameSupport::getName(); }
|
||||
std::string const GetTargetName() override { return "party member to heal"; }
|
||||
std::string const getName() override { return PartyMemberActionNameSupport::getName(); }
|
||||
};
|
||||
|
||||
class ResurrectPartyMemberAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
ResurrectPartyMemberAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) {
|
||||
}
|
||||
public:
|
||||
ResurrectPartyMemberAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) {}
|
||||
|
||||
std::string const GetTargetName() override { return "party member to resurrect"; }
|
||||
NextAction** getPrerequisites() override
|
||||
{
|
||||
return NextAction::merge( NextAction::array(0, new NextAction("reach party member to resurrect"), NULL), Action::getPrerequisites());
|
||||
}
|
||||
std::string const GetTargetName() override { return "party member to resurrect"; }
|
||||
NextAction** getPrerequisites() override
|
||||
{
|
||||
return NextAction::merge(NextAction::array(0, new NextAction("reach party member to resurrect"), NULL),
|
||||
Action::getPrerequisites());
|
||||
}
|
||||
};
|
||||
|
||||
class CurePartyMemberAction : public CastSpellAction, public PartyMemberActionNameSupport
|
||||
{
|
||||
public:
|
||||
CurePartyMemberAction(PlayerbotAI* botAI, std::string const spell, uint32 dispelType) :
|
||||
CastSpellAction(botAI, spell), PartyMemberActionNameSupport(spell), dispelType(dispelType) { }
|
||||
public:
|
||||
CurePartyMemberAction(PlayerbotAI* botAI, std::string const spell, uint32 dispelType)
|
||||
: CastSpellAction(botAI, spell), PartyMemberActionNameSupport(spell), dispelType(dispelType)
|
||||
{
|
||||
}
|
||||
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return PartyMemberActionNameSupport::getName(); }
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return PartyMemberActionNameSupport::getName(); }
|
||||
|
||||
protected:
|
||||
uint32 dispelType;
|
||||
protected:
|
||||
uint32 dispelType;
|
||||
};
|
||||
|
||||
class BuffOnPartyAction : public CastBuffSpellAction, public PartyMemberActionNameSupport
|
||||
{
|
||||
public:
|
||||
BuffOnPartyAction(PlayerbotAI* botAI, std::string const spell) :
|
||||
CastBuffSpellAction(botAI, spell), PartyMemberActionNameSupport(spell) { }
|
||||
public:
|
||||
BuffOnPartyAction(PlayerbotAI* botAI, std::string const spell)
|
||||
: CastBuffSpellAction(botAI, spell), PartyMemberActionNameSupport(spell)
|
||||
{
|
||||
}
|
||||
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return PartyMemberActionNameSupport::getName(); }
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return PartyMemberActionNameSupport::getName(); }
|
||||
};
|
||||
|
||||
class CastShootAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastShootAction(PlayerbotAI* botAI);
|
||||
public:
|
||||
CastShootAction(PlayerbotAI* botAI);
|
||||
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
};
|
||||
|
||||
class CastLifeBloodAction : public CastHealingSpellAction
|
||||
{
|
||||
public:
|
||||
CastLifeBloodAction(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, "lifeblood") { }
|
||||
public:
|
||||
CastLifeBloodAction(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, "lifeblood") {}
|
||||
};
|
||||
|
||||
class CastGiftOfTheNaaruAction : public CastHealingSpellAction
|
||||
{
|
||||
public:
|
||||
CastGiftOfTheNaaruAction(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, "gift of the naaru") { }
|
||||
public:
|
||||
CastGiftOfTheNaaruAction(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, "gift of the naaru") {}
|
||||
};
|
||||
|
||||
class CastArcaneTorrentAction : public CastBuffSpellAction
|
||||
{
|
||||
public:
|
||||
CastArcaneTorrentAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "arcane torrent") { }
|
||||
public:
|
||||
CastArcaneTorrentAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "arcane torrent") {}
|
||||
};
|
||||
|
||||
class CastManaTapAction : public CastBuffSpellAction
|
||||
{
|
||||
public:
|
||||
CastManaTapAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "mana tap") { }
|
||||
public:
|
||||
CastManaTapAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "mana tap") {}
|
||||
};
|
||||
|
||||
class CastWarStompAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastWarStompAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "war stomp") { }
|
||||
public:
|
||||
CastWarStompAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "war stomp") {}
|
||||
};
|
||||
|
||||
class CastSpellOnEnemyHealerAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastSpellOnEnemyHealerAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) { }
|
||||
public:
|
||||
CastSpellOnEnemyHealerAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) {}
|
||||
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on enemy healer"; }
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on enemy healer"; }
|
||||
};
|
||||
|
||||
class CastSnareSpellAction : public CastDebuffSpellAction
|
||||
{
|
||||
public:
|
||||
CastSnareSpellAction(PlayerbotAI* botAI, std::string const spell) : CastDebuffSpellAction(botAI, spell) { }
|
||||
public:
|
||||
CastSnareSpellAction(PlayerbotAI* botAI, std::string const spell) : CastDebuffSpellAction(botAI, spell) {}
|
||||
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on snare target"; }
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
std::string const getName() override { return spell + " on snare target"; }
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
};
|
||||
|
||||
class CastCrowdControlSpellAction : public CastBuffSpellAction
|
||||
{
|
||||
public:
|
||||
CastCrowdControlSpellAction(PlayerbotAI* botAI, std::string const spell) : CastBuffSpellAction(botAI, spell) { }
|
||||
public:
|
||||
CastCrowdControlSpellAction(PlayerbotAI* botAI, std::string const spell) : CastBuffSpellAction(botAI, spell) {}
|
||||
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isPossible() override;
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
Value<Unit*>* GetTargetValue() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isPossible() override;
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
};
|
||||
|
||||
class CastProtectSpellAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastProtectSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) { }
|
||||
public:
|
||||
CastProtectSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) {}
|
||||
|
||||
std::string const GetTargetName() override;
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
std::string const GetTargetName() override;
|
||||
bool isUseful() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
};
|
||||
|
||||
class CastVehicleSpellAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
CastVehicleSpellAction(PlayerbotAI* botAI, std::string const& spell) : CastSpellAction(botAI, spell)
|
||||
{
|
||||
range = 120.0f;
|
||||
}
|
||||
public:
|
||||
CastVehicleSpellAction(PlayerbotAI* botAI, std::string const& spell) : CastSpellAction(botAI, spell)
|
||||
{
|
||||
range = 120.0f;
|
||||
}
|
||||
|
||||
std::string const GetTargetName() override { return "current target"; }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
std::string const GetTargetName() override { return "current target"; }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::None; }
|
||||
|
||||
protected:
|
||||
WorldObject* spellTarget;
|
||||
protected:
|
||||
WorldObject* spellTarget;
|
||||
};
|
||||
|
||||
class CastHurlBoulderAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastHurlBoulderAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "hurl boulder") { }
|
||||
public:
|
||||
CastHurlBoulderAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "hurl boulder") {}
|
||||
};
|
||||
|
||||
class CastSteamRushAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastSteamRushAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "steam rush") { }
|
||||
public:
|
||||
CastSteamRushAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "steam rush") {}
|
||||
};
|
||||
|
||||
class CastRamAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastRamAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "ram") { }
|
||||
public:
|
||||
CastRamAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "ram") {}
|
||||
};
|
||||
|
||||
class CastNapalmAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastNapalmAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "napalm") { }
|
||||
public:
|
||||
CastNapalmAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "napalm") {}
|
||||
};
|
||||
|
||||
class CastFireCannonAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastFireCannonAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "fire cannon") { }
|
||||
public:
|
||||
CastFireCannonAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "fire cannon") {}
|
||||
};
|
||||
|
||||
class CastSteamBlastAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastSteamBlastAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "steam blast") { }
|
||||
public:
|
||||
CastSteamBlastAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "steam blast") {}
|
||||
};
|
||||
|
||||
class CastIncendiaryRocketAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastIncendiaryRocketAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "incendiary rocket") { }
|
||||
public:
|
||||
CastIncendiaryRocketAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "incendiary rocket") {}
|
||||
};
|
||||
|
||||
class CastRocketBlastAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastRocketBlastAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "rocket blast") { }
|
||||
public:
|
||||
CastRocketBlastAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "rocket blast") {}
|
||||
};
|
||||
|
||||
class CastGlaiveThrowAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastGlaiveThrowAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "glaive throw") { }
|
||||
public:
|
||||
CastGlaiveThrowAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "glaive throw") {}
|
||||
};
|
||||
|
||||
class CastBladeSalvoAction : public CastVehicleSpellAction
|
||||
{
|
||||
public:
|
||||
CastBladeSalvoAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "blade salvo") { }
|
||||
public:
|
||||
CastBladeSalvoAction(PlayerbotAI* botAI) : CastVehicleSpellAction(botAI, "blade salvo") {}
|
||||
};
|
||||
|
||||
class MainTankActionNameSupport {
|
||||
class MainTankActionNameSupport
|
||||
{
|
||||
public:
|
||||
MainTankActionNameSupport(std::string spell)
|
||||
{
|
||||
name = std::string(spell) + " on main tank";
|
||||
}
|
||||
MainTankActionNameSupport(std::string spell) { name = std::string(spell) + " on main tank"; }
|
||||
|
||||
virtual std::string const getName() { return name; }
|
||||
|
||||
@@ -361,8 +384,11 @@ private:
|
||||
class BuffOnMainTankAction : public CastBuffSpellAction, public MainTankActionNameSupport
|
||||
{
|
||||
public:
|
||||
BuffOnMainTankAction(PlayerbotAI* ai, std::string spell, bool checkIsOwner = false) :
|
||||
CastBuffSpellAction(ai, spell, checkIsOwner), MainTankActionNameSupport(spell) {}
|
||||
BuffOnMainTankAction(PlayerbotAI* ai, std::string spell, bool checkIsOwner = false)
|
||||
: CastBuffSpellAction(ai, spell, checkIsOwner), MainTankActionNameSupport(spell)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual Value<Unit*>* GetTargetValue();
|
||||
virtual std::string const getName() { return MainTankActionNameSupport::getName(); }
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GiveItemAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -49,7 +51,8 @@ bool GiveItemAction::Execute(Event event)
|
||||
else
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Cannot get " << chat->FormatItem(item->GetTemplate(), item->GetCount()) << " from " << bot->GetName() << "- my bags are full";
|
||||
out << "Cannot get " << chat->FormatItem(item->GetTemplate(), item->GetCount()) << " from "
|
||||
<< bot->GetName() << "- my bags are full";
|
||||
receiverAi->TellError(out.str());
|
||||
}
|
||||
}
|
||||
@@ -57,36 +60,26 @@ bool GiveItemAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
Unit* GiveItemAction::GetTarget()
|
||||
{
|
||||
return AI_VALUE2(Unit*, "party member without item", item);
|
||||
}
|
||||
Unit* GiveItemAction::GetTarget() { return AI_VALUE2(Unit*, "party member without item", item); }
|
||||
|
||||
bool GiveItemAction::isUseful()
|
||||
{
|
||||
return GetTarget() && AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig->lowMana;
|
||||
}
|
||||
|
||||
Unit* GiveFoodAction::GetTarget()
|
||||
{
|
||||
return AI_VALUE(Unit*, "party member without food");
|
||||
}
|
||||
Unit* GiveFoodAction::GetTarget() { return AI_VALUE(Unit*, "party member without food"); }
|
||||
|
||||
bool GiveFoodAction::isUseful()
|
||||
{
|
||||
if (!GetTarget())
|
||||
return false;
|
||||
|
||||
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*) GetTarget());
|
||||
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*)GetTarget());
|
||||
|
||||
return !isRandomBot || (isRandomBot && !sPlayerbotAIConfig->freeFood);
|
||||
}
|
||||
|
||||
Unit* GiveWaterAction::GetTarget()
|
||||
{
|
||||
return AI_VALUE(Unit*, "party member without water");
|
||||
}
|
||||
|
||||
Unit* GiveWaterAction::GetTarget() { return AI_VALUE(Unit*, "party member without water"); }
|
||||
|
||||
bool GiveWaterAction::isUseful()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GIVEITEMACTION_H
|
||||
@@ -11,21 +12,24 @@ class PlayerbotAI;
|
||||
|
||||
class GiveItemAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
GiveItemAction(PlayerbotAI* botAI, std::string const name, std::string const item) : InventoryAction(botAI, name), item(item) { }
|
||||
public:
|
||||
GiveItemAction(PlayerbotAI* botAI, std::string const name, std::string const item)
|
||||
: InventoryAction(botAI, name), item(item)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
Unit* GetTarget() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
Unit* GetTarget() override;
|
||||
|
||||
protected:
|
||||
std::string const item;
|
||||
protected:
|
||||
std::string const item;
|
||||
};
|
||||
|
||||
class GiveFoodAction : public GiveItemAction
|
||||
{
|
||||
public:
|
||||
GiveFoodAction(PlayerbotAI* botAI) : GiveItemAction(botAI, "give food", "conjured food") { }
|
||||
public:
|
||||
GiveFoodAction(PlayerbotAI* botAI) : GiveItemAction(botAI, "give food", "conjured food") {}
|
||||
|
||||
bool isUseful() override;
|
||||
Unit* GetTarget() override;
|
||||
@@ -33,8 +37,8 @@ class GiveFoodAction : public GiveItemAction
|
||||
|
||||
class GiveWaterAction : public GiveItemAction
|
||||
{
|
||||
public:
|
||||
GiveWaterAction(PlayerbotAI* botAI) : GiveItemAction(botAI, "give water", "conjured water") { }
|
||||
public:
|
||||
GiveWaterAction(PlayerbotAI* botAI) : GiveItemAction(botAI, "give water", "conjured water") {}
|
||||
|
||||
bool isUseful() override;
|
||||
Unit* GetTarget() override;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GoAction.h"
|
||||
|
||||
#include "ChooseTravelTargetAction.h"
|
||||
#include "Event.h"
|
||||
#include "Formations.h"
|
||||
#include "PathGenerator.h"
|
||||
#include "PositionValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
std::vector<std::string> split(std::string const s, char delim);
|
||||
@@ -73,7 +75,8 @@ bool GoAction::Execute(Event event)
|
||||
if (GameObject* go = botAI->GetGameObject(guid))
|
||||
if (go->isSpawned())
|
||||
{
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, go), sPlayerbotAIConfig->reactDistance))
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, go),
|
||||
sPlayerbotAIConfig->reactDistance))
|
||||
{
|
||||
botAI->TellError("It is too far away");
|
||||
return false;
|
||||
@@ -82,7 +85,8 @@ bool GoAction::Execute(Event event)
|
||||
std::ostringstream out;
|
||||
out << "Moving to " << ChatHelper::FormatGameobject(go);
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
return MoveNear(bot->GetMapId(), go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 0.5f, sPlayerbotAIConfig->followDistance);
|
||||
return MoveNear(bot->GetMapId(), go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 0.5f,
|
||||
sPlayerbotAIConfig->followDistance);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -101,7 +105,8 @@ bool GoAction::Execute(Event event)
|
||||
std::ostringstream out;
|
||||
out << "Moving to " << unit->GetName();
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
return MoveNear(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ() + 0.5f, sPlayerbotAIConfig->followDistance);
|
||||
return MoveNear(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(),
|
||||
unit->GetPositionZ() + 0.5f, sPlayerbotAIConfig->followDistance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +149,6 @@ bool GoAction::Execute(Event event)
|
||||
|
||||
out << (end - aend).length();
|
||||
|
||||
|
||||
for (auto i : points)
|
||||
{
|
||||
CreateWp(bot, i.x, i.y, i.z, 0.f, 11144);
|
||||
@@ -172,7 +176,8 @@ bool GoAction::Execute(Event event)
|
||||
float z = bot->GetPositionZ();
|
||||
bot->UpdateAllowedPositionZ(x, y, z);
|
||||
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, x, y), sPlayerbotAIConfig->reactDistance))
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, x, y),
|
||||
sPlayerbotAIConfig->reactDistance))
|
||||
{
|
||||
botAI->TellMaster("It is too far away");
|
||||
return false;
|
||||
@@ -204,7 +209,8 @@ bool GoAction::Execute(Event event)
|
||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[param];
|
||||
if (pos.isSet())
|
||||
{
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, pos.x, pos.y), sPlayerbotAIConfig->reactDistance))
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, pos.x, pos.y),
|
||||
sPlayerbotAIConfig->reactDistance))
|
||||
{
|
||||
botAI->TellError("It is too far away");
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GOACTION_H
|
||||
@@ -13,10 +14,10 @@ class WorldPosition;
|
||||
|
||||
class GoAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
GoAction(PlayerbotAI* botAI) : MovementAction(botAI, "Go") { }
|
||||
public:
|
||||
GoAction(PlayerbotAI* botAI) : MovementAction(botAI, "Go") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,47 +1,53 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GossipHelloAction.h"
|
||||
#include "GossipDef.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool GossipHelloAction::Execute(Event event)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
WorldPacket &p = event.getPacket();
|
||||
if (p.empty())
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (master)
|
||||
guid = master->GetTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
p.rpos(0);
|
||||
p >> guid;
|
||||
}
|
||||
WorldPacket& p = event.getPacket();
|
||||
if (p.empty())
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (master)
|
||||
guid = master->GetTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
p.rpos(0);
|
||||
p >> guid;
|
||||
}
|
||||
|
||||
if (!guid)
|
||||
return false;
|
||||
if (!guid)
|
||||
return false;
|
||||
|
||||
Creature* pCreature = bot->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!pCreature)
|
||||
{
|
||||
LOG_DEBUG("playerbots", "[PlayerbotMgr]: HandleMasterIncomingPacket - Received CMSG_GOSSIP_HELLO {} not found or you can't interact with him.", guid.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
Creature* pCreature = bot->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!pCreature)
|
||||
{
|
||||
LOG_DEBUG("playerbots",
|
||||
"[PlayerbotMgr]: HandleMasterIncomingPacket - Received CMSG_GOSSIP_HELLO {} not found or you can't "
|
||||
"interact with him.",
|
||||
guid.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
GossipMenuItemsMapBounds pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(pCreature->GetCreatureTemplate()->GossipMenuId);
|
||||
if (pMenuItemBounds.first == pMenuItemBounds.second)
|
||||
return false;
|
||||
GossipMenuItemsMapBounds pMenuItemBounds =
|
||||
sObjectMgr->GetGossipMenuItemsMapBounds(pCreature->GetCreatureTemplate()->GossipMenuId);
|
||||
if (pMenuItemBounds.first == pMenuItemBounds.second)
|
||||
return false;
|
||||
|
||||
std::string const text = event.getParam();
|
||||
int32 menuToSelect = -1;
|
||||
if (text.empty())
|
||||
{
|
||||
std::string const text = event.getParam();
|
||||
int32 menuToSelect = -1;
|
||||
if (text.empty())
|
||||
{
|
||||
WorldPacket p1;
|
||||
p1 << guid;
|
||||
bot->GetSession()->HandleGossipHelloOpcode(p1);
|
||||
@@ -52,23 +58,23 @@ bool GossipHelloAction::Execute(Event event)
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
|
||||
TellGossipMenus();
|
||||
}
|
||||
else if (!bot->PlayerTalkClass)
|
||||
{
|
||||
botAI->TellError("I need to talk first");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
menuToSelect = atoi(text.c_str());
|
||||
// if (menuToSelect > 0)
|
||||
}
|
||||
else if (!bot->PlayerTalkClass)
|
||||
{
|
||||
botAI->TellError("I need to talk first");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
menuToSelect = atoi(text.c_str());
|
||||
// if (menuToSelect > 0)
|
||||
// menuToSelect--;
|
||||
|
||||
ProcessGossip(menuToSelect);
|
||||
}
|
||||
}
|
||||
|
||||
bot->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
|
||||
return true;
|
||||
bot->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
void GossipHelloAction::TellGossipText(uint32 textId)
|
||||
@@ -104,8 +110,9 @@ void GossipHelloAction::TellGossipMenus()
|
||||
TellGossipText(textId);
|
||||
}
|
||||
|
||||
GossipMenuItemContainer const &items = menu.GetMenuItems();
|
||||
for (auto iter = items.begin(); iter != items.end(); iter++) {
|
||||
GossipMenuItemContainer const& items = menu.GetMenuItems();
|
||||
for (auto iter = items.begin(); iter != items.end(); iter++)
|
||||
{
|
||||
GossipMenuItem const* item = &(iter->second);
|
||||
std::ostringstream out;
|
||||
out << "[" << iter->first << "] " << item->Message;
|
||||
@@ -113,7 +120,6 @@ void GossipHelloAction::TellGossipMenus()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GossipHelloAction::ProcessGossip(int32 menuToSelect)
|
||||
{
|
||||
GossipMenu& menu = bot->PlayerTalkClass->GetGossipMenu();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GOSSIPHELLOACTION_H
|
||||
@@ -11,15 +12,15 @@ class PlayerbotAI;
|
||||
|
||||
class GossipHelloAction : public Action
|
||||
{
|
||||
public:
|
||||
GossipHelloAction(PlayerbotAI* botAI) : Action(botAI, "gossip hello") { }
|
||||
public:
|
||||
GossipHelloAction(PlayerbotAI* botAI) : Action(botAI, "gossip hello") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
void TellGossipMenus();
|
||||
bool ProcessGossip(int32 menuToSelect);
|
||||
void TellGossipText(uint32 textId);
|
||||
private:
|
||||
void TellGossipMenus();
|
||||
bool ProcessGossip(int32 menuToSelect);
|
||||
void TellGossipText(uint32 textId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GreetAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet")
|
||||
{
|
||||
}
|
||||
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet") {}
|
||||
|
||||
bool GreetAction::Execute(Event event)
|
||||
{
|
||||
@@ -25,7 +25,7 @@ bool GreetAction::Execute(Event event)
|
||||
|
||||
ObjectGuid oldSel = bot->GetTarget();
|
||||
bot->SetTarget(guid);
|
||||
//bot->HandleEmote(EMOTE_ONESHOT_WAVE);
|
||||
// bot->HandleEmote(EMOTE_ONESHOT_WAVE);
|
||||
botAI->PlayEmote(TEXT_EMOTE_HELLO);
|
||||
bot->SetTarget(oldSel);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GREETACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class GreetAction : public Action
|
||||
{
|
||||
public:
|
||||
GreetAction(PlayerbotAI* botAI);
|
||||
public:
|
||||
GreetAction(PlayerbotAI* botAI);
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GuildAcceptAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "GuildPackets.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PlayerbotSecurity.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool GuildAcceptAction::Execute(Event event)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GUILDACCEPTACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class GuildAcceptAction : public Action
|
||||
{
|
||||
public:
|
||||
GuildAcceptAction(PlayerbotAI* botAI) : Action(botAI, "guild accept") { }
|
||||
public:
|
||||
GuildAcceptAction(PlayerbotAI* botAI) : Action(botAI, "guild accept") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GuildBankAction.h"
|
||||
|
||||
#include "GuildMgr.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -18,7 +20,7 @@ bool GuildBankAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
GuidVector gos = *botAI->GetAiObjectContext()->GetValue<GuidVector >("nearest game objects");
|
||||
GuidVector gos = *botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest game objects");
|
||||
for (GuidVector::iterator i = gos.begin(); i != gos.end(); ++i)
|
||||
{
|
||||
GameObject* go = botAI->GetGameObject(*i);
|
||||
@@ -58,11 +60,12 @@ bool GuildBankAction::MoveFromCharToBank(Item* item, GameObject* bank)
|
||||
std::ostringstream out;
|
||||
|
||||
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
|
||||
//guild->SwapItems(bot, 0, playerSlot, 0, INVENTORY_SLOT_BAG_0, 0);
|
||||
// guild->SwapItems(bot, 0, playerSlot, 0, INVENTORY_SLOT_BAG_0, 0);
|
||||
|
||||
// check source pos rights (item moved to bank)
|
||||
if (!guild->MemberHasTabRights(bot->GetGUID(), 0, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
||||
out << "I can't put " << chat->FormatItem(item->GetTemplate()) << " to guild bank. I have no rights to put items in the first guild bank tab";
|
||||
out << "I can't put " << chat->FormatItem(item->GetTemplate())
|
||||
<< " to guild bank. I have no rights to put items in the first guild bank tab";
|
||||
else
|
||||
{
|
||||
out << chat->FormatItem(item->GetTemplate()) << " put to guild bank";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GUILDBANKACTION_H
|
||||
@@ -13,14 +14,14 @@ class PlayerbotAI;
|
||||
|
||||
class GuildBankAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
GuildBankAction(PlayerbotAI* botAI) : InventoryAction(botAI, "guild bank") { }
|
||||
public:
|
||||
GuildBankAction(PlayerbotAI* botAI) : InventoryAction(botAI, "guild bank") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool Execute(std::string const text, GameObject* bank);
|
||||
bool MoveFromCharToBank(Item* item, GameObject* bank);
|
||||
private:
|
||||
bool Execute(std::string const text, GameObject* bank);
|
||||
bool MoveFromCharToBank(Item* item, GameObject* bank);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GuildCreateActions.h"
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "BudgetValues.h"
|
||||
#include "Event.h"
|
||||
@@ -13,7 +15,7 @@
|
||||
|
||||
bool BuyPetitionAction::Execute(Event event)
|
||||
{
|
||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector >("nearest npcs")->Get();
|
||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
||||
bool vendored = false, result = false;
|
||||
for (GuidVector::iterator i = vendors.begin(); i != vendors.end(); ++i)
|
||||
{
|
||||
@@ -48,7 +50,7 @@ bool BuyPetitionAction::Execute(Event event)
|
||||
for (uint8 i = 0; i < 10; ++i)
|
||||
data << std::string("");
|
||||
|
||||
data << uint32(0); // index
|
||||
data << uint32(0); // index
|
||||
data << uint32(0);
|
||||
|
||||
bot->GetSession()->HandlePetitionBuyOpcode(data);
|
||||
@@ -59,10 +61,7 @@ bool BuyPetitionAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BuyPetitionAction::isUseful()
|
||||
{
|
||||
return canBuyPetition(bot);
|
||||
};
|
||||
bool BuyPetitionAction::isUseful() { return canBuyPetition(bot); };
|
||||
|
||||
bool BuyPetitionAction::canBuyPetition(Player* bot)
|
||||
{
|
||||
@@ -87,7 +86,7 @@ bool BuyPetitionAction::canBuyPetition(Player* bot)
|
||||
if (!botAI->HasStrategy("guild", BOT_STATE_NON_COMBAT))
|
||||
return false;
|
||||
|
||||
uint32 cost = 1000; //GUILD_CHARTER_COST;
|
||||
uint32 cost = 1000; // GUILD_CHARTER_COST;
|
||||
|
||||
if (AI_VALUE2(uint32, "free money for", uint32(NeedMoneyFor::guild)) < cost)
|
||||
return false;
|
||||
@@ -97,10 +96,10 @@ bool BuyPetitionAction::canBuyPetition(Player* bot)
|
||||
|
||||
bool PetitionOfferAction::Execute(Event event)
|
||||
{
|
||||
uint32 petitionEntry = 5863; //GUILD_CHARTER
|
||||
uint32 petitionEntry = 5863; // GUILD_CHARTER
|
||||
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
|
||||
|
||||
if (petitions.empty())
|
||||
if (petitions.empty())
|
||||
return false;
|
||||
|
||||
ObjectGuid guid = event.getObject();
|
||||
@@ -131,8 +130,9 @@ bool PetitionOfferAction::Execute(Event event)
|
||||
data << petitions.front()->GetGUID();
|
||||
data << guid;
|
||||
|
||||
QueryResult result = CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE player_account = {} AND petitionguid = {}",
|
||||
player->GetSession()->GetAccountId(), petitions.front()->GetGUID().GetCounter());
|
||||
QueryResult result =
|
||||
CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE player_account = {} AND petitionguid = {}",
|
||||
player->GetSession()->GetAccountId(), petitions.front()->GetGUID().GetCounter());
|
||||
if (result)
|
||||
{
|
||||
return false;
|
||||
@@ -140,7 +140,8 @@ bool PetitionOfferAction::Execute(Event event)
|
||||
|
||||
bot->GetSession()->HandleOfferPetitionOpcode(data);
|
||||
|
||||
result = CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE petitionguid = {}", petitions.front()->GetGUID().GetCounter());
|
||||
result = CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE petitionguid = {}",
|
||||
petitions.front()->GetGUID().GetCounter());
|
||||
uint8 signs = result ? (uint8)result->GetRowCount() : 0;
|
||||
|
||||
context->GetValue<uint8>("petition signs")->Set(signs);
|
||||
@@ -148,16 +149,13 @@ bool PetitionOfferAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PetitionOfferAction::isUseful()
|
||||
{
|
||||
return !bot->GetGuildId();
|
||||
}
|
||||
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
|
||||
|
||||
bool PetitionOfferNearbyAction::Execute(Event event)
|
||||
{
|
||||
uint32 found = 0;
|
||||
|
||||
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector >("nearest friendly players")->Get();
|
||||
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
|
||||
for (auto& i : nearGuids)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(i);
|
||||
@@ -180,7 +178,7 @@ bool PetitionOfferNearbyAction::Execute(Event event)
|
||||
continue;
|
||||
|
||||
*/
|
||||
if (botAI->HasActivePlayerMaster()) //Do not invite alts of active players.
|
||||
if (botAI->HasActivePlayerMaster()) // Do not invite alts of active players.
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@@ -192,7 +190,7 @@ bool PetitionOfferNearbyAction::Execute(Event event)
|
||||
if (sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
|
||||
continue;
|
||||
|
||||
//Parse rpg target to quest action.
|
||||
// Parse rpg target to quest action.
|
||||
WorldPacket p(CMSG_QUESTGIVER_ACCEPT_QUEST);
|
||||
p << i;
|
||||
p.rpos(0);
|
||||
@@ -206,12 +204,13 @@ bool PetitionOfferNearbyAction::Execute(Event event)
|
||||
|
||||
bool PetitionOfferNearbyAction::isUseful()
|
||||
{
|
||||
return !bot->GetGuildId() && AI_VALUE2(uint32, "item count", chat->FormatQItem(5863)) && AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
||||
return !bot->GetGuildId() && AI_VALUE2(uint32, "item count", chat->FormatQItem(5863)) &&
|
||||
AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
||||
}
|
||||
|
||||
bool PetitionTurnInAction::Execute(Event event)
|
||||
{
|
||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector >("nearest npcs")->Get();
|
||||
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));
|
||||
|
||||
@@ -250,7 +249,7 @@ bool PetitionTurnInAction::Execute(Event event)
|
||||
|
||||
guild->HandleSetEmblem(emblemInfo);
|
||||
|
||||
//LANG_GUILD_VETERAN -> can invite
|
||||
// LANG_GUILD_VETERAN -> can invite
|
||||
guild->HandleSetRankInfo(2, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK | GR_RIGHT_INVITE);
|
||||
}
|
||||
|
||||
@@ -259,10 +258,10 @@ bool PetitionTurnInAction::Execute(Event event)
|
||||
|
||||
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);
|
||||
|
||||
bool foundTarget = SetNpcFlagTarget(&newTarget, { UNIT_NPC_FLAG_PETITIONER });
|
||||
bool foundTarget = SetNpcFlagTarget(&newTarget, {UNIT_NPC_FLAG_PETITIONER});
|
||||
|
||||
if (!foundTarget || !newTarget.isActive())
|
||||
return false;
|
||||
@@ -284,7 +283,8 @@ bool PetitionTurnInAction::isUseful()
|
||||
}
|
||||
|
||||
return inCity && !bot->GetGuildId() && AI_VALUE2(uint32, "item count", chat->FormatQItem(5863)) &&
|
||||
AI_VALUE(uint8, "petition signs") >= sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS) && !context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
||||
AI_VALUE(uint8, "petition signs") >= sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS) &&
|
||||
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
||||
}
|
||||
|
||||
bool BuyTabardAction::Execute(Event event)
|
||||
@@ -295,10 +295,10 @@ bool BuyTabardAction::Execute(Event event)
|
||||
|
||||
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);
|
||||
|
||||
bool foundTarget = SetNpcFlagTarget(&newTarget, { UNIT_NPC_FLAG_TABARDDESIGNER }, "Tabard Vendor", { 5976 });
|
||||
bool foundTarget = SetNpcFlagTarget(&newTarget, {UNIT_NPC_FLAG_TABARDDESIGNER}, "Tabard Vendor", {5976});
|
||||
|
||||
if (!foundTarget || !newTarget.isActive())
|
||||
return false;
|
||||
@@ -320,5 +320,6 @@ bool BuyTabardAction::isUseful()
|
||||
}
|
||||
|
||||
return inCity && bot->GetGuildId() && !AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)) &&
|
||||
AI_VALUE2(uint32, "free money for", uint32(NeedMoneyFor::guild)) >= 10000 && !context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
||||
AI_VALUE2(uint32, "free money for", uint32(NeedMoneyFor::guild)) >= 10000 &&
|
||||
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
||||
}
|
||||
|
||||
@@ -1,60 +1,61 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GUILDCREATEACTION_H
|
||||
#define _PLAYERBOT_GUILDCREATEACTION_H
|
||||
|
||||
#include "InventoryAction.h"
|
||||
#include "ChooseTravelTargetAction.h"
|
||||
#include "InventoryAction.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class BuyPetitionAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
BuyPetitionAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buy petition") { }
|
||||
public:
|
||||
BuyPetitionAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buy petition") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
static bool canBuyPetition(Player* bot);
|
||||
static bool canBuyPetition(Player* bot);
|
||||
};
|
||||
|
||||
class PetitionOfferAction : public Action
|
||||
{
|
||||
public:
|
||||
PetitionOfferAction(PlayerbotAI* botAI, std::string const name = "petition offer") : Action(botAI, name) { }
|
||||
public:
|
||||
PetitionOfferAction(PlayerbotAI* botAI, std::string const name = "petition offer") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class PetitionOfferNearbyAction : public PetitionOfferAction
|
||||
{
|
||||
public:
|
||||
PetitionOfferNearbyAction(PlayerbotAI* botAI) : PetitionOfferAction(botAI, "petition offer nearby") { }
|
||||
public:
|
||||
PetitionOfferNearbyAction(PlayerbotAI* botAI) : PetitionOfferAction(botAI, "petition offer nearby") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class PetitionTurnInAction : public ChooseTravelTargetAction
|
||||
{
|
||||
public:
|
||||
PetitionTurnInAction(PlayerbotAI* botAI) : ChooseTravelTargetAction(botAI, "turn in petitn") { }
|
||||
public:
|
||||
PetitionTurnInAction(PlayerbotAI* botAI) : ChooseTravelTargetAction(botAI, "turn in petitn") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class BuyTabardAction : public ChooseTravelTargetAction
|
||||
{
|
||||
public:
|
||||
BuyTabardAction(PlayerbotAI* botAI) : ChooseTravelTargetAction(botAI, "buy tabard") { }
|
||||
public:
|
||||
BuyTabardAction(PlayerbotAI* botAI) : ChooseTravelTargetAction(botAI, "buy tabard") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "GuildManagementActions.h"
|
||||
|
||||
#include "GuildMgr.h"
|
||||
#include "GuildPackets.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -39,9 +41,9 @@ Player* GuidManageAction::GetPlayer(Event event)
|
||||
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
guid = bot->GetTarget();
|
||||
guid = bot->GetTarget();
|
||||
else
|
||||
guid = master->GetTarget();
|
||||
guid = master->GetTarget();
|
||||
|
||||
player = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
@@ -51,7 +53,7 @@ Player* GuidManageAction::GetPlayer(Event event)
|
||||
player = event.getOwner();
|
||||
|
||||
if (player)
|
||||
return player;
|
||||
return player;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -70,10 +72,7 @@ bool GuidManageAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GuidManageAction::PlayerIsValid(Player* member)
|
||||
{
|
||||
return !member->GetGuildId();
|
||||
}
|
||||
bool GuidManageAction::PlayerIsValid(Player* member) { return !member->GetGuildId(); }
|
||||
|
||||
uint8 GuidManageAction::GetRankId(Player* member)
|
||||
{
|
||||
@@ -91,10 +90,7 @@ void GuildInviteAction::SendPacket(WorldPacket packet)
|
||||
bot->GetSession()->HandleGuildInviteOpcode(data);
|
||||
}
|
||||
|
||||
bool GuildInviteAction::PlayerIsValid(Player* member)
|
||||
{
|
||||
return !member->GetGuildId();
|
||||
}
|
||||
bool GuildInviteAction::PlayerIsValid(Player* member) { return !member->GetGuildId(); }
|
||||
|
||||
bool GuildPromoteAction::isUseful()
|
||||
{
|
||||
@@ -162,8 +158,8 @@ bool GuildManageNearbyAction::Execute(Event event)
|
||||
if (player->isDND())
|
||||
continue;
|
||||
|
||||
|
||||
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId()) //Promote or demote nearby members based on chance.
|
||||
// Promote or demote nearby members based on chance.
|
||||
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId())
|
||||
{
|
||||
Guild::Member* member = guild->GetMember(player->GetGUID());
|
||||
uint32 dCount = AI_VALUE(uint32, "death count");
|
||||
@@ -324,7 +320,4 @@ bool GuildLeaveAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GuildLeaveAction::isUseful()
|
||||
{
|
||||
return bot->GetGuildId();
|
||||
}
|
||||
bool GuildLeaveAction::isUseful() { return bot->GetGuildId(); }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_GUILDMAMANEGEMENTACTION_H
|
||||
@@ -14,85 +15,100 @@ class WorldPacket;
|
||||
|
||||
class GuidManageAction : public Action
|
||||
{
|
||||
public:
|
||||
GuidManageAction(PlayerbotAI* botAI, std::string const name = "guild manage", uint16 opcode = CMSG_GUILD_INVITE) : Action(botAI, name), opcode(opcode) { }
|
||||
public:
|
||||
GuidManageAction(PlayerbotAI* botAI, std::string const name = "guild manage", uint16 opcode = CMSG_GUILD_INVITE)
|
||||
: Action(botAI, name), opcode(opcode)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override { return false; }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override { return false; }
|
||||
|
||||
protected:
|
||||
virtual void SendPacket(WorldPacket data) { };
|
||||
virtual Player* GetPlayer(Event event);
|
||||
virtual bool PlayerIsValid(Player* member);
|
||||
virtual uint8 GetRankId(Player* member);
|
||||
protected:
|
||||
virtual void SendPacket(WorldPacket data){};
|
||||
virtual Player* GetPlayer(Event event);
|
||||
virtual bool PlayerIsValid(Player* member);
|
||||
virtual uint8 GetRankId(Player* member);
|
||||
|
||||
uint16 opcode;
|
||||
uint16 opcode;
|
||||
};
|
||||
|
||||
class GuildInviteAction : public GuidManageAction
|
||||
{
|
||||
public:
|
||||
GuildInviteAction(PlayerbotAI* botAI, std::string const name = "guild invite", uint16 opcode = CMSG_GUILD_INVITE) : GuidManageAction(botAI, name, opcode) { }
|
||||
public:
|
||||
GuildInviteAction(PlayerbotAI* botAI, std::string const name = "guild invite", uint16 opcode = CMSG_GUILD_INVITE)
|
||||
: GuidManageAction(botAI, name, opcode)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override;
|
||||
bool isUseful() override;
|
||||
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
};
|
||||
|
||||
class GuildPromoteAction : public GuidManageAction
|
||||
{
|
||||
public:
|
||||
GuildPromoteAction(PlayerbotAI* botAI, std::string const name = "guild promote", uint16 opcode = CMSG_GUILD_PROMOTE) : GuidManageAction(botAI, name, opcode) { }
|
||||
public:
|
||||
GuildPromoteAction(PlayerbotAI* botAI, std::string const name = "guild promote", uint16 opcode = CMSG_GUILD_PROMOTE)
|
||||
: GuidManageAction(botAI, name, opcode)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override;
|
||||
bool isUseful() override;
|
||||
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
};
|
||||
|
||||
class GuildDemoteAction : public GuidManageAction
|
||||
{
|
||||
public:
|
||||
GuildDemoteAction(PlayerbotAI* botAI, std::string const name = "guild demote", uint16 opcode = CMSG_GUILD_DEMOTE) : GuidManageAction(botAI, name, opcode) { }
|
||||
public:
|
||||
GuildDemoteAction(PlayerbotAI* botAI, std::string const name = "guild demote", uint16 opcode = CMSG_GUILD_DEMOTE)
|
||||
: GuidManageAction(botAI, name, opcode)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override;
|
||||
bool isUseful() override;
|
||||
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
};
|
||||
|
||||
class GuildRemoveAction : public GuidManageAction
|
||||
{
|
||||
public:
|
||||
GuildRemoveAction(PlayerbotAI* botAI, std::string const name = "guild remove", uint16 opcode = CMSG_GUILD_REMOVE) : GuidManageAction(botAI, name, opcode) { }
|
||||
public:
|
||||
GuildRemoveAction(PlayerbotAI* botAI, std::string const name = "guild remove", uint16 opcode = CMSG_GUILD_REMOVE)
|
||||
: GuidManageAction(botAI, name, opcode)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override;
|
||||
bool isUseful() override;
|
||||
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
protected:
|
||||
void SendPacket(WorldPacket data) override;
|
||||
bool PlayerIsValid(Player* member) override;
|
||||
};
|
||||
|
||||
class GuildManageNearbyAction : public Action
|
||||
{
|
||||
public:
|
||||
GuildManageNearbyAction(PlayerbotAI* botAI) : Action(botAI, "guild manage nearby") { }
|
||||
public:
|
||||
GuildManageNearbyAction(PlayerbotAI* botAI) : Action(botAI, "guild manage nearby") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class GuildLeaveAction : public Action
|
||||
{
|
||||
public:
|
||||
GuildLeaveAction(PlayerbotAI* botAI) : Action(botAI, "guild leave") { }
|
||||
public:
|
||||
GuildLeaveAction(PlayerbotAI* botAI) : Action(botAI, "guild leave") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "HelpAction.h"
|
||||
|
||||
#include "ChatActionContext.h"
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help")
|
||||
{
|
||||
chatContext = new ChatActionContext();
|
||||
}
|
||||
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help") { chatContext = new ChatActionContext(); }
|
||||
|
||||
HelpAction::~HelpAction()
|
||||
{
|
||||
delete chatContext;
|
||||
}
|
||||
HelpAction::~HelpAction() { delete chatContext; }
|
||||
|
||||
bool HelpAction::Execute(Event event)
|
||||
{
|
||||
@@ -45,12 +41,12 @@ std::string const HelpAction::CombineSupported(std::set<std::string> commands)
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
for (std::set<std::string>::iterator i = commands.begin(); i != commands.end(); )
|
||||
{
|
||||
for (std::set<std::string>::iterator i = commands.begin(); i != commands.end();)
|
||||
{
|
||||
out << *i;
|
||||
if (++i != commands.end())
|
||||
out << ", ";
|
||||
}
|
||||
if (++i != commands.end())
|
||||
out << ", ";
|
||||
}
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_HELPACTION_H
|
||||
@@ -12,18 +13,18 @@ class PlayerbotAI;
|
||||
|
||||
class HelpAction : public Action
|
||||
{
|
||||
public:
|
||||
HelpAction(PlayerbotAI* botAI);
|
||||
public:
|
||||
HelpAction(PlayerbotAI* botAI);
|
||||
|
||||
virtual ~HelpAction();
|
||||
bool Execute(Event event) override;
|
||||
virtual ~HelpAction();
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
void TellChatCommands();
|
||||
void TellStrategies();
|
||||
std::string const CombineSupported(std::set<std::string> commands);
|
||||
private:
|
||||
void TellChatCommands();
|
||||
void TellStrategies();
|
||||
std::string const CombineSupported(std::set<std::string> commands);
|
||||
|
||||
NamedObjectContext<Action>* chatContext;
|
||||
NamedObjectContext<Action>* chatContext;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user