Removed charcommand code while allowing atcommand code to support its functionality.

Charcommands still retain their '#' symbol but now looks for a character name as the first parameter instead of last.
Atcommand configs now support charcommand level configurations by comma seperation (e.g. 60,99)
As a result of this, all atcommands that don't affect multiple users already (@kickall, @doom, @mapexit) are capable of remote usage.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13403 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
sketchyphoenix 2008-12-18 02:36:01 +00:00
parent cb049336a5
commit 76ff905e03
24 changed files with 732 additions and 4954 deletions

View File

@ -3,6 +3,11 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2008/12/17
* Removed charcommand code and allowed atcommand code to support its functionality. [SketchyPhoenix]
- Charcommands still retain their '#' symbol but now looks for a character name as the first parameter instead of last.
- Atcommand configs now support charcommand level configurations by comma seperation (e.g. 60,99).
- As a result of this, all atcommands that don't affect multiple users already (@kickall, @doom, @mapexit) are capable of remote usage.
2008/12/01
* Fixed rare crash when using Flying Kick on clones (bugreport:2506) [ultramage]
* Corrected Flying Kick's debuff rules to match official servers

File diff suppressed because it is too large Load Diff

View File

@ -1,275 +0,0 @@
//--------------------------------------------------------------
// eAthena charcommand configuration file.
// Originally translated by Peter Kieser <pfak@telus.net>
//--------------------------------------------------------------
// The symbol that will be used to recognize commands.
// You can set any one character except control-characters (0x00-0x1f),
// '%', '$' (party/guild chat speaking) and '/' (standard client commands).
// The symbol must also be different from from the GM atcommand symbol.
command_symbol: #
//--------------------------
// 0: normal player commands
// None for security purposes.
//-------------------------
// 1: Super player commands
//---------------------------
// 10: Super player+ commands
//----------------------
// 20: Mediator commands
// Displays helpfile in eAthena base directory
help: 20
//--------------------
// 40: Sub-GM commands
// View the items in a character's cart
cartlist: 40
// Apply an effect onto another character
effect: 40
// View the exp of a character
exp: 40
// List a chacter's items
itemlist: 40
// View the jail time remaining
jailtime: 40
// Refresh a character
refresh: 40
// List a chacter's stats
stats: 40
// List a chacter's storage items
storagelist: 40
//---------------------
// 50: Sub-GM+ commands
// Change a character's clothing color
dye: 50
// Give another character a fake name
fakename: 50
// Open the hatch dialog for a character
hatch: 50
// Change a character's hair color
hcolor: 50
haircolor: 50
// Change a character's hair style
hstyle: 50
hairstyle: 50
// Changes character's model
model: 50
// Give or remove a peco from a character
mount: 50
mountpeco: 50
// Make another character's pet friendly/not
petfriendly: 50
// Rename another character's pet
petrename: 50
// Change a character's size
size: 50
//----------------
// 60: GM commands
// Resurrects a dead character
alive: 60
revive: 60
// Add or removes cash/kafra points to a character
cash: 60
points: 60
// Give a player all the skills available to him/her
allskill: 60
allskills: 60
skillall: 60
skillsall: 60
// Give a character the maximum possible stats
allstat: 60
allstats: 60
statall: 60
statsall: 60
// Change another character's base level (3 same commands)
blvl: 60
blevel: 60
baselvl: 60
baselevel: 60
// Changes the sex of an online player (all characters on the account)
changesex: 60
// Delete items from a character
delitem: 60
// Disguise a character
disguise: 60
undisguise: 60
// Drop a players possessions on the ground
dropall: 60
// Put a players possessions in storage
storeall: 60
// Resets another character's designated maps
feelreset: 60
// Change the guild level for a character's guild
glvl: 60
glevel: 60
guildlvl: 60
guildlevel: 60
// Open guild storage for a character
gstorage: 60
// Heal a character
heal: 60
// Invoke GM Hide on a character
hide: 60
// Increase a character's homunculus' level
hlvl: 60
hlevel: 60
homlvl: 60
homlevel: 60
// Evolve a character's homunculus
homevolve: 60
homevolution: 60
// Change a character's homunculus' friendly value
homfriendly: 60
// Change a character's homunculus' hunger value
homhungry: 60
// View a character's homunculus' stats
hominfo: 40
// Give another character an item
item: 60
// Create a specific item (with cards, refines, etc
item2: 60
// Remove all of a character's possessions
itemreset: 60
// Change another character's job (2 same commands)
job: 60
jobchange: 60
// Change another character's job level (3 same commands)
jlvl: 60
jlevel: 60
joblvl: 60
joblevel: 60
// Allow a character to attack anybody
killer: 60
// Make a character killable by anybody
killable: 60
// Return a character to their respawn point
load: 60
// Take away a character's platinum skill
lostskill: 60
// Make a character immune to monsters
monsterignore: 60
// Apply a certain option to another character
option: 60
// Change a character's pet's hungry value
pethungry: 60
// Produce forged equipment on a character (as if he/she was a blacksmith)
produce: 60
// Give another character a platinum skill
questskill: 60
// Performs a stat and skill reset on someone else.
reset: 60
// Save another character
save: 60
// Gives another character skill points
skpoint: 60
// Change a character's walking speed
speed: 60
// Give another character spiritball effect
spiritball: 60
// Open storage for a character
storage: 60
// Gives another character status points
stpoint: 60
// Change a character's stats
str: 60
agi: 60
vit: 60
int: 60
dex: 60
luk: 60
// Resets another character's status, skills
streset: 60
skreset: 60
// Warp a player somewhere else (3 same commands)
warp: 60
rura: 60
rura+: 60
//----------------------
// 80: GM Chief commands
// Refine a character's equipment
refine: 80
// Give another character zeny
zeny: 80
//---------------------------
// 99: Administrator commands
//---------------------------------------------------------------
// 100: Disabled commands
import: conf/import/charcommand_conf.txt

View File

@ -5770,23 +5770,10 @@ one.
*charcommand <command>;
NOTE: This command is changed a bit on newer trunk versions,
scroll down a bit for the new version!
This command will run the given command line exactly as if it was typed in from
the keyboard from a character that belonged to an account which had GM level 99.
On older trunk versions and stable:
command is the name of the current character (strcharinfo(0))
followed by ':' and the command and it's parameters.
Example(s):
//Will be executed as if a lvl 99 GM done the #option command.
charCommand strcharinfo(0)+":#option 0 0 0 Roy";
Newer Trunk version:
The big change is that the character name is no longer needed.
This also enabled the commands to run without a player attached (according to Lance).
The commands can also run without an attached rid.
Example(s):

View File

@ -15,7 +15,7 @@ COMMON_SQL_H = ../common/sql.h
MAP_OBJ = map.o chrif.o clif.o pc.o status.o npc.o \
npc_chat.o chat.o path.o itemdb.o mob.o script.o \
storage.o skill.o atcommand.o charcommand.o battle.o \
storage.o skill.o atcommand.o battle.o \
intif.o trade.o party.o vending.o guild.o pet.o \
log.o mail.o date.o unit.o homunculus.o mercenary.o quest.o
MAP_TXT_OBJ = $(MAP_OBJ:%=obj_txt/%) \
@ -24,7 +24,7 @@ MAP_SQL_OBJ = $(MAP_OBJ:%=obj_sql/%) \
obj_sql/mapreg_sql.o
MAP_H = map.h chrif.h clif.h pc.h status.h npc.h \
chat.h itemdb.h mob.h script.h path.h \
storage.h skill.h atcommand.h charcommand.h battle.h \
storage.h skill.h atcommand.h battle.h \
intif.h trade.h party.h vending.h guild.h pet.h \
log.h mail.h date.h unit.h homunculus.h mercenary.h quest.h mapreg.h

