Update pet script command (#2705)

* Fixes #2703.
* Added alternative for script command bpet: birthpet.
* Added alternative for script command pet: catchpet.
* Updated documentation for script command pet.
* Added PET_CATCH_UNIVERSAL_ITEM for script command pet which will attempt to catch the targeted monster as long as it is in the pet database and the targeted monster requires the lure item used.
Thanks to @sader1992!
This commit is contained in:
Sader Fawall 2017-12-28 04:27:04 +02:00 committed by Aleos
parent 716f6c0f29
commit d19ba918ae
5 changed files with 20 additions and 3 deletions

View File

@ -9016,6 +9016,7 @@ mapflag <map name> battleground 2
---------------------------------------
*bpet;
*birthpet;
This command opens up a pet hatching window on the client connected to the
invoking character. It is used in item script for the pet incubators and will
@ -9026,13 +9027,21 @@ This is still usable outside item scripts.
---------------------------------------
*pet <pet id>;
*catchpet <pet id>;
This command is used in all the item scripts for taming items. Running this
command will make the pet catching cursor appear on the client connected to the
invoking character, usable on the monsters with the specified pet ID number. It
will still work outside an item script.
If the <pet id> is PET_CATCH_UNIVERSAL the item will attempt to catch the targeted
monster as long as it is in the pet database and does not have the MD_STATUS_IMMUNE
monster mode.
If the <pet id> is PET_CATCH_UNIVERSAL_ITEM the item will attempt to catch the targeted
monster as long as it is in the pet database and the targeted monster requires the lure
item used.
See 'doc/mob_db_mode_list.txt' for more information about monster modes.
A full list of pet IDs can be found inside 'db/pet_db.txt'.
A full list of pet IDs can be found inside 'db/(pre-)re/pet_db.txt'.
---------------------------------------
@ -9040,7 +9049,7 @@ A full list of pet IDs can be found inside 'db/pet_db.txt'.
This command will create a pet egg and put it in the invoking character's
inventory. The kind of pet is specified by pet ID numbers listed in
'db/pet_db.txt'. The egg is created exactly as if the character just successfully
'db/(pre-)re/pet_db.txt'. The egg is created exactly as if the character just successfully
caught a pet in the normal way.
// This will make you a poring:
@ -9058,7 +9067,7 @@ This function will return pet information for the pet the invoking character
currently has active. Valid types are:
PETINFO_ID - Pet ID
PETINFO_CLASS - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it
PETINFO_CLASS - Pet class number as per 'db/(pre-)re/pet_db.txt' - will tell you what kind of a pet it
is.
PETINFO_NAME - Pet name. Will return "null" if there's no pet.
PETINFO_INTIMATE - Pet friendly level (intimacy score). 1000 is full loyalty.

View File

@ -661,6 +661,10 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
if (sd->catch_target_class == PET_CATCH_UNIVERSAL && !status_has_mode(&md->status,MD_STATUS_IMMUNE))
sd->catch_target_class = md->mob_id;
//catch_target_class == PET_CATCH_UNIVERSAL_ITEM is used for catching any monster required the lure item used
else if (sd->catch_target_class == PET_CATCH_UNIVERSAL_ITEM && sd->itemid == pet_db[i].itemID)
sd->catch_target_class = md->mob_id;
if(i < 0 || sd->catch_target_class != md->mob_id) {
clif_emotion(&md->bl, ET_ANGER); //mob will do /ag if wrong lure is used on them.
clif_pet_roulette(sd,0);

View File

@ -50,6 +50,7 @@ enum e_pet_itemtype : uint8 { PET_CLASS,PET_CATCH,PET_EGG,PET_EQUIP,PET_FOOD };
enum e_pet_catch : uint16 {
PET_CATCH_FAIL = 0, ///< A catch attempt failed
PET_CATCH_UNIVERSAL = 1, ///< The catch attempt is universal (ignoring MD_STATUS_IMMUNE/Boss)
PET_CATCH_UNIVERSAL_ITEM = 2,
};
struct pet_recovery { //Stat recovery

View File

@ -23920,6 +23920,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(debugmes,"s"),
BUILDIN_DEF2(catchpet,"pet","i"),
BUILDIN_DEF2(birthpet,"bpet",""),
BUILDIN_DEF(catchpet,"i"),
BUILDIN_DEF(birthpet,""),
BUILDIN_DEF(resetlvl,"i?"),
BUILDIN_DEF(resetstatus,"?"),
BUILDIN_DEF(resetskill,"?"),

View File

@ -6102,6 +6102,7 @@
/* pet catch */
export_constant(PET_CATCH_UNIVERSAL);
export_constant(PET_CATCH_UNIVERSAL_ITEM);
#undef export_constant
#undef export_constant2