summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c63
-rw-r--r--src/map/clif.h8
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/pet.c26
-rw-r--r--src/map/status.h2
5 files changed, 33 insertions, 68 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 724ce0ff0..b4975ff22 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1098,7 +1098,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFW(buf,46)=sc->opt3;
}
WBUFW(buf,14)=vd->class_;
- WBUFW(buf,16)=vd->hair_style; //For pets
+ WBUFW(buf,16)=vd->hair_style; //For pets (disables mob attack cursor)
//18W: Weapon
WBUFW(buf,20)=vd->head_bottom; //Pet armor
WBUFL(buf,22)=gettick();
@@ -1315,13 +1315,12 @@ int clif_spawn(struct block_list *bl)
WBUFW(buf,10)=sc->opt2;
WBUFW(buf,12)=sc->option;
}
- WBUFW(buf,14)=vd->hair_style;
+ WBUFW(buf,14)=vd->hair_style; //For pets (disables mob attack cursor)
//14W: Hair Style
//16W: Weapon
- //18W: Head bottom
+ WBUFW(buf,18)=vd->head_bottom; //Pet armor (ignored by client)
WBUFW(buf,20)=vd->class_;
//22W: Shield
- WBUFW(buf,24)=vd->head_bottom; //Pet armor
//24W: Head top
//26W: Head mid
//28W: Hair color
@@ -1365,12 +1364,8 @@ int clif_spawn(struct block_list *bl)
}
break;
case BL_PET:
- if (vd->head_bottom) //Pet armor display fix.
- {
- TBL_PET* pd = (TBL_PET*)bl;
- if (pd->vd.head_bottom) clif_pet_equip(pd); // needed to display pet equip properly
- clif_send_petdata_area(pd, 5, battle_config.pet_hair_style); // removes the attack cursor
- }
+ if (vd->head_bottom) //Pet armor display fix.
+ clif_pet_equip_area((TBL_PET*)bl); // needed to display pet equip properly
break;
}
return 0;
@@ -3745,22 +3740,8 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
}
break;
case BL_PET:
- if (vd->head_bottom) //Pet armor display fix.
- {
- // needed to display pet equip properly
- TBL_PET* pd = (TBL_PET*)bl;
- if (pd->vd.head_bottom)
- {
- //TODO: adjust clif_pet_equip() to support a 'target', then rewrite this mess into a function call
- int fd = sd->fd;
- WFIFOHEAD(fd,packet_len(0x1a4));
- WFIFOW(fd,0) = 0x1a4;
- WFIFOB(fd,2) = 3;
- WFIFOL(fd,3) = pd->bl.id;
- WFIFOL(fd,7) = pd->vd.head_bottom;
- WFIFOSET(fd,packet_len(0x1a4));
- }
- }
+ if (vd->head_bottom) //Pet armor display fix.
+ clif_pet_equip(sd, (TBL_PET*)bl);
break;
}
}
@@ -6132,37 +6113,21 @@ int clif_sendegg(struct map_session_data *sd)
* type = 3 -> param = accessory id
* type = 4 -> param = performance number (1-3:normal, 4:special)
* type = 5 -> param = hairstyle number
+ * If sd is null, the update is sent to nearby objects, otherwise it is sent only to that player.
*------------------------------------------*/
-int clif_send_petdata(struct map_session_data* sd, int type, int param)
-{
- int fd;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, sd->pd);
-
- fd = sd->fd;
- WFIFOHEAD(fd,packet_len(0x1a4));
- WFIFOW(fd,0) = 0x1a4;
- WFIFOB(fd,2) = type;
- WFIFOL(fd,3) = sd->pd->bl.id;
- WFIFOL(fd,7) = param;
- WFIFOSET(fd,packet_len(0x1a4));
-
- return 0;
-}
-
-int clif_send_petdata_area(struct pet_data* pd, int type, int param)
+int clif_send_petdata(struct map_session_data *sd, struct pet_data* pd, int type, int param)
{
uint8 buf[16];
-
nullpo_retr(0, pd);
WBUFW(buf,0) = 0x1a4;
WBUFB(buf,2) = type;
WBUFL(buf,3) = pd->bl.id;
WBUFL(buf,7) = param;
- clif_send(buf, packet_len(0x1a4), &pd->bl, AREA);
-
+ if (sd)
+ clif_send(buf, packet_len(0x1a4), &sd->bl, SELF);
+ else
+ clif_send(buf, packet_len(0x1a4), &pd->bl, AREA);
return 0;
}
@@ -8061,7 +8026,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(sd->pd) {
map_addblock(&sd->pd->bl);
clif_spawn(&sd->pd->bl);
- clif_send_petdata(sd,0,0);
+ clif_send_petdata(sd,sd->pd,0,0);
clif_send_petstatus(sd);
// skill_unit_move(&sd->pd->bl,gettick(),1);
}
diff --git a/src/map/clif.h b/src/map/clif.h
index bb510b94a..0037b832c 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -321,10 +321,10 @@ int clif_catch_process(struct map_session_data *sd);
int clif_pet_roulette(struct map_session_data *sd,int data);
int clif_sendegg(struct map_session_data *sd);
int clif_send_petstatus(struct map_session_data *sd);
-int clif_send_petdata(struct map_session_data* sd, int type, int param);
-int clif_send_petdata_area(struct pet_data* pd, int type, int param);
-#define clif_pet_equip(pd) clif_send_petdata_area(pd, 3, (pd)->vd.head_bottom)
-#define clif_pet_performance(pd, param) clif_send_petdata_area(pd, 4, param)
+int clif_send_petdata(struct map_session_data *sd, struct pet_data* pd, int type, int param);
+#define clif_pet_equip(sd, pd) clif_send_petdata(sd, pd, 3, (pd)->vd.head_bottom)
+#define clif_pet_equip_area(pd) clif_send_petdata(NULL, pd, 3, (pd)->vd.head_bottom)
+#define clif_pet_performance(pd, param) clif_send_petdata(NULL, pd, 4, param)
int clif_pet_emotion(struct pet_data *pd,int param);
int clif_pet_food(struct map_session_data *sd,int foodid,int fail);
diff --git a/src/map/pc.c b/src/map/pc.c
index 098c0ca94..2ab6fbb0c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4859,7 +4859,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
pet->intimate -= sd->pd->petDB->die;
if(pet->intimate < 0)
pet->intimate = 0;
- clif_send_petdata(sd,1,pet->intimate);
+ clif_send_petdata(sd,sd->pd,1,pet->intimate);
}
if(sd->pd->target_id) // Unlock all targets...
pet_unlocktarget(sd->pd);
diff --git a/src/map/pet.c b/src/map/pet.c
index ef0ade4fd..d9743332a 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -258,9 +258,9 @@ static int pet_hungry(int tid,unsigned int tick,int id,int data)
pd->status.speed = pd->db->status.speed;
}
status_calc_pet(pd, 0);
- clif_send_petdata(sd,1,pd->pet.intimate);
+ clif_send_petdata(sd,pd,1,pd->pet.intimate);
}
- clif_send_petdata(sd,2,pd->pet.hungry);
+ clif_send_petdata(sd,pd,2,pd->pet.hungry);
if(battle_config.pet_hungry_delay_rate != 100)
interval = (pd->petDB->hungry_delay*battle_config.pet_hungry_delay_rate)/100;
@@ -461,9 +461,9 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
if(sd->bl.prev != NULL) {
map_addblock(&sd->pd->bl);
clif_spawn(&sd->pd->bl);
- clif_send_petdata(sd,0,0);
- clif_send_petdata(sd,5,battle_config.pet_hair_style);
- clif_pet_equip(sd->pd);
+ clif_send_petdata(sd,sd->pd, 0,0);
+ clif_send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
+ clif_pet_equip_area(sd->pd);
clif_send_petstatus(sd);
}
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
@@ -503,9 +503,9 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
if(sd->pd && sd->bl.prev != NULL) {
map_addblock(&sd->pd->bl);
clif_spawn(&sd->pd->bl);
- clif_send_petdata(sd,0,0);
- clif_send_petdata(sd,5,battle_config.pet_hair_style);
- clif_pet_equip(sd->pd);
+ clif_send_petdata(sd,sd->pd,0,0);
+ clif_send_petdata(sd,sd->pd,5,battle_config.pet_hair_style);
+ clif_pet_equip_area(sd->pd);
clif_send_petstatus(sd);
}
}
@@ -690,7 +690,7 @@ int pet_change_name_ack(struct map_session_data *sd, char* name, int flag)
memcpy(pd->pet.name, name, NAME_LENGTH);
clif_charnameack (0,&pd->bl);
pd->pet.rename_flag = 1;
- clif_pet_equip(pd);
+ clif_pet_equip_area(pd);
clif_send_petstatus(sd);
return 1;
}
@@ -714,7 +714,7 @@ int pet_equipitem(struct map_session_data *sd,int index)
pc_delitem(sd,index,1,0);
pd->pet.equip = nameid;
status_set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data.
- clif_pet_equip(pd);
+ clif_pet_equip_area(pd);
if (battle_config.pet_equip_required)
{ //Skotlex: start support timers if need
unsigned int tick = gettick();
@@ -743,7 +743,7 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
nameid = pd->pet.equip;
pd->pet.equip = 0;
status_set_viewdata(&pd->bl, pd->pet.class_);
- clif_pet_equip(pd);
+ clif_pet_equip_area(pd);
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = nameid;
tmp_item.identify = 1;
@@ -813,8 +813,8 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd)
if(pd->pet.hungry > 100)
pd->pet.hungry = 100;
- clif_send_petdata(sd,2,pd->pet.hungry);
- clif_send_petdata(sd,1,pd->pet.intimate);
+ clif_send_petdata(sd,pd,2,pd->pet.hungry);
+ clif_send_petdata(sd,pd,1,pd->pet.intimate);
clif_pet_food(sd,pd->petDB->FoodID,1);
return 0;
diff --git a/src/map/status.h b/src/map/status.h
index fffad3db3..793989c53 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -476,7 +476,7 @@ enum {
OPT1_FREEZE,
OPT1_STUN,
OPT1_SLEEP,
- //What is 5?
+ //Aegis uses OPT1 = 5 to identify undead enemies (which also grants them immunity to the other opt1 changes)
OPT1_STONEWAIT=6 //Petrifying
};