Skip to content

Commit

Permalink
Fixed skill unit effect issue, wrong used packet for newer client. Ca…
Browse files Browse the repository at this point in the history
…using some skills shows wrong animation. (Partial merge from 3CeAM 2.0 r16, r17, & r18)

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
  • Loading branch information
cydh committed Aug 8, 2014
1 parent a1e53ca commit 05d3c6b
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 111 deletions.
14 changes: 11 additions & 3 deletions db/packet_db.txt
Expand Up @@ -1785,7 +1785,7 @@ packet_ver: 31

//2012-06-18
packet_ver: 32
0x0983,29
0x0983,29 // ZC_MSG_STATE_CHANGE3
0x0861,41,bookingregreq,2:4:6 //actually 12-05-03

//2012-07-02aRagexeRE (unstable)
Expand Down Expand Up @@ -1815,7 +1815,7 @@ packet_ver: 34
0x0363,6,ticksend,2
0x0365,12,searchstoreinfolistitemclick,2:6:10
0x0438,6,dropitem,2:4
0x0447,2,booking_playcancel,0
0x0447,2,booking_playcancel,0 // CZ_BLOCKING_PLAY_CANCEL
0x044A,6,clientversion,2
0x0844,2,cashshopopen,0
0x0849,16 //clif_cashshop_result
Expand Down Expand Up @@ -1867,11 +1867,16 @@ packet_ver: 34
0x0995,-1 //store itemlist normal
0x0996,-1 //store itemlist equip
0x0997,-1 //ZC_EQUIPWIN_MICROSCOPE_V5
0x0998,8,equipitem,2:4
0x0998,8,equipitem,2:4 // CZ_REQ_WEAR_EQUIP_V5
0x0999,11 // cz_wear_equipv5
0x099a,9 // take_off_equipv5
0x099b,8 //maptypeproperty2

// New Packets
0x08ff,24 // ZC_EFST_SET_ENTER
0x0984,28 // ZC_EFST_SET_ENTER2
0x099f,22 // ZC_SKILL_ENTRY4

//2013-05-15aRagexe (Yommy)
packet_ver: 35
0x0369,7,actionrequest,2:6
Expand Down Expand Up @@ -2205,6 +2210,9 @@ packet_ver: 44
0x09B8,6,bankclose,2
0x09B9,4,ZC_ACK_CLOSE_BANKING,2

//2013-07-31cRagexe
0x09ca,23 //ZC_SKILL_ENTRY5

//2013-08-07Ragexe
packet_ver: 45
0x0369,7,actionrequest,2:6
Expand Down
2 changes: 1 addition & 1 deletion db/pre-re/skill_unit_db.txt
Expand Up @@ -156,7 +156,7 @@
2490,0xea, , 0, 1,1000,enemy, 0x002 //GN_HELLS_PLANT

2555,0x104, , 0, 1:2:2:3:3,500,enemy,0x6 //RL_B_TRAP
2567,0xe7, , -1, 0,1000,enemy, 0x98 //RL_FIRE_RAIN
2567,0x105, , -1, 0,1000,enemy, 0x98 //RL_FIRE_RAIN

3006,0x86, , 0, 1,1000,enemy, 0x018 //KO_BAKURETSU
3008,0x86, , 0, 1:1:1:1:1:1:1:1:1:2,1000,enemy, 0x018 //KO_MUCHANAGE
Expand Down
2 changes: 1 addition & 1 deletion db/re/skill_unit_db.txt
Expand Up @@ -158,7 +158,7 @@
2490,0xea, , 0, 1,1000,enemy, 0x002 //GN_HELLS_PLANT

2555,0x104, , 0, 1:2:2:3:3,500,enemy,0x6 //RL_B_TRAP
2567,0xe7, , -1, 0,1000,enemy, 0x98 //RL_FIRE_RAIN
2567,0x105, , -1, 0,1000,enemy, 0x98 //RL_FIRE_RAIN

