WZ_ESTIMATION

This commit is contained in:
Atemo 2024-05-26 00:10:38 +02:00
parent 420635e7af
commit 6edc930f4a
5 changed files with 49 additions and 33 deletions

View File

@ -6261,39 +6261,33 @@ void clif_skill_teleportmessage( map_session_data& sd, e_notify_mapinfo_result r
}
/// Displays Sense (WZ_ESTIMATION) information window (ZC_MONSTER_INFO).
/// Displays Sense (WZ_ESTIMATION) information window.
/// 018c <class>.W <level>.W <size>.W <hp>.L <def>.W <race>.W <mdef>.W <element>.W
/// <water%>.B <earth%>.B <fire%>.B <wind%>.B <poison%>.B <holy%>.B <shadow%>.B <ghost%>.B <undead%>.B
void clif_skill_estimation(map_session_data *sd,struct block_list *dst)
{
struct status_data *status;
unsigned char buf[64];
int i, fix;
/// <water%>.B <earth%>.B <fire%>.B <wind%>.B <poison%>.B <holy%>.B <shadow%>.B <ghost%>.B <undead%>.B (ZC_MONSTER_INFO)
void clif_skill_estimation( map_session_data& sd, mob_data& md ){
PACKET_ZC_MONSTER_INFO packet{};
nullpo_retv(sd);
nullpo_retv(dst);
if( dst->type != BL_MOB )
return;
status = status_get_status_data(dst);
WBUFW(buf, 0)=0x18c;
WBUFW(buf, 2)=status_get_class(dst);
WBUFW(buf, 4)=status_get_lv(dst);
WBUFW(buf, 6)=status->size;
WBUFL(buf, 8)=status->hp;
WBUFW(buf,12)= (battle_config.estimation_type&1?status->def:0)
+(battle_config.estimation_type&2?status->def2:0);
WBUFW(buf,14)=status->race;
WBUFW(buf,16)= (battle_config.estimation_type&1?status->mdef:0)
+(battle_config.estimation_type&2?status->mdef2:0);
WBUFW(buf,18)= status->def_ele;
for(i=0;i<9;i++)
packet.packetType = HEADER_ZC_MONSTER_INFO;
packet.class_ = md.vd->class_;
packet.level = static_cast<decltype(packet.level)>( md.level );
packet.size = md.status.size;
packet.hp = md.status.hp;
packet.def = static_cast<decltype(packet.def)>( ((battle_config.estimation_type&1) ? md.status.def : 0 ) + ((battle_config.estimation_type&2) ? md.status.def2 : 0 ) );
packet.race = md.status.race;
packet.mdef = static_cast<decltype(packet.mdef)>( ((battle_config.estimation_type&1) ? md.status.mdef : 0 ) + ((battle_config.estimation_type&2) ? md.status.mdef2 : 0 ) );
packet.element = md.status.def_ele;
// The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex]
WBUFB(buf,20+i)= (unsigned char)((fix=elemental_attribute_db.getAttribute(status->ele_lv, i+1, status->def_ele))<0?0:fix);
packet.water = static_cast<decltype(packet.water)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 1, md.status.def_ele), (int16)0 ) );
packet.earth = static_cast<decltype(packet.earth)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 2, md.status.def_ele), (int16)0 ) );
packet.fire = static_cast<decltype(packet.fire)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 3, md.status.def_ele), (int16)0 ) );
packet.wind = static_cast<decltype(packet.wind)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 4, md.status.def_ele), (int16)0 ) );
packet.poison = static_cast<decltype(packet.poison)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 5, md.status.def_ele), (int16)0 ) );
packet.holy = static_cast<decltype(packet.holy)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 6, md.status.def_ele), (int16)0 ) );
packet.shadow = static_cast<decltype(packet.shadow)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 7, md.status.def_ele), (int16)0 ) );
packet.ghost = static_cast<decltype(packet.ghost)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 8, md.status.def_ele), (int16)0 ) );
packet.undead = static_cast<decltype(packet.undead)>( std::max( elemental_attribute_db.getAttribute(md.status.ele_lv, 9, md.status.def_ele), (int16)0 ) );
clif_send(buf,packet_len(0x18c),&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF);
clif_send( &packet, sizeof( packet ), &sd.bl, (sd.status.party_id > 0) ? PARTY_SAMEMAP : SELF );
}

View File

@ -919,7 +919,7 @@ int clif_skill_damage( block_list& src, block_list& dst, t_tick tick, int32 sdel
//int clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
bool clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,t_tick tick);
void clif_skill_poseffect( block_list& bl, uint16 skill_id, uint16 skill_lv, int32 x, int32 y, t_tick tick );
void clif_skill_estimation(map_session_data *sd,struct block_list *dst);
void clif_skill_estimation( map_session_data& sd, mob_data& md );
void clif_skill_warppoint( map_session_data* sd, uint16 skill_id, uint16 skill_lv, const char* map1, const char* map2 = "", const char* map3 = "", const char* map4 = "" );
void clif_skill_memomessage( map_session_data& sd, e_ack_remember_warppoint_result result );
void clif_skill_teleportmessage( map_session_data& sd, e_notify_mapinfo_result result );

View File

@ -231,7 +231,6 @@
packet(0x0187,6);
parseable_packet(0x018a,4,clif_parse_QuitGame,2);
packet(0x018b,4);
packet(0x018c,29);
packet(0x018d,-1);
parseable_packet( HEADER_CZ_REQMAKINGITEM, sizeof( struct PACKET_CZ_REQMAKINGITEM ), clif_parse_ProduceMix, 0 );
packet( HEADER_ZC_ACK_REQMAKINGITEM, sizeof( PACKET_ZC_ACK_REQMAKINGITEM ) );

View File

@ -1036,6 +1036,28 @@ struct PACKET_ZC_DELETEITEM_FROM_MCSTORE {
DEFINE_PACKET_HEADER(ZC_DELETEITEM_FROM_MCSTORE, 0x137);
#endif
struct PACKET_ZC_MONSTER_INFO {
int16 packetType;
uint16 class_;
uint16 level;
uint16 size;
uint32 hp;
int16 def;
uint16 race;
int16 mdef;
uint16 element;
uint8 water;
uint8 earth;
uint8 fire;
uint8 wind;
uint8 poison;
uint8 holy;
uint8 shadow;
uint8 ghost;
uint8 undead;
} __attribute__((packed));
DEFINE_PACKET_HEADER(ZC_MONSTER_INFO, 0x18c);
// NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
#pragma pack( pop )

View File

@ -9257,7 +9257,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
clif_skill_nodamage(src, bl, skill_id, skill_lv, 1);
clif_skill_estimation(sd, bl);
if (dstmd != nullptr)
clif_skill_estimation( *sd, *dstmd );
if( skill_id == MER_ESTIMATION )
sd = nullptr;
break;