Преглед на файлове

Fixed Bug.
- Issue on packetver 20131223 or newer where skill-damage with type 6 would be considered by the client as endure-type, fixing by swapping with value 8 which presents no different graphical representation than it'd otherwise. (Hercules 1c1e10a)

- Implemented official party-leader-changed-packet (Hercules 14475dc)
- Add Older Packet ShowScript & Implemented to montransform status change parameter optional
- Add support for packet ZC_SKILL_POSTDELAY_LIST. (idAthena)

icxbb-xx преди 10 години
родител
ревизия
43f25e3509
променени са 6 файла, в които са добавени 83 реда и са изтрити 18 реда
  1. 3 2
      db/packet_db.txt
  2. 2 1
      src/map/chrif.c
  3. 62 5
      src/map/clif.c
  4. 4 0
      src/map/clif.h
  5. 2 5
      src/map/party.c
  6. 10 5
      src/map/script.c

+ 3 - 2
db/packet_db.txt

@@ -463,6 +463,7 @@ packet_ver: 5
 //0x020b,-1
 //0x020c,-1
 0x020d,-1
+0x8b3,-1
 0x8d6,6,ZC_CLEAR_DIALOG,2
 
 //2004-07-05aSakexe
@@ -1346,7 +1347,7 @@ packet_ver: 25
 
 //2008-11-12aRagexeRE
 0x043d,8
-//0x043e,-1
+0x043e,4
 0x043f,8
 
 //2008-12-17aRagexeRE
@@ -1467,7 +1468,7 @@ packet_ver: 25
 0x07fb,25
 
 //2009-12-01aRagexeRE
-//0x07fc,10
+0x07fc,10
 //0x07fd,-1
 0x07fe,26
 //0x07ff,-1

+ 2 - 1
src/map/chrif.c

@@ -1407,7 +1407,8 @@ int chrif_skillcooldown_load(int fd) {
 	count = RFIFOW(fd, 12); //sc_count
 	for (i = 0; i < count; i++) {
 		struct skill_cooldown_data *data = (struct skill_cooldown_data*) RFIFOP(fd, 14 + i * sizeof (struct skill_cooldown_data));
-		skill_blockpc_start(sd, data->skill_id, data->tick);
+		if (skill_blockpc_start(sd, data->skill_id, data->tick))
+			clif_skill_cooldown_list(sd, data->skill_id, data->tick);
 	}
 	return 0;
 }

+ 62 - 5
src/map/clif.c

@@ -5060,6 +5060,24 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned
 #endif
 }
 
+/// List of skills that have cooldown (ZC_SKILL_POSTDELAY_LIST).
+/// 043e <len>.W <skill ID>.W <tick>.L
+/// NOTE: This will tell the client which skills are currently in cooldown when a player logs on
+/// and display them in the shortcut bar. [Rytech]
+void clif_skill_cooldown_list(struct map_session_data *sd, uint16 skill_id, unsigned int tick)
+{
+#if PACKETVER >= 20081112
+	unsigned char buf[8];
+
+	nullpo_retv(sd);
+
+	WBUFW(buf,0) = 0x43e;
+	WBUFW(buf,2) = packet_len(0x43e);
+	WBUFW(buf,4) = skill_id;
+	WBUFL(buf,6) = tick;
+	clif_send(buf,packet_len(0x43e),&sd->bl,SELF);
+#endif
+}
 
 /// Skill attack effect and damage.
 /// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL)
@@ -5074,8 +5092,12 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
 	nullpo_ret(dst);
 
 	type = clif_calc_delay(type,div,damage,ddelay);