3006,0x86, , 0, 1,1000,enemy, 0x018 //KO_BAKURETSU
3008,0x86, , 0, 1:1:1:1:1:1:1:1:1:2,1000,enemy, 0x018 //KO_MUCHANAGE
Expand Down
190 changes: 93 additions & 97 deletions src/map/clif.c
Expand Up @@ -4303,6 +4303,7 @@ static int clif_calc_walkdelay(struct block_list *bl,int delay, char type, int64
/// Sends a 'damage' packet (src performs action on dst)
/// 008a <src ID>.L <dst ID>.L <server tick>.L <src speed>.L <dst speed>.L <damage>.W <div>.W <type>.B <damage2>.W (ZC_NOTIFY_ACT)
/// 02e1 <src ID>.L <dst ID>.L <server tick>.L <src speed>.L <dst speed>.L <damage>.L <div>.W <type>.B <damage2>.L (ZC_NOTIFY_ACT2)
/// 08c8 <src ID>.L <dst ID>.L <server tick>.L <src speed>.L <dst speed>.L <damage>.L <IsSPDamage>.B <div>.W <type>.B <damage2>.L (ZC_NOTIFY_ACT3) //! TODO
/// type:
/// 0 = damage [ damage: total damage, div: amount of hits, damage2: assassin dual-wield damage ]
/// 1 = pick up item
Expand Down Expand Up @@ -4507,72 +4508,108 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi
WFIFOSET(fd,packet_len(0x9d));
}

/// Notifes client about Graffiti
/// 01c9 <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B <has msg>.B <msg>.80B (ZC_SKILL_ENTRY2)
static void clif_graffiti(struct block_list *bl, struct skill_unit *unit, enum send_target target) {
unsigned char buf[128];

nullpo_retv(bl);
nullpo_retv(unit);

WBUFW(buf, 0) = 0x1c9;
WBUFL(buf, 2) = unit->bl.id;
WBUFL(buf, 6) = unit->group->src_id;
WBUFW(buf,10) = unit->bl.x;
WBUFW(buf,12) = unit->bl.y;
WBUFB(buf,14) = unit->group->unit_id;
WBUFB(buf,15) = 1;
WBUFB(buf,16) = 1;
safestrncpy((char*)WBUFP(buf,17),unit->group->valstr,MESSAGE_SIZE);
clif_send(buf,packet_len(0x1c9),bl,target);
}

/// Notifies the client of a skill unit.
/// 011f <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B (ZC_SKILL_ENTRY)
/// 01c9 <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B <has msg>.B <msg>.80B (ZC_SKILL_ENTRY2)
/// 08c7 <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.B <range>.W <visible>.B (ZC_SKILL_ENTRY3)
/// 099f <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.W <visible>.B (ZC_SKILL_ENTRY4)
static void clif_getareachar_skillunit(int type,struct map_session_data *sd, struct skill_unit *unit)
{
int fd = sd->fd;
int header=0, unit_id=0, pos=0;
/// 09ca <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.B <visible>.B <skill level>.B (ZC_SKILL_ENTRY5)
void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *unit, enum send_target target) {
int header = 0, unit_id = 0, pos = 0, fd = 0, len = -1;
unsigned char buf[128];

nullpo_retv(bl);
nullpo_retv(unit);

if (bl->type == BL_PC)
fd = ((TBL_PC*)bl)->fd;

if( unit->group->state.guildaura )
if (unit->group->state.guildaura)
return;

if (battle_config.traps_setting&1 && skill_get_inf2(unit->group->skill_id)&INF2_TRAP)
unit_id=UNT_DUMMYSKILL; //Use invisible unit id for traps.
unit_id = UNT_DUMMYSKILL; //Use invisible unit id for traps.
else if (unit->group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE)
unit_id = unit->val2&UF_SONG ? UNT_DISSONANCE : UNT_UGLYDANCE;
else if (skill_get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT))
unit_id=UNT_DUMMYSKILL; //Use invisible unit id for other case of rangedsingle unit
unit_id = UNT_DUMMYSKILL; //Use invisible unit id for other case of rangedsingle unit
else
unit_id=unit->group->unit_id;
unit_id = unit->group->unit_id;

#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) // Graffiti [Valaris]
type = 2;
if (unit_id == UNT_GRAFFITI) { // Graffiti [Valaris]
clif_graffiti(bl, unit, target);
return;
}
#endif

switch(type){
case 2: header=0x1c9; break;
case 3: header=0x8c7; break;
case 4: header=0x99f; break;
default:
case 1: header=0x11f; break;
}
#if PACKETVER <= 20120702
header = 0x011f;
//#if PACKETVER < 20110718
// header = 0x011f;
//#elif PACKETVER < 20121212
// header = 0x08c7;
#elif PACKETVER < 20130731
header = 0x099f;
#else
header = 0x09ca;
#endif

