diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-29 00:20:43 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-29 00:20:43 +0000 |
commit | b4446fe25bb94d21ec0eec391e755ae9c32cd37d (patch) | |
tree | fbc8419740ccc2be51af62b163bb4e3d822b0213 | |
parent | 98bc5a50c724236000263526a0539caeb11a3200 (diff) | |
download | hercules-b4446fe25bb94d21ec0eec391e755ae9c32cd37d.tar.gz hercules-b4446fe25bb94d21ec0eec391e755ae9c32cd37d.tar.bz2 hercules-b4446fe25bb94d21ec0eec391e755ae9c32cd37d.tar.xz hercules-b4446fe25bb94d21ec0eec391e755ae9c32cd37d.zip |
- Added #cash and #points to add cash/kafra points to a character.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12267 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | conf/charcommand_athena.conf | 4 | ||||
-rw-r--r-- | src/map/charcommand.c | 50 |
2 files changed, 54 insertions, 0 deletions
diff --git a/conf/charcommand_athena.conf b/conf/charcommand_athena.conf index 20e0c2427..4b7bf672f 100644 --- a/conf/charcommand_athena.conf +++ b/conf/charcommand_athena.conf @@ -97,6 +97,10 @@ size: 50 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 diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 71323ace1..bde5e7d2e 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -907,6 +907,54 @@ int charcommand_zeny(const int fd, struct map_session_data* sd, const char* comm } /*========================================== + * #cash or #points <amount> <charname> + *------------------------------------------*/ +int charcommand_cash(const int fd, struct map_session_data* sd, const char* command, const char* message) +{ + struct map_session_data *pl_sd; + char character[NAME_LENGTH]; + int value = 0; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + + if( !message || !*message || sscanf(message, "%d %23[^\n]", &value, character) < 2 || value == 0 ) + { + clif_displaymessage(fd, "Please, enter a number and a player name (usage: #cash|#points <points> <name>)."); + return -1; + } + + if( (pl_sd = map_nick2sd(character)) != NULL ) + { + if( !strcmpi(command+1,"cash") ) + { + if( value > 0 ) + pc_getcash(pl_sd, value, 0); + else + pc_paycash(pl_sd, value, 0); + + clif_displaymessage(fd, "Character's Cash Points changed!."); + } + else + { // @points + if( value > 0 ) + pc_getcash(pl_sd, 0, value); + else + pc_paycash(pl_sd, value, value); + + clif_displaymessage(fd, "Character's Kafra Points changed!."); + } + } + else + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + return 0; +} + +/*========================================== * #fakename <char name> <fake name> *------------------------------------------*/ int charcommand_fakename(const int fd, struct map_session_data* sd, const char* command, const char* message) @@ -3739,6 +3787,8 @@ CharCommandInfo charcommand_info[] = { { "homfriendly", 60, charcommand_homfriendly }, { "homhungry", 60, charcommand_homhungry }, { "hominfo", 40, charcommand_hominfo }, + { "cash", 60, charcommand_cash }, + { "points", 60, charcommand_cash }, }; |