summaryrefslogtreecommitdiff
path: root/src/map/atcommand.h
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-29 09:16:39 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-29 09:16:39 +0000
commit8f36123ac4f0dad6a9c2428b0b01a3ffd81017a4 (patch)
tree844de2f22a0f03953031d1baaf3ffdc426ad48cd /src/map/atcommand.h
parentccbcf5a85c209341e6471269abef23b58633d083 (diff)
downloadhercules-8f36123ac4f0dad6a9c2428b0b01a3ffd81017a4.tar.gz
hercules-8f36123ac4f0dad6a9c2428b0b01a3ffd81017a4.tar.bz2
hercules-8f36123ac4f0dad6a9c2428b0b01a3ffd81017a4.tar.xz
hercules-8f36123ac4f0dad6a9c2428b0b01a3ffd81017a4.zip
Command code cleaning (refer to topic:169759)
* separated the execution part of command code into interface part and internal part to better see which checks are done and when (fixes problem where 'nocommand' mapflag blocked server npcs) * moved the internal commands list (array) to the end of the file, this let me discard that long block of ACMD_FUNC() declarations * removed enum AtCommandType from command headers and commands array; its purpose was perhaps to identify aliased commands, but apparently it was never finished because the rest of the code doesn't use it (also doing aliases like this is not a very good idea) * internally, commands are now referenced to using their function name * removed the @/# symbols from the command lists; all lookup functions will now properly deal with strings with- and without a command symbol (commands interface still requires the symbol tho', so TODO for later) * removed several unneeded commands (*id2 code, dmalloc debug commands) * reverted atcommand config from alphabetically-sorted to how it was before (with additional fixes; see /conf changelog) * added missing code for #dropall / #storeall * added a warning when trying to set gm level of an undefined command The structure of the commands table has changed, please adjust docs/guides to match the new format (sorry for the inconvenience). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11607 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.h')
-rw-r--r--src/map/atcommand.h299
1 files changed, 22 insertions, 277 deletions
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index d2532fda7..c8823b38e 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -4,297 +4,42 @@
#ifndef _ATCOMMAND_H_
#define _ATCOMMAND_H_
+//#include "map.h"
+struct map_session_data;
+
//This is the distance at which @autoloot works,
//if the item drops farther from the player than this,
//it will not be autolooted. [Skotlex]
//Note: The range is unlimited unless this define is set.
//#define AUTOLOOT_DISTANCE AREA_SIZE
-//#include "map.h"
-struct map_session_data;
-
-enum AtCommandType {
- AtCommand_None = -1,
- AtCommand_Broadcast = 0,
- AtCommand_LocalBroadcast,
- AtCommand_MapMove,
- AtCommand_ResetState,
- AtCommand_RuraP,
- AtCommand_Rura,
- AtCommand_Warp,
- AtCommand_Where,
- AtCommand_JumpTo,
- AtCommand_Jump,
- AtCommand_Who,
- AtCommand_Who2,
- AtCommand_Who3,
- AtCommand_WhoMap,
- AtCommand_WhoMap2,
- AtCommand_WhoMap3,
- AtCommand_WhoGM,
- AtCommand_Save,
- AtCommand_Load,
- AtCommand_Speed,
- AtCommand_CharSpeed,
- AtCommand_Storage,
- AtCommand_GuildStorage,
- AtCommand_Option,
- AtCommand_Hide,
- AtCommand_JobChange,
- AtCommand_JobChange2,
- AtCommand_JobChange3,
- AtCommand_Die,
- AtCommand_Kill,
- AtCommand_Alive,
- AtCommand_Kami,
- AtCommand_KamiB,
- AtCommand_KamiC, //LuzZza
- AtCommand_Heal,
- AtCommand_Item,
- AtCommand_Item2,
- AtCommand_ItemReset,
- AtCommand_BaseLevelUp,
- AtCommand_JobLevelUp,
- AtCommand_H,
- AtCommand_Help,
- AtCommand_H2,
- AtCommand_Help2,
- AtCommand_GM,
- AtCommand_PvPOff,
- AtCommand_PvPOn,
- AtCommand_GvGOff,
- AtCommand_GvGOn,
- AtCommand_Model,
- AtCommand_Go,
- AtCommand_Spawn,
- AtCommand_MonsterSmall,
- AtCommand_MonsterBig,
- AtCommand_KillMonster,
- AtCommand_KillMonster2,
- AtCommand_Refine,
- AtCommand_Produce,
- AtCommand_Memo,
- AtCommand_GAT,
- AtCommand_DisplayStatus,
- AtCommand_StatusPoint,
- AtCommand_SkillPoint,
- AtCommand_Zeny,
- AtCommand_Param,
- AtCommand_Strength,
- AtCommand_Agility,
- AtCommand_Vitality,
- AtCommand_Intelligence,
- AtCommand_Dexterity,
- AtCommand_Luck,
- AtCommand_GuildLevelUp,
- AtCommand_MakeEgg,
- AtCommand_PetFriendly,
- AtCommand_PetHungry,
- AtCommand_PetRename,
- AtCommand_Recall,
- AtCommand_Night,
- AtCommand_Day,
- AtCommand_Doom,
- AtCommand_DoomMap,
- AtCommand_Raise,
- AtCommand_RaiseMap,
- AtCommand_Kick,
- AtCommand_KickAll,
- AtCommand_AllSkill,
- AtCommand_QuestSkill,
- AtCommand_LostSkill,
- AtCommand_SpiritBall,
- AtCommand_Party,
- AtCommand_Guild,
- AtCommand_AgitStart,
- AtCommand_AgitEnd,
- AtCommand_MapExit,
- AtCommand_IDSearch,
- AtCommand_RecallAll,
- AtCommand_ReloadItemDB,
- AtCommand_ReloadMobDB,
- AtCommand_ReloadSkillDB,
- AtCommand_ReloadScript,
- AtCommand_ReloadGMDB,
- AtCommand_ReloadAtcommand,
- AtCommand_ReloadBattleConf,
- AtCommand_ReloadStatusDB,
- AtCommand_ReloadPcDB,
- AtCommand_ReloadMOTD, // [Valaris]
- AtCommand_MapInfo,
- AtCommand_Dye,
- AtCommand_Hstyle,
- AtCommand_Hcolor,
- AtCommand_StatAll,
- AtCommand_CharBlock, // by Yor
- AtCommand_CharBan, // by Yor
- AtCommand_CharUnBlock, // by Yor
- AtCommand_CharUnBan, // by Yor
- AtCommand_MountPeco, // by Valaris
- AtCommand_GuildSpy, // [Syrus22]
- AtCommand_PartySpy, // [Syrus22]
- AtCommand_RepairAll, // [Valaris]
- AtCommand_GuildRecall, // by Yor
- AtCommand_PartyRecall, // by Yor
- AtCommand_Nuke, // [Valaris]
- AtCommand_Shownpc,
- AtCommand_Hidenpc,
- AtCommand_Loadnpc,
- AtCommand_Unloadnpc,
- AtCommand_ServerTime, // by Yor
- AtCommand_Jail, // by Yor
- AtCommand_UnJail, // by Yor
- AtCommand_JailFor, // Meruru
- AtCommand_JailTime, // Coltaro
- AtCommand_Disguise, // [Valaris]
- AtCommand_UnDisguise, // by Yor
- AtCommand_EMail, // by Yor
- AtCommand_Hatch,
- AtCommand_Effect, // by Apple
- AtCommand_AddWarp, // by MouseJstr
- AtCommand_Follow, // by MouseJstr
- AtCommand_SkillOn, // by MouseJstr
- AtCommand_SkillOff, // by MouseJstr
- AtCommand_Killer, // by MouseJstr
- AtCommand_NpcMove, // by MouseJstr
- AtCommand_Killable, // by MouseJstr
- AtCommand_Dropall, // by MouseJstr
- AtCommand_Storeall, // by MouseJstr
- AtCommand_Skillid, // by MouseJstr
- AtCommand_Useskill, // by MouseJstr
- AtCommand_DisplaySkill,
- AtCommand_Summon,
- AtCommand_Rain,
- AtCommand_Snow,
- AtCommand_Sakura,
- AtCommand_Clouds,
- AtCommand_Clouds2, // [Valaris]
- AtCommand_Fog,
- AtCommand_Fireworks,
- AtCommand_Leaves,
- AtCommand_AdjGmLvl, // MouseJstr
- AtCommand_AdjCmdLvl, // MouseJstr
- AtCommand_Trade, // MouseJstr
- AtCommand_Send,
- AtCommand_SetBattleFlag,
- AtCommand_UnMute,
- AtCommand_Clearweather, // by Dexity
- AtCommand_UpTime, // by MC Cameri
- AtCommand_ChangeSex, // by MC Cameri
- AtCommand_Mute, // [celest]
- AtCommand_WhoZeny, // [Valaris] <-- LOL...(MC Cameri) worth it.
- AtCommand_Refresh, // by MC Cameri
- AtCommand_PetId, // by MC Cameri
- AtCommand_Identify, // by MC Cameri
- AtCommand_Gmotd, // Added by MC Cameri, created by davidsiaw
- AtCommand_MiscEffect, // by MC Cameri
- AtCommand_MobSearch,
- AtCommand_CleanMap,
- AtCommand_NpcTalk,
- AtCommand_PetTalk,
- AtCommand_Users,
- AtCommand_SkillTree, // by MouseJstr
- AtCommand_Marry, // by MouseJstr
- AtCommand_Divorce, // by MouseJstr
- AtCommand_Me, //added by massdriller, code by lordalfa
- AtCommand_DMStart, // by MouseJstr
- AtCommand_DMTick, // by MouseJstr
- AtCommand_JumpToId2, // by Dino9021
- AtCommand_RecallId2, // by Dino9021
- AtCommand_KickId2, // by Dino9021
- AtCommand_ReviveId2, // by Dino9021
- AtCommand_KillId2, // by Dino9021
- AtCommand_Sound,
- AtCommand_UndisguiseAll,
- AtCommand_DisguiseAll,
- AtCommand_ChangeLook,
- AtCommand_AutoLoot, //by Upa-Kun
- AtCommand_MobInfo, //by Lupus
- AtCommand_Exp, // by Skotlex
- AtCommand_Adopt, // by Veider
- AtCommand_Version, // by Ancyker
- AtCommand_MuteArea, // MouseJstr
- AtCommand_Rates, // MouseJstr
- AtCommand_ItemInfo, // Lupus
- AtCommand_WhoDrops, // Skotlex
- AtCommand_WhereIs, // Skotlex
- AtCommand_MapFlag, // Lupus
- AtCommand_MonsterIgnore, // [Valaris]
- AtCommand_FakeName, // [Valaris]
- AtCommand_Size, // [Valaris]
- AtCommand_ShowDelay,
- AtCommand_ShowExp,
- AtCommand_ShowZeny,
- AtCommand_AutoTrade,//durf
- AtCommand_ChangeGM,//durf
- AtCommand_ChangeLeader,
- AtCommand_PartyOption,
- AtCommand_Invite, // By LuzZza
- AtCommand_Duel, // By LuzZza
- AtCommand_Leave, // By LuzZza
- AtCommand_Accept, // By LuzZza
- AtCommand_Reject, // By LuzZza
- AtCommand_Away, // LuzZza
- AtCommand_Main, // LuzZza
- AtCommand_Clone, // [Valaris]
- AtCommand_ToNPC, // LuzZza
- AtCommand_Commands, // [Skotlex]
- AtCommand_NoAsk, // [LuzZza]
- AtCommand_Request, // [Skotlex]
- AtCommand_HomLevel, //[orn]
- AtCommand_HomEvolution, //[orn]
- AtCommand_MakeHomun, //[orn]
- AtCommand_HomFriendly, //[orn]
- AtCommand_HomHungry, //[orn]
- AtCommand_HomTalk, //[orn]
- AtCommand_HomInfo, //[Toms]
- AtCommand_HomStats, //[Skotlex]
- AtCommand_HomShuffle, //[Skotlex]
- AtCommand_ShowMobs, //KarLaeda
- AtCommand_FeelReset, //[HiddenDragon]
- AtCommand_HappyHappyJoyJoy,
- // SQL-only commands start
-#ifndef TXT_ONLY
- AtCommand_Mail, // [Mail System]
- AtCommand_RefreshOnline, // [Valaris]
- // SQL-only commands end
-#endif
- // No more commands after this line
- AtCommand_Unknown,
- AtCommand_MAX
-};
-
-typedef enum AtCommandType AtCommandType;
-
-typedef struct AtCommandInfo {
- AtCommandType type;
- const char* command;
- int level;
- int (*proc)(const int fd, struct map_session_data* sd, const char* command, const char* message);
-} AtCommandInfo;
-
-AtCommandType is_atcommand(const int fd, struct map_session_data* sd, const char* message);
-AtCommandType is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl);
-AtCommandType atcommand(struct map_session_data *sd, const int level, const char* message, AtCommandInfo* info);
-int get_atcommand_level(const AtCommandType type);
+extern char atcommand_symbol;
+typedef int (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message);
-char* msg_txt(int msg_number); // [Yor]
+bool is_atcommand(const int fd, struct map_session_data* sd, const char* message);
+bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl);
+int get_atcommand_level(const AtCommandFunc func);
void do_init_atcommand(void);
void do_final_atcommand(void);
+int atcommand_config_read(const char *cfgName);
-int atcommand_item(const int fd, struct map_session_data* sd,const char* command, const char* message); // [Valaris]
-int atcommand_rura(const int fd, struct map_session_data* sd,const char* command, const char* message); // [Yor]
-int atcommand_jumpto(const int fd, struct map_session_data* sd, const char* command, const char* message); // [Yor]
-int atcommand_recall(const int fd, struct map_session_data* sd, const char* command, const char* message); // [Yor]
+int atcommand_item(const int fd, struct map_session_data* sd,const char* command, const char* message);
+int atcommand_mapmove(const int fd, struct map_session_data* sd,const char* command, const char* message);
int atcommand_monster(const int fd, struct map_session_data* sd, const char* command, const char* message);
+int atcommand_jumpto(const int fd, struct map_session_data* sd, const char* command, const char* message);
+int atcommand_recall(const int fd, struct map_session_data* sd, const char* command, const char* message);
+int atcommand_hide(const int fd, struct map_session_data* sd, const char* command, const char* message);
+int atcommand_mute(const int fd, struct map_session_data* sd, const char* command, const char* message);
+int atcommand_kick(const int fd, struct map_session_data* sd, const char* command, const char* message);
+int atcommand_broadcast(const int fd, struct map_session_data* sd,const char* command, const char* message);
+int atcommand_localbroadcast(const int fd, struct map_session_data* sd,const char* command, const char* message);
+int atcommand_reset(const int fd, struct map_session_data* sd,const char* command, const char* message);
-int atcommand_config_read(const char *cfgName);
-int msg_config_read(const char *cfgName);
-void do_final_msg(void);
-
-extern char atcommand_symbol;
#define MAX_MSG 1000
extern char* msg_table[MAX_MSG];
+char* msg_txt(int msg_number);
+int msg_config_read(const char* cfgName);
+void do_final_msg(void);
#endif /* _ATCOMMAND_H_ */