Selaa lähdekoodia

- Added support for packet 0x229 (clif_changeoption).
- Bumped up PACKETVER to 7 to enable use of packets 0x229 and 0x22c
- Small cleanup on the calculation in the skill tree regarding spirit skills.
- Added missing next/prev initialization in chat-creation.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6359 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 vuotta sitten
vanhempi
commit
54e4cd9afc
5 muutettua tiedostoa jossa 78 lisäystä ja 15 poistoa
  1. 4 0
      Changelog-Trunk.txt
  2. 1 1
      src/map/chat.c
  3. 64 9
      src/map/clif.c
  4. 1 1
      src/map/clif.h
  5. 8 4
      src/map/pc.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/04/29
+	* Added support for packet 0x229 (clif_changeoption). [Skotlex]
+	* Bumped up PACKETVER to 7 to enable use of packets 0x229 and 0x22c
+	  [Skotlex]
+	* Added missing next/prev initialization in chat-creation. [Skotlex]
 	* Added missing sql-files/mob_db.sql... somehow it was missing from the
 	  mob_db update. [Skotlex]
 	* Clones can't be class-changed now [Skotlex]

+ 1 - 1
src/map/chat.c

@@ -45,7 +45,7 @@ int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,cha
 	cd->bl.x = sd->bl.x;
 	cd->bl.y = sd->bl.y;
 	cd->bl.type = BL_CHAT;
-
+	cd->bl.next = cd->bl.prev = NULL;
 	cd->bl.id = map_addobject(&cd->bl);	
 	if(cd->bl.id==0){
 		clif_createchat(sd,1);

+ 64 - 9
src/map/clif.c

@@ -982,7 +982,6 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
 	
 	if(pcdb_checkid(vd->class_)) { 
 #if PACKETVER > 6
-		//Packet 0x22c, still in construction. [Skotlex]
 		memset(buf,0,packet_len_table[0x22c]);
 
 		WBUFW(buf,0)=0x22c;
@@ -1094,6 +1093,32 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
 #endif
 	}
 	//Non-player sprites only require a few fields.
+#if PACKETVER > 6
+	memset(buf,0,packet_len_table[0x22c]);
+
+	WBUFW(buf,0)=0x22c;
+	WBUFL(buf,2)=bl->id;
+	WBUFW(buf,6)=status_get_speed(bl);
+	if (sc) {
+		WBUFW(buf,8)=sc->opt1;
+		WBUFW(buf,10)=sc->opt2;
+		WBUFL(buf,12)=sc->option;
+		WBUFL(buf,48)=sc->opt3;
+	}
+	WBUFW(buf,16)=vd->class_;
+	WBUFW(buf,18)=vd->hair_style; //For pets
+	WBUFW(buf,20)=vd->head_bottom;	//Pet armor
+	WBUFL(buf,26)=gettick();
+	WBUFW(buf,38)=unit_getdir(bl);
+	WBUFL(buf,40)=guild_id;
+	WBUFL(buf,44)=emblem_id;
+	WBUFPOS2(buf,54,bl->x,bl->y,ud->to_x,ud->to_y);
+	WBUFB(buf,59)=0x88; // Deals with acceleration in directions. [Valaris]
+	WBUFB(buf,60)=0;
+	WBUFB(buf,61)=0;
+	WBUFW(buf,62)=clif_setlevel(lv);
+	return packet_len_table[0x22c];
+#else
 	memset(buf,0,packet_len_table[0x7b]);
 
 	WBUFW(buf,0)=0x7b;
@@ -1117,19 +1142,30 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
 	WBUFB(buf,56)=5;
 	WBUFB(buf,57)=5;
 	WBUFW(buf,58)=clif_setlevel(lv);
-
 	return packet_len_table[0x7b];
+#endif
 }
 
 //Modifies the buffer for disguise characters and sends it to self.
 //Flag = 0: change id to negative, buf will have disguise data.
 //Flag = 1: change id to positive, class and option to make your own char invisible.
 //Luckily, the offsets that need to be changed are the same in packets 0x78, 0x7b, 0x1d8 and 0x1da