View File

@ -46,6 +46,7 @@
// extern variables
char atcommand_symbol = '@'; // first char of the commands
char charcommand_symbol = '#';
char* msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
// local declarations
@ -55,6 +56,7 @@ typedef struct AtCommandInfo
{
const char* command;
int level;
int level2;
AtCommandFunc func;
} AtCommandInfo;
@ -6578,15 +6580,15 @@ int atcommand_summon(const int fd, struct map_session_data* sd, const char* comm
*------------------------------------------*/
int atcommand_adjcmdlvl(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
int newlev;
int newlev, newremotelev;
char name[100];
AtCommandInfo* cmd;
nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%d %99s", &newlev, name) != 2)
if (!message || !*message || sscanf(message, "%d %d %99s", &newlev, &newremotelev, name) != 2)
{
clif_displaymessage(fd, "Usage: @adjcmdlvl <lvl> <command>.");
clif_displaymessage(fd, "Usage: @adjcmdlvl <lvl> <remote lvl> <command>.");
return -1;
}
@ -6596,12 +6598,12 @@ int atcommand_adjcmdlvl(const int fd, struct map_session_data* sd, const char* c
clif_displaymessage(fd, "@command not found.");
return -1;
}
else if (newlev > pc_isGM(sd))
else if (newlev > pc_isGM(sd) || newremotelev > pc_isGM(sd) )
{
clif_displaymessage(fd, "You can't make a command require higher GM level than your own.");
return -1;
}
else if (cmd->level > pc_isGM(sd))
else if (cmd->level > pc_isGM(sd) || cmd->level2 > pc_isGM(sd) )
{
clif_displaymessage(fd, "You can't adjust the level of a command which's level is above your own.");
return -1;
@ -6609,6 +6611,7 @@ int atcommand_adjcmdlvl(const int fd, struct map_session_data* sd, const char* c
else
{
cmd->level = newlev;
cmd->level2 = newremotelev;
clif_displaymessage(fd, "@command level changed.");
return 0;
}
@ -8238,295 +8241,295 @@ int atcommand_allowks(const int fd, struct map_session_data *sd, const char *com
*------------------------------------------*/
AtCommandInfo atcommand_info[] = {
{ "rura", 40, atcommand_mapmove },
{ "warp", 40, atcommand_mapmove },
{ "mapmove", 40, atcommand_mapmove }, // + /mm
{ "where", 1, atcommand_where },
{ "jumpto", 20, atcommand_jumpto }, // + /shift
{ "warpto", 20, atcommand_jumpto },
{ "goto", 20, atcommand_jumpto },
{ "jump", 40, atcommand_jump },
{ "who", 20, atcommand_who },
{ "whois", 20, atcommand_who },
{ "who2", 20, atcommand_who2 },
{ "who3", 20, atcommand_who3 },
{ "whomap", 20, atcommand_whomap },
{ "whomap2", 20, atcommand_whomap2 },
{ "whomap3", 20, atcommand_whomap3 },
{ "whogm", 20, atcommand_whogm },
{ "save", 40, atcommand_save },
{ "return", 40, atcommand_load },
{ "load", 40, atcommand_load },
{ "speed", 40, atcommand_speed },
{ "storage", 1, atcommand_storage },
{ "gstorage", 50, atcommand_guildstorage },
{ "option", 40, atcommand_option },
{ "hide", 40, atcommand_hide }, // + /hide
{ "jobchange", 40, atcommand_jobchange },
{ "job", 40, atcommand_jobchange },
{ "die", 1, atcommand_die },
{ "kill", 60, atcommand_kill },
{ "alive", 60, atcommand_alive },
{ "kami", 40, atcommand_kami },
{ "kamib", 40, atcommand_kami },
{ "kamic", 40, atcommand_kami },
{ "heal", 40, atcommand_heal },
{ "item", 60, atcommand_item },
{ "item2", 60, atcommand_item2 },
{ "itemreset", 40, atcommand_itemreset },
{ "blvl", 60, atcommand_baselevelup },
{ "lvup", 60, atcommand_baselevelup },
{ "blevel", 60, atcommand_baselevelup },
{ "baselvl", 60, atcommand_baselevelup },
{ "baselvup", 60, atcommand_baselevelup },
{ "baselevel", 60, atcommand_baselevelup },
{ "baselvlup", 60, atcommand_baselevelup },
{ "jlvl", 60, atcommand_joblevelup },
{ "jlevel", 60, atcommand_joblevelup },
{ "joblvl", 60, atcommand_joblevelup },
{ "joblevel", 60, atcommand_joblevelup },
{ "joblvup", 60, atcommand_joblevelup },
{ "joblvlup", 60, atcommand_joblevelup },
{ "h", 20, atcommand_help },
{ "help", 20, atcommand_help },
{ "h2", 20, atcommand_help2 },
{ "help2", 20, atcommand_help2 },
{ "pvpoff", 40, atcommand_pvpoff },
{ "pvpon", 40, atcommand_pvpon },
{ "gvgoff", 40, atcommand_gvgoff },
{ "gpvpoff", 40, atcommand_gvgoff },
{ "gvgon", 40, atcommand_gvgon },
{ "gpvpon", 40, atcommand_gvgon },
{ "model", 20, atcommand_model },
{ "go", 10, atcommand_go },
{ "monster", 50, atcommand_monster },
{ "spawn", 50, atcommand_monster },
{ "monstersmall", 50, atcommand_monstersmall },
{ "monsterbig", 50, atcommand_monsterbig },
{ "killmonster", 60, atcommand_killmonster },
{ "killmonster2", 40, atcommand_killmonster2 },
{ "refine", 60, atcommand_refine },
{ "produce", 60, atcommand_produce },
{ "memo", 40, atcommand_memo },
{ "gat", 99, atcommand_gat },
{ "displaystatus", 99, atcommand_displaystatus },
{ "stpoint", 60, atcommand_statuspoint },
{ "skpoint", 60, atcommand_skillpoint },
{ "zeny", 60, atcommand_zeny },
{ "str", 60, atcommand_param },
{ "agi", 60, atcommand_param },
{ "vit", 60, atcommand_param },
{ "int", 60, atcommand_param },
{ "dex", 60, atcommand_param },
{ "luk", 60, atcommand_param },
{ "glvl", 60, atcommand_guildlevelup },
{ "glevel", 60, atcommand_guildlevelup },
{ "guildlvl", 60, atcommand_guildlevelup },
{ "guildlvup", 60, atcommand_guildlevelup },
{ "guildlevel", 60, atcommand_guildlevelup },
{ "guildlvlup", 60, atcommand_guildlevelup },
{ "makeegg", 60, atcommand_makeegg },
{ "hatch", 60, atcommand_hatch },
{ "petfriendly", 40, atcommand_petfriendly },
{ "pethungry", 40, atcommand_pethungry },
{ "petrename", 1, atcommand_petrename },
{ "recall", 60, atcommand_recall }, // + /recall
{ "night", 80, atcommand_night },
{ "day", 80, atcommand_day },
{ "doom", 80, atcommand_doom },
{ "doommap", 80, atcommand_doommap },
{ "raise", 80, atcommand_raise },
{ "raisemap", 80, atcommand_raisemap },
{ "kick", 20, atcommand_kick }, // + right click menu for GM "(name) force to quit"
{ "kickall", 99, atcommand_kickall },
{ "allskill", 60, atcommand_allskill },
{ "allskills", 60, atcommand_allskill },
{ "skillall", 60, atcommand_allskill },
{ "skillsall", 60, atcommand_allskill },
{ "questskill", 40, atcommand_questskill },
{ "lostskill", 40, atcommand_lostskill },
{ "spiritball", 40, atcommand_spiritball },
{ "party", 1, atcommand_party },
{ "guild", 50, atcommand_guild },
{ "agitstart", 60, atcommand_agitstart },
{ "agitend", 60, atcommand_agitend },
{ "mapexit", 99, atcommand_mapexit },
{ "idsearch", 60, atcommand_idsearch },
{ "broadcast", 40, atcommand_broadcast }, // + /b and /nb
{ "localbroadcast", 40, atcommand_localbroadcast }, // + /lb and /nlb
{ "recallall", 80, atcommand_recallall },
{ "reloaditemdb", 99, atcommand_reloaditemdb },
{ "reloadmobdb", 99, atcommand_reloadmobdb },
{ "reloadskilldb", 99, atcommand_reloadskilldb },
{ "reloadscript", 99, atcommand_reloadscript },
{ "reloadatcommand", 99, atcommand_reloadatcommand },
{ "reloadbattleconf", 99, atcommand_reloadbattleconf },
{ "reloadstatusdb", 99, atcommand_reloadstatusdb },
{ "reloadpcdb", 99, atcommand_reloadpcdb },
{ "reloadmotd", 99, atcommand_reloadmotd },
{ "mapinfo", 99, atcommand_mapinfo },
{ "dye", 40, atcommand_dye },
{ "ccolor", 40, atcommand_dye },
{ "hairstyle", 40, atcommand_hair_style },
{ "hstyle", 40, atcommand_hair_style },
{ "haircolor", 40, atcommand_hair_color },
{ "hcolor", 40, atcommand_hair_color },
{ "statall", 60, atcommand_stat_all },
{ "statsall", 60, atcommand_stat_all },
{ "allstats", 60, atcommand_stat_all },
{ "allstat", 60, atcommand_stat_all },
{ "block", 60, atcommand_char_block },
{ "charblock", 60, atcommand_char_block },
{ "ban", 60, atcommand_char_ban },
{ "banish", 60, atcommand_char_ban },
{ "charban", 60, atcommand_char_ban },
{ "charbanish", 60, atcommand_char_ban },
{ "unblock", 60, atcommand_char_unblock },
{ "charunblock", 60, atcommand_char_unblock },
{ "unban", 60, atcommand_char_unban },
{ "unbanish", 60, atcommand_char_unban },
{ "charunban", 60, atcommand_char_unban },
{ "charunbanish", 60, atcommand_char_unban },
{ "mount", 20, atcommand_mount_peco },
{ "mountpeco", 20, atcommand_mount_peco },
{ "guildspy", 60, atcommand_guildspy },
{ "partyspy", 60, atcommand_partyspy },
{ "repairall", 60, atcommand_repairall },
{ "guildrecall", 60, atcommand_guildrecall },
{ "partyrecall", 60, atcommand_partyrecall },
{ "nuke", 60, atcommand_nuke },
{ "shownpc", 80, atcommand_shownpc },
{ "hidenpc", 80, atcommand_hidenpc },
{ "loadnpc", 80, atcommand_loadnpc },
{ "unloadnpc", 80, atcommand_unloadnpc },
{ "time", 1, atcommand_servertime },
{ "date", 1, atcommand_servertime },
{ "serverdate", 1, atcommand_servertime },
{ "servertime", 1, atcommand_servertime },
{ "jail", 60, atcommand_jail },
{ "unjail", 60, atcommand_unjail },
{ "discharge", 60, atcommand_unjail },
{ "jailfor", 60, atcommand_jailfor },
{ "jailtime", 1, atcommand_jailtime },
{ "disguise", 20, atcommand_disguise },
{ "undisguise", 20, atcommand_undisguise },
{ "email", 1, atcommand_email },
{ "effect", 40, atcommand_effect },
{ "follow", 20, atcommand_follow },
{ "addwarp", 60, atcommand_addwarp },
{ "skillon", 80, atcommand_skillon },
{ "skilloff", 80, atcommand_skilloff },
{ "killer", 60, atcommand_killer },
{ "npcmove", 80, atcommand_npcmove },
{ "killable", 40, atcommand_killable },
{ "dropall", 40, atcommand_dropall },
{ "storeall", 40, atcommand_storeall },
{ "skillid", 40, atcommand_skillid },
{ "useskill", 40, atcommand_useskill },
{ "displayskill", 99, atcommand_displayskill },
{ "snow", 99, atcommand_snow },
{ "sakura", 99, atcommand_sakura },
{ "clouds", 99, atcommand_clouds },
{ "clouds2", 99, atcommand_clouds2 },
{ "fog", 99, atcommand_fog },
{ "fireworks", 99, atcommand_fireworks },
{ "leaves", 99, atcommand_leaves },
{ "summon", 60, atcommand_summon },
{ "adjgmlvl", 99, atcommand_adjgmlvl },
{ "adjcmdlvl", 99, atcommand_adjcmdlvl },
{ "trade", 60, atcommand_trade },
{ "send", 99, atcommand_send },
{ "setbattleflag", 99, atcommand_setbattleflag },
{ "unmute", 80, atcommand_unmute },
{ "clearweather", 99, atcommand_clearweather },
{ "uptime", 1, atcommand_uptime },
{ "changesex", 60, atcommand_changesex },
{ "mute", 80, atcommand_mute },
{ "refresh", 1, atcommand_refresh },
{ "identify", 40, atcommand_identify },
{ "gmotd", 20, atcommand_gmotd },
{ "misceffect", 50, atcommand_misceffect },
{ "mobsearch", 10, atcommand_mobsearch },
{ "cleanmap", 40, atcommand_cleanmap },
{ "npctalk", 20, atcommand_npctalk },
{ "pettalk", 10, atcommand_pettalk },
{ "users", 40, atcommand_users },
{ "reset", 40, atcommand_reset },
{ "skilltree", 40, atcommand_skilltree },
{ "marry", 40, atcommand_marry },
{ "divorce", 40, atcommand_divorce },
{ "sound", 40, atcommand_sound },
{ "undisguiseall", 99, atcommand_undisguiseall },
{ "disguiseall", 99, atcommand_disguiseall },
{ "changelook", 60, atcommand_changelook },
{ "autoloot", 10, atcommand_autoloot },
{ "alootid", 10, atcommand_autolootitem },
{ "mobinfo", 1, atcommand_mobinfo },
{ "monsterinfo", 1, atcommand_mobinfo },
{ "mi", 1, atcommand_mobinfo },
{ "exp", 1, atcommand_exp },
{ "adopt", 40, atcommand_adopt },
{ "version", 1, atcommand_version },
{ "mutearea", 99, atcommand_mutearea },
{ "stfu", 99, atcommand_mutearea },
{ "rates", 1, atcommand_rates },
{ "iteminfo", 1, atcommand_iteminfo },
{ "ii", 1, atcommand_iteminfo },
{ "whodrops", 1, atcommand_whodrops },
{ "whereis", 10, atcommand_whereis },
{ "mapflag", 99, atcommand_mapflag },
{ "me", 20, atcommand_me },
{ "monsterignore", 99, atcommand_monsterignore },
{ "battleignore", 99, atcommand_monsterignore },
{ "fakename", 20, atcommand_fakename },
{ "size", 20, atcommand_size },
{ "showexp", 10, atcommand_showexp},
{ "showzeny", 10, atcommand_showzeny},
{ "showdelay", 1, atcommand_showdelay},
{ "autotrade", 10, atcommand_autotrade },
{ "at", 10, atcommand_autotrade },
{ "changegm", 10, atcommand_changegm },
{ "changeleader", 10, atcommand_changeleader },
{ "partyoption", 10, atcommand_partyoption},
{ "invite", 1, atcommand_invite },
{ "duel", 1, atcommand_duel },
{ "leave", 1, atcommand_leave },
{ "accept", 1, atcommand_accept },
{ "reject", 1, atcommand_reject },
{ "away", 1, atcommand_away },
{ "aw", 1, atcommand_away },
{ "main", 1, atcommand_main },
{ "clone", 50, atcommand_clone },
{ "slaveclone", 50, atcommand_clone },
{ "evilclone", 50, atcommand_clone },
{ "tonpc", 40, atcommand_tonpc },
{ "commands", 1, atcommand_commands },
{ "noask", 1, atcommand_noask },
{ "request", 20, atcommand_request },
{ "hlvl", 60, atcommand_homlevel },
{ "hlevel", 60, atcommand_homlevel },
{ "homlvl", 60, atcommand_homlevel },
{ "homlvup", 60, atcommand_homlevel },
{ "homlevel", 60, atcommand_homlevel },
{ "homevolve", 60, atcommand_homevolution },
{ "homevolution", 60, atcommand_homevolution },
{ "makehomun", 60, atcommand_makehomun },
{ "homfriendly", 60, atcommand_homfriendly },
{ "homhungry", 60, atcommand_homhungry },
{ "homtalk", 10, atcommand_homtalk },
{ "hominfo", 1, atcommand_hominfo },
{ "homstats", 1, atcommand_homstats },
{ "homshuffle", 60, atcommand_homshuffle },
{ "showmobs", 10, atcommand_showmobs },
{ "feelreset", 10, atcommand_feelreset },
{ "auction", 60, atcommand_auction },
{ "mail", 1, atcommand_mail },
{ "noks", 0, atcommand_ksprotection },
{ "allowks", 6, atcommand_allowks },
{ "cash", 60, atcommand_cash },
{ "points", 60, atcommand_cash },
{ "agitstart2", 60, atcommand_agitstart2 },
{ "agitend2", 60, atcommand_agitend2 },
{ "rura", 40,40, atcommand_mapmove },
{ "warp", 40,40, atcommand_mapmove },
{ "mapmove", 40,40, atcommand_mapmove }, // + /mm
{ "where", 1,1, atcommand_where },
{ "jumpto", 20,20, atcommand_jumpto }, // + /shift
{ "warpto", 20,20, atcommand_jumpto },
{ "goto", 20,20, atcommand_jumpto },
{ "jump", 40,40, atcommand_jump },
{ "who", 20,20, atcommand_who },
{ "whois", 20,20, atcommand_who },
{ "who2", 20,20, atcommand_who2 },
{ "who3", 20,20, atcommand_who3 },
{ "whomap", 20,20, atcommand_whomap },
{ "whomap2", 20,20, atcommand_whomap2 },
{ "whomap3", 20,20, atcommand_whomap3 },
{ "whogm", 20,20, atcommand_whogm },
{ "save", 40,40, atcommand_save },
{ "return", 40,40, atcommand_load },
{ "load", 40,40, atcommand_load },
{ "speed", 40,40, atcommand_speed },
{ "storage", 1,1, atcommand_storage },
{ "gstorage", 50,50, atcommand_guildstorage },
{ "option", 40,40, atcommand_option },
{ "hide", 40,40, atcommand_hide }, // + /hide
{ "jobchange", 40,40, atcommand_jobchange },
{ "job", 40,40, atcommand_jobchange },
{ "die", 1,1, atcommand_die },
{ "kill", 60,60, atcommand_kill },
{ "alive", 60,60, atcommand_alive },
{ "kami", 40,40, atcommand_kami },
{ "kamib", 40,40, atcommand_kami },
{ "kamic", 40,40, atcommand_kami },
{ "heal", 40,60, atcommand_heal },
{ "item", 60,60, atcommand_item },
{ "item2", 60,60, atcommand_item2 },
{ "itemreset", 40,40, atcommand_itemreset },
{ "blvl", 60,60, atcommand_baselevelup },
{ "lvup", 60,60, atcommand_baselevelup },
{ "blevel", 60,60, atcommand_baselevelup },
{ "baselvl", 60,60, atcommand_baselevelup },
{ "baselvup", 60,60, atcommand_baselevelup },
{ "baselevel", 60,60, atcommand_baselevelup },
{ "baselvlup", 60,60, atcommand_baselevelup },
{ "jlvl", 60,60, atcommand_joblevelup },
{ "jlevel", 60,60, atcommand_joblevelup },
{ "joblvl", 60,60, atcommand_joblevelup },
{ "joblevel", 60,60, atcommand_joblevelup },
{ "joblvup", 60,60, atcommand_joblevelup },
{ "joblvlup", 60,60, atcommand_joblevelup },
{ "h", 20,20, atcommand_help },
{ "help", 20,20, atcommand_help },
{ "h2", 20,20, atcommand_help2 },
{ "help2", 20,20, atcommand_help2 },
{ "pvpoff", 40,40, atcommand_pvpoff },
{ "pvpon", 40,40, atcommand_pvpon },
{ "gvgoff", 40,40, atcommand_gvgoff },
{ "gpvpoff", 40,40, atcommand_gvgoff },
{ "gvgon", 40,40, atcommand_gvgon },
{ "gpvpon", 40,40, atcommand_gvgon },
{ "model", 20,20, atcommand_model },
{ "go", 10,10, atcommand_go },
{ "monster", 50,50, atcommand_monster },
{ "spawn", 50,50, atcommand_monster },
{ "monstersmall", 50,50, atcommand_monstersmall },
{ "monsterbig", 50,50, atcommand_monsterbig },
{ "killmonster", 60,60, atcommand_killmonster },
{ "killmonster2", 40,40, atcommand_killmonster2 },
{ "refine", 60,60, atcommand_refine },
{ "produce", 60,60, atcommand_produce },
{ "memo", 40,40, atcommand_memo },
{ "gat", 99,99, atcommand_gat },
{ "displaystatus", 99,99, atcommand_displaystatus },
{ "stpoint", 60,60, atcommand_statuspoint },
{ "skpoint", 60,60, atcommand_skillpoint },
{ "zeny", 60,60, atcommand_zeny },
{ "str", 60,60, atcommand_param },
{ "agi", 60,60, atcommand_param },
{ "vit", 60,60, atcommand_param },
{ "int", 60,60, atcommand_param },
{ "dex", 60,60, atcommand_param },
{ "luk", 60,60, atcommand_param },
{ "glvl", 60,60, atcommand_guildlevelup },
{ "glevel", 60,60, atcommand_guildlevelup },
{ "guildlvl", 60,60, atcommand_guildlevelup },
{ "guildlvup", 60,60, atcommand_guildlevelup },
{ "guildlevel", 60,60, atcommand_guildlevelup },
{ "guildlvlup", 60,60, atcommand_guildlevelup },
{ "makeegg", 60,60, atcommand_makeegg },
{ "hatch", 60,60, atcommand_hatch },
{ "petfriendly", 40,40, atcommand_petfriendly },
{ "pethungry", 40,40, atcommand_pethungry },
{ "petrename", 1,1, atcommand_petrename },
{ "recall", 60,60, atcommand_recall }, // + /recall
{ "night", 80,80, atcommand_night },
{ "day", 80,80, atcommand_day },
{ "doom", 80,80, atcommand_doom },
{ "doommap", 80,80, atcommand_doommap },
{ "raise", 80,80, atcommand_raise },
{ "raisemap", 80,80, atcommand_raisemap },
{ "kick", 20,20, atcommand_kick }, // + right click menu for GM "(name) force to quit"
{ "kickall", 99,99, atcommand_kickall },
{ "allskill", 60,60, atcommand_allskill },
{ "allskills", 60,60, atcommand_allskill },
{ "skillall", 60,60, atcommand_allskill },
{ "skillsall", 60,60, atcommand_allskill },
{ "questskill", 40,40, atcommand_questskill },
{ "lostskill", 40,40, atcommand_lostskill },
{ "spiritball", 40,40, atcommand_spiritball },
{ "party", 1,1, atcommand_party },
{ "guild", 50,50, atcommand_guild },
{ "agitstart", 60,60, atcommand_agitstart },
{ "agitend", 60,60, atcommand_agitend },
{ "mapexit", 99,99, atcommand_mapexit },
{ "idsearch", 60,60, atcommand_idsearch },
{ "broadcast", 40,40, atcommand_broadcast }, // + /b and /nb
{ "localbroadcast", 40,40, atcommand_localbroadcast }, // + /lb and /nlb
{ "recallall", 80,80, atcommand_recallall },
{ "reloaditemdb", 99,99, atcommand_reloaditemdb },
{ "reloadmobdb", 99,99, atcommand_reloadmobdb },
{ "reloadskilldb", 99,99, atcommand_reloadskilldb },
{ "reloadscript", 99,99, atcommand_reloadscript },
{ "reloadatcommand", 99,99, atcommand_reloadatcommand },
{ "reloadbattleconf", 99,99, atcommand_reloadbattleconf },
{ "reloadstatusdb", 99,99, atcommand_reloadstatusdb },
{ "reloadpcdb", 99,99, atcommand_reloadpcdb },
{ "reloadmotd", 99,99, atcommand_reloadmotd },
{ "mapinfo", 99,99, atcommand_mapinfo },
{ "dye", 40,40, atcommand_dye },
{ "ccolor", 40,40, atcommand_dye },
{ "hairstyle", 40,40, atcommand_hair_style },
{ "hstyle", 40,40, atcommand_hair_style },
{ "haircolor", 40,40, atcommand_hair_color },
{ "hcolor", 40,40, atcommand_hair_color },
{ "statall", 60,60, atcommand_stat_all },
{ "statsall", 60,60, atcommand_stat_all },
{ "allstats", 60,60, atcommand_stat_all },
{ "allstat", 60,60, atcommand_stat_all },
{ "block", 60,60, atcommand_char_block },
{ "charblock", 60,60, atcommand_char_block },
{ "ban", 60,60, atcommand_char_ban },
{ "banish", 60,60, atcommand_char_ban },
{ "charban", 60,60, atcommand_char_ban },
{ "charbanish", 60,60, atcommand_char_ban },
{ "unblock", 60,60, atcommand_char_unblock },
{ "charunblock", 60,60, atcommand_char_unblock },
{ "unban", 60,60, atcommand_char_unban },
{ "unbanish", 60,60, atcommand_char_unban },
{ "charunban", 60,60, atcommand_char_unban },
{ "charunbanish", 60,60, atcommand_char_unban },
{ "mount", 20,20, atcommand_mount_peco },
{ "mountpeco", 20,20, atcommand_mount_peco },
{ "guildspy", 60,60, atcommand_guildspy },
{ "partyspy", 60,60, atcommand_partyspy },
{ "repairall", 60,60, atcommand_repairall },
{ "guildrecall", 60,60, atcommand_guildrecall },
{ "partyrecall", 60,60, atcommand_partyrecall },
{ "nuke", 60,60, atcommand_nuke },
{ "shownpc", 80,80, atcommand_shownpc },
{ "hidenpc", 80,80, atcommand_hidenpc },
{ "loadnpc", 80,80, atcommand_loadnpc },
{ "unloadnpc", 80,80, atcommand_unloadnpc },
{ "time", 1,1, atcommand_servertime },
{ "date", 1,1, atcommand_servertime },
{ "serverdate", 1,1, atcommand_servertime },
{ "servertime", 1,1, atcommand_servertime },
{ "jail", 60,60, atcommand_jail },
{ "unjail", 60,60, atcommand_unjail },
{ "discharge", 60,60, atcommand_unjail },
{ "jailfor", 60,60, atcommand_jailfor },
{ "jailtime", 1,1, atcommand_jailtime },
{ "disguise", 20,20, atcommand_disguise },
{ "undisguise", 20,20, atcommand_undisguise },
{ "email", 1,1, atcommand_email },
{ "effect", 40,40, atcommand_effect },
{ "follow", 20,20, atcommand_follow },
{ "addwarp", 60,60, atcommand_addwarp },
{ "skillon", 80,80, atcommand_skillon },
{ "skilloff", 80,80, atcommand_skilloff },
{ "killer", 60,60, atcommand_killer },
{ "npcmove", 80,80, atcommand_npcmove },
{ "killable", 40,40, atcommand_killable },
{ "dropall", 40,40, atcommand_dropall },
{ "storeall", 40,40, atcommand_storeall },
{ "skillid", 40,40, atcommand_skillid },
{ "useskill", 40,40, atcommand_useskill },
{ "displayskill", 99,99, atcommand_displayskill },
{ "snow", 99,99, atcommand_snow },
{ "sakura", 99,99, atcommand_sakura },
{ "clouds", 99,99, atcommand_clouds },
{ "clouds2", 99,99, atcommand_clouds2 },
{ "fog", 99,99, atcommand_fog },
{ "fireworks", 99,99, atcommand_fireworks },
{ "leaves", 99,99, atcommand_leaves },
{ "summon", 60,60, atcommand_summon },
{ "adjgmlvl", 99,99, atcommand_adjgmlvl },
{ "adjcmdlvl", 99,99, atcommand_adjcmdlvl },
{ "trade", 60,60, atcommand_trade },
{ "send", 99,99, atcommand_send },
{ "setbattleflag", 99,99, atcommand_setbattleflag },
{ "unmute", 80,80, atcommand_unmute },
{ "clearweather", 99,99, atcommand_clearweather },
{ "uptime", 1,1, atcommand_uptime },
{ "changesex", 60,60, atcommand_changesex },
{ "mute", 80,80, atcommand_mute },
{ "refresh", 1,1, atcommand_refresh },
{ "identify", 40,40, atcommand_identify },
{ "gmotd", 20,20, atcommand_gmotd },
{ "misceffect", 50,50, atcommand_misceffect },
{ "mobsearch", 10,10, atcommand_mobsearch },
{ "cleanmap", 40,40, atcommand_cleanmap },
{ "npctalk", 20,20, atcommand_npctalk },
{ "pettalk", 10,10, atcommand_pettalk },
{ "users", 40,40, atcommand_users },
{ "reset", 40,40, atcommand_reset },
{ "skilltree", 40,40, atcommand_skilltree },
{ "marry", 40,40, atcommand_marry },
{ "divorce", 40,40, atcommand_divorce },
{ "sound", 40,40, atcommand_sound },
{ "undisguiseall", 99,99, atcommand_undisguiseall },
{ "disguiseall", 99,99, atcommand_disguiseall },
{ "changelook", 60,60, atcommand_changelook },
{ "autoloot", 10,10, atcommand_autoloot },
{ "alootid", 10,10, atcommand_autolootitem },
{ "mobinfo", 1,1, atcommand_mobinfo },
{ "monsterinfo", 1,1, atcommand_mobinfo },
{ "mi", 1,1, atcommand_mobinfo },
{ "exp", 1,1, atcommand_exp },
{ "adopt", 40,40, atcommand_adopt },
{ "version", 1,1, atcommand_version },
{ "mutearea", 99,99, atcommand_mutearea },
{ "stfu", 99,99, atcommand_mutearea },
{ "rates", 1,1, atcommand_rates },
{ "iteminfo", 1,1, atcommand_iteminfo },
{ "ii", 1,1, atcommand_iteminfo },
{ "whodrops", 1,1, atcommand_whodrops },
{ "whereis", 10,10, atcommand_whereis },
{ "mapflag", 99,99, atcommand_mapflag },
{ "me", 20,20, atcommand_me },
{ "monsterignore", 99,99, atcommand_monsterignore },
{ "battleignore", 99,99, atcommand_monsterignore },
{ "fakename", 20,20, atcommand_fakename },
{ "size", 20,20, atcommand_size },
{ "showexp", 10,10, atcommand_showexp},
{ "showzeny", 10,10, atcommand_showzeny},
{ "showdelay", 1,1, atcommand_showdelay},
{ "autotrade", 10,10, atcommand_autotrade },
{ "at", 10,10, atcommand_autotrade },
{ "changegm", 10,10, atcommand_changegm },
{ "changeleader", 10,10, atcommand_changeleader },
{ "partyoption", 10,10, atcommand_partyoption},
{ "invite", 1,1, atcommand_invite },
{ "duel", 1,1, atcommand_duel },
{ "leave", 1,1, atcommand_leave },
{ "accept", 1,1, atcommand_accept },
{ "reject", 1,1, atcommand_reject },
{ "away", 1,1, atcommand_away },
{ "aw", 1,1, atcommand_away },
{ "main", 1,1, atcommand_main },
{ "clone", 50,50, atcommand_clone },
{ "slaveclone", 50,50, atcommand_clone },
{ "evilclone", 50,50, atcommand_clone },
{ "tonpc", 40,40, atcommand_tonpc },
{ "commands", 1,1, atcommand_commands },
{ "noask", 1,1, atcommand_noask },
{ "request", 20,20, atcommand_request },
{ "hlvl", 60,60, atcommand_homlevel },
{ "hlevel", 60,60, atcommand_homlevel },
{ "homlvl", 60,60, atcommand_homlevel },
{ "homlvup", 60,60, atcommand_homlevel },
{ "homlevel", 60,60, atcommand_homlevel },
{ "homevolve", 60,60, atcommand_homevolution },
{ "homevolution", 60,60, atcommand_homevolution },
{ "makehomun", 60,60, atcommand_makehomun },
{ "homfriendly", 60,60, atcommand_homfriendly },
{ "homhungry", 60,60, atcommand_homhungry },
{ "homtalk", 10,10, atcommand_homtalk },
{ "hominfo", 1,1, atcommand_hominfo },
{ "homstats", 1,1, atcommand_homstats },
{ "homshuffle", 60,60, atcommand_homshuffle },
{ "showmobs", 10,10, atcommand_showmobs },
{ "feelreset", 10,10, atcommand_feelreset },
{ "auction", 60,60, atcommand_auction },
{ "mail", 1,1, atcommand_mail },
{ "noks", 0,0, atcommand_ksprotection },
{ "allowks", 6,6, atcommand_allowks },
{ "cash", 60,60, atcommand_cash },
{ "points", 60,60, atcommand_cash },
{ "agitstart2", 60,60, atcommand_agitstart2 },
{ "agitend2", 60,60, atcommand_agitend2 },
};
@ -8536,7 +8539,7 @@ AtCommandInfo atcommand_info[] = {
static AtCommandInfo* get_atcommandinfo_byname(const char* name)
{
int i;
if( *name == atcommand_symbol ) name++; // for backwards compatibility
if( *name == atcommand_symbol || *name == charcommand_symbol ) name++; // for backwards compatibility
ARR_FIND( 0, ARRAYLENGTH(atcommand_info), i, strcmpi(atcommand_info[i].command, name) == 0 );
return ( i < ARRAYLENGTH(atcommand_info) ) ? &atcommand_info[i] : NULL;
}
@ -8561,8 +8564,9 @@ int get_atcommand_level(const AtCommandFunc func)
/// Executes an at-command.
/// To be called by internal server code (bypasses various restrictions).
bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl)
bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl, const char charname[NAME_LENGTH])
{
struct map_session_data* ssd;
AtCommandInfo* info;
char command[100];
char args[100];
@ -8570,15 +8574,15 @@ bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str
if( !str || !*str )
return false;
if( *str != atcommand_symbol ) // check first char
if( *str != atcommand_symbol && *str != charcommand_symbol ) // check first char
return false;
if( sscanf(str, "%99s %99[^\n]", command, args) < 2 )
args[0] = '\0';
info = get_atcommandinfo_byname(command);
if( info == NULL || info->func == NULL || gmlvl < info->level )
if( info == NULL || info->func == NULL || ( *str == atcommand_symbol && gmlvl < info->level ) || ( *str == charcommand_symbol && gmlvl < info->level2 ) )
{
if( gmlvl == 0 )
return false; // will just display as normal text
@ -8590,8 +8594,12 @@ bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str
}
}
if( log_config.gm && info->level >= log_config.gm )
log_atcommand(sd, str);
if( log_config.gm && info->level >= log_config.gm ) {
if( (ssd = map_nick2sd(charname)) != NULL )
log_atcommand(ssd, str);
else
log_atcommand(sd, str);
}
if( info->func(fd, sd, command, args) != 0 )
{
@ -8606,6 +8614,13 @@ bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str
/// To be used by player-invoked code (restrictions will be applied).
bool is_atcommand(const int fd, struct map_session_data* sd, const char* message)
{
struct map_session_data* pl_sd;
char charname[NAME_LENGTH];
char cmd[100];
char param[100];
const char* message2;
int gmlvl = pc_isGM(sd);
nullpo_retr(false, sd);
@ -8626,10 +8641,32 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
}
// skip 10/11-langtype's codepage indicator, if detected
if( message[0] == '|' && strlen(message) >= 4 && message[3] == atcommand_symbol )
if( message[0] == '|' && strlen(message) >= 4 && (message[3] == atcommand_symbol || message[3] == charcommand_symbol) )
message += 3;
if (*message == charcommand_symbol)
{
if (sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", cmd, charname, param) > 2
|| sscanf(message, "%99s %23s %99[^\n]", cmd, charname, param) > 2)
{
if ( (pl_sd = map_nick2sd(charname)) == NULL )
{
sprintf(atcmd_output, "%s failed. Player %s not found.", cmd, charname);
clif_displaymessage(fd, atcmd_output);
return true;
}
else {
//we pass fd instead of pl_sd->fd otherwise command output messages are sent to the target
//also, the name is taken out of the message since it's not needed anymore
sprintf(atcmd_output, "%s %s", cmd, param);
memcpy(atcmd_temp, atcmd_output, sizeof(atcmd_output));
message2 = atcmd_temp;
return is_atcommand_sub(fd,pl_sd,message2,gmlvl,sd->status.name);
}
}
}
return is_atcommand_sub(fd,sd,message,gmlvl);
return is_atcommand_sub(fd,sd,message,gmlvl,sd->status.name);
}
@ -8638,7 +8675,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
*------------------------------------------*/
int atcommand_config_read(const char* cfgName)
{
char line[1024], w1[1024], w2[1024];
char line[1024], w1[1024], w2[1024], w3[1024];
AtCommandInfo* p;
FILE* fp;
@ -8653,14 +8690,17 @@ int atcommand_config_read(const char* cfgName)
if( line[0] == '/' && line[1] == '/' )
continue;
if( sscanf(line, "%1023[^:]:%1023s", w1, w2) != 2 )
if( (sscanf(line, "%1023[^:]:%1023[^,],%1023s", w1, w2, w3)) != 3
&& ( sscanf(line, "%1023[^:]:%1023s", w1, w2) != 2 && strcmpi(w1, "import") != 0 ) )
continue;
p = get_atcommandinfo_byname(w1);
if( p != NULL )
{
p->level = atoi(w2);
p->level = cap_value(p->level, 0, 100);
p->level2 = atoi(w3);
p->level2 = cap_value(p->level2, 0, 100);
}
else
if( strcmpi(w1, "import") == 0 )
@ -8671,7 +8711,7 @@ int atcommand_config_read(const char* cfgName)
w2[0] != '/' && // symbol of standard ragnarok GM commands
w2[0] != '%' && // symbol of party chat speaking
w2[0] != '$' && // symbol of guild chat speaking
w2[0] != '#' ) // symbol of charcommand
w2[0] != '#' ) // remote symbol
atcommand_symbol = w2[0];
else
ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName);
@ -8700,7 +8740,7 @@ void do_final_atcommand()
int atcommand_commands(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
char line_buff[CHATBOX_SIZE];
int i, gm_lvl = pc_isGM(sd), count = 0;
int i, gm_lvl = pc_isGM(sd), count = 0, count2 = 0;
char* cur = line_buff;
memset(line_buff,' ',CHATBOX_SIZE);
@ -8708,33 +8748,60 @@ int atcommand_commands(const int fd, struct map_session_data* sd, const char* co
clif_displaymessage(fd, msg_txt(273)); // "Commands available:"
for( i = 0; i < ARRAYLENGTH(atcommand_info); i++ )
{
unsigned int slen;
if( gm_lvl < atcommand_info[i].level )
continue;
slen = (unsigned int)strlen(atcommand_info[i].command);
// flush the text buffer if this command won't fit into it
if( slen + cur - line_buff >= CHATBOX_SIZE )
for( i = 0; i < ARRAYLENGTH(atcommand_info); i++ )
{
clif_displaymessage(fd,line_buff);
cur = line_buff;
memset(line_buff,' ',CHATBOX_SIZE);
line_buff[CHATBOX_SIZE-1] = 0;
unsigned int slen;
if( gm_lvl < atcommand_info[i].level )
continue;
slen = (unsigned int)strlen(atcommand_info[i].command);
// flush the text buffer if this command won't fit into it
if( slen + cur - line_buff >= CHATBOX_SIZE )
{
clif_displaymessage(fd,line_buff);
cur = line_buff;
memset(line_buff,' ',CHATBOX_SIZE);
line_buff[CHATBOX_SIZE-1] = 0;
}
memcpy(cur,atcommand_info[i].command,slen);
cur += slen+(10-slen%10);
count++;
}
for( i = 0; i < ARRAYLENGTH(atcommand_info); i++ )
{
unsigned int slen;
memcpy(cur,atcommand_info[i].command,slen);
cur += slen+(10-slen%10);
if( gm_lvl < atcommand_info[i].level2 )
continue;
count++;
}
slen = (unsigned int)strlen(atcommand_info[i].command);
// flush the text buffer if this command won't fit into it
if( slen + cur - line_buff >= CHATBOX_SIZE )
{
clif_displaymessage(fd,line_buff);
cur = line_buff;
memset(line_buff,' ',CHATBOX_SIZE);
line_buff[CHATBOX_SIZE-1] = 0;
}
memcpy(cur,atcommand_info[i].command,slen);
cur += slen+(10-slen%10);
count2++;
}
clif_displaymessage(fd,line_buff);
sprintf(atcmd_output, msg_txt(274), count); // "%d commands found."
clif_displaymessage(fd, atcmd_output);
sprintf(atcmd_output, "%d charcommands found.", count2);
clif_displaymessage(fd, atcmd_output);
return 0;
}
}

View File

@ -14,10 +14,11 @@ struct map_session_data;
//#define AUTOLOOT_DISTANCE AREA_SIZE
extern char atcommand_symbol;
extern char charcommand_symbol;
typedef int (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message);
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);
bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl, const char charname[NAME_LENGTH]);
int get_atcommand_level(const AtCommandFunc func);
void do_init_atcommand(void);

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _CHARCOMMAND_H_
#define _CHARCOMMAND_H_
//#include "map.h"
struct map_session_data;
extern char charcommand_symbol;
typedef int (*CharCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message);
bool is_charcommand(const int fd, struct map_session_data* sd, const char* message);
bool is_charcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl);
int get_charcommand_level(const CharCommandFunc func);
int charcommand_config_read(const char* cfgName);
#endif /* _CHARCOMMAND_H_ */

