summaryrefslogtreecommitdiff
path: root/src/map/charcommand.c
diff options
context:
space:
mode:
authorcodemaster <codemaster@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-13 22:15:58 +0000
committercodemaster <codemaster@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-13 22:15:58 +0000
commitae6aa7431d176f3defab07234cdd7677523f0c4d (patch)
treeaead9f031a47c24081d13030d72fc6c63e1c8f50 /src/map/charcommand.c
parent6ef9c57c9e27f1225ba4be518d980cfae17a10f5 (diff)
downloadhercules-ae6aa7431d176f3defab07234cdd7677523f0c4d.tar.gz
hercules-ae6aa7431d176f3defab07234cdd7677523f0c4d.tar.bz2
hercules-ae6aa7431d176f3defab07234cdd7677523f0c4d.tar.xz
hercules-ae6aa7431d176f3defab07234cdd7677523f0c4d.zip
* common/mmo.h: changed base_level and job_level to unsigned int to increase max levels
* char/char.c: added a NULL check for the file in parse_friend_txt * map/atcommand.c/.h: added @clearweather (thanks to Dexity) * map/charcommand.c/.h: added #spiritball * map/mob.c: fixed a compiler warning (ln was an int and was supposed to be an unsigned long int) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@563 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/charcommand.c')
-rw-r--r--src/map/charcommand.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 4c22ecbcc..56cf6b316 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -42,6 +42,7 @@ CCMD_FUNC(option);
CCMD_FUNC(save);
CCMD_FUNC(stats_all);
CCMD_FUNC(reset);
+CCMD_FUNC(spiritball);
#ifdef TXT_ONLY
/* TXT_ONLY */
@@ -70,6 +71,7 @@ static CharCommandInfo charcommand_info[] = {
{ CharCommandReset, "#reset", 60, charcommand_reset },
{ CharCommandSave, "#save", 60, charcommand_save },
{ CharCommandStatsAll, "#statsall", 40, charcommand_stats_all },
+ { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball },
#ifdef TXT_ONLY
/* TXT_ONLY */
@@ -248,8 +250,8 @@ int charcommand_config_read(const char *cfgName) {
charcommand_config_read(w2);
else if (strcmpi(w1, "command_symbol") == 0 && w2[0] > 31 &&
w2[0] != '/' && // symbol of standard ragnarok GM commands
- w2[0] != '%' && // symbol of party chat speaking
- w2[0] != '@') // symbol for @commands
+ w2[0] != '%' // symbol of party chat speaking
+ )
command_symbol = w2[0];
}
fclose(fp);
@@ -701,3 +703,44 @@ int charcommand_stats_all(const int fd, struct map_session_data* sd, const char*
return 0;
}
+/*==========================================
+ * CharSpiritBall Function by PalasX
+ *------------------------------------------
+ */
+int charcommand_spiritball(const int fd, struct map_session_data* sd,const char* command, const char* message)
+{
+ struct map_session_data *pl_sd;
+ char character[100];
+ int spirit = 0;
+
+ memset(character, '\0', sizeof(character));
+
+ if(!message || !*message || sscanf(message, "%d %99[^\n]", &spirit, character) < 2 || spirit < 0 || spirit > 1000) {
+ clif_displaymessage(fd, "Usage: @spiritball <number: 0-1000>) <CHARACTER_NAME>.");
+ return -1;
+ }
+
+ if((pl_sd = map_nick2sd(character)) != NULL) {
+ if (spirit >= 0 && spirit <= 0x7FFF) {
+ if (pl_sd->spiritball != spirit || spirit > 999) {
+ if (pl_sd->spiritball > 0)
+ pc_delspiritball(pl_sd, pl_sd->spiritball, 1);
+ pl_sd->spiritball = spirit;
+ clif_spiritball(pl_sd);
+ // no message, player can look the difference
+ if (spirit > 1000)
+ clif_displaymessage(fd, msg_table[204]); // WARNING: more than 1000 spiritballs can CRASH your server and/or client!
+ } else {
+ clif_displaymessage(fd, msg_table[205]); // You already have this number of spiritballs.
+ return -1;
+ }
+ } else {
+ clif_displaymessage(fd, msg_table[37]); // An invalid number was specified.
+ return -1;
+ }
+ } else {
+ clif_displaymessage(fd, msg_table[3]); // Character not found.
+ return -1;
+ }
+ return 0;
+}