+//But no longer holds true for packet 0x22c
 static void clif_setdisguise(struct map_session_data *sd, unsigned char *buf,int len, int flag) {
+
 	if (flag) {
-		WBUFL(buf,2)=sd->bl.id;
-		WBUFW(buf,12)=OPTION_INVISIBLE;
-		WBUFW(buf,14)=sd->status.class_;
+#if PACKETVER > 6
+		if (WBUFW(buf,0)==0x22c) {
+			WBUFL(buf,12)=OPTION_INVISIBLE;
+			WBUFW(buf,16)=sd->status.class_;
+		} else {
+#endif
+			WBUFL(buf,2)=sd->bl.id;
+			WBUFW(buf,12)=OPTION_INVISIBLE;
+			WBUFW(buf,14)=sd->status.class_;
+#if PACKETVER > 6
+		}
+#endif
 	} else {
 		WBUFL(buf,2)=-sd->bl.id;
 	}
@@ -3035,12 +3071,30 @@ int clif_changeoption(struct block_list* bl)
 
 	nullpo_retr(0, bl);
 	sc = status_get_sc(bl);
-
+	if (!sc) return 0; //How can an option change if there's no sc?
+	
+#if PACKETVER > 6
+	WBUFW(buf,0) = 0x229;
+	WBUFL(buf,2) = bl->id;
+	WBUFW(buf,6) = sc->opt1;
+	WBUFW(buf,8) = sc->opt2;
+	WBUFL(buf,10) = sc->option;
+	WBUFB(buf,14) = 0;	// ??
+	if(disguised(bl)) {
+		clif_send(buf,packet_len_table[0x229],bl,AREA_WOS);
+		WBUFL(buf,2) = -bl->id;
+		clif_send(buf,packet_len_table[0x229],bl,SELF);
+		WBUFL(buf,2) = bl->id;
+		WBUFL(buf,10) = OPTION_INVISIBLE;
+		clif_send(buf,packet_len_table[0x229],bl,SELF);
+	} else
+		clif_send(buf,packet_len_table[0x229],bl,AREA);
+#else
 	WBUFW(buf,0) = 0x119;
 	WBUFL(buf,2) = bl->id;
-	WBUFW(buf,6) = sc?sc->opt1:0;
-	WBUFW(buf,8) = sc?sc->opt2:0;
-	WBUFW(buf,10) = sc?sc->option:0;
+	WBUFW(buf,6) = sc->opt1;
+	WBUFW(buf,8) = sc->opt2;
+	WBUFW(buf,10) = sc->option;
 	WBUFB(buf,12) = 0;	// ??
 	if(disguised(bl)) {
 		clif_send(buf,packet_len_table[0x119],bl,AREA_WOS);
@@ -3051,6 +3105,7 @@ int clif_changeoption(struct block_list* bl)
 		clif_send(buf,packet_len_table[0x119],bl,SELF);
 	} else
 		clif_send(buf,packet_len_table[0x119],bl,AREA);
+#endif
 
 	return 0;
 }

+ 1 - 1
src/map/clif.h

@@ -16,7 +16,7 @@ typedef unsigned int in_addr_t;
 #include "map.h"
 
 // protocol version
-#define PACKETVER			6
+#define PACKETVER			7
 
 // packet DB
 #define MAX_PACKET_DB		0x25f

+ 8 - 4
src/map/pc.c

@@ -985,10 +985,14 @@ int pc_calc_skilltree(struct map_session_data *sd)
 					f=0; // Do not unlock normal skills when Basic Skills is not maxed out (can happen because of skill reset)
 			}
 			if(sd->status.skill[id].id==0 ){
-				if(sd->sc.count && sd->sc.data[SC_SPIRIT].timer != -1 && skill_get_inf2(id)&INF2_SPIRIT_SKILL) { //Enable Spirit Skills. [Skotlex]
-					sd->status.skill[id].id=id;
-					sd->status.skill[id].lv=1;
-					sd->status.skill[id].flag=1; //So it is not saved, and tagged as a "bonus" skill.
+				if(skill_get_inf2(id)&INF2_SPIRIT_SKILL)
+				{	//Spirit skills cannot be learned, they will only show up on your tree when you get buffed.
+					if (sd->sc.count && sd->sc.data[SC_SPIRIT].timer != -1)
+					{	//Enable Spirit Skills. [Skotlex]
+						sd->status.skill[id].id=id;
+						sd->status.skill[id].lv=1;
+						sd->status.skill[id].flag=1; //So it is not saved, and tagged as a "bonus" skill.
+					}
 					flag=1;
 				} else if (f){
 					sd->status.skill[id].id=id;