diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/groupdb.cpp | 98 | ||||
-rw-r--r-- | src/resources/servercommands.inc | 288 |
2 files changed, 386 insertions, 0 deletions
diff --git a/src/resources/db/groupdb.cpp b/src/resources/db/groupdb.cpp index 461a26ed4..f3e2852e0 100644 --- a/src/resources/db/groupdb.cpp +++ b/src/resources/db/groupdb.cpp @@ -47,6 +47,103 @@ void GroupDb::load() mLoaded = true; } +#define servercommandFirst(name) \ + if (str == #name) \ + return ServerCommandType::name; \ + else +#define servercommand(name) \ + if (str == #name) \ + return ServerCommandType::name; \ + else +#define servercommand2(name1, name2) \ + if (str == #name2) \ + return ServerCommandType::name1; \ + else + +static ServerCommandTypeT parseName(const std::string &str, + const int id) +{ +#include "resources/servercommands.inc" + { + reportAlways("GroupsDb: unknown command name: '%s' in group id '%d'.", + str.c_str(), + id); + } + + return ServerCommandType::Max; +} + +#undef servercommandFirst +#undef servercommand +#undef servercommand2 + +static ServerCommandEnable::Type parseUseFlag(const std::string &str, + const int id) +{ + if (str == "self") + { + return ServerCommandEnable::Self; + } + else if (str == "other") + { + return ServerCommandEnable::Other; + } + else if (str == "both") + { + return ServerCommandEnable::Both; + } + else + { + reportAlways("GroupsDb: unknown use flag: '%s' in group id '%d'." + "Possible values 'self', 'other', 'both'.", + str.c_str(), + id); + return ServerCommandEnable::No; + } +} + +static void loadCommands(XmlNodePtr rootNode, + const int id, + GroupInfo *groupInfo) A_NONNULL(3); +static void loadCommands(XmlNodePtr rootNode, + const int id, + GroupInfo *groupInfo) +{ + for_each_xml_child_node(node, rootNode) + { + if (xmlNameEqual(node, "command")) + { + const std::string nameStr = XML::getProperty(node, + "name", + ""); + const std::string useStr = XML::getProperty(node, + "use", + ""); + ServerCommandTypeT name = parseName(nameStr, id); + if (name == ServerCommandType::Max) + continue; + ServerCommandEnable::Type useFlag = parseUseFlag(useStr, id); + if (useFlag == ServerCommandEnable::No) + continue; + groupInfo->mCommands[CAST_SIZE(name)] = useFlag; + } + } +} + +static void loadSubNodes(XmlNodePtr groupNode, + const int id, + GroupInfo *groupInfo) A_NONNULL(3); +static void loadSubNodes(XmlNodePtr groupNode, + const int id, + GroupInfo *groupInfo) +{ + for_each_xml_child_node(node, groupNode) + { + if (xmlNameEqual(node, "commands")) + loadCommands(node, id, groupInfo); + } +} + void GroupDb::loadXmlFile(const std::string &fileName, const SkipError skipError) { @@ -115,6 +212,7 @@ void GroupDb::loadXmlFile(const std::string &fileName, group->showBadge = XML::getBoolProperty(node, "showBadge", false); + loadSubNodes(node, id, group); } } } diff --git a/src/resources/servercommands.inc b/src/resources/servercommands.inc new file mode 100644 index 000000000..a8c9efa5b --- /dev/null +++ b/src/resources/servercommands.inc @@ -0,0 +1,288 @@ +/* + * The ManaPlus Client + * Copyright (C) 2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Hercules commands +servercommandFirst(warp) +servercommand(where) +servercommand(jumpto) +servercommand(jump) +servercommand(who) +servercommand(who2) +servercommand(who3) +servercommand(whomap) +servercommand(whomap2) +servercommand(whomap3) +servercommand(whogm) +servercommand(save) +servercommand(load) +servercommand(speed) +servercommand(storage) +servercommand(guildstorage) +servercommand(option) +servercommand(hide) +servercommand(jobchange) +servercommand(kill) +servercommand(alive) +servercommand(kami) +servercommand(kamib) +servercommand(kamic) +servercommand(lkami) +servercommand(heal) +servercommand(item) +servercommand(item2) +servercommand(itembound) +servercommand(itembound2) +servercommand(itemreset) +servercommand(clearstorage) +servercommand(cleargstorage) +servercommand(clearcart) +servercommand(blvl) +servercommand(jlvl) +servercommand(help) +servercommand(pvpoff) +servercommand(pvpon) +servercommand(gvgoff) +servercommand(gvgon) +servercommand(model) +servercommand(go) +servercommand(monster) +servercommand(monstersmall) +servercommand(monsterbig) +servercommand(killmonster) +servercommand(killmonster2) +servercommand(refine) +servercommand(produce) +servercommand(memo) +servercommand(gat) +servercommand(displaystatus) +servercommand(stpoint) +servercommand(skpoint) +servercommand(zeny) +servercommand(str) +servercommand(agi) +servercommand(vit) +servercommand2(int_, "int") +servercommand(dex) +servercommand(luk) +servercommand(glvl) +servercommand(makeegg) +servercommand(hatch) +servercommand(petfriendly) +servercommand(pethungry) +servercommand(petrename) +servercommand(recall) +servercommand(night) +servercommand(day) +servercommand(doom) +servercommand(doommap) +servercommand(raise) +servercommand(raisemap) +servercommand(kick) +servercommand(kickall) +servercommand(allskill) +servercommand(questskill) +servercommand(lostskill) +servercommand(spiritball) +servercommand(party) +servercommand(guild) +servercommand(breakguild) +servercommand(agitstart) +servercommand(agitend) +servercommand(mapexit) +servercommand(idsearch) +servercommand(broadcast) +servercommand(localbroadcast) +servercommand(recallall) +servercommand(reloaditemdb) +servercommand(reloadmobdb) +servercommand(reloadskilldb) +servercommand(reloadscript) +servercommand(reloadatcommand) +servercommand(reloadbattleconf) +servercommand(reloadstatusdb) +servercommand(reloadpcdb) +servercommand(mapinfo) +servercommand(dye) +servercommand(hairstyle) +servercommand(haircolor) +servercommand(allstats) +servercommand(block) +servercommand(ban) +servercommand(charban) +servercommand(unblock) +servercommand(charunban) +servercommand(unban) +servercommand(mount) +servercommand(guildspy) +servercommand(partyspy) +servercommand(repairall) +servercommand(guildrecall) +servercommand(partyrecall) +servercommand(nuke) +servercommand(shownpc) +servercommand(hidenpc) +servercommand(loadnpc) +servercommand(unloadnpc) +servercommand(time) +servercommand(jail) +servercommand(unjail) +servercommand(jailfor) +servercommand(jailtime) +servercommand(disguise) +servercommand(undisguise) +servercommand(email) +servercommand(effect) +servercommand(follow) +servercommand(addwarp) +servercommand(skillon) +servercommand(skilloff) +servercommand(killer) +servercommand(npcmove) +servercommand(killable) +servercommand(dropall) +servercommand(storeall) +servercommand(skillid) +servercommand(useskill) +servercommand(displayskill) +servercommand(snow) +servercommand(sakura) +servercommand(clouds) +servercommand(clouds2) +servercommand(fog) +servercommand(fireworks) +servercommand(leaves) +servercommand(summon) +servercommand(adjgroup) +servercommand(trade) +servercommand(send) +servercommand(setbattleflag) +servercommand(unmute) +servercommand(clearweather) +servercommand(uptime) +servercommand(changesex) +servercommand(mute) +servercommand(refresh) +servercommand(refreshall) +servercommand(identify) +servercommand(misceffect) +servercommand(mobsearch) +servercommand(cleanmap) +servercommand(cleanarea) +servercommand(npctalk) +servercommand(pettalk) +servercommand(users) +servercommand(reset) +servercommand(skilltree) +servercommand(marry) +servercommand(divorce) +servercommand(sound) +servercommand(undisguiseall) +servercommand(disguiseall) +servercommand(changelook) +servercommand(autoloot) +servercommand(alootid) +servercommand(autoloottype) +servercommand(mobinfo) +servercommand(exp) +servercommand(version) +servercommand(mutearea) +servercommand(rates) +servercommand(iteminfo) +servercommand(whodrops) +servercommand(whereis) +servercommand(mapflag) +servercommand(me) +servercommand(monsterignore) +servercommand(fakename) +servercommand(size) +servercommand(showexp) +servercommand(showzeny) +servercommand(showdelay) +servercommand(autotrade) +servercommand(changegm) +servercommand(changeleader) +servercommand(partyoption) +servercommand(invite) +servercommand(duel) +servercommand(leave) +servercommand(accept) +servercommand(reject) +servercommand(clone) +servercommand(slaveclone) +servercommand(evilclone) +servercommand(tonpc) +servercommand(commands) +servercommand(noask) +servercommand(request) +servercommand(homlevel) +servercommand(homevolution) +servercommand(hommutate) +servercommand(makehomun) +servercommand(homfriendly) +servercommand(homhungry) +servercommand(homtalk) +servercommand(hominfo) +servercommand(homstats) +servercommand(homshuffle) +servercommand(showmobs) +servercommand(feelreset) +servercommand(auction) +servercommand(mail) +servercommand(noks) +servercommand(allowks) +servercommand(cash) +servercommand(points) +servercommand(agitstart2) +servercommand(agitend2) +servercommand(skreset) +servercommand(streset) +servercommand(storagelist) +servercommand(cartlist) +servercommand(itemlist) +servercommand(stats) +servercommand(delitem) +servercommand(charcommands) +servercommand(font) +servercommand(accinfo) +servercommand(set) +servercommand(reloadquestdb) +servercommand(undisguiseguild) +servercommand(disguiseguild) +servercommand(sizeall) +servercommand(sizeguild) +servercommand(addperm) +servercommand(rmvperm) +servercommand(unloadnpcfile) +servercommand(cart) +servercommand(cashmount) +servercommand(join) +servercommand(channel) +servercommand(fontcolor) +servercommand(searchstore) +servercommand(costume) +servercommand(skdebug) +servercommand(cddebug) +servercommand(lang) +servercommand(bodystyle) +servercommand(setskill) + +// Evol commands +servercommand(slide) +servercommand(serverexit) |