View File

@ -6,6 +6,7 @@
#include "../common/nullpo.h"
#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "../common/mmo.h"
#include "atcommand.h" // msg_txt()
#include "battle.h" // struct battle_config
#include "clif.h"

View File

@ -23,7 +23,6 @@
#include "script.h"
#include "skill.h"
#include "atcommand.h"
#include "charcommand.h"
#include "intif.h"
#include "battle.h"
#include "mob.h"
@ -8215,7 +8214,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) )
return;
if( is_atcommand(fd, sd, message) || is_charcommand(fd, sd, message) )
if( is_atcommand(fd, sd, message) )
return;
if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
@ -8526,7 +8525,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
if( !clif_process_message(sd, 1, &target, &namelen, &message, &messagelen) )
return;
if (is_atcommand(fd, sd, message) || is_charcommand(fd, sd, message) )
if (is_atcommand(fd, sd, message) )
return;
if (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))
@ -10053,7 +10052,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) )
return;
if( is_atcommand(fd, sd, message) || is_charcommand(fd, sd, message) )
if( is_atcommand(fd, sd, message) )
return;
if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
@ -10331,7 +10330,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) )
return;
if( is_atcommand(fd, sd, message) || is_charcommand(fd, sd, message) )
if( is_atcommand(fd, sd, message) )
return;
if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )

