From e6d726f486b00d443320269a96a0e6d9a12d8d38 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 10 Sep 2007 17:07:35 +0000 Subject: - Removed bonus bAddEffWhenHitShort as it is unneeded and unused. - Corrected getpetinfo so it actually returns "null" when there's no pet and you request the name (the docs state it so). - Also cleaned up a bit getpetinfo - Added gethominfo (which behaves in the same way as getpetinfo). - The 'maxcount' skill_db field now can store independant values per skill-level, required for Kamaitachi since it uses different range values per level. - Corrected bonus3 bAutoSpell(WhenHit) to select target enemy (rather than self) for skills with inf self and inf2 'don't target self' (aka: auto-select target skills). - Corrected map_foreachinpath to do a wall check for targets beyond the initially selected tile. - Corrected Kamaitachi's range to be 9, and the path range to be 4+SkillLv git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11169 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 73 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 16 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 7e36818e9..a5dc7696b 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11062,27 +11062,68 @@ BUILDIN_FUNC(recovery) BUILDIN_FUNC(getpetinfo) { TBL_PC *sd=script_rid2sd(st); - struct pet_data *pd; + TBL_PET *pd; int type=script_getnum(st,2); + + if(!sd || !sd->pd) { + if (type == 2) + script_pushconststr(st,"null"); + else + script_pushint(st,0); + return 0; + } + pd = sd->pd; + switch(type){ + case 0: script_pushint(st,pd->pet.pet_id); break; + case 1: script_pushint(st,pd->pet.class_); break; + case 2: script_pushstr(st,aStrdup(pd->pet.name)); break; + case 3: script_pushint(st,pd->pet.intimate); break; + case 4: script_pushint(st,pd->pet.hungry); break; + case 5: script_pushint(st,pd->pet.rename_flag); break; + default: + script_pushint(st,0); + break; + } + return 0; +} - if(sd && sd->status.pet_id && sd->pd){ - pd = sd->pd; - switch(type){ - case 0: script_pushint(st,sd->status.pet_id); break; - case 1: script_pushint(st,pd->pet.class_); break; - case 2: script_pushstr(st,aStrdup(pd->pet.name)); break; - case 3: script_pushint(st,pd->pet.intimate); break; - case 4: script_pushint(st,pd->pet.hungry); break; - case 5: script_pushint(st,pd->pet.rename_flag); break; - default: - script_pushint(st,0); - break; - } - }else{ - script_pushint(st,0); +/*========================================== + * Get your homunculus info: gethominfo(n) + * n -> 0:hom_id 1:class 2:name + * 3:friendly 4:hungry, 5: rename flag. + * 6: level + *------------------------------------------*/ +BUILDIN_FUNC(gethominfo) +{ + TBL_PC *sd=script_rid2sd(st); + TBL_HOM *hd; + int type=script_getnum(st,2); + + hd = sd?sd->hd:NULL; + if(!merc_is_hom_active(hd)) + { + if (type == 2) + script_pushconststr(st,"null"); + else + script_pushint(st,0); + return 0; + } + + switch(type){ + case 0: script_pushint(st,hd->homunculus.hom_id); break; + case 1: script_pushint(st,hd->homunculus.class_); break; + case 2: script_pushstr(st,aStrdup(hd->homunculus.name)); break; + case 3: script_pushint(st,hd->homunculus.intimacy); break; + case 4: script_pushint(st,hd->homunculus.hunger); break; + case 5: script_pushint(st,hd->homunculus.rename_flag); break; + case 6: script_pushint(st,hd->homunculus.level); break; + default: + script_pushint(st,0); + break; } return 0; } + /*========================================== * Shows wether your inventory(and equips) contain selected card or not. -- cgit v1.2.3-60-g2f50