ZC_CHANGESTATE_PET
This commit is contained in:
parent
a47f868be0
commit
c0c8f2527c
@ -1748,8 +1748,10 @@ int clif_spawn( struct block_list *bl, bool walking ){
|
||||
}
|
||||
break;
|
||||
case BL_PET:
|
||||
if (vd->head_bottom)
|
||||
clif_pet_equip_area((TBL_PET*)bl); // needed to display pet equip properly
|
||||
if (vd->head_bottom) { // needed to display pet equip properly
|
||||
pet_data* pd = BL_CAST( BL_PET, bl );
|
||||
clif_pet_equip_area( *pd );
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -2027,8 +2029,10 @@ static void clif_move2( struct block_list *bl, struct view_data *vd, struct unit
|
||||
}
|
||||
break;
|
||||
case BL_PET:
|
||||
if(vd->head_bottom) // needed to display pet equip properly
|
||||
clif_pet_equip_area((TBL_PET*)bl);
|
||||
if (vd->head_bottom) { // needed to display pet equip properly
|
||||
pet_data* pd = BL_CAST( BL_PET, bl );
|
||||
clif_pet_equip_area( *pd );
|
||||
}
|
||||
break;
|
||||
}
|
||||
clif_ally_only = false;
|
||||
@ -5101,8 +5105,10 @@ void clif_getareachar_unit( map_session_data* sd,struct block_list *bl ){
|
||||
}
|
||||
break;
|
||||
case BL_PET:
|
||||
if (vd->head_bottom)
|
||||
clif_pet_equip(sd, (TBL_PET*)bl); // needed to display pet equip properly
|
||||
if (vd->head_bottom) { // needed to display pet equip properly
|
||||
pet_data* pd = BL_CAST( BL_PET, bl );
|
||||
clif_pet_equip( sd, *pd );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -8238,8 +8244,8 @@ void clif_sendegg(map_session_data *sd)
|
||||
}
|
||||
|
||||
|
||||
/// Sends a specific pet data update (ZC_CHANGESTATE_PET).
|
||||
/// 01a4 <type>.B <id>.L <data>.L
|
||||
/// Sends a specific pet data update.
|
||||
/// 01a4 <type>.B <id>.L <data>.L (ZC_CHANGESTATE_PET)
|
||||
/// type:
|
||||
/// 0 = pre-init (data = 0)
|
||||
/// 1 = intimacy (data = 0~4)
|
||||
@ -8250,19 +8256,18 @@ void clif_sendegg(map_session_data *sd)
|
||||
/// 6 = close egg selection ui and update egg in inventory (PACKETVER >= 20180704)
|
||||
///
|
||||
/// If sd is null, the update is sent to nearby objects, otherwise it is sent only to that player.
|
||||
void clif_send_petdata(map_session_data* sd, struct pet_data* pd, int type, int param)
|
||||
{
|
||||
uint8 buf[16];
|
||||
nullpo_retv(pd);
|
||||
void clif_send_petdata( map_session_data* sd, pet_data& pd, e_changestate_pet data_type, int32 value ){
|
||||
PACKET_ZC_CHANGESTATE_PET packet{};
|
||||
|
||||
WBUFW(buf,0) = 0x1a4;
|
||||
WBUFB(buf,2) = type;
|
||||
WBUFL(buf,3) = pd->bl.id;
|
||||
WBUFL(buf,7) = param;
|
||||
if (sd)
|
||||
clif_send(buf, packet_len(0x1a4), &sd->bl, SELF);
|
||||
packet.PacketType = HEADER_ZC_CHANGESTATE_PET;
|
||||
packet.type = static_cast<decltype(packet.type)>( data_type );
|
||||
packet.GID = pd.bl.id;
|
||||
packet.data = value;
|
||||
|
||||
if (sd != nullptr)
|
||||
clif_send( &packet, sizeof( packet ), &sd->bl, SELF );
|
||||
else
|
||||
clif_send(buf, packet_len(0x1a4), &pd->bl, AREA);
|
||||
clif_send( &packet, sizeof( packet ), &pd.bl, AREA );
|
||||
}
|
||||
|
||||
|
||||
@ -10794,7 +10799,7 @@ void clif_parse_LoadEndAck(int fd,map_session_data *sd)
|
||||
if(map_addblock(&sd->pd->bl))
|
||||
return;
|
||||
clif_spawn(&sd->pd->bl);
|
||||
clif_send_petdata(sd,sd->pd,0,0);
|
||||
clif_send_petdata( sd, *sd->pd, CHANGESTATEPET_INIT, 0 );
|
||||
clif_send_petstatus( *sd, *sd->pd );
|
||||
// skill_unit_move(&sd->pd->bl,gettick(),1);
|
||||
}
|
||||
|
||||
@ -791,6 +791,16 @@ enum e_ack_additem_to_cart : uint8 {
|
||||
ADDITEM_TO_CART_FAIL_COUNT = 1
|
||||
};
|
||||
|
||||
enum e_changestate_pet : uint8 {
|
||||
CHANGESTATEPET_INIT = 0,
|
||||
CHANGESTATEPET_INTIMACY = 1,
|
||||
CHANGESTATEPET_HUNGER = 2,
|
||||
CHANGESTATEPET_ACCESSORY = 3,
|
||||
CHANGESTATEPET_PERFORMANCE = 4,
|
||||
CHANGESTATEPET_HAIRSTYLE = 5,
|
||||
CHANGESTATEPET_UPDATE_EGG = 6,
|
||||
};
|
||||
|
||||
int clif_setip(const char* ip);
|
||||
void clif_setbindip(const char* ip);
|
||||
void clif_setport(uint16 port);
|
||||
@ -1091,10 +1101,9 @@ void clif_catch_process( map_session_data& sd );
|
||||
void clif_pet_roulette( map_session_data& sd, bool success );
|
||||
void clif_sendegg(map_session_data *sd);
|
||||
void clif_send_petstatus( map_session_data& sd, pet_data& pd );
|
||||
void clif_send_petdata(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(nullptr, pd, 3, (pd)->vd.head_bottom)
|
||||
#define clif_pet_performance(pd, param) clif_send_petdata(nullptr, pd, 4, param)
|
||||
void clif_send_petdata( map_session_data* sd, pet_data& pd, e_changestate_pet data_type, int32 value );
|
||||
#define clif_pet_equip(sd, pd) clif_send_petdata(sd, pd, CHANGESTATEPET_ACCESSORY, (pd).vd.head_bottom)
|
||||
#define clif_pet_equip_area(pd) clif_send_petdata(nullptr, pd, CHANGESTATEPET_ACCESSORY, (pd).vd.head_bottom)
|
||||
void clif_pet_emotion(struct pet_data *pd,int param);
|
||||
void clif_pet_food( map_session_data& sd, int32 foodid, bool success );
|
||||
void clif_pet_autofeed_status(map_session_data* sd, bool force);
|
||||
|
||||
@ -249,7 +249,6 @@
|
||||
parseable_packet(0x019f,6,clif_parse_CatchPet,2);
|
||||
parseable_packet(0x01a1,3,clif_parse_PetMenu,2);
|
||||
packet(0x01a3,5);
|
||||
packet(0x01a4,11);
|
||||
parseable_packet(0x01a5,26,clif_parse_ChangePetName,2);
|
||||
packet(0x01a6,-1);
|
||||
parseable_packet(0x01a7,4,clif_parse_SelectEgg,2);
|
||||
|
||||
@ -9669,7 +9669,7 @@ int pc_dead(map_session_data *sd,struct block_list *src)
|
||||
struct pet_data *pd = sd->pd;
|
||||
if( !mapdata->getMapFlag(MF_NOEXPPENALTY) ) {
|
||||
pet_set_intimate(pd, pd->pet.intimate + pd->get_pet_db()->die);
|
||||
clif_send_petdata(sd,sd->pd,1,pd->pet.intimate);
|
||||
clif_send_petdata( sd, *sd->pd, CHANGESTATEPET_INTIMACY, pd->pet.intimate );
|
||||
}
|
||||
if( sd->pd->target_id ) // Unlock all targets...
|
||||
pet_unlocktarget(sd->pd);
|
||||
|
||||
@ -866,11 +866,11 @@ static TIMER_FUNC(pet_hungry){
|
||||
}
|
||||
|
||||
status_calc_pet(pd,SCO_NONE);
|
||||
clif_send_petdata(sd,pd,1,pd->pet.intimate);
|
||||
clif_send_petdata( sd, *pd, CHANGESTATEPET_INTIMACY, pd->pet.intimate );
|
||||
interval = 20000; // While starving, it's every 20 seconds
|
||||
}
|
||||
|
||||
clif_send_petdata(sd,pd,2,pd->pet.hungry);
|
||||
clif_send_petdata( sd, *pd, CHANGESTATEPET_HUNGER, pd->pet.hungry );
|
||||
|
||||
if( battle_config.feature_pet_autofeed && pd->pet.autofeed && pd->pet.hungry <= battle_config.feature_pet_autofeed_rate ){
|
||||
pet_food( sd, pd );
|
||||
@ -941,7 +941,7 @@ static int pet_performance(map_session_data *sd, struct pet_data *pd)
|
||||
val = 1;
|
||||
|
||||
pet_stop_walking(pd,2000<<8);
|
||||
clif_pet_performance(pd, rnd_value(1, val));
|
||||
clif_send_petdata( nullptr, *pd, CHANGESTATEPET_PERFORMANCE, rnd_value(1, val) );
|
||||
pet_lootitem_drop(pd,nullptr);
|
||||
|
||||
return 1;
|
||||
@ -967,7 +967,7 @@ bool pet_return_egg( map_session_data *sd, struct pet_data *pd ){
|
||||
pd->pet.incubate = 1;
|
||||
#if PACKETVER >= 20180704
|
||||
clif_inventorylist(sd);
|
||||
clif_send_petdata(sd, pd, 6, 0);
|
||||
clif_send_petdata( sd, *pd, CHANGESTATEPET_UPDATE_EGG, 0 );
|
||||
#endif
|
||||
unit_free(&pd->bl,CLR_OUTSIGHT);
|
||||
|
||||
@ -1109,12 +1109,12 @@ int pet_birth_process(map_session_data *sd, struct s_pet *pet)
|
||||
return 1;
|
||||
|
||||
clif_spawn(&sd->pd->bl);
|
||||
clif_send_petdata(sd,sd->pd, 0,0);
|
||||
clif_send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
|
||||
clif_send_petdata( sd, *sd->pd, CHANGESTATEPET_INIT, 0 );
|
||||
clif_send_petdata( sd, *sd->pd, CHANGESTATEPET_HAIRSTYLE, battle_config.pet_hair_style );
|
||||
#if PACKETVER >= 20180704
|
||||
clif_send_petdata(sd, sd->pd, 6, 1);
|
||||
clif_send_petdata( sd, *sd->pd, CHANGESTATEPET_UPDATE_EGG, 1 );
|
||||
#endif
|
||||
clif_pet_equip_area(sd->pd);
|
||||
clif_pet_equip_area( *sd->pd );
|
||||
clif_send_petstatus( *sd, *sd->pd );
|
||||
clif_pet_autofeed_status(sd,true);
|
||||
}
|
||||
@ -1170,9 +1170,9 @@ int pet_recv_petdata(uint32 account_id,struct s_pet *p,int flag)
|
||||
return 1;
|
||||
|
||||
clif_spawn(&sd->pd->bl);
|
||||
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_petdata( sd, *sd->pd, CHANGESTATEPET_INIT, 0 );
|
||||
clif_send_petdata( sd, *sd->pd, CHANGESTATEPET_HAIRSTYLE, battle_config.pet_hair_style );
|
||||
clif_pet_equip_area( *sd->pd );
|
||||
clif_send_petstatus( *sd, *sd->pd );
|
||||
}
|
||||
}
|
||||
@ -1476,7 +1476,7 @@ int pet_change_name_ack(map_session_data *sd, char* name, int flag)
|
||||
safestrncpy(pd->pet.name, name, NAME_LENGTH);
|
||||
clif_name_area(&pd->bl);
|
||||
pd->pet.rename_flag = 1;
|
||||
clif_pet_equip_area(pd);
|
||||
clif_pet_equip_area( *pd );
|
||||
clif_send_petstatus( *sd, *pd );
|
||||
|
||||
int index = pet_egg_search( sd, pd->pet.pet_id );
|
||||
@ -1521,7 +1521,7 @@ int pet_equipitem(map_session_data *sd,int index)
|
||||
pc_delitem(sd,index,1,0,0,LOG_TYPE_OTHER);
|
||||
pd->pet.equip = nameid;
|
||||
status_set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data.
|
||||
clif_pet_equip_area(pd);
|
||||
clif_pet_equip_area( *pd );
|
||||
|
||||
if (battle_config.pet_equip_required) { // Skotlex: start support timers if need
|
||||
t_tick tick = gettick();
|
||||
@ -1557,7 +1557,7 @@ static int pet_unequipitem(map_session_data *sd, struct pet_data *pd)
|
||||
t_itemid nameid = pd->pet.equip;
|
||||
pd->pet.equip = 0;
|
||||
status_set_viewdata(&pd->bl, pd->pet.class_);
|
||||
clif_pet_equip_area(pd);
|
||||
clif_pet_equip_area( *pd );
|
||||
memset(&tmp_item,0,sizeof(tmp_item));
|
||||
tmp_item.nameid = nameid;
|
||||
tmp_item.identify = 1;
|
||||
@ -1643,8 +1643,8 @@ int pet_food(map_session_data *sd, struct pet_data *pd)
|
||||
|
||||
log_feeding(sd, LOG_FEED_PET, pet_db_ptr->FoodID);
|
||||
|
||||
clif_send_petdata(sd,pd,2,pd->pet.hungry);
|
||||
clif_send_petdata(sd,pd,1,pd->pet.intimate);
|
||||
clif_send_petdata( sd, *pd, CHANGESTATEPET_HUNGER, pd->pet.hungry );
|
||||
clif_send_petdata( sd, *pd, CHANGESTATEPET_INTIMACY, pd->pet.intimate );
|
||||
clif_pet_food( *sd, pet_db_ptr->FoodID, 1 );
|
||||
|
||||
return 0;
|
||||
@ -2320,9 +2320,9 @@ void pet_evolution(map_session_data *sd, int16 pet_id) {
|
||||
return;
|
||||
|
||||
clif_spawn(&sd->pd->bl);
|
||||
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_petdata( sd, *sd->pd, CHANGESTATEPET_INIT, 0 );
|
||||
clif_send_petdata( sd, *sd->pd, CHANGESTATEPET_HAIRSTYLE, battle_config.pet_hair_style );
|
||||
clif_pet_equip_area( *sd->pd );
|
||||
clif_send_petstatus( *sd, *sd->pd );
|
||||
clif_emotion(&sd->bl, ET_BEST);
|
||||
clif_specialeffect(&sd->pd->bl, EF_HO_UP, AREA);
|
||||
|
||||
@ -19347,8 +19347,8 @@ BUILDIN_FUNC(setunitdata)
|
||||
case UPET_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break;
|
||||
case UPET_X: if (!unit_walktoxy(bl, (short)value, pd->bl.y, 2)) unit_movepos(bl, (short)value, md->bl.y, 0, 0); break;
|
||||
case UPET_Y: if (!unit_walktoxy(bl, pd->bl.x, (short)value, 2)) unit_movepos(bl, pd->bl.x, (short)value, 0, 0); break;
|
||||
case UPET_HUNGER: pd->pet.hungry = cap_value((short)value, 0, 100); clif_send_petdata(map_id2sd(pd->pet.account_id), pd, 2, pd->pet.hungry); break;
|
||||
case UPET_INTIMACY: pet_set_intimate(pd, (unsigned int)value); clif_send_petdata(map_id2sd(pd->pet.account_id), pd, 1, pd->pet.intimate); break;
|
||||
case UPET_HUNGER: pd->pet.hungry = cap_value((short)value, 0, 100); clif_send_petdata( map_id2sd(pd->pet.account_id), *pd, CHANGESTATEPET_HUNGER, pd->pet.hungry ); break;
|
||||
case UPET_INTIMACY: pet_set_intimate(pd, (unsigned int)value); clif_send_petdata( map_id2sd(pd->pet.account_id), *pd, CHANGESTATEPET_INTIMACY, pd->pet.intimate ); break;
|
||||
case UPET_SPEED: pd->status.speed = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break;
|
||||
case UPET_LOOKDIR: unit_setdir(bl, (uint8)value); break;
|
||||
case UPET_CANMOVETICK: pd->ud.canmove_tick = value > 0 ? (unsigned int)value : 0; break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user