-	sc = status_get_sc(dst);
-	if(sc && sc->count) {
+
+#if PACKETVER >= 20131223
+	if( type == 6 ) type = 8;
+#endif
+
+	if( ( sc = status_get_sc(dst) ) && sc->count ) {
 		if(sc->data[SC_HALLUCINATION] && damage)
 			damage = damage*(sc->data[SC_HALLUCINATION]->val2) + rnd()%100;
 	}
@@ -17373,6 +17395,41 @@ void clif_crimson_marker(struct map_session_data *sd, struct block_list *bl, boo
 	clif_send(buf, len, &sd->bl, SELF);
 }
 
+/// [Ind/Hercules]
+void clif_showscript(struct block_list* bl, const char* message) {
+	char buf[256];
+	size_t len;
+	nullpo_retv(bl);
+
+	if(!message)
+		return;
+
+	len = strlen(message)+1;
+
+	if( len > sizeof(buf)-8 ) {
+		ShowWarning("clif_showscript: Truncating too long message '%s' (len=%d).\n", message, len);
+		len = sizeof(buf)-8;
+	}
+
+	WBUFW(buf,0) = 0x8b3;
+	WBUFW(buf,2) = (len+8);
+	WBUFL(buf,4) = bl->id;
+	safestrncpy((char *) WBUFP(buf,8), message, len);
+	clif_send((unsigned char *) buf, WBUFW(buf,2), bl, ALL_CLIENT);
+}
+
+/// [Ind/Hercules]
+void clif_party_leaderchanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) {
+	unsigned char buf[10];
+
+	nullpo_retv(sd);
+
+	WBUFW(buf,0) = 0x7fc;
+	WBUFL(buf,2) = prev_leader_aid;
+	WBUFL(buf,6) = new_leader_aid;
+	clif_send(buf,packet_len(0x7fc),&sd->bl,PARTY);
+}
+
 /**
 * !TODO: Special item that obtained, must be broadcasted by this packet
 * 07fd ?? (ZC_BROADCASTING_SPECIAL_ITEM_OBTAIN)
@@ -17670,7 +17727,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,
 	    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,  8,  0, 25,
+	    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  4, 25,
 	//#0x0440
 	   10,  4, -1,  0,  0,  0, 14,  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,
@@ -17749,7 +17806,7 @@ void packetdb_readdb(void)
 	    6,  2, -1,  4,  4,  4,  4,  8,  8,268,  6,  8,  6, 54, 30, 54,
 #endif
 	    0, 15,  8,  6, -1,  8,  8, 32, -1,  5,  0,  0,  0,  0,  0,  0,
-	    0,  0,  0,  0,  0,  0, 14, -1, -1, -1,  8, 25,  0,  0, 26,  0,
+	    0,  0,  0,  0,  0,  0, 14, -1, -1, -1,  8, 25,  10,  0, 26,  0,
 	//#0x0800
 #if PACKETVER < 20091229
 	   -1, -1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 14, 20,
@@ -17772,7 +17829,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,
 		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,  -1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	//#0x08C0
 		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,

+ 4 - 0
src/map/clif.h

@@ -528,6 +528,7 @@ void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x,
 void clif_skillcastcancel(struct block_list* bl);
 void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype);
 void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick);
+void clif_skill_cooldown_list(struct map_session_data *sd, uint16 skill_id, unsigned int tick);
 int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,int type);
 //int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type);
 int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail);
@@ -883,6 +884,9 @@ void clif_update_rankingpoint(struct map_session_data *sd, int rankingtype, int
 
 void clif_crimson_marker(struct map_session_data *sd, struct block_list *bl, bool remove);
 
+void clif_showscript(struct block_list* bl, const char* message);
+void clif_party_leaderchanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid);
+
 //void clif_broadcast_obtain_special_item(); ///TODO!
 
 #endif /* _CLIF_H_ */

+ 2 - 5
src/map/party.c

@@ -782,13 +782,10 @@ int party_changeleader(struct map_session_data *sd, struct map_session_data *tsd
 	// Change leadership.
 	p->party.member[mi].leader = 0;
 
-	if (p->data[mi].sd && p->data[mi].sd->fd)
-		clif_displaymessage(p->data[mi].sd->fd, msg_txt(sd,284));
-
 	p->party.member[tmi].leader = 1;
 
-	if (p->data[tmi].sd && p->data[tmi].sd->fd)
-		clif_displaymessage(p->data[tmi].sd->fd, msg_txt(sd,285));
+	// Update members
+	clif_party_leaderchanged(p->data[mi].sd, p->data[mi].sd->status.account_id, p->data[tmi].sd->status.account_id);
 
 	// Update info.
 	intif_party_leaderchange(p->party.party_id,p->party.member[tmi].account_id,p->party.member[tmi].char_id);

+ 10 - 5
src/map/script.c

@@ -18765,6 +18765,7 @@ BUILDIN_FUNC(montransform) {
 	enum sc_type type;
 	int tick, mob_id, val1, val2, val3, val4;
 	struct script_data *data;
+	val1 = val2 = val3 = val4 = 0;
 
 	if( (sd = script_rid2sd(st)) == NULL )
 		return 1;
@@ -18777,8 +18778,11 @@ BUILDIN_FUNC(montransform) {
 		mob_id = mobdb_checkid(script_getnum(st, 2));
 
 	tick = script_getnum(st, 3);
-	type = (sc_type)script_getnum(st, 4);
-	val1 = val2 = val3 = val4 = 0;
+
+	if (script_hasdata(st, 4))
+		type = (sc_type)script_getnum(st, 4);
+	else
+		type = SC_NONE;
 
 	if (mob_id == 0) {
 		if( data_isstring(data) )
@@ -18793,7 +18797,7 @@ BUILDIN_FUNC(montransform) {
 		return SCRIPT_CMD_FAILURE;
 	}
 
-	if (!(type > SC_NONE && type < SC_MAX)) {
+	if (!(type >= SC_NONE && type < SC_MAX)) {
 		ShowWarning("buildin_montransform: Unsupported status change id %d\n", type);
 		return SCRIPT_CMD_FAILURE;
 	}
@@ -18825,10 +18829,11 @@ BUILDIN_FUNC(montransform) {
 		}
 
 		sprintf(msg, msg_txt(sd,728), monster->name); // Traaaansformation-!! %s form!!
-		clif_disp_overhead(&sd->bl, msg);
+		clif_showscript(&sd->bl, msg);
 		status_change_end(&sd->bl, SC_MONSTER_TRANSFORM, INVALID_TIMER); // Clear previous
 		sc_start2(NULL, &sd->bl, SC_MONSTER_TRANSFORM, 100, mob_id, type, tick);
-		sc_start4(NULL, &sd->bl, type, 100, val1, val2, val3, val4, tick);
+		if (script_hasdata(st, 4))
+			sc_start4(NULL, &sd->bl, type, 100, val1, val2, val3, val4, tick);
 	}
 
 	return SCRIPT_CMD_SUCCESS;