Skip to content

Commit

Permalink
-Help fix/update: Added a few help texts, fixed and ran sql generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikely4r committed Sep 20, 2024
1 parent a50e46a commit 8c04f6b
Show file tree
Hide file tree
Showing 13 changed files with 1,673 additions and 1,066 deletions.
6 changes: 1 addition & 5 deletions botpch.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@
#include "Globals/ObjectMgr.h"
#include "DBScripts/ScriptMgr.h"

#include "playerbot/playerbot.h"

#ifndef GenerateBotHelp
//#define GenerateBotHelp //Enable only for help generation
#endif
#include "playerbot/playerbot.h"
2 changes: 1 addition & 1 deletion playerbot/ChatFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class RoleChatFilter : public ChatFilter
virtual std::string GetHelpName() {
return "role";
}
virtual std::unordered_map<std::string,string> GetFilterExamples()
virtual std::unordered_map<std::string,std::string> GetFilterExamples()
{
std::unordered_map<std::string, std::string> retMap;
retMap["@tank"] = "All bots that have a tank spec.";
Expand Down
4 changes: 4 additions & 0 deletions playerbot/PlayerbotAIAware.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#pragma once
#include <string>

#ifndef GenerateBotHelp
//#define GenerateBotHelp //Enable only for help generation
#endif

class PlayerbotAI;

namespace ai
Expand Down
12 changes: 6 additions & 6 deletions playerbot/PlayerbotHelpMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ std::string PlayerbotHelpMgr::makeList(std::vector<std::string>const parts, std:
}

#ifdef GenerateBotHelp
string PlayerbotHelpMgr::formatFloat(float num)
std::string PlayerbotHelpMgr::formatFloat(float num)
{
std::ostringstream out;
out << std::fixed << std::setprecision(3);
Expand All @@ -90,12 +90,12 @@ bool PlayerbotHelpMgr::IsGenericSupported(PlayerbotAIAware* object)
return supported.find(name) != supported.end();
}

string PlayerbotHelpMgr::GetObjectName(PlayerbotAIAware* object, std::string className)
std::string PlayerbotHelpMgr::GetObjectName(PlayerbotAIAware* object, std::string className)
{
return IsGenericSupported(object) ? object->getName() : className + " " + object->getName();
}

string PlayerbotHelpMgr::GetObjectLink(PlayerbotAIAware* object, std::string className)
std::string PlayerbotHelpMgr::GetObjectLink(PlayerbotAIAware* object, std::string className)
{
std::string prefix = "unkown";
if (dynamic_cast<Strategy*>(object))
Expand Down Expand Up @@ -235,7 +235,7 @@ void PlayerbotHelpMgr::LoadAllStrategies()
}
}

string PlayerbotHelpMgr::GetStrategyBehaviour(std::string className, Strategy* strategy)
std::string PlayerbotHelpMgr::GetStrategyBehaviour(std::string className, Strategy* strategy)
{
std::string behavior;

Expand Down Expand Up @@ -328,7 +328,7 @@ void PlayerbotHelpMgr::GenerateStrategyHelp()
}
}

string PlayerbotHelpMgr::GetTriggerBehaviour(std::string className, Trigger* trigger)
std::string PlayerbotHelpMgr::GetTriggerBehaviour(std::string className, Trigger* trigger)
{
std::string behavior;

Expand Down Expand Up @@ -441,7 +441,7 @@ void PlayerbotHelpMgr::GenerateTriggerHelp()
}
}

string PlayerbotHelpMgr::GetActionBehaviour(std::string className, Action* nextAction)
std::string PlayerbotHelpMgr::GetActionBehaviour(std::string className, Action* nextAction)
{
std::string behavior;

Expand Down
12 changes: 12 additions & 0 deletions playerbot/strategy/actions/AcceptBattleGroundInvitationAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ namespace ai
ai->ResetStrategies();*/
return true;
}

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "accept bg invitation"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action clicks the accept button when invited to join a bg.\n"
"After joining the bg strategies are reset..\n"
"This action is currently disabled..";
}
virtual std::vector<std::string> GetUsedActions() { return {}; }
virtual std::vector<std::string> GetUsedValues() { return {}; }
#endif
};
}

12 changes: 12 additions & 0 deletions playerbot/strategy/actions/AcceptDuelAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ namespace ai
ai->ResetStrategies();
return true;
}

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "accept duel"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action clicks the accept button when invited to join a bg.\n"
"After joining the bg strategies are reset.\n"
"This action is currently disabled.";
}
virtual std::vector<std::string> GetUsedActions() { return {}; }
virtual std::vector<std::string> GetUsedValues() { return {}; }
#endif
};

}
51 changes: 51 additions & 0 deletions playerbot/strategy/actions/AcceptQuestAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,82 @@ namespace ai

