summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormc_cameri <mc_cameri@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-23 10:35:02 +0000
committermc_cameri <mc_cameri@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-23 10:35:02 +0000
commitf06d1020a56c6d7602cbf5176c1ba3d3525b4c3e (patch)
treed9e826ac458290af97d8394a433da802aed33054
parentfb8340df44d09c75593c2b97dc4fdba18d081899 (diff)
downloadhercules-f06d1020a56c6d7602cbf5176c1ba3d3525b4c3e.tar.gz
hercules-f06d1020a56c6d7602cbf5176c1ba3d3525b4c3e.tar.bz2
hercules-f06d1020a56c6d7602cbf5176c1ba3d3525b4c3e.tar.xz
hercules-f06d1020a56c6d7602cbf5176c1ba3d3525b4c3e.zip
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@334 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog.txt4
-rw-r--r--conf-tmpl/charcommand_athena.conf1
-rw-r--r--src/map/atcommand.c130
-rw-r--r--src/map/atcommand.h5
-rw-r--r--src/map/charcommand.c163
-rw-r--r--src/map/charcommand.h2
-rw-r--r--src/map/map.c2
7 files changed, 152 insertions, 155 deletions
diff --git a/Changelog.txt b/Changelog.txt
index fa833028f..d6ea6c36c 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,12 +1,14 @@
Date Added
11/23
+ * @charoption is now #option [MC Cameri]
+ * @charpetfriendly is now #petfriendly [MC Cameri]
+ * @charstats is now #stats [MC Cameri]
* Skill Updates: [celest]
- Added some code for the new guild skills (10%) and Moonlit Petals (5%)
- Notes to other devs: Guild skills with id's 10000-10014 will be stored in
skill_db[500-514]
- Corrected Hilt Binding
- Corrected Assassin Cross' dual wield
-
11/22
* (TXT)Stripped some code off read_gm_accounts() and made with it addGM() [MC Cameri]
-Usage: addGM(account_id,level);
diff --git a/conf-tmpl/charcommand_athena.conf b/conf-tmpl/charcommand_athena.conf
index 1d55c0d98..2f80208df 100644
--- a/conf-tmpl/charcommand_athena.conf
+++ b/conf-tmpl/charcommand_athena.conf
@@ -11,3 +11,4 @@ job: 60
jobchange: 60
petrename: 50
petfriendly: 50
+stats: 40 \ No newline at end of file
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 7ea5eb975..adeed29c6 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -104,7 +104,6 @@ ATCOMMAND_FUNC(hatch);
ATCOMMAND_FUNC(petfriendly);
ATCOMMAND_FUNC(pethungry);
ATCOMMAND_FUNC(petrename);
-ATCOMMAND_FUNC(charpetrename); // by Yor
ATCOMMAND_FUNC(recall);
ATCOMMAND_FUNC(recallall);
ATCOMMAND_FUNC(revive);
@@ -327,9 +326,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_PetRename, "@petrename", 1, atcommand_petrename },
{ AtCommand_Recall, "@recall", 60, atcommand_recall }, // + /recall
{ AtCommand_Revive, "@revive", 60, atcommand_revive },
- { AtCommand_CharacterStats, "@charstats", 40, atcommand_character_stats },
{ AtCommand_CharacterStatsAll, "@charstatsall", 40, atcommand_character_stats_all },
- { AtCommand_CharacterOption, "@charoption", 60, atcommand_character_option },
{ AtCommand_CharacterSave, "@charsave", 60, atcommand_character_save },
{ AtCommand_Night, "@night", 80, atcommand_night },
{ AtCommand_Day, "@day", 80, atcommand_day },
@@ -4062,64 +4059,6 @@ int atcommand_revive(
*
*------------------------------------------
*/
-int atcommand_character_stats(
- const int fd, struct map_session_data* sd,
- const char* command, const char* message)
-{
- char character[100];
- char job_jobname[100];
- char output[200];
- struct map_session_data *pl_sd;
- int i;
-
- memset(character, '\0', sizeof(character));
- memset(job_jobname, '\0', sizeof(job_jobname));
- memset(output, '\0', sizeof(output));
-
- if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) {
- clif_displaymessage(fd, "Please, enter a player name (usage: @charstats <char name>).");
- return -1;
- }
-
- if ((pl_sd = map_nick2sd(character)) != NULL) {
- struct {
- const char* format;
- int value;
- } output_table[] = {
- { "Base Level - %d", pl_sd->status.base_level },
- { job_jobname, pl_sd->status.job_level },
- { "Hp - %d", pl_sd->status.hp },
- { "MaxHp - %d", pl_sd->status.max_hp },
- { "Sp - %d", pl_sd->status.sp },
- { "MaxSp - %d", pl_sd->status.max_sp },
- { "Str - %3d", pl_sd->status.str },
- { "Agi - %3d", pl_sd->status.agi },
- { "Vit - %3d", pl_sd->status.vit },
- { "Int - %3d", pl_sd->status.int_ },
- { "Dex - %3d", pl_sd->status.dex },
- { "Luk - %3d", pl_sd->status.luk },
- { "Zeny - %d", pl_sd->status.zeny },
- { NULL, 0 }
- };
- sprintf(job_jobname, "Job - %s %s", job_name(pl_sd->status.class), "(level %d)");
- sprintf(output, msg_table[53], pl_sd->status.name); // '%s' stats:
- clif_displaymessage(fd, output);
- for (i = 0; output_table[i].format != NULL; i++) {
- sprintf(output, output_table[i].format, output_table[i].value);
- clif_displaymessage(fd, output);
- }
- } else {
- clif_displaymessage(fd, msg_table[3]); // Character not found.
- return -1;
- }
-
- return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
//** Character Stats All by fritz
int atcommand_character_stats_all(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
@@ -4162,75 +4101,6 @@ int atcommand_character_stats_all(const int fd, struct map_session_data* sd, con
}
/*==========================================
- *
- *------------------------------------------
- */
-int atcommand_character_option(
- const int fd, struct map_session_data* sd,
- const char* command, const char* message)
-{
- char character[100];
- int opt1 = 0, opt2 = 0, opt3 = 0;
- struct map_session_data* pl_sd;
-
- memset(character, '\0', sizeof(character));
-
- if (!message || !*message || sscanf(message, "%d %d %d %99[^\n]", &opt1, &opt2, &opt3, character) < 4 || opt1 < 0 || opt2 < 0 || opt3 < 0) {
- clif_displaymessage(fd, "Please, enter valid options and a player name (usage: @charoption <param1> <param2> <param3> <charname>).");
- return -1;
- }
-
- if ((pl_sd = map_nick2sd(character)) != NULL) {
- if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change option only to lower or same level
- pl_sd->opt1 = opt1;
- pl_sd->opt2 = opt2;
- pl_sd->status.option = opt3;
- // fix pecopeco display
- if (pl_sd->status.class == 13 || pl_sd->status.class == 21 || pl_sd->status.class == 4014 || pl_sd->status.class == 4022) {
- if (!pc_isriding(pl_sd)) { // pl_sd have the new value...
- if (pl_sd->status.class == 13)
- pl_sd->status.class = pl_sd->view_class = 7;
- else if (pl_sd->status.class == 21)
- pl_sd->status.class = pl_sd->view_class = 14;
- else if (pl_sd->status.class == 4014)
- pl_sd->status.class = pl_sd->view_class = 4008;
- else if (pl_sd->status.class == 4022)
- pl_sd->status.class = pl_sd->view_class = 4015;
- }
- } else {
- if (pc_isriding(pl_sd)) { // pl_sd have the new value...
- if (pl_sd->disguise > 0) { // temporary prevention of crash caused by peco + disguise, will look into a better solution [Valaris] (code added by [Yor])
- pl_sd->status.option &= ~0x0020;
- } else {
- if (pl_sd->status.class == 7)
- pl_sd->status.class = pl_sd->view_class = 13;
- else if (pl_sd->status.class == 14)
- pl_sd->status.class = pl_sd->view_class = 21;
- else if (pl_sd->status.class == 4008)
- pl_sd->status.class = pl_sd->view_class = 4014;
- else if (pl_sd->status.class == 4015)
- pl_sd->status.class = pl_sd->view_class = 4022;
- else
- pl_sd->status.option &= ~0x0020;
- }
- }
- }
- clif_changeoption(&pl_sd->bl);
- pc_calcstatus(pl_sd, 0);
- clif_displaymessage(fd, msg_table[58]); // Character's options changed.
- } else {
- clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
- return -1;
- }
- } else {
- clif_displaymessage(fd, msg_table[3]); // Character not found.
- return -1;
- }
-
- return 0;
-}
-
-/*==========================================
* charchangesex command (usage: charchangesex <player_name>)
*------------------------------------------
*/
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index a87166064..f5e4fb11f 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -78,13 +78,13 @@ enum AtCommandType {
AtCommand_PetFriendly,
AtCommand_PetHungry,
AtCommand_PetRename,
- AtCommand_CharPetRename, // by Yor
+// AtCommand_CharPetRename, // by Yor, Now #petrename
AtCommand_Recall,
// AtCommand_CharacterJob, // Now #jobchange
AtCommand_Revive,
AtCommand_CharacterStats,
AtCommand_CharacterStatsAll,
- AtCommand_CharacterOption,
+// AtCommand_CharacterOption, // Now #option
AtCommand_CharacterSave,
AtCommand_CharacterLoad,
AtCommand_Night,
@@ -250,6 +250,7 @@ int atcommand_config_read(const char *cfgName);
int msg_config_read(const char *cfgName);
char *str_lower(char *str);
+char * job_name(int class);
#endif
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index c2e091302..e2aa67424 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -32,10 +32,13 @@ static char command_symbol = '#';
static char msg_table[1000][1024]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
-#define CHARCOMMAND_FUNC(x) int charcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)
+#define CCMD_FUNC(x) int charcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)
-CHARCOMMAND_FUNC(jobchange);
-CHARCOMMAND_FUNC(petrename);
+CCMD_FUNC(jobchange);
+CCMD_FUNC(petrename);
+CCMD_FUNC(petfriendly);
+CCMD_FUNC(stats);
+CCMD_FUNC(option);
#ifdef TXT_ONLY
/* TXT_ONLY */
@@ -58,6 +61,9 @@ static CharCommandInfo charcommand_info[] = {
{ CharCommandJobChange, "#job", 60, charcommand_jobchange },
{ CharCommandJobChange, "#jobchange", 60, charcommand_jobchange },
{ CharCommandPetRename, "#petrename", 50, charcommand_petrename },
+ { CharCommandPetFriendly, "#petfriendly", 50, charcommand_petfriendly },
+ { CharCommandStats, "#stats", 40, charcommand_stats },
+ { CharCommandOption, "#option", 60, charcommand_option },
#ifdef TXT_ONLY
/* TXT_ONLY */
@@ -126,12 +132,12 @@ is_charcommand(const int fd, struct map_session_data* sd, const char* message, i
p++;
if (type == CharCommand_Unknown || info.proc == NULL) {
- sprintf(output, msg_table[153], command); // %s is Unknown Command.
+ snprintf(output, sizeof(output),msg_txt(153), command); // %s is Unknown Command.
clif_displaymessage(fd, output);
} else {
if (info.proc(fd, sd, command, p) != 0) {
// Command can not be executed
- sprintf(output, msg_table[154], command); // %s failed.
+ snprintf(output, sizeof(output), msg_txt(154), command); // %s failed.
clif_displaymessage(fd, output);
}
}
@@ -213,7 +219,7 @@ int charcommand_config_read(const char *cfgName) {
FILE* fp;
if ((fp = fopen(cfgName, "r")) == NULL) {
- printf("Char commands configuration file not found: %s\n", cfgName);
+ printf("CharCommands configuration file not found: %s\n", cfgName);
return 1;
}
@@ -245,19 +251,6 @@ int charcommand_config_read(const char *cfgName) {
return 0;
}
-
-
-/*==========================================
-// # command processing functions
- *------------------------------------------
- */
-int
-charcommand_test (const int fd, struct map_session_data* sd,
- const char* command, const char* message) {
- clif_displaymessage(fd,"Works!");
- return 0;
-}
-
/*==========================================
* 対象キャラクターを転職させる upper指定で転生や養子も可能
*------------------------------------------
@@ -373,7 +366,7 @@ int charcommand_petrename(
return -1;
}
} else {
- clif_displaymessage(fd, msg_table[3]); // Character not found.
+ clif_displaymessage(fd, msg_txt(3)); // Character not found.
return -1;
}
@@ -398,7 +391,7 @@ int charcommand_petfriendly(
if (!message || !*message || sscanf(message,"%d %s",&friendly,character) < 2) {
clif_displaymessage(fd, "Please, enter a valid value (usage: "
"#petfriendly <0-1000> <player>).");
- return 0;
+ return -1;
}
if (((pl_sd = map_nick2sd(character)) != NULL) && pc_isGM(sd)>pc_isGM(pl_sd)) {
@@ -432,6 +425,64 @@ int charcommand_petfriendly(
return -1;
}
} else {
+ clif_displaymessage(fd, msg_txt(3)); // Character not found.
+ return -1;
+ }
+
+ return 0;
+}
+
+/*==========================================
+ *
+ *------------------------------------------
+ */
+int charcommand_stats(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ char character[100];
+ char job_jobname[100];
+ char output[200];
+ struct map_session_data *pl_sd;
+ int i;
+
+ memset(character, '\0', sizeof(character));
+ memset(job_jobname, '\0', sizeof(job_jobname));
+ memset(output, '\0', sizeof(output));
+
+ if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) {
+ clif_displaymessage(fd, "Please, enter a player name (usage: #stats <char name>).");
+ return -1;
+ }
+
+ if ((pl_sd = map_nick2sd(character)) != NULL) {
+ struct {
+ const char* format;
+ int value;
+ } output_table[] = {
+ { "Base Level - %d", pl_sd->status.base_level },
+ { job_jobname, pl_sd->status.job_level },
+ { "Hp - %d", pl_sd->status.hp },
+ { "MaxHp - %d", pl_sd->status.max_hp },
+ { "Sp - %d", pl_sd->status.sp },
+ { "MaxSp - %d", pl_sd->status.max_sp },
+ { "Str - %3d", pl_sd->status.str },
+ { "Agi - %3d", pl_sd->status.agi },
+ { "Vit - %3d", pl_sd->status.vit },
+ { "Int - %3d", pl_sd->status.int_ },
+ { "Dex - %3d", pl_sd->status.dex },
+ { "Luk - %3d", pl_sd->status.luk },
+ { "Zeny - %d", pl_sd->status.zeny },
+ { NULL, 0 }
+ };
+ sprintf(job_jobname, "Job - %s %s", job_name(pl_sd->status.class), "(level %d)");
+ sprintf(output, msg_table[53], pl_sd->status.name); // '%s' stats:
+ clif_displaymessage(fd, output);
+ for (i = 0; output_table[i].format != NULL; i++) {
+ sprintf(output, output_table[i].format, output_table[i].value);
+ clif_displaymessage(fd, output);
+ }
+ } else {
clif_displaymessage(fd, msg_table[3]); // Character not found.
return -1;
}
@@ -439,3 +490,73 @@ int charcommand_petfriendly(
return 0;
}
+/*==========================================
+ *
+ *------------------------------------------
+ */
+int charcommand_option(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ char character[100];
+ int opt1 = 0, opt2 = 0, opt3 = 0;
+ struct map_session_data* pl_sd;
+
+ memset(character, '\0', sizeof(character));
+
+ if (!message || !*message ||
+ sscanf(message, "%d %d %d %99[^\n]", &opt1, &opt2, &opt3, character) < 4 ||
+ opt1 < 0 || opt2 < 0 || opt3 < 0) {
+ clif_displaymessage(fd, "Please, enter valid options and a player name (usage: #option <param1> <param2> <param3> <charname>).");
+ return -1;
+ }
+
+ if ((pl_sd = map_nick2sd(character)) != NULL) {
+ if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change option only to lower or same level
+ pl_sd->opt1 = opt1;
+ pl_sd->opt2 = opt2;
+ pl_sd->status.option = opt3;
+ // fix pecopeco display
+ if (pl_sd->status.class == 13 || pl_sd->status.class == 21 || pl_sd->status.class == 4014 || pl_sd->status.class == 4022) {
+ if (!pc_isriding(pl_sd)) { // pl_sd have the new value...
+ if (pl_sd->status.class == 13)
+ pl_sd->status.class = pl_sd->view_class = 7;
+ else if (pl_sd->status.class == 21)
+ pl_sd->status.class = pl_sd->view_class = 14;
+ else if (pl_sd->status.class == 4014)
+ pl_sd->status.class = pl_sd->view_class = 4008;
+ else if (pl_sd->status.class == 4022)
+ pl_sd->status.class = pl_sd->view_class = 4015;
+ }
+ } else {
+ if (pc_isriding(pl_sd)) { // pl_sd have the new value...
+ if (pl_sd->disguise > 0) { // temporary prevention of crash caused by peco + disguise, will look into a better solution [Valaris] (code added by [Yor])
+ pl_sd->status.option &= ~0x0020;
+ } else {
+ if (pl_sd->status.class == 7)
+ pl_sd->status.class = pl_sd->view_class = 13;
+ else if (pl_sd->status.class == 14)
+ pl_sd->status.class = pl_sd->view_class = 21;
+ else if (pl_sd->status.class == 4008)
+ pl_sd->status.class = pl_sd->view_class = 4014;
+ else if (pl_sd->status.class == 4015)
+ pl_sd->status.class = pl_sd->view_class = 4022;
+ else
+ pl_sd->status.option &= ~0x0020;
+ }
+ }
+ }
+ clif_changeoption(&pl_sd->bl);
+ pc_calcstatus(pl_sd, 0);
+ clif_displaymessage(fd, msg_table[58]); // Character's options changed.
+ } else {
+ clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
+ return -1;
+ }
+ } else {
+ clif_displaymessage(fd, msg_table[3]); // Character not found.
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/map/charcommand.h b/src/map/charcommand.h
index 9a89f001e..65efb8b96 100644
--- a/src/map/charcommand.h
+++ b/src/map/charcommand.h
@@ -6,6 +6,8 @@ enum CharCommandType {
CharCommandJobChange,
CharCommandPetRename,
CharCommandPetFriendly,
+ CharCommandStats,
+ CharCommandOption,
#ifdef TXT_ONLY
/* TXT_ONLY */
diff --git a/src/map/map.c b/src/map/map.c
index 358e957fc..102354823 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2282,10 +2282,10 @@ 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);
- msg_config_read(MSG_CONF_NAME);
#ifndef TXT_ONLY
sql_config_read(SQL_CONF_NAME);
log_config_read(LOG_CONF_NAME);