Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { "rp", SEC_PLAYER, true, NULL, "", rpCommandTable },
- { "gold", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleGoldCommand>, "", NULL },
- { "spawn", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleXperimentCommand>, "", NULL },
- bool ChatHandler::HandleGoldCommand(const char* args)
- {
- if (*args)
- return false;
- Player* target = m_session->GetPlayer();
- target->SetMoney(MAX_MONEY_AMOUNT);
- PSendSysMessage("Added gold.");
- return true;
- }
- bool ChatHandler::ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd)
- {
- std::string list;
- for (uint32 i = 0; table[i].Name != NULL; ++i)
- {
- // must be available (ignore handler existence for show command with possibe avalable subcomands
- if (!isAvailable(table[i]))
- continue;
- /// for empty subcmd show all available
- if (*subcmd && !hasStringAbbr(table[i].Name, subcmd))
- continue;
- if (m_session)
- list += "\n ";
- else
- list += "\n\r ";
- list += "|cFFcc6600";
- list += table[i].Name;
- list += "|r";
- QueryResult text = WorldDatabase.PQuery("SELECT text FROM customhelp WHERE name = '%s'", table[i].Name);
- if (text)
- {
- std::string helptext = text->Fetch()[0].GetString();
- list += " ";
- list += "|cFF5785db";
- list += helptext;
- list += "|r";
- }
- if (table[i].ChildCommands)
- list += " |cFFc52e40<subcommands available>|r";
- }
- if (list.empty())
- return false;
- if (table == getCommandTable())
- {
- SendSysMessage(LANG_AVIABLE_CMD);
- PSendSysMessage("%s", list.c_str());
- PSendSysMessage("|cFFcbb6b8-Scroll up to see more commands-|r");
- }
- else
- PSendSysMessage(LANG_SUBCMDS_LIST, cmd, list.c_str());
- PSendSysMessage("|cFFcbb6b8-Scroll up to see more commands-|r");
- return true;
- }
Add Comment
Please, Sign In to add comment