View File

@ -38,7 +38,6 @@
#include "homunculus.h"
#include "mercenary.h"
#include "atcommand.h"
#include "charcommand.h"
#include "log.h"
#ifndef TXT_ONLY
#include "mail.h"
@ -2935,7 +2934,7 @@ int parse_console(char* buf)
ShowInfo("Type of command: '%s' || Command: '%s' || Map: '%s' Coords: %d %d\n", type, command, map, x, y);
if( n == 5 && strcmpi("admin",type) == 0 ){
if( !is_atcommand_sub(sd.fd,&sd,command,99) )
if( !is_atcommand_sub(sd.fd,&sd,command,99,sd.status.name) )
ShowInfo("Console: not atcommand\n");
} else if( n == 2 && strcmpi("server",type) == 0 ){
if( strcmpi("shutdown",command) == 0 ||
@ -3468,8 +3467,6 @@ int do_init(int argc, char *argv[])
BATTLE_CONF_FILENAME = argv[i+1];
else if (strcmp(argv[i],"--atcommand_config") == 0 || strcmp(argv[i],"--atcommand-config") == 0)
ATCOMMAND_CONF_FILENAME = argv[i+1];
else if (strcmp(argv[i],"--charcommand_config") == 0 || strcmp(argv[i],"--charcommand-config") == 0)
CHARCOMMAND_CONF_FILENAME = argv[i+1];
else if (strcmp(argv[i],"--script_config") == 0 || strcmp(argv[i],"--script-config") == 0)
SCRIPT_CONF_NAME = argv[i+1];
else if (strcmp(argv[i],"--msg_config") == 0 || strcmp(argv[i],"--msg-config") == 0)
@ -3511,7 +3508,6 @@ int do_init(int argc, char *argv[])
battle_config_read(BATTLE_CONF_FILENAME);
msg_config_read(MSG_CONF_NAME);
atcommand_config_read(ATCOMMAND_CONF_FILENAME);
charcommand_config_read(CHARCOMMAND_CONF_FILENAME);
script_config_read(SCRIPT_CONF_NAME);
inter_config_read(INTER_CONF_NAME);
log_config_read(LOG_CONF_NAME);

View File

@ -620,7 +620,6 @@ extern char *LOG_CONF_NAME;
extern char *MAP_CONF_NAME;
extern char *BATTLE_CONF_FILENAME;
extern char *ATCOMMAND_CONF_FILENAME;
extern char *CHARCOMMAND_CONF_FILENAME;
extern char *SCRIPT_CONF_NAME;
extern char *MSG_CONF_NAME;
extern char *GRF_PATH_FILENAME;

View File

@ -10,6 +10,7 @@
#include "../common/strlib.h" // safestrncpy()
#include "../common/timer.h"
#include "../common/utils.h"
#include "../common/mmo.h" //NAME_LENGTH
#include "atcommand.h" // get_atcommand_level()
#include "battle.h" // battle_config

View File

@ -37,7 +37,6 @@
#include "party.h"
#include "guild.h"
#include "atcommand.h"
#include "charcommand.h"
#include "log.h"
#include "unit.h"
#include "pet.h"
@ -10686,7 +10685,7 @@ BUILDIN_FUNC(atcommand)
cmd++;
}
is_atcommand_sub(fd, sd, cmd, 99);
is_atcommand_sub(fd, sd, cmd, 99, sd->status.name);
return 0;
}
@ -10695,8 +10694,11 @@ BUILDIN_FUNC(charcommand)
{
TBL_PC dummy_sd;
TBL_PC* sd;
TBL_PC* temp_sd;
char output[200], temp[200], command[200], charname[NAME_LENGTH], param[200];
int fd;
const char* cmd;
const char* message;
cmd = script_getstr(st,2);
@ -10717,15 +10719,24 @@ BUILDIN_FUNC(charcommand)
}
}
// compatibility with previous implementation (deprecated!)
if(cmd[0] != charcommand_symbol)
if (*cmd == charcommand_symbol)
{
cmd += strlen(sd->status.name);
while(*cmd != charcommand_symbol && *cmd != 0)
cmd++;
if (sscanf(cmd, "%99s \"%23[^\"]\" %99[^\n]", command, charname, param) > 2
|| sscanf(cmd, "%99s %23s %99[^\n]", command, charname, param) > 2)
{
if ( (temp_sd = map_nick2sd(charname)) != NULL )
{
sprintf(output, "%s %s", cmd, param);
memcpy(temp, output, sizeof(output));
message = temp;
is_atcommand_sub(fd,sd,message,99,sd->status.name);
}
}
}
else {
ShowWarning("script: buildin_charcommand: No '#' symbol!");
script_reportsrc(st);
}
is_charcommand_sub(fd, sd, cmd, 99);
return 0;
}

