diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-08 19:25:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-12 01:03:20 +0300 |
commit | 092ffb2b754365ea5487a82c7a2c60667a471cef (patch) | |
tree | ab0e7f318c75c9d06c886cd8d51a753910526a0d /src/map/clif.c | |
parent | fbd918a61906e6ee2edfd2e05c913e8b94414458 (diff) | |
download | hercules-092ffb2b754365ea5487a82c7a2c60667a471cef.tar.gz hercules-092ffb2b754365ea5487a82c7a2c60667a471cef.tar.bz2 hercules-092ffb2b754365ea5487a82c7a2c60667a471cef.tar.xz hercules-092ffb2b754365ea5487a82c7a2c60667a471cef.zip |
Add packet id clif_hominfo (0x9f7 / ZC_PROPERTY_HOMUN_2)
Based on 3CeaM commit:
commit 296480b6b4687c8f0faf698eae38f0e775bf5f6e
Author: Rytech16 <Rytech16@cad27aaa-dce3-4a30-a00a-e4fd67c11881>
Date: Sun Apr 19 03:24:41 2015 +0000
git-svn-id: svn://svn.code.sf.net/p/v1-3ceam/code/trunk@757 cad27aaa-dce3-4a30-a00a-e4fd67c11881
Note: selected very new packet version for this id, because other servers have inconsistent data.
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 87 |
1 files changed, 53 insertions, 34 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 80f32ae67..c6689f9c0 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1495,6 +1495,15 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) struct status_data *hstatus; unsigned char buf[128]; enum homun_type htype; + int offset = 0; + +// probably can works also for < 20141223, but in 3CeaM packet size defined only for 20150513 +#if PACKETVER < 20150513 + int cmd = 0x22e; +#else + int cmd = 0x9f7; +#endif + int len = packet_len(cmd); nullpo_retv(sd); nullpo_retv(hd); @@ -1502,65 +1511,75 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) hstatus = &hd->battle_status; htype = homun->class2type(hd->homunculus.class_); - memset(buf,0,packet_len(0x22e)); - WBUFW(buf,0)=0x22e; - memcpy(WBUFP(buf,2),hd->homunculus.name,NAME_LENGTH); + memset(buf, 0, len); + WBUFW(buf, 0) = cmd; + memcpy(WBUFP(buf, 2), hd->homunculus.name, NAME_LENGTH); // Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true) - WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); - WBUFW(buf,27)=hd->homunculus.level; - WBUFW(buf,29)=hd->homunculus.hunger; - WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; - WBUFW(buf,33)=0; // equip id + WBUFB(buf, 26) = (battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf, 27) = hd->homunculus.level; + WBUFW(buf, 29) = hd->homunculus.hunger; + WBUFW(buf, 31) = (unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf, 33) = 0; // equip id #ifdef RENEWAL WBUFW(buf, 35) = cap_value(hstatus->rhw.atk2, 0, INT16_MAX); #else - WBUFW(buf,35)=cap_value(hstatus->rhw.atk2+hstatus->batk, 0, INT16_MAX); + WBUFW(buf,35) = cap_value(hstatus->rhw.atk2 + hstatus->batk, 0, INT16_MAX); #endif - WBUFW(buf,37)=cap_value(hstatus->matk_max, 0, INT16_MAX); - WBUFW(buf,39)=hstatus->hit; + WBUFW(buf,37) = cap_value(hstatus->matk_max, 0, INT16_MAX); + WBUFW(buf,39) = hstatus->hit; if (battle_config.hom_setting&0x10) - WBUFW(buf,41)=hstatus->luk/3 + 1; //crit is a +1 decimal value! Just display purpose.[Vicious] + WBUFW(buf, 41) = hstatus->luk / 3 + 1; //crit is a +1 decimal value! Just display purpose.[Vicious] else - WBUFW(buf,41)=hstatus->cri/10; + WBUFW(buf, 41) = hstatus->cri / 10; #ifdef RENEWAL WBUFW(buf, 43) = hstatus->def + hstatus->def2; WBUFW(buf, 45) = hstatus->mdef + hstatus->mdef2; #else - WBUFW(buf,43)=hstatus->def + hstatus->vit ; + WBUFW(buf, 43) =hstatus->def + hstatus->vit ; WBUFW(buf, 45) = hstatus->mdef; #endif - WBUFW(buf,47)=hstatus->flee; - WBUFW(buf,49)=(flag)?0:hstatus->amotion; + WBUFW(buf, 47) = hstatus->flee; + WBUFW(buf, 49) = (flag) ? 0 : hstatus->amotion; + +// probably can works also for < 20141223, but in 3CeaM packet size defined only for 20150513 +#if PACKETVER < 20150513 if (hstatus->max_hp > INT16_MAX) { - WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); - WBUFW(buf,53) = 100; + WBUFW(buf, 51) = hstatus->hp / (hstatus->max_hp / 100); + WBUFW(buf, 53) = 100; } else { - WBUFW(buf,51)=hstatus->hp; - WBUFW(buf,53)=hstatus->max_hp; + WBUFW(buf, 51) = hstatus->hp; + WBUFW(buf, 53) = hstatus->max_hp; } +#else + WBUFL(buf, 51) = hstatus->hp; + WBUFL(buf, 55) = hstatus->max_hp; + offset = 4; +#endif + if (hstatus->max_sp > INT16_MAX) { - WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); - WBUFW(buf,57) = 100; + WBUFW(buf, 55 + offset) = hstatus->sp / (hstatus->max_sp / 100); + WBUFW(buf, 57 + offset) = 100; } else { - WBUFW(buf,55)=hstatus->sp; - WBUFW(buf,57)=hstatus->max_sp; + WBUFW(buf, 55 + offset) = hstatus->sp; + WBUFW(buf, 57 + offset) = hstatus->max_sp; } - WBUFL(buf,59)=hd->homunculus.exp; - WBUFL(buf,63)=hd->exp_next; - switch( htype ) { + WBUFL(buf, 59 + offset) = hd->homunculus.exp; + WBUFL(buf, 63 + offset) = hd->exp_next; + switch (htype) { case HT_REG: case HT_EVO: - if( hd->homunculus.level >= battle_config.hom_max_level ) - WBUFL(buf,63)=0; + if (hd->homunculus.level >= battle_config.hom_max_level) + WBUFL(buf, 63 + offset) = 0; break; case HT_S: - if( hd->homunculus.level >= battle_config.hom_S_max_level ) - WBUFL(buf,63)=0; + if (hd->homunculus.level >= battle_config.hom_S_max_level) + WBUFL(buf, 63 + offset) = 0; break; } - WBUFW(buf,67)=hd->homunculus.skillpts; - WBUFW(buf,69)=status_get_range(&hd->bl); - clif->send(buf,packet_len(0x22e),&sd->bl,SELF); + WBUFW(buf, 67 + offset) = hd->homunculus.skillpts; + WBUFW(buf, 69 + offset) = status_get_range(&hd->bl); + + clif->send(buf, len, &sd->bl, SELF); } /// Notification about a change in homunuculus' state (ZC_CHANGESTATE_MER). |