summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-18 13:09:16 +0200
committerHaru <haru@dotalux.com>2015-09-25 12:55:36 +0200
commit1aea178ef7cdb76eda5600540b5fbd29fd54ff88 (patch)
tree855d4feafba212d7f36872c1b46814c1f1a85e75 /src/map/pet.c
parente99bf73af31a8b1f09b9ce033c16832ee5cac51d (diff)
downloadhercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.tar.gz
hercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.tar.bz2
hercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.tar.xz
hercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.zip
More aggressive whitespace cleanup. Follow up to 51329e6
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c76
1 files changed, 37 insertions, 39 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index 6a7924a16..2865cc901 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -107,7 +107,7 @@ int pet_attackskill(struct pet_data *pd, int target_id) {
if (DIFF_TICK(pd->ud.canact_tick, timer->gettick()) > 0)
return 0;
-
+
if (rnd()%100 < (pd->a_skill->rate +pd->pet.intimate*pd->a_skill->bonusrate/1000)) {
//Skotlex: Use pet's skill
int inf;
@@ -133,7 +133,7 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type)
int rate;
pd = sd->pd;
-
+
Assert_ret(pd->msd == 0 || pd->msd->pd == pd);
if( bl == NULL || bl->type != BL_MOB || bl->prev == NULL
@@ -186,7 +186,7 @@ int pet_sc_check(struct map_session_data *sd, int type)
return 1;
pd->recovery->timer = timer->add(timer->gettick()+pd->recovery->delay*1000,pet->recovery_timer,sd->bl.id,0);
-
+
return 0;
}
@@ -211,7 +211,7 @@ int pet_hungry(int tid, int64 tick, int id, intptr_t data) {
if (pd->pet.intimate <= 0)
return 1; //You lost the pet already, the rest is irrelevant.
-
+
pd->pet.hungry--;
if( pd->pet.hungry < 0 )
{
@@ -337,7 +337,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo)
//The pet_id value was lost? odd... restore it.
sd->status.pet_id = petinfo->pet_id;
}
-
+
i = pet->search_petDB_index(petinfo->class_,PET_CLASS);
if(i < 0) {
sd->status.pet_id = 0;
@@ -367,10 +367,10 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo)
pd->last_thinktime = timer->gettick();
pd->state.skillbonus = 0;
-
+
if( battle_config.pet_status_support )
script->run_pet(pet->db[i].pet_script,0,sd->bl.id,0);
-
+
if( pd->petDB ) {
if( pd->petDB->equip_script )
status_calc_pc(sd,SCO_NONE);
@@ -380,7 +380,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo)
else
interval = pd->petDB->hungry_delay;
}
-
+
if( interval <= 0 )
interval = 1;
pd->pet_hungry_timer = timer->add(timer->gettick() + interval, pet->hungry, sd->bl.id, 0);
@@ -567,7 +567,7 @@ bool pet_get_egg(int account_id, short pet_class, int pet_id ) {
// the first request. [Panikon]
i = pet->search_petDB_index(pet_class,PET_CLASS);
sd->catch_target_class = -1;
-
+
if(i < 0) {
intif->delete_petdata(pet_id);
return false;
@@ -594,11 +594,11 @@ int pet_menu(struct map_session_data *sd,int menunum)
nullpo_ret(sd);
if (sd->pd == NULL)
return 1;
-
+
//You lost the pet already.
if(!sd->status.pet_id || sd->pd->pet.intimate <= 0 || sd->pd->pet.incubate)
return 1;
-
+
egg_id = itemdb->exists(sd->pd->petDB->EggID);
if (egg_id) {
if ((egg_id->flag.trade_restriction&ITR_NODROP) && !pc->inventoryblank(sd)) {
@@ -606,7 +606,7 @@ int pet_menu(struct map_session_data *sd,int menunum)
return 1;
}
}
-
+
switch(menunum) {
case 0:
clif->send_petstatus(sd);
@@ -672,9 +672,9 @@ int pet_equipitem(struct map_session_data *sd,int index) {
nullpo_retr(1, sd);
pd = sd->pd;
if (!pd) return 1;
-
+
nameid = sd->status.inventory[index].nameid;
-
+
if(pd->petDB->AcceID == 0 || nameid != pd->petDB->AcceID || pd->pet.equip != 0) {
clif->equipitemack(sd,0,0,EIA_FAIL);
return 1;
@@ -843,7 +843,7 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick
pet->randomwalk(pd,tick);
return 0;
}
-
+
if (!check_distance_bl(&sd->bl, &pd->bl, pd->db->range3)) {
//Master too far, chase.
if(pd->target_id)
@@ -867,7 +867,7 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick
pd->status.speed = pd->petDB->speed;
pd->ud.state.change_walk_target = pd->ud.state.speed_changed = 1;
}
-
+
if (pd->target_id) {
target= map->id2bl(pd->target_id);
if (!target || pd->bl.m != target->m || status->isdead(target)
@@ -877,13 +877,13 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick
pet->unlocktarget(pd);
}
}
-
+
if(!target && pd->loot && pd->msd && pc_has_permission(pd->msd, PC_PERM_TRADE) && pd->loot->count < pd->loot->max && DIFF_TICK(tick,pd->ud.canact_tick)>0) {
//Use half the pet's range of sight.
map->foreachinrange(pet->ai_sub_hard_lootsearch,&pd->bl,
pd->db->range2/2, BL_ITEM,pd,&target);
}
-
+
if (!target) {
//Just walk around.
if (check_distance_bl(&sd->bl, &pd->bl, 3))
@@ -898,7 +898,7 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick
return 0;
}
-
+
if(pd->ud.target == target->id &&
(pd->ud.attacktimer != INVALID_TIMER || pd->ud.walktimer != INVALID_TIMER))
return 0; //Target already locked.
@@ -962,7 +962,7 @@ int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
if(sd_charid && sd_charid != pd->msd->status.char_id)
return 0;
-
+
if(unit->can_reach_bl(&pd->bl,bl, pd->db->range2, 1, NULL, NULL) &&
((*target) == NULL || //New target closer than previous one.
!check_distance_bl(&pd->bl, *target, distance_bl(&pd->bl, bl))))
@@ -1047,18 +1047,18 @@ int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) {
struct pet_data *pd;
int bonus;
int duration = 0;
-
+
if(sd == NULL || sd->pd==NULL || sd->pd->bonus == NULL)
return 1;
-
+
pd=sd->pd;
-
+
if(pd->bonus->timer != tid) {
ShowError("pet_skill_bonus_timer %d != %d\n",pd->bonus->timer,tid);
pd->bonus->timer = INVALID_TIMER;
return 0;
}
-
+
// determine the time for the next timer
if (pd->state.skillbonus && pd->bonus->delay > 0) {
bonus = 0;
@@ -1070,7 +1070,7 @@ int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) {
pd->bonus->timer = INVALID_TIMER;
return 0;
}
-
+
if (pd->state.skillbonus != bonus) {
pd->state.skillbonus = bonus;
status_calc_pc(sd, SCO_NONE);
@@ -1086,10 +1086,10 @@ int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) {
int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd=map->id2sd(id);
struct pet_data *pd;
-
+
if(sd==NULL || sd->pd == NULL || sd->pd->recovery == NULL)
return 1;
-
+
pd=sd->pd;
if(pd->recovery->timer != tid) {
@@ -1106,7 +1106,7 @@ int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) {
}
pd->recovery->timer = INVALID_TIMER;
-
+
return 0;
}
@@ -1120,14 +1120,14 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) {
short rate = 100;
if(sd==NULL || sd->pd == NULL || sd->pd->s_skill == NULL)
return 1;
-
+
pd=sd->pd;
-
+
if(pd->s_skill->timer != tid) {
ShowError("pet_skill_support_timer %d != %d\n",pd->s_skill->timer,tid);
return 0;
}
-
+
st = status->get_status_data(&sd->bl);
if (DIFF_TICK(pd->ud.canact_tick, tick) > 0) {
@@ -1135,7 +1135,7 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) {
pd->s_skill->timer=timer->add(pd->ud.canact_tick,pet->skill_support_timer,sd->bl.id,0);
return 0;
}
-
+
if(pc_isdead(sd) ||
(rate = get_percentage(st->sp, st->max_sp)) > pd->s_skill->sp ||
(rate = get_percentage(st->hp, st->max_hp)) > pd->s_skill->hp ||
@@ -1144,7 +1144,7 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) {
pd->s_skill->timer=timer->add(tick+(rate>10?rate:10)*100,pet->skill_support_timer,sd->bl.id,0);
return 0;
}
-
+
pet_stop_attack(pd);
pet_stop_walking(pd, STOPWALKING_FLAG_FIXPOS);
pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000,pet->skill_support_timer,sd->bl.id,0);
@@ -1307,7 +1307,7 @@ int do_init_pet(bool minimal) {
pet->item_drop_ers = ers_new(sizeof(struct item_drop),"pet.c::item_drop_ers",ERS_OPT_NONE);
pet->item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"pet.c::item_drop_list_ers",ERS_OPT_NONE);
-
+
timer->add_func_list(pet->hungry,"pet_hungry");
timer->add_func_list(pet->ai_hard,"pet_ai_hard");
timer->add_func_list(pet->skill_bonus_timer,"pet_skill_bonus_timer"); // [Valaris]
@@ -1341,16 +1341,14 @@ int do_final_pet(void)
}
void pet_defaults(void) {
pet = &pet_s;
-
+
memset(pet->db,0,sizeof(pet->db));
pet->item_drop_ers = NULL;
pet->item_drop_list_ers = NULL;
-
- /* */
+
pet->init = do_init_pet;
pet->final = do_final_pet;
-
- /* */
+
pet->hungry_val = pet_hungry_val;
pet->set_intimate = pet_set_intimate;
pet->create_egg = pet_create_egg;