summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-15 21:12:45 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-15 21:12:45 +0000
commit9a309db58c70c994d7f937a243b52fe27a6c1f1d (patch)
treee3e40a7c60acb6a17687505da4197a77f355e1bf /src/map/status.c
parent4aacac823607e804583d401bc2e27e7ca94865b6 (diff)
downloadhercules-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/status.c')
-rw-r--r--src/map/status.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 4b4609fa5..43455725b 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1361,28 +1361,26 @@ int status_calc_mob(struct mob_data* md, int first)
//Skotlex: Calculates the stats of the given pet.
int status_calc_pet(struct pet_data *pd, int first)
{
- struct map_session_data *sd;
- int lv;
nullpo_retr(0, pd);
- sd = pd->msd;
- if(!sd || sd->status.pet_id == 0 || sd->pd == NULL)
- return 0;
if (first) {
memcpy(&pd->status, &pd->db->status, sizeof(struct status_data));
pd->status.speed = pd->petDB->speed;
}
- if (battle_config.pet_lv_rate)
+ if (battle_config.pet_lv_rate && pd->msd)
{
+ struct map_session_data *sd = pd->msd;
+ int lv;
+
lv =sd->status.base_level*battle_config.pet_lv_rate/100;
if (lv < 0)
lv = 1;
- if (lv != sd->pet.level || first)
+ if (lv != pd->pet.level || first)
{
struct status_data *bstat = &pd->db->status, *status = &pd->status;
- sd->pet.level = lv;
+ pd->pet.level = lv;
if (!first) //Lv Up animation
clif_misceffect(&pd->bl, 0);
status->rhw.atk = (bstat->rhw.atk*lv)/pd->db->lv;
@@ -1415,7 +1413,7 @@ int status_calc_pet(struct pet_data *pd, int first)
}
//Support rate modifier (1000 = 100%)
- pd->rate_fix = 1000*(sd->pet.intimate - battle_config.pet_support_min_friendly)/(1000- battle_config.pet_support_min_friendly) +500;
+ pd->rate_fix = 1000*(pd->pet.intimate - battle_config.pet_support_min_friendly)/(1000- battle_config.pet_support_min_friendly) +500;
if(battle_config.pet_support_rate != 100)
pd->rate_fix = pd->rate_fix*battle_config.pet_support_rate/100;
return 1;
@@ -1793,10 +1791,11 @@ int status_calc_pc(struct map_session_data* sd,int first)
}
}
- if(sd->status.pet_id > 0 && battle_config.pet_status_support && sd->pet.intimate > 0)
+ if(sd->pd && battle_config.pet_status_support)
{ // Pet
struct pet_data *pd=sd->pd;
- if(pd && (!battle_config.pet_equip_required || pd->equip > 0) &&
+ if(pd && pd->pet.intimate > 0 &&
+ (!battle_config.pet_equip_required || pd->pet.equip > 0) &&
pd->state.skillbonus == 1 && pd->bonus) //Skotlex: Readjusted for pets
pc_bonus(sd,pd->bonus->type, pd->bonus->val);
}
@@ -3736,7 +3735,7 @@ int status_get_class(struct block_list *bl)
if(bl->type==BL_PC)
return ((struct map_session_data *)bl)->status.class_;
if(bl->type==BL_PET)
- return ((struct pet_data *)bl)->class_;
+ return ((struct pet_data *)bl)->pet.class_;
if(bl->type==BL_HOM)
return ((struct homun_data *)bl)->master->homunculus.class_;
return 0;
@@ -3754,7 +3753,7 @@ int status_get_lv(struct block_list *bl)
if(bl->type==BL_PC)
return ((TBL_PC*)bl)->status.base_level;
if(bl->type==BL_PET)
- return ((TBL_PET*)bl)->msd->pet.level;
+ return ((TBL_PET*)bl)->pet.level;
if(bl->type==BL_HOM)
return ((TBL_HOM*)bl)->master->homunculus.level;
return 1;
@@ -4014,10 +4013,10 @@ void status_set_viewdata(struct block_list *bl, int class_)
memcpy(&pd->vd, vd, sizeof(struct view_data));
if (!pcdb_checkid(vd->class_)) {
pd->vd.hair_style = battle_config.pet_hair_style;
- if(pd->equip) {
- pd->vd.head_bottom = itemdb_viewid(pd->equip);
+ if(pd->pet.equip) {
+ pd->vd.head_bottom = itemdb_viewid(pd->pet.equip);
if (!pd->vd.head_bottom)
- pd->vd.head_bottom = pd->equip;
+ pd->vd.head_bottom = pd->pet.equip;
}
}
} else if (battle_config.error_log)