summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-29 07:30:19 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-29 07:30:19 +0000
commitc8b1b09166e76fd4edcfa6787b29e4fb37371476 (patch)
tree5b78dea881ec375f8c3de4bbde066e450a5566e3 /src
parent9aa84dcd148be7aefe0d66075ca6ff4907f60952 (diff)
downloadhercules-c8b1b09166e76fd4edcfa6787b29e4fb37371476.tar.gz
hercules-c8b1b09166e76fd4edcfa6787b29e4fb37371476.tar.bz2
hercules-c8b1b09166e76fd4edcfa6787b29e4fb37371476.tar.xz
hercules-c8b1b09166e76fd4edcfa6787b29e4fb37371476.zip
- 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6359 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/chat.c2
-rw-r--r--src/map/clif.c73
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/pc.c12
4 files changed, 74 insertions, 15 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 0936b48ac..0e438cedf 100644
--- a/src/map/chat.c
+++ b/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);
diff --git a/src/map/clif.c b/src/map/clif.c
index 08bfd598c..1b15c8247 100644
--- a/src/map/clif.c
+++ b/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;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index f7a78dbce..759b5dad3 100644
--- a/src/map/clif.h
+++ b/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
diff --git a/src/map/pc.c b/src/map/pc.c
index ed8dfbf62..81a687f06 100644
--- a/src/map/pc.c
+++ b/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;