Преглед изворни кода

Changed atcommand definitions (#8921)

Changed definition of servertime
Changed definition of mount_peco
Changed definition of mapmove
Changed definition of hair_style
Changed definition of hair_color
Changed definition of baselevelup
Changed definition of joblevelup
Changed definition of statuspoint
Changed definition of traitpoint
Changed definition of skillpoint
Changed definition of stat_all
Changed definition of trait_all
Changed definition of guildlevelup
Changed definition of char_block
Changed definition of char_unblock
Changed definition of char_ban
Changed definition of char_unban
Changed definition of autolootitem
Changed definition of ksprotection
Updated groups.yml to the new definitions
Added support for aliases in groups.yml
Lemongrass3110 пре 4 месеци
родитељ
комит
16806d08e1
5 измењених фајлова са 141 додато и 101 уклоњено
  1. 104 76
      conf/atcommands.yml
  2. 2 2
      conf/groups.yml
  3. 23 21
      src/map/atcommand.cpp
  4. 3 0
      src/map/atcommand.hpp
  5. 9 2
      src/map/pc_groups.cpp

+ 104 - 76
conf/atcommands.yml

@@ -74,26 +74,13 @@ Body:
       - skillsall
     Help: |
       Give you all skills.
-  - Command: allstats
-    Aliases:
-      - allstat
-      - statall
-      - statsall
-    Help: |
-      Params: <value>
-      Adds value in all stats (maximum if no value).
-  - Command: alltraits
-    Aliases:
-      - alltrait
-      - traitall
-      - traitsall
-    Help: |
-      Params: <value>
-      Adds value in all traits (maximum if no value).
   - Command: autoloot
     Help: |
       Params: <on|off|#>
       Makes items go straight into your inventory.
+  - Command: autolootitem
+    Aliases:
+      - alootid
   - Command: autoloottype
     Aliases:
       - aloottype
@@ -102,25 +89,15 @@ Body:
       - at
     Help: |
       Allows you to vend while you are offline.
-  - Command: ban
+  - Command: baselevelup
     Aliases:
-      - banish
-    Help: |
-      Params: <time> <name>\n" "Temporarily ban an account.
-      time usage: adjustment (+/- value) and element (y/a, m, d/j, h, mn, s)
-      Example: @ban +1m-2mn1s-6y testplayer
-  - Command: block
-    Help: |
-      Params: <char name>
-      Permanently blocks an account.
-  - Command: blvl
-    Aliases:
-      - lvup
-      - blevel
+      - baselevel
       - baselvl
       - baselvup
-      - baselevel
       - baselvlup
+      - blevel
+      - blvl
+      - lvup
     Help: |
       Params: <number of levels>
       Raises your base level the desired number of levels.
@@ -156,6 +133,34 @@ Body:
   - Command: changesex
     Help: |
       Changes your gender.
+  - Command: char_ban
+    Aliases:
+      - ban
+      - banish
+      - charban
+    Help: |
+      Params: <time> <name>\n" "Temporarily ban an account.
+      time usage: adjustment (+/- value) and element (y/a, m, d/j, h, mn, s)
+      Example: @ban +1m-2mn1s-6y testplayer
+  - Command: char_block
+    Aliases:
+      - block
+    Help: |
+      Params: <char name>
+      Permanently blocks an account.
+  - Command: char_unban
+    Aliases:
+      - charunban
+      - unban
+      - unbanish
+    Help: |
+      Params: <name> - Unban an account
+  - Command: char_unblock
+    Aliases:
+      - unblock
+    Help: |
+      Params: <char name>
+      Unblocks an account.
   - Command: clone
     Help: |
       Params: <charname>
@@ -254,13 +259,14 @@ Body:
   - Command: gat
     Help: |
       For debugging (you inspect around gat)
-  - Command: glvl
+  - Command: guildlevelup
     Aliases:
       - glevel
-      - guildlvl
-      - guildlvup
+      - glvl
       - guildlevel
+      - guildlvl
       - guildlvlup
+      - guildlvup
     Help: |
       Params: <# of levels>
       Raise Guild by desired number of levels
@@ -317,14 +323,16 @@ Body:
       - gpvpon
     Help: |
       Enables GvG on the current map
-  - Command: haircolor
+  - Command: hair_color
     Aliases:
+      - haircolor
       - hcolor
     Help: |
       Params <hair palette no.>
       Changes your hair color.
-  - Command: hairstyle
+  - Command: hair_style
     Aliases:
+      - hairstyle
       - hstyle
     Help: |
       Params: <hairstyle no.>
@@ -395,16 +403,6 @@ Body:
   - Command: jail
     Help: |
       Params: <char name> - Sends specified character in jails
-  - Command: jlvl
-    Aliases:
-      - jlevel
-      - joblvl
-      - joblvup
-      - joblevel
-      - joblvlup
-    Help: |
-      Params: <number of levels>
-      Raises your job level the desired number of levels.
   - Command: jobchange
     Aliases:
       - job
@@ -467,6 +465,17 @@ Body:
       4220 Baby Summoner        4222 Baby Ninja        4223 Baby Kagero         4224 Baby Oboro
       4225 Baby Taekwon       4226 Baby Star Glad    4227 Baby Soul Linker    4228 Baby Gunslinger
       4229 Baby Rebellion   4241 Baby Star Emperor    4242 Baby Soul Reaper
+  - Command: joblevelup
+    Aliases:
+      - jlevel
+      - jlvl
+      - joblevel
+      - joblvl
+      - joblvlup
+      - joblvup
+    Help: |
+      Params: <number of levels>
+      Raises your job level the desired number of levels.
   - Command: jump
     Help: |
       Params: [<x> [<y>]]
@@ -508,6 +517,9 @@ Body:
   - Command: killmonster2
     Help: |
       Kills all monsters of your map (without drops).
+  - Command: ksprotection
+    Aliases:
+      - noks
   - Command: langtype
     Help: |
       Params: <language>
@@ -575,6 +587,13 @@ Body:
   - Command: mapinfo
     Help: |
       Params: [<0-3> [map]] - Give information about a map (general info +: 0: no more, 1: players, 2: NPC, 3: chatrooms).
+  - Command: mapmove
+    Aliases:
+      - rura
+      - warp
+    Help: |
+      Params: <mapname> [<x> <y>]
+      Warps you to the selected map and position.
   - Command: marry
     Help: |
       Params: <player name>
@@ -621,8 +640,9 @@ Body:
     Help: |
       Params: <monster name|ID>
       Spawns a smaller version of a monster.
-  - Command: mount
+  - Command: mount_peco
     Aliases:
+      - mount
       - mountpeco
     Help: |
       Give/remove a job-based mount (class is required, but not the skill).
@@ -841,6 +861,13 @@ Body:
     Help: |
       Params: <Hex Number> [<value>]
       For debugging (packet variety)
+  - Command: servertime
+    Aliases:
+      - date
+      - serverdate
+      - time
+    Help: |
+      Shows the date and time of the server.
   - Command: setcard 
     Help: |
       Adds a card or enchant to the specific slot of the equipment.
@@ -876,13 +903,15 @@ Body:
   - Command: skillon
     Help: |
       Turn skills on for a map.
+  - Command: skillpoint
+    Aliases:
+      - skpoint
+    Help: |
+      Params: <number of points> - Gives you the desired number of skill points.
   - Command: skilltree
     Help: |
       Params: <skillnum> <charname>
       Prints the skill tree needed to get a skill for the target player.
-  - Command: skpoint
-    Help: |
-      Params: <number of points> - Gives you the desired number of skill points.
   - Command: slaveclone
     Help: |
       Params: <charname>
@@ -910,6 +939,20 @@ Body:
     Help: |
       Params: <amount>
       Raises STA by given amount.
+  - Command: stat_all
+    Aliases:
+      - allstat
+      - allstats
+      - statall
+      - statsall
+    Help: |
+      Params: <value>
+      Adds value in all stats (maximum if no value).
+  - Command: statuspoint
+    Aliases:
+      - stpoint
+    Help: |
+      Params: <number of points> - Gives you the desired number of stat points.
   - Command: stockall
     Help: |
       Params: [<item type>]
@@ -920,35 +963,27 @@ Body:
   - Command: storeall
     Help: |
       Puts all your possessions in storage.
-  - Command: stpoint
-    Help: |
-      Params: <number of points> - Gives you the desired number of stat points.
   - Command: str
     Help: |
       Params: <amount>
       Raises STR by given amount.
-  - Command: time
-    Aliases:
-      - date
-      - serverdate
-      - servertime
-    Help: |
-      Shows the date and time of the server.
   - Command: trade
     Help: |
       Params: <char name> - Open a trade window with a another player
-  - Command: trpoint
-    Help: |
-      Params: <number of points> - Gives you the desired number of trait stat points.
-  - Command: unban
+  - Command: trait_all
     Aliases:
-      - unbanish
+      - alltrait
+      - alltraits
+      - traitall
+      - traitsall
     Help: |
-      Params: <name> - Unban a account
-  - Command: unblock
+      Params: <value>
+      Adds value in all traits (maximum if no value).
+  - Command: traitpoint
+    Aliases:
+      - trpoint
     Help: |
-      Params: <char name>
-      Unblocks an account.
+      Params: <number of points> - Gives you the desired number of trait stat points.
   - Command: undisguise
     Help: |
       Restore your normal appearance.
@@ -983,13 +1018,6 @@ Body:
     Help: |
       Params: <amount>
       Raises VIT by given amount.
-  - Command: warp
-    Aliases:
-      - rura
-      - mapmove
-    Help: |
-      Params: <mapname> [<x> <y>]
-      Warps you to the selected map and position.
   - Command: where
     Help: |
       Params: <char name>

+ 2 - 2
conf/groups.yml

@@ -71,7 +71,7 @@ Body:
       mobinfo: true
       iteminfo: true
       whodrops: true
-      time: true
+      servertime: true
       jailtime: true
       hominfo: true
       homstats: true
@@ -195,7 +195,7 @@ Body:
       fakename: true
       option: true
       speed: true
-      warp: true
+      mapmove: true
       kill: true
       recall: true
       ban: true

+ 23 - 21
src/map/atcommand.cpp

@@ -11253,7 +11253,7 @@ void atcommand_basecommands(void) {
 	 **/
 	AtCommandInfo atcommand_base[] = {
 #include <custom/atcommand_def.inc>
-		ACMD_DEF2R("warp", mapmove, ATCMD_NOCONSOLE),
+		ACMD_DEF(mapmove),
 		ACMD_DEF(where),
 		ACMD_DEF(jumpto),
 		ACMD_DEF(jump),
@@ -11289,8 +11289,8 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(clearstorage),
 		ACMD_DEF(cleargstorage),
 		ACMD_DEF(clearcart),
-		ACMD_DEF2R("blvl", baselevelup, ATCMD_NOCONSOLE),
-		ACMD_DEF2("jlvl", joblevelup),
+		ACMD_DEF(baselevelup),
+		ACMD_DEF(joblevelup),
 		ACMD_DEF(help),
 		ACMD_DEF(pvpoff),
 		ACMD_DEF(pvpon),
@@ -11309,9 +11309,9 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(memo),
 		ACMD_DEF(gat),
 		ACMD_DEF(displaystatus),
-		ACMD_DEF2("stpoint", statuspoint),
-		ACMD_DEF2("trpoint", traitpoint),
-		ACMD_DEF2("skpoint", skillpoint),
+		ACMD_DEF(statuspoint),
+		ACMD_DEF(traitpoint),
+		ACMD_DEF(skillpoint),
 		ACMD_DEF(zeny),
 		ACMD_DEF2("str", param),
 		ACMD_DEF2("agi", param),
@@ -11325,7 +11325,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF2("spl", param),
 		ACMD_DEF2("con", param),
 		ACMD_DEF2("crt", param),
-		ACMD_DEF2("glvl", guildlevelup),
+		ACMD_DEF(guildlevelup),
 		ACMD_DEF(makeegg),
 		ACMD_DEF(hatch),
 		ACMD_DEF(petfriendly),
@@ -11375,17 +11375,15 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(partysharelvl),
 		ACMD_DEF(mapinfo),
 		ACMD_DEF(dye),
-		ACMD_DEF2("hairstyle", hair_style),
-		ACMD_DEF2("haircolor", hair_color),
-		ACMD_DEF2("allstats", stat_all),
-		ACMD_DEF2("alltraits", trait_all),
-		ACMD_DEF2("block", char_block),
-		ACMD_DEF2("ban", char_ban),
-		ACMD_DEF2("unblock", char_unblock),
-		ACMD_DEF2("unban", char_unban),
-		ACMD_DEF2("charban", char_ban),
-		ACMD_DEF2("charunban", char_unban),
-		ACMD_DEF2("mount", mount_peco),
+		ACMD_DEF(hair_style),
+		ACMD_DEF(hair_color),
+		ACMD_DEF(stat_all),
+		ACMD_DEF(trait_all),
+		ACMD_DEF(char_block),
+		ACMD_DEF(char_ban),
+		ACMD_DEF(char_unblock),
+		ACMD_DEF(char_unban),
+		ACMD_DEF(mount_peco),
 		ACMD_DEF(guildspy),
 		ACMD_DEF(partyspy),
 		ACMD_DEF(clanspy),
@@ -11398,7 +11396,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(loadnpc),
 		ACMD_DEF(unloadnpc),
 		ACMD_DEF(reloadnpcfile),
-		ACMD_DEF2("time", servertime),
+		ACMD_DEF(servertime),
 		ACMD_DEF(jail),
 		ACMD_DEF(unjail),
 		ACMD_DEF(jailfor),
@@ -11461,7 +11459,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(disguiseall),
 		ACMD_DEF(changelook),
 		ACMD_DEF(autoloot),
-		ACMD_DEF2("alootid", autolootitem),
+		ACMD_DEF(autolootitem),
 		ACMD_DEF(autoloottype),
 		ACMD_DEF(mobinfo),
 		ACMD_DEF(exp),
@@ -11510,7 +11508,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(hatereset),
 		ACMD_DEF(auction),
 		ACMD_DEF(mail),
-		ACMD_DEF2("noks", ksprotection),
+		ACMD_DEF(ksprotection),
 		ACMD_DEF(allowks),
 		ACMD_DEF(cash),
 		ACMD_DEF(points),
@@ -11592,6 +11590,10 @@ bool atcommand_exists(const char* name)
 	return strdb_exists(atcommand_db, name);
 }
 
+const char* atcommand_alias_lookup( const std::string& cmd ){
+	return atcommand_alias_db.checkAlias( cmd.c_str() );
+}
+
 static AtCommandInfo* get_atcommandinfo_byname(const char *name)
 {
 	if (strdb_exists(atcommand_db, name))

+ 3 - 0
src/map/atcommand.hpp

@@ -4,6 +4,8 @@
 #ifndef ATCOMMAND_HPP
 #define ATCOMMAND_HPP
 
+#include <string>
+
 #include <common/cbasetypes.hpp>
 #include <common/mmo.hpp>
 
@@ -28,6 +30,7 @@ void do_final_atcommand(void);
 void atcommand_db_load_groups();
 
 bool atcommand_exists(const char* name);
+const char* atcommand_alias_lookup( const std::string& cmd );
 
 // @commands (script based)
 struct atcmd_binding_data {

+ 9 - 2
src/map/pc_groups.cpp

@@ -30,8 +30,15 @@ bool PlayerGroupDatabase::parseCommands( const ryml::NodeRef& node, std::vector<
 		}
 
 		if( !atcommand_exists( command.c_str() ) ){
-			this->invalidWarning( it, "Unknown atcommand: %s\n", command.c_str() );
-			return false;
+			const char* command_str = command.c_str();
+			const char* alias_str = atcommand_alias_lookup( command );
+
+			if( strcmp( command_str, alias_str ) == 0 ){
+				this->invalidWarning( it, "Unknown atcommand: %s\n", command.c_str() );
+				return false;
+			}
+
+			command = alias_str;
 		}
 
 		util::tolower( command );