WFIFOHEAD(fd,packet_len(header));
WFIFOW(fd,pos)=header;
if(type==3 || type==4){
WFIFOW(fd, pos+2)=packet_len(header);
pos +=2;
}
WFIFOL(fd,pos+2)=unit->bl.id;
WFIFOL(fd,pos+6)=unit->group->src_id;
WFIFOW(fd,pos+10)=unit->bl.x;
WFIFOW(fd,pos+12)=unit->bl.y;
switch(type){
case 1: WFIFOB(fd,pos+14)=unit_id;
WFIFOB(fd,pos+15)=1;
len = packet_len(header);
WBUFW(buf,pos) = header;
if (header != 0x011f) {
WBUFW(buf, pos+2) = len;
pos += 2;
}
WBUFL(buf,pos+2) = unit->bl.id;
WBUFL(buf,pos+6) = unit->group->src_id;
WBUFW(buf,pos+10) = unit->bl.x;
WBUFW(buf,pos+12) = unit->bl.y;
switch (header) {
case 0x011f:
WBUFB(buf,pos+14) = unit_id;
WBUFB(buf,pos+15) = 1;
break;
case 2: WFIFOB(fd,pos+14)=unit_id;
WFIFOB(fd,pos+15)=1;
WFIFOB(fd,pos+16)=1;
safestrncpy((char*)WFIFOP(fd,pos+17),unit->group->valstr,MESSAGE_SIZE);
case 0x08c7:
WBUFB(buf,pos+14) = unit_id;
WBUFW(buf,pos+15) = unit->range;
WBUFB(buf,pos+17) = 1;
break;
case 3: WFIFOB(fd,pos+14)=unit_id;
WFIFOW(fd,pos+15)=unit->range;
WFIFOB(fd,pos+17)=1; //visible
case 0x099f:
WBUFL(buf,pos+14) = unit_id;
WBUFW(buf,pos+18) = unit->range;
WBUFB(buf,pos+20) = 1;
break;
case 4: WFIFOL(fd,pos+14)=unit_id; pos += 3;
WFIFOW(fd,pos+15)=unit->range;
WFIFOB(fd,pos+17)=1;
case 0x09ca:
WBUFL(buf,pos+14) = unit_id;
WBUFB(buf,pos+18) = (unsigned char)unit->range;
WBUFB(buf,pos+19) = 1;
WBUFB(buf,pos+20) = (unsigned char)unit->group->skill_lv;
break;
}
WFIFOSET(fd,packet_len(header));
clif_send(buf, len, bl, target);

if(unit->group->skill_id == WZ_ICEWALL)
clif_changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,5,SELF);
if (unit->group->skill_id == WZ_ICEWALL)
clif_changemapcell(fd, unit->bl.m, unit->bl.x, unit->bl.y, 5, SELF);
}


Expand Down Expand Up @@ -4641,7 +4678,7 @@ static int clif_getareachar(struct block_list* bl,va_list ap)
clif_getareachar_item(sd,(struct flooritem_data*) bl);
break;
case BL_SKILL:
clif_getareachar_skillunit(1,sd,(TBL_SKILL*)bl);
clif_getareachar_skillunit(&sd->bl, (TBL_SKILL*)bl, SELF);
break;
default:
if(&sd->bl == bl)
Expand Down Expand Up @@ -4725,7 +4762,7 @@ int clif_insight(struct block_list *bl,va_list ap)
clif_getareachar_item(tsd,(struct flooritem_data*)bl);
break;
case BL_SKILL:
clif_getareachar_skillunit(1,tsd,(TBL_SKILL*)bl);
clif_getareachar_skillunit(&tsd->bl, (TBL_SKILL*)bl, SELF);
break;
default:
clif_getareachar_unit(tsd,bl);
Expand Down Expand Up @@ -5218,51 +5255,6 @@ void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,i
clif_send(buf,packet_len(0x117),src,AREA);
}


