TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ahbot_commandscript Class Reference

Public Member Functions

 ahbot_commandscript ()
 
std::vector< ChatCommandGetCommands () const override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Static Public Member Functions

static bool HandleAHBotItemsAmountCommand (ChatHandler *handler, const char *args)
 
template<AuctionQuality Q>
static bool HandleAHBotItemsAmountQualityCommand (ChatHandler *handler, const char *args)
 
static bool HandleAHBotItemsRatioCommand (ChatHandler *handler, const char *args)
 
template<AuctionHouseType H>
static bool HandleAHBotItemsRatioHouseCommand (ChatHandler *handler, const char *args)
 
static bool HandleAHBotRebuildCommand (ChatHandler *, const char *args)
 
static bool HandleAHBotReloadCommand (ChatHandler *handler, const char *)
 
static bool HandleAHBotStatusCommand (ChatHandler *handler, const char *args)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

ahbot_commandscript::ahbot_commandscript ( )
inline
34 : CommandScript("ahbot_commandscript") {}
CommandScript(const char *name)
Definition: ScriptMgr.cpp:1616

Member Function Documentation

std::vector<ChatCommand> ahbot_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

37  {
38  static std::vector<ChatCommand> ahbotItemsAmountCommandTable =
39  {
40  { "gray", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_GRAY, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GRAY>, "" },
41  { "white", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_WHITE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_WHITE>, "" },
42  { "green", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_GREEN, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREEN>, "" },
43  { "blue", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_BLUE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_BLUE>, "" },
44  { "purple", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_PURPLE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_PURPLE>, "" },
45  { "orange", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_ORANGE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_ORANGE>, "" },
46  { "yellow", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_YELLOW, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_YELLOW>, "" },
48  };
49 
50  static std::vector<ChatCommand> ahbotItemsRatioCommandTable =
51  {
52  { "alliance", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO_ALLIANCE, true, &HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_ALLIANCE>, "" },
53  { "horde", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO_HORDE, true, &HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_HORDE>, "" },
54  { "neutral", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO_NEUTRAL, true, &HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_NEUTRAL>, "" },
56  };
57 
58  static std::vector<ChatCommand> ahbotCommandTable =
59  {
60  { "items", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS, true, NULL, "", ahbotItemsAmountCommandTable },
61  { "ratio", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO, true, NULL, "", ahbotItemsRatioCommandTable },
65  };
66 
67  static std::vector<ChatCommand> commandTable =
68  {
69  { "ahbot", rbac::RBAC_PERM_COMMAND_AHBOT, false, NULL, "", ahbotCommandTable },
70  };
71 
72  return commandTable;
73  }
arena_t NULL
Definition: jemalloc_internal.h:624
static bool HandleAHBotStatusCommand(ChatHandler *handler, const char *args)
Definition: cs_ahbot.cpp:161
static bool HandleAHBotItemsRatioCommand(ChatHandler *handler, const char *args)
Definition: cs_ahbot.cpp:110
static bool HandleAHBotItemsAmountCommand(ChatHandler *handler, const char *args)
Definition: cs_ahbot.cpp:75
Definition: RBAC.h:672
static bool HandleAHBotRebuildCommand(ChatHandler *, const char *args)
Definition: cs_ahbot.cpp:142
static bool HandleAHBotReloadCommand(ChatHandler *handler, const char *)
Definition: cs_ahbot.cpp:154

+ Here is the call graph for this function:

static bool ahbot_commandscript::HandleAHBotItemsAmountCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
76  {
78  char* arg = strtok((char*)args, " ");
79  for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
80  {
81  if (!arg)
82  return false;
83  qVals[i] = atoi(arg);
84  arg = strtok(NULL, " ");
85  }
86 
87  sAuctionBot->SetItemsAmount(qVals);
88 
89  for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
90  handler->PSendSysMessage(LANG_AHBOT_ITEMS_AMOUNT, handler->GetTrinityString(ahbotQualityIds[i]), sAuctionBotConfig->GetConfigItemQualityAmount(AuctionQuality(i)));
91 
92  return true;
93  }
AuctionQuality
Definition: AuctionHouseBot.h:27
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
#define MAX_AUCTION_QUALITY
Definition: AuctionHouseBot.h:38
arena_t NULL
Definition: jemalloc_internal.h:624
uint32_t uint32
Definition: Define.h:150
#define sAuctionBot
Definition: AuctionHouseBot.h:305
Definition: Language.h:978
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
static const uint32 ahbotQualityIds[MAX_AUCTION_QUALITY]
Definition: cs_ahbot.cpp:23
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<AuctionQuality Q>
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand< AUCTION_QUALITY_YELLOW > ( ChatHandler handler,
const char *  args 
)
inlinestatic
97  {
98  char* arg = strtok((char*)args, " ");
99  if (!arg)
100  return false;
101  uint32 qualityVal = atoi(arg);
102 
103  sAuctionBot->SetItemsAmountForQuality(Q, qualityVal);
105  sAuctionBotConfig->GetConfigItemQualityAmount(Q));
106 
107  return true;
108  }
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
uint32_t uint32
Definition: Define.h:150
#define sAuctionBot
Definition: AuctionHouseBot.h:305
Definition: Language.h:978
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
static const uint32 ahbotQualityIds[MAX_AUCTION_QUALITY]
Definition: cs_ahbot.cpp:23
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
uint8 const Q[]
Definition: AuthenticationPackets.cpp:237

+ Here is the call graph for this function:

static bool ahbot_commandscript::HandleAHBotItemsRatioCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
111  {
113  char* arg = strtok((char*)args, " ");
114  for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
115  {
116  if (!arg)
117  return false;
118  rVal[i] = atoi(arg);
119  arg = strtok(NULL, " ");
120  }
121 
122  sAuctionBot->SetItemsRatio(rVal[0], rVal[1], rVal[2]);
123 
124  for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
126  return true;
127  }
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
AuctionHouseType
Definition: AuctionHouseBot.h:40
#define MAX_AUCTION_QUALITY
Definition: AuctionHouseBot.h:38
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:979
#define MAX_AUCTION_HOUSE_TYPE
Definition: AuctionHouseBot.h:47
uint32_t uint32
Definition: Define.h:150
static char const * GetHouseTypeName(AuctionHouseType houseType)
Definition: AuctionHouseBot.cpp:269
#define sAuctionBot
Definition: AuctionHouseBot.h:305
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<AuctionHouseType H>
template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand< AUCTION_HOUSE_NEUTRAL > ( ChatHandler handler,
const char *  args 
)
inlinestatic
131  {
132  char* arg = strtok((char*)args, " ");
133  if (!arg)
134  return false;
135  uint32 ratioVal = atoi(arg);
136 
137  sAuctionBot->SetItemsRatioForHouse(H, ratioVal);
139  return true;
140  }
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
#define H(x, y, z)
Definition: Language.h:979
uint32_t uint32
Definition: Define.h:150
static char const * GetHouseTypeName(AuctionHouseType houseType)
Definition: AuctionHouseBot.cpp:269
#define sAuctionBot
Definition: AuctionHouseBot.h:305
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

static bool ahbot_commandscript::HandleAHBotRebuildCommand ( ChatHandler ,
const char *  args 
)
inlinestatic
143  {
144  char* arg = strtok((char*)args, " ");
145 
146  bool all = false;
147  if (arg && strcmp(arg, "all") == 0)
148  all = true;
149 
150  sAuctionBot->Rebuild(all);
151  return true;
152  }
bool all(float x)
Definition: g3dmath.h:431
#define sAuctionBot
Definition: AuctionHouseBot.h:305
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool ahbot_commandscript::HandleAHBotReloadCommand ( ChatHandler handler,
const char *   
)
inlinestatic
155  {
156  sAuctionBot->ReloadAllConfig();
158  return true;
159  }
Definition: Language.h:960
#define sAuctionBot
Definition: AuctionHouseBot.h:305
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool ahbot_commandscript::HandleAHBotStatusCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
162  {
163  char* arg = strtok((char*)args, " ");
164  if (!arg)
165  return false;
166 
167  bool all = false;
168  if (strcmp(arg, "all") == 0)
169  all = true;
170 
171  AuctionHouseBotStatusInfo statusInfo;
172  sAuctionBot->PrepareStatusInfos(statusInfo);
173 
174  WorldSession* session = handler->GetSession();
175 
176  if (!session)
177  {
181  }
182  else
184 
186 
188  statusInfo[AUCTION_HOUSE_ALLIANCE].ItemsCount,
189  statusInfo[AUCTION_HOUSE_HORDE].ItemsCount,
190  statusInfo[AUCTION_HOUSE_NEUTRAL].ItemsCount,
191  statusInfo[AUCTION_HOUSE_ALLIANCE].ItemsCount +
192  statusInfo[AUCTION_HOUSE_HORDE].ItemsCount +
193  statusInfo[AUCTION_HOUSE_NEUTRAL].ItemsCount);
194 
195  if (all)
196  {
204 
205  if (!session)
206  {
210  }
211  else
213 
214  for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
215  handler->PSendSysMessage(fmtId, handler->GetTrinityString(ahbotQualityIds[i]),
216  statusInfo[AUCTION_HOUSE_ALLIANCE].QualityInfo[i],
217  statusInfo[AUCTION_HOUSE_HORDE].QualityInfo[i],
218  statusInfo[AUCTION_HOUSE_NEUTRAL].QualityInfo[i],
219  sAuctionBotConfig->GetConfigItemQualityAmount(AuctionQuality(i)));
220  }
221 
222  if (!session)
224 
225  return true;
226  }
AuctionQuality
Definition: AuctionHouseBot.h:27
Definition: AuctionHouseBot.h:42
Definition: Language.h:962
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
AuctionHouseBotStatusInfoPerType AuctionHouseBotStatusInfo[MAX_AUCTION_HOUSE_TYPE]
Definition: AuctionHouseBot.h:269
#define MAX_AUCTION_QUALITY
Definition: AuctionHouseBot.h:38
Definition: Language.h:963
Definition: Language.h:965
Definition: AuctionHouseBot.h:55
bool all(float x)
Definition: g3dmath.h:431
Definition: AuctionHouseBot.h:44
Definition: Language.h:964
Definition: Language.h:968
Definition: Language.h:969
uint32_t uint32
Definition: Define.h:150
Definition: AuctionHouseBot.h:56
#define sAuctionBot
Definition: AuctionHouseBot.h:305
Definition: Language.h:970
Definition: Language.h:967
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
Definition: Language.h:966
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
static const uint32 ahbotQualityIds[MAX_AUCTION_QUALITY]
Definition: cs_ahbot.cpp:23
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Player session in the World.
Definition: WorldSession.h:882
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: AuctionHouseBot.h:43
Definition: AuctionHouseBot.h:57
Definition: Language.h:961

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: