diff options
author | Haru <haru@dotalux.com> | 2020-06-28 02:04:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 02:04:04 +0200 |
commit | 74e33aee9e47d0d74bf3ff58b55a823729c529ad (patch) | |
tree | 48d68c2a3c59c9260f7d39089ffd7c1ae8508e69 /src/map/atcommand.c | |
parent | 44db4ecf056d23a114c033eecd7f907a92217a77 (diff) | |
parent | 604962fd2a7e69c812708d0cb9cfe4130e595ea2 (diff) | |
download | hercules-74e33aee9e47d0d74bf3ff58b55a823729c529ad.tar.gz hercules-74e33aee9e47d0d74bf3ff58b55a823729c529ad.tar.bz2 hercules-74e33aee9e47d0d74bf3ff58b55a823729c529ad.tar.xz hercules-74e33aee9e47d0d74bf3ff58b55a823729c529ad.zip |
Merge pull request #2781 from Kenpachi2k13/pet_features
Add some pet features and minor pet code clean up
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 76448b237..9d5c601bf 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2810,10 +2810,8 @@ ACMD(petfriendly) return false; } - if (friendly != pd->pet.intimate) { // No need to update the pet's status if intimacy value won't change. + if (friendly != pd->pet.intimate) // No need to update the pet's status if intimacy value won't change. pet->set_intimate(pd, friendly); - clif->send_petstatus(sd); - } clif->message(fd, msg_fd(fd, 182)); // Pet intimacy changed. (Send message regardless of value has changed or not.) @@ -2854,10 +2852,8 @@ ACMD(pethungry) return false; } - if (hungry != pd->pet.hungry) { // No need to update the pet's status if hunger value won't change. - pd->pet.hungry = hungry; - clif->send_petstatus(sd); - } + if (hungry != pd->pet.hungry) // No need to update the pet's status if hunger value won't change. + pet->set_hunger(pd, hungry); clif->message(fd, msg_fd(fd, 185)); // Pet hunger changed. (Send message regardless of value has changed or not.) @@ -2881,6 +2877,15 @@ ACMD(petrename) } pd->pet.rename_flag = 0; + + int i; + + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET + && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); + + if (i != sd->status.inventorySize) + sd->status.inventory[i].card[3] = pet->get_card4_value(pd->pet.rename_flag, pd->pet.intimate); + intif->save_petdata(sd->status.account_id, &pd->pet); clif->send_petstatus(sd); clif->message(fd, msg_fd(fd,187)); // You can now rename your pet. @@ -8562,7 +8567,7 @@ ACMD(itemlist) if( it->card[0] == CARD0_PET ) { // pet egg - if (it->card[3]) + if ((it->card[3] & 1) != 0) StrBuf->Printf(&buf, msg_fd(fd,1348), (unsigned int)MakeDWord(it->card[1], it->card[2])); // -> (pet egg, pet id: %u, named) else StrBuf->Printf(&buf, msg_fd(fd,1349), (unsigned int)MakeDWord(it->card[1], it->card[2])); // -> (pet egg, pet id: %u, unnamed) |