summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/charcommand_athena.conf4
-rw-r--r--src/map/charcommand.c50
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 },
};