From dd60f4c47ee5eb5b1b9aa383b1e9bc81d5a2bc61 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Sun, 27 May 2018 22:52:08 +0200 Subject: [PATCH] Added 2 new parameters for getpetinfo (#3164) Fixed inter-server handling for creation of pets that are not incubated. Thanks to @Everade for his idea. --- doc/script_commands.txt | 2 ++ src/char/int_pet.cpp | 11 ++++++++--- src/map/script.cpp | 2 ++ src/map/script.hpp | 4 +++- src/map/script_constants.hpp | 3 +++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 7af9e826bf..d3ccbdf710 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -9243,6 +9243,8 @@ currently has active. Valid types are: PETINFO_RENAMED - Pet rename flag. 0 means this pet has not been named yet. PETINFO_LEVEL - Pet level PETINFO_BLOCKID - Pet Game ID + PETINFO_EGGID - Pet egg item id + PETINFO_FOODID - Pet food item id --------------------------------------- diff --git a/src/char/int_pet.cpp b/src/char/int_pet.cpp index 436ed54973..f7ff685ae3 100644 --- a/src/char/int_pet.cpp +++ b/src/char/int_pet.cpp @@ -18,6 +18,7 @@ #include "inter.hpp" struct s_pet *pet_pt; +int mapif_load_pet(int fd, uint32 account_id, uint32 char_id, int pet_id); //--------------------------------------------------------- int inter_pet_tosql(int pet_id, struct s_pet* p) @@ -211,9 +212,13 @@ int mapif_create_pet(int fd, uint32 account_id, uint32 char_id, short pet_class, pet_pt->intimate = 1000; pet_pt->pet_id = -1; //Signal NEW pet. - if (inter_pet_tosql(pet_pt->pet_id,pet_pt)) - mapif_pet_created(fd, account_id, pet_pt); - else //Failed... + if (inter_pet_tosql(pet_pt->pet_id,pet_pt)){ + if( pet_pt->incubate ){ + mapif_pet_created(fd, account_id, pet_pt); + }else{ + mapif_load_pet(fd, account_id, char_id, pet_pt->pet_id); + } + }else //Failed... mapif_pet_created(fd, account_id, NULL); return 0; diff --git a/src/map/script.cpp b/src/map/script.cpp index f10d154acf..7c818a232e 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -14916,6 +14916,8 @@ BUILDIN_FUNC(getpetinfo) case PETINFO_RENAMED: script_pushint(st,pd->pet.rename_flag); break; case PETINFO_LEVEL: script_pushint(st,(int)pd->pet.level); break; case PETINFO_BLOCKID: script_pushint(st,pd->bl.id); break; + case PETINFO_EGGID: script_pushint(st,pd->pet.egg_id); break; + case PETINFO_FOODID: script_pushint(st,pd->get_pet_db()->FoodID); break; default: script_pushint(st,0); break; diff --git a/src/map/script.hpp b/src/map/script.hpp index eede980aff..9b6d0f6a35 100644 --- a/src/map/script.hpp +++ b/src/map/script.hpp @@ -378,7 +378,9 @@ enum petinfo_types { PETINFO_HUNGRY, PETINFO_RENAMED, PETINFO_LEVEL, - PETINFO_BLOCKID + PETINFO_BLOCKID, + PETINFO_EGGID, + PETINFO_FOODID }; enum questinfo_types { diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp index 0d31cc280e..69b341c300 100644 --- a/src/map/script_constants.hpp +++ b/src/map/script_constants.hpp @@ -3922,6 +3922,8 @@ export_constant(PETINFO_RENAMED); export_constant(PETINFO_LEVEL); export_constant(PETINFO_BLOCKID); + export_constant(PETINFO_EGGID); + export_constant(PETINFO_FOODID); // For backwards compatability - might be removed in the near future export_constant2("PET_ID",PETINFO_ID); @@ -4334,6 +4336,7 @@ export_constant(ROA_VALUE); export_constant(ROA_PARAM); + /* special card flags */ export_constant(CARD0_FORGE); export_constant(CARD0_CREATE); export_constant(CARD0_PET);