diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-15 21:12:45 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-15 21:12:45 +0000 |
commit | 9a309db58c70c994d7f937a243b52fe27a6c1f1d (patch) | |
tree | e3e40a7c60acb6a17687505da4197a77f355e1bf /src/map/charcommand.c | |
parent | 4aacac823607e804583d401bc2e27e7ca94865b6 (diff) | |
download | hercules-9a309db58c70c994d7f937a243b52fe27a6c1f1d.tar.gz hercules-9a309db58c70c994d7f937a243b52fe27a6c1f1d.tar.bz2 hercules-9a309db58c70c994d7f937a243b52fe27a6c1f1d.tar.xz hercules-9a309db58c70c994d7f937a243b52fe27a6c1f1d.zip |
- Cleaned up some of the pet related @/# commands, same for some script commands.
- Moved s_pet structure from map_session_data to pet_data, this enabled the removal of a few redundant values in the pet_data structure (name, class, equip)
- Pet offensive skills who's inf value is self will be casted on the pet now (for stuff like Grand Cross)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8301 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/charcommand.c')
-rw-r--r-- | src/map/charcommand.c | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/src/map/charcommand.c b/src/map/charcommand.c index d2a75eb1d..740f7465d 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -362,6 +362,7 @@ int charcommand_petrename( {
char character[NAME_LENGTH];
struct map_session_data *pl_sd;
+ struct pet_data *pd;
memset(character, '\0', sizeof(character));
@@ -370,26 +371,26 @@ int charcommand_petrename( return -1;
}
- if ((pl_sd = map_nick2sd(character)) != NULL) {
- if (pl_sd->status.pet_id > 0 && pl_sd->pd) {
- if (pl_sd->pet.rename_flag != 0) {
- pl_sd->pet.rename_flag = 0;
- intif_save_petdata(pl_sd->status.account_id, &pl_sd->pet);
- clif_send_petstatus(pl_sd);
- clif_displaymessage(fd, msg_table[189]); // This player can now rename his/her pet.
- } else {
- clif_displaymessage(fd, msg_table[190]); // This player can already rename his/her pet.
- return -1;
- }
- } else {
- clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet.
- return -1;
- }
- } else {
+ if ((pl_sd = map_nick2sd(character)) == NULL) {
clif_displaymessage(fd, msg_txt(3)); // Character not found.
return -1;
}
+ if (!pl_sd->status.pet_id || !pl_sd->pd) {
+ clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet.
+ return -1;
+ }
+
+ pd = pl_sd->pd;
+
+ if (pd->pet.rename_flag) {
+ clif_displaymessage(fd, msg_table[190]); // This player can already rename his/her pet.
+ return -1;
+ }
+ pd->pet.rename_flag = 0;
+ intif_save_petdata(pl_sd->status.account_id, &pd->pet);
+ clif_send_petstatus(pl_sd);
+ clif_displaymessage(fd, msg_table[189]); // This player can now rename his/her pet.
return 0;
}
@@ -403,9 +404,9 @@ int charcommand_petfriendly( const char* command, const char* message)
{
int friendly = 0;
- int t = 0;
char character[NAME_LENGTH];
struct map_session_data *pl_sd;
+ struct pet_data *pd;
memset(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message,"%d %23s",&friendly,character) < 2) {
@@ -414,32 +415,33 @@ int charcommand_petfriendly( return -1;
}
- if (((pl_sd = map_nick2sd(character)) != NULL) && pc_isGM(sd)>pc_isGM(pl_sd)) {
- if (pl_sd->status.pet_id > 0 && pl_sd->pd) {
- if (friendly >= 0 && friendly <= 1000) {
- if (friendly != pl_sd->pet.intimate) {
- t = pl_sd->pet.intimate;
- pl_sd->pet.intimate = friendly;
- clif_send_petstatus(pl_sd);
- clif_pet_emotion(pl_sd->pd,0);
- clif_displaymessage(pl_sd->fd, msg_table[182]); // Pet friendly value changed!
- clif_displaymessage(sd->fd, msg_table[182]); // Pet friendly value changed!
- } else {
- clif_displaymessage(fd, msg_table[183]); // Pet friendly is already the good value.
- return -1;
- }
- } else {
- clif_displaymessage(fd, msg_table[37]); // An invalid number was specified.
- return -1;
- }
- } else {
- return -1;
- }
- } else {
+ if (((pl_sd = map_nick2sd(character)) == NULL) ||
+ pc_isGM(sd)<pc_isGM(pl_sd)) {
clif_displaymessage(fd, msg_txt(3)); // Character not found.
return -1;
}
+ if (!pl_sd->status.pet_id || !pl_sd->pd) {
+ clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet.
+ return -1;
+ }
+
+ if (friendly < 0 || friendly > 1000) {
+ clif_displaymessage(fd, msg_table[37]); // An invalid number was specified.
+ return -1;
+ }
+
+ pd = pl_sd->pd;
+ if (friendly == pd->pet.intimate) {
+ clif_displaymessage(fd, msg_table[183]); // Pet friendly is already the good value.
+ return -1;
+ }
+
+ pd->pet.intimate = friendly;
+ clif_send_petstatus(pl_sd);
+ clif_pet_emotion(pd,0);
+ clif_displaymessage(pl_sd->fd, msg_table[182]); // Pet friendly value changed!
+ clif_displaymessage(sd->fd, msg_table[182]); // Pet friendly value changed!
return 0;
}
|