View File

@ -215,14 +215,6 @@ SOURCE=..\src\map\battle.h
# End Source File
# Begin Source File
SOURCE=..\src\map\charcommand.c
# End Source File
# Begin Source File
SOURCE=..\src\map\charcommand.h
# End Source File
# Begin Source File
SOURCE=..\src\map\chat.c
# End Source File
# Begin Source File

View File

@ -199,10 +199,6 @@ SOURCE=..\src\map\battle.c
# End Source File
# Begin Source File
SOURCE=..\src\map\charcommand.c
# End Source File
# Begin Source File
SOURCE=..\src\map\chat.c
# End Source File
# Begin Source File
@ -319,10 +315,6 @@ SOURCE=..\src\map\battle.h
# End Source File
# Begin Source File
SOURCE=..\src\map\charcommand.h
# End Source File
# Begin Source File
SOURCE=..\src\map\chat.h
# End Source File
# Begin Source File

View File

@ -160,12 +160,6 @@
<File
RelativePath="..\src\map\battle.h">
</File>
<File
RelativePath="..\src\map\charcommand.c">
</File>
<File
RelativePath="..\src\map\charcommand.h">
</File>
<File
RelativePath="..\src\map\chat.c">
</File>

View File

@ -160,12 +160,6 @@
<File
RelativePath="..\src\map\battle.h">
</File>
<File
RelativePath="..\src\map\charcommand.c">
</File>
<File
RelativePath="..\src\map\charcommand.h">
</File>
<File
RelativePath="..\src\map\chat.c">
</File>

View File

@ -353,14 +353,6 @@
RelativePath="..\src\map\battle.h"
>
</File>
<File
RelativePath="..\src\map\charcommand.c"
>
</File>
<File
RelativePath="..\src\map\charcommand.h"
>
</File>
<File
RelativePath="..\src\map\chat.c"
>

View File

@ -218,14 +218,6 @@
RelativePath="..\src\map\battle.h"
>
</File>
<File
RelativePath="..\src\map\charcommand.c"
>
</File>
<File
RelativePath="..\src\map\charcommand.h"
>
</File>
<File
RelativePath="..\src\map\chat.c"
>

View File

@ -358,14 +358,6 @@
RelativePath="..\src\map\battle.h"
>
</File>
<File
RelativePath="..\src\map\charcommand.c"
>
</File>
<File
RelativePath="..\src\map\charcommand.h"
>
</File>
<File
RelativePath="..\src\map\chat.c"
>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="map-server_txt"
ProjectGUID="{D356871D-58E1-450B-967A-E1E9646175AF}"
RootNamespace="map-server_txt"
@ -217,14 +217,6 @@
RelativePath="..\src\map\battle.h"
>
</File>
<File
RelativePath="..\src\map\charcommand.c"
>
</File>
<File
RelativePath="..\src\map\charcommand.h"
>
</File>
<File
RelativePath="..\src\map\chat.c"
>
@ -265,6 +257,14 @@
RelativePath="..\src\map\guild.h"
>
</File>
<File
RelativePath="..\src\map\homunculus.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.h"
>
</File>
<File
RelativePath="..\src\map\intif.c"
>
@ -313,14 +313,6 @@
RelativePath="..\src\map\mapreg_txt.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.h"
>
</File>
<File
RelativePath="..\src\map\mercenary.c"
>