protected:
virtual bool ProcessQuest(Player* requester, Quest const* quest, WorldObject* questGiver) override;

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "accept all quests"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action wil accept all quests from the npc selected by the master\n"
"It will use all nearby quest givers if none is selected.";
}
virtual std::vector<std::string> GetUsedActions() { return {}; }
virtual std::vector<std::string> GetUsedValues() { return { "nearest npcs" , "nearest game objects no los" }; }
#endif
};

class AcceptQuestAction : public AcceptAllQuestsAction
{
public:
AcceptQuestAction(PlayerbotAI* ai) : AcceptAllQuestsAction(ai, "accept quest") {}
virtual bool Execute(Event& event);

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "accept quests"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action wil accept a specified quest (link or *) from any nearby quest giver.";
}
virtual std::vector<std::string> GetUsedActions() { return { }; }
virtual std::vector<std::string> GetUsedValues() { return { "nearest npcs" , "nearest game objects no los" }; }
#endif
};

class AcceptQuestShareAction : public Action
{
public:
AcceptQuestShareAction(PlayerbotAI* ai) : Action(ai, "accept quest share") {}
virtual bool Execute(Event& event);

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "accept quest share"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action will make a bot click accept when shared a quest.";
}
virtual std::vector<std::string> GetUsedActions() { return { }; }
virtual std::vector<std::string> GetUsedValues() { return { }; }
#endif
};

class ConfirmQuestAction : public Action {
public:
ConfirmQuestAction(PlayerbotAI* ai) : Action(ai, "confirm quest") {}
virtual bool Execute(Event& event);

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "confirm quest"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action will make a bot click accept asked to start a quest.";
}
virtual std::vector<std::string> GetUsedActions() { return { }; }
virtual std::vector<std::string> GetUsedValues() { return { }; }
#endif
};

class QuestDetailsAction : public Action {
public:
QuestDetailsAction(PlayerbotAI* ai) : Action(ai, "quest details") {}
virtual bool Execute(Event& event);

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "quest details"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action will make a bot click accept in the quest details page.";
}
virtual std::vector<std::string> GetUsedActions() { return { }; }
virtual std::vector<std::string> GetUsedValues() { return { }; }
#endif
};
}
10 changes: 10 additions & 0 deletions playerbot/strategy/actions/AcceptResurrectAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ namespace ai

return false;
}

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "accept resurrect"; } //Must equal iternal name
virtual std::string GetHelpDescription()
{
return "This action clicks the accept button asked if it wants to be resurrected by a player.";
}
virtual std::vector<std::string> GetUsedActions() { return {}; }
virtual std::vector<std::string> GetUsedValues() { return {}; }
#endif
};

}
2 changes: 1 addition & 1 deletion playerbot/strategy/actions/QuestAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace ai
class QuestAction : public Action
{
public:
QuestAction(PlayerbotAI* ai, std::string name) : Action(ai, name) {}
QuestAction(PlayerbotAI* ai, std::string name = "quest") : Action(ai, name) {}

public:
virtual bool Execute(Event& event);
Expand Down
8 changes: 8 additions & 0 deletions playerbot/strategy/generic/CombatStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ namespace ai
public:
AvoidAoeStrategyMultiplier(PlayerbotAI* ai) : Multiplier(ai, "run away on area debuff") {}
float GetValue(Action* action) override;

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "run away on area debuff"; } //Must equal iternal name
virtual std::string GetHelpDescription() {
return "This stops bots from casting certain (cast-time) spells when affected by an area debuf.";
}
virtual std::vector<std::string> GetRelatedStrategies() { return {}; }
#endif
};

class WaitForAttackStrategy : public Strategy
Expand Down
7 changes: 7 additions & 0 deletions playerbot/strategy/values/ActiveSpellValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@ namespace ai
ActiveSpellValue(PlayerbotAI* ai, std::string name = "active spell") : CalculatedValue<uint32>(ai, name) {}

virtual uint32 Calculate();

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "active spell"; } //Must equal iternal name
virtual std::string GetHelpTypeName() { return "spell"; }
virtual std::string GetHelpDescription() { return "This value contains the spell id of the spell that the bot is currently casting."; }
virtual std::vector<std::string> GetUsedValues() { return {}; }
#endif
};
}
7 changes: 7 additions & 0 deletions playerbot/strategy/values/AlwaysLootListValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ namespace ai
virtual std::string Save();
virtual bool Load(std::string value);

#ifdef GenerateBotHelp
virtual std::string GetHelpName() { return "always loot list"; } //Must equal iternal name
virtual std::string GetHelpTypeName() { return "loot"; }
virtual std::string GetHelpDescription() { return "This value contains a list of item ids that should always be looted."; }
virtual std::vector<std::string> GetUsedValues() { return {}; }
#endif

private:
std::set<uint32> list;
};
Expand Down
Loading

0 comments on commit 8c04f6b

Please sign in to comment.