/*==========================================
* Tells all client's nearby 'unit' sight range that it spawned
*------------------------------------------*/
//FIXME: this is just an AREA version of clif_getareachar_skillunit()
void clif_skill_setunit(struct skill_unit *unit)
{
unsigned char buf[128];

nullpo_retv(unit);

if( unit->group->state.guildaura )
return;

#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
WBUFW(buf, 0)=0x1c9;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
WBUFW(buf,10)=unit->bl.x;
WBUFW(buf,12)=unit->bl.y;
WBUFB(buf,14)=unit->group->unit_id;
WBUFB(buf,15)=1;
WBUFB(buf,16)=1;
safestrncpy((char*)WBUFP(buf,17),unit->group->valstr,MESSAGE_SIZE);
clif_send(buf,packet_len(0x1c9),&unit->bl,AREA);
return;
}
#endif
WBUFW(buf, 0)=0x11f;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
WBUFW(buf,10)=unit->bl.x;
WBUFW(buf,12)=unit->bl.y;
if (unit->group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE)
WBUFB(buf,14)=unit->val2&UF_SONG?UNT_DISSONANCE:UNT_UGLYDANCE;
else if (skill_get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT))
WBUFB(buf, 14) = UNT_DUMMYSKILL; // Only display the unit at center.
else
WBUFB(buf,14)=unit->group->unit_id;
WBUFB(buf,15)=1; // ignored by client (always gets set to 1)
clif_send(buf,packet_len(0x11f),&unit->bl,AREA);
}


/// Presents a list of available warp destinations (ZC_WARPLIST).
/// 011c <skill id>.W { <map name>.16B }*4
void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4)
Expand Down Expand Up @@ -5473,9 +5465,7 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id
/// Notifies clients of a status change.
/// 0196 <index>.W <id>.L <state>.B (ZC_MSG_STATE_CHANGE) [used for ending status changes and starting them on non-pc units (when needed)]
/// 043f <index>.W <id>.L <state>.B <remain msec>.L { <val>.L }*3 (ZC_MSG_STATE_CHANGE2) [used exclusively for starting statuses on pcs]
/// 08ff <id>.L <index>.W <remain msec>.L { <val>.L }*3 (PACKETVER >= 20111108)
/// 0983 <index>.W <id>.L <state>.B <total msec>.L <remain msec>.L { <val>.L }*3 (PACKETVER >= 20120618)
/// 0984 <id>.L <index>.W <total msec>.L <remain msec>.L { <val>.L }*3 (PACKETVER >= 20120618)
/// 0983 <index>.W <id>.L <state>.B <total msec>.L <remain msec>.L { <val>.L }*3 (ZC_MSG_STATE_CHANGE3) (PACKETVER >= 20120618)
void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3)
{
unsigned char buf[32];
Expand Down Expand Up @@ -5549,6 +5539,12 @@ void clif_status_change2(struct block_list *bl, int tid, enum send_target target
}


/// 08ff <id>.L <index>.W <remain msec>.L { <val>.L }*3 (ZC_EFST_SET_ENTER) (PACKETVER >= 20111108)
/// 0984 <id>.L <index>.W <total msec>.L <remain msec>.L { <val>.L }*3 (ZC_EFST_SET_ENTER2) (PACKETVER >= 20120618)
//! TODO
//void clif_efst_enter();


/// Send message (modified by [Yor]) (ZC_NOTIFY_PLAYERCHAT).
/// 008e <packet len>.W <message>.?B
void clif_displaymessage(const int fd, const char* mes)
Expand Down Expand Up @@ -17742,7 +17738,7 @@ void packetdb_readdb(void)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//#0x08C0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 10,
9, 7, 10, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand All @@ -17758,11 +17754,11 @@ void packetdb_readdb(void)
0, 0, 0, 0, 0, 0, 0, 14, 6, 50, 0, 0, 0, 0, 0, 0,
//#0x0980
0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
31, 0, 0, 0, 0, 0, 0, -1, 8, 11, 9, 8, 0, 0, 0, 0,
31, 0, 0, 0, 0, 0, 0, -1, 8, 11, 9, 8, 0, 0, 0, 22,
0, 0, 0, 0, 0, 0, 12, 10, 14, 10, 14, 6, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 6, 4, 6, 4, 0, 0, 0, 0, 0, 0,
//#0x09C0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,102, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0,102, 0,
0, 0, 0, 0, 2, 0, -1, 0, 2, 0, 0, 0, 0, 0, 0, 7,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand Down
3 changes: 1 addition & 2 deletions src/map/clif.h
Expand Up @@ -541,9 +541,8 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id

void clif_produceeffect(struct map_session_data* sd,int flag, unsigned short nameid);

void clif_skill_setunit(struct skill_unit *unit);
void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *unit, enum send_target target);
void clif_skill_delunit(struct skill_unit *unit);

void clif_skillunit_update(struct block_list* bl);

void clif_autospell(struct map_session_data *sd,uint16 skill_lv);
Expand Down

0 comments on commit 05d3c6b

Please sign in to comment.