Bom, esse é um ótimo editor de Access direto pelo Jogo.
É um exelente programador brasileiro que fez.
The Chaos.
Lembrando só pessoa com acesso pode editar essa lista. ou seja ( Gods, Gms )
No final de commandos.cpp
bool Commands::commandsXmlEditor(Creature* creature, const std::string& cmd, const std::string& param) { Player* player = creature->getPlayer(); if(!player) return false; Item* book = Item::CreateItem(2597); std::stringstream tds; for(CommandMap::iterator it = commandMap.begin(); it != commandMap.end(); ++it){ tds << it->second->name << "= "<<it->second->accesslevel<<";"<<std::endl; } book->setText(tds.str().c_str()); player->sendTextWindow(book,65535, true); player->eCommands = true; return false; } void Commands::playerEditCommands(Player* player, Item* item, const std::string& text) { if(!player) return; player->eCommands = false; std::string tmp = text, command; std::string datadir = g_config.getString(ConfigManager::DATA_DIRECTORY); std::string filename = datadir + "commands.xml"; std::stringstream sb; xmlNodePtr nn, sn, pn, root; xmlDocPtr doc = xmlNewDoc((const xmlChar*)"1.0"); doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"commands", NULL); root = doc->children; while(tmp.size() > 1){ pn = xmlNewNode(NULL,(const xmlChar*)"command"); std::string::size_type pos = tmp.find('=', 0); sb.str(""); sb << tmp.substr(0, pos).c_str(); tmp.erase(0, pos+2); xmlSetProp(pn, (const xmlChar*)"cmd", (const xmlChar*)sb.str().c_str()); pos = tmp.find(';', 0); sb.str(""); sb << tmp.substr(0, pos).c_str(); tmp.erase(0, pos+2); xmlSetProp(pn, (const xmlChar*)"access", (const xmlChar*)sb.str().c_str()); xmlAddChild(root, pn); } xmlSaveFormatFileEnc(filename.c_str(), doc, "UTF-8", 1); this->reload(); return; }
Depois dê
{"/raid",&Commands::forceRaid},
Adicione:
{"/cmdeditor", &Commands::commandsXmlEditor},
Agora ache:
std::string key = defined_commands[i].name;
Em baixo adicione:
cmd->name = key;
Em Commands.h abaixo de:
static ReturnValue placeSummon(Creature* creature, const std::string& name);
Adicione:
void playerEditCommands(Player* player, Item* item, const std::string& text);
Depois dê:
bool forceRaid(Creature* creature, const std::string& cmd, const std::string& param);
Adicione:
bool commandsXmlEditor(Creature* creature, const std::string& cmd, const std::string& param);
Agora na função struct Command{
Depois dê:
bool loaded;
Adicione:
std::string name;
Ok, agora em Protocol.cpp aonde fica os #include adicione
#include "commands.h" extern Commands commands;
Ache a função void Protocol79::ParseTextWindow(NetworkMessage& msg)
{
Depois dê
std::string new_text = msg.GetString();
Adicione
if(player->eCommands){ commands.playerEditCommands(player, readItem, new_text); return; }
Em player.h depois dê
uint32_t maxDepotLimit;
Adicione:
bool eCommands;
Pronto. Agora você tem que dar Rebuild all, para reparar as suas sources.
Obs: Cuidado com esse code, você só pode mudar os números, nunca mude o nome do comando.
Créditos: The Chaos
Tradução: Jackson Zani
Abraços.