Pārlūkot izejas kodu

- Add some support for 2013 packet thx to <Shaktoh> help
-- Add clif_maptypeproperty2 herc:4d89aa6
-- Add mmo_char_send082d herc:f69814b

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

glighta 12 gadi atpakaļ
vecāks
revīzija
01807f9a82
7 mainītis faili ar 120 papildinājumiem un 41 dzēšanām
  1. 2 0
      db/packet_db.txt
  2. 29 1
      src/char/char.c
  3. 2 2
      src/config/const.h
  4. 48 35
      src/map/clif.c
  5. 1 0
      src/map/clif.h
  6. 3 0
      src/map/duel.c
  7. 35 3
      src/map/script.c

+ 2 - 0
db/packet_db.txt

@@ -1832,6 +1832,8 @@ packet_ver: 34
 0x094E,-1,searchstoreinfo,2:4:5:9:13:14:15
 //0x0835,2,searchstoreinfonextpage,0
 //0x0838,12,searchstoreinfolistitemclick,2:6:10
+0x0447,2
+0x99b,8
 
 // New cashshop
 0x0844,2,cashshopopen,0

+ 29 - 1
src/char/char.c

@@ -1937,6 +1937,26 @@ int mmo_char_send006b(int fd, struct char_session_data* sd)
 	return 0;
 }
 
+//----------------------------------------
+// [Ind/Hercules] notify client about charselect window data
+//----------------------------------------
+void mmo_char_send082d(int fd, struct char_session_data* sd) {
+	if (save_log)
+		ShowInfo("Loading Char Data ("CL_BOLD"%d"CL_RESET")\n",sd->account_id);
+
+	WFIFOHEAD(fd,29);
+	WFIFOW(fd,0) = 0x82d;
+	WFIFOW(fd,2) = 29;
+	WFIFOB(fd,4) = sd->char_slots;
+	WFIFOB(fd,5) = MAX_CHARS - sd->char_slots;
+	WFIFOB(fd,6) = MAX_CHARS - sd->char_slots;
+	WFIFOB(fd,7) = sd->char_slots;
+	WFIFOB(fd,8) = sd->char_slots;
+	memset(WFIFOP(fd,9), 0, 20); // unused bytes
+	WFIFOSET(fd,29);
+	mmo_char_send006b(fd,sd);
+}
+
 int char_married(int pl1, int pl2)
 {
 	if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) )
@@ -2239,7 +2259,11 @@ int parse_fromlogin(int fd) {
 					WFIFOSET(i,3);
 				} else {
 					// send characters to player
-					mmo_char_send006b(i, sd);
+					#if PACKETVER >= 20130000
+						mmo_char_send082d(i, sd);
+					#else
+						mmo_char_send006b(i, sd);
+					#endif
 #if PACKETVER >=  20110309
 					if( pincode_enabled ){
 						// PIN code system enabled
@@ -4703,7 +4727,11 @@ void moveCharSlot( int fd, struct char_session_data* sd, unsigned short from, un
 
 	// We successfully moved the char - time to notify the client
 	moveCharSlotReply( fd, sd, from, 0 );
+#if PACKETVER >= 20130000
+	mmo_char_send082d(fd, sd);
+#else
 	mmo_char_send006b( fd, sd );
+#endif
 }
 
 // reason

+ 2 - 2
src/config/const.h

@@ -13,7 +13,7 @@
  */
 
 /**
- * "Sane Checks" to save you from compiling with cool bugs 
+ * "Sane Checks" to save you from compiling with cool bugs
  **/
 #if SECURE_NPCTIMEOUT_INTERVAL <= 0
 	#error SECURE_NPCTIMEOUT_INTERVAL should be at least 1 (1s)
@@ -79,7 +79,7 @@
 		if( status_get_lv(src) > 100 ) \
 			md.damage = md.damage * 150 / 100 + md.damage * status_get_lv(src) / 100;
 #else
-	#define RE_LVL_DMOD(val) 
+	#define RE_LVL_DMOD(val)
 	#define RE_LVL_MDMOD(val)
 	#define RE_LVL_TMDMOD()
 #endif

+ 48 - 35
src/map/clif.c

@@ -66,14 +66,12 @@ struct Clif_Config {
 struct s_packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB + 1];
 
 //Converts item type in case of pet eggs.
-static inline int itemtype(int type)
-{
+static inline int itemtype(int type) {
 	return ( type == IT_PETEGG ) ? IT_WEAPON : type;
 }
 
 
-static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsigned char dir)
-{
+static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsigned char dir) {
 	p += pos;
 	p[0] = (uint8)(x>>2);
 	p[1] = (uint8)((x<<6) | ((y>>4)&0x3f));
@@ -82,8 +80,7 @@ static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsig
 
 
 // client-side: x0+=sx0*0.0625-0.5 and y0+=sy0*0.0625-0.5
-static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0)
-{
+static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) {
 	p += pos;
 	p[0] = (uint8)(x0>>2);
 	p[1] = (uint8)((x0<<6) | ((y0>>4)&0x3f));
@@ -94,20 +91,17 @@ static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, sh
 }
 
 
-static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsigned char dir)
-{
+static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsigned char dir) {
 	WBUFPOS(WFIFOP(fd,pos), 0, x, y, dir);
 }
 
 
-static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0)
-{
+static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) {
 	WBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0);
 }
 
 
-static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* y, unsigned char* dir)
-{
+static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* y, unsigned char* dir) {
 	p += pos;
 
 	if( x ) {
@@ -124,8 +118,7 @@ static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short*
 }
 
 
-static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0)
-{
+static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) {
 	p += pos;
 
 	if( x0 ) {
@@ -154,28 +147,24 @@ static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short
 }
 
 
-static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir)
-{
+static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) {
 	RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir);
 }
 
 
-static inline void RFIFOPOS2(int fd, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0)
-{
+static inline void RFIFOPOS2(int fd, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) {
 	RBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0);
 }
 
 
 //To idenfity disguised characters.
-static inline bool disguised(struct block_list* bl)
-{
+static inline bool disguised(struct block_list* bl) {
 	return (bool)( bl->type == BL_PC && ((TBL_PC*)bl)->disguise );
 }
 
 
 //Guarantees that the given string does not exceeds the allowed size, as well as making sure it's null terminated. [Skotlex]
-static inline unsigned int mes_len_check(char* mes, unsigned int len, unsigned int max)
-{
+static inline unsigned int mes_len_check(char* mes, unsigned int len, unsigned int max) {
 	if( len > max )
 		len = max;
 
@@ -196,8 +185,7 @@ static int clif_parse (int fd);
 /*==========================================
  * Ip setting of map-server
  *------------------------------------------*/
-int clif_setip(const char* ip)
-{
+int clif_setip(const char* ip) {
 	char ip_str[16];
 	map_ip = host2ip(ip);
 	if (!map_ip) {
@@ -307,8 +295,7 @@ static int clif_send_sub(struct block_list *bl, va_list ap)
 	nullpo_ret(src_bl = va_arg(ap,struct block_list*));
 	type = va_arg(ap,int);
 
-	switch(type)
-	{
+	switch(type) {
 	case AREA_WOS:
 		if (bl == src_bl)
 			return 0;
@@ -880,8 +867,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un
 }
 
 //To make the assignation of the level based on limits clearer/easier. [Skotlex]
-static int clif_setlevel_sub(int lv)
-{
+static int clif_setlevel_sub(int lv) {
 	if( lv < battle_config.max_lv ) {
 		;
 	} else if( lv < battle_config.aura_lv ) {
@@ -893,8 +879,7 @@ static int clif_setlevel_sub(int lv)
 	return lv;
 }
 
-static int clif_setlevel(struct block_list* bl)
-{
+static int clif_setlevel(struct block_list* bl) {
 	int lv = status_get_lv(bl);
 	if( battle_config.client_limit_unit_lv&bl->type )
 		return clif_setlevel_sub(lv);
@@ -1647,13 +1632,12 @@ static int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data)
 /*==========================================
  *
  *------------------------------------------*/
-void clif_quitsave(int fd,struct map_session_data *sd)
-{
+void clif_quitsave(int fd,struct map_session_data *sd) {
 	if (!battle_config.prevent_logout ||
 		DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout)
 		map_quit(sd);
-	else if (sd->fd)
-	{	//Disassociate session from player (session is deleted after this function was called)
+	else if (sd->fd) {
+		//Disassociate session from player (session is deleted after this function was called)
 		//And set a timer to make him quit later.
 		session[sd->fd]->session_data = NULL;
 		sd->fd = 0;
@@ -5570,6 +5554,32 @@ void clif_map_property(struct map_session_data* sd, enum map_property property)
 	WFIFOSET(fd,packet_len(0x199));
 }
 
+void clif_maptypeproperty2(struct block_list *bl,enum send_target t) {
+#if PACKETVER >= 20130000 /* not entirely sure when this started */
+	uint8 buf[8];
+
+	WBUFW(buf,0)=0x99b; //2
+	WBUFW(buf,2)=0x28; //2
+
+	WBUFB(buf,4) = RBUFB(buf,4)|0x01; //party
+	WBUFB(buf,4) = RBUFB(buf,4)|0x02; //guild
+	WBUFB(buf,4) = RBUFB(buf,4)|((map_flag_gvg2(bl->m))?0x04:0); //siege
+	WBUFB(buf,4) = RBUFB(buf,4)|0x08; //mineffect
+	WBUFB(buf,4) = RBUFB(buf,4)|0x10; //nolockon
+	WBUFB(buf,4) = RBUFB(buf,4)|((map[bl->m].flag.pvp)?0x20:0); //countpk
+	WBUFB(buf,4) = RBUFB(buf,4)|0; //nopartyformation
+	WBUFB(buf,4) = RBUFB(buf,4)|((map[bl->m].flag.battleground)?0x80:0); //battleground
+
+	WBUFB(buf,5) = RBUFB(buf,5)|0x01; //noitemconsumption
+	WBUFB(buf,5) = RBUFB(buf,5)|0x02; //cart
+	WBUFB(buf,5) = RBUFB(buf,5)|0x04; //summonstarmiracle
+//	WBUFB(buf,5) = RBUFB(buf,5)&0xf8;  //sparebit[0-4]
+
+	WBUFW(buf,6) = 0; //sparebit [5-15], + extra[4]
+
+	clif_send(buf,packet_len(0x99b),bl,t);
+#endif
+}
 
 /// Set the map type (ZC_NOTIFY_MAPPROPERTY2).
 /// 01d6 <type>.W
@@ -8248,6 +8258,7 @@ void clif_refresh(struct map_session_data *sd)
 
 	mail_clear(sd);
 
+
 	if( disguised(&sd->bl) ) {/* refresh-da */
 		short disguise = sd->disguise;
 		pc_disguise(sd, 0);
@@ -9312,6 +9323,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 
 	mail_clear(sd);
 
+	clif_maptypeproperty2(&sd->bl,SELF);
+
 	/* Guild Aura Init */
 	if( sd->state.gmaster_flag ) {
 		guild_guildaura_refresh(sd,GD_LEADERSHIP,guild_checkskill(sd->state.gmaster_flag,GD_LEADERSHIP));
@@ -16704,7 +16717,7 @@ static int packetdb_readdb(void)
 		0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,
 	//#0x0980
 		0,  0,  0, 29,  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,  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, 14,  0,  0,  0,  0,  0,  0,  0,  0,
 

+ 1 - 0
src/map/clif.h

@@ -585,6 +585,7 @@ void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned l
 void clif_heal(int fd,int type,int val);
 void clif_resurrection(struct block_list *bl,int type);
 void clif_map_property(struct map_session_data* sd, enum map_property property);
+void clif_maptypeproperty2(struct block_list *bl,enum send_target t);
 void clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum,int type);
 void clif_map_property_mapall(int map, enum map_property property);
 void clif_refine(int fd, int fail, int index, int val);

+ 3 - 0
src/map/duel.c

@@ -95,6 +95,7 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl)
 	clif_disp_onlyself(sd, output, strlen(output));
 
 	clif_map_property(sd, MAPPROPERTY_FREEPVPZONE);
+	clif_maptypeproperty2(&sd->bl,SELF);
 	//clif_misceffect2(&sd->bl, 159);
 	return i;
 }
@@ -141,6 +142,7 @@ void duel_leave(const unsigned int did, struct map_session_data* sd)
 	sd->duel_group = 0;
 	duel_savetime(sd);
 	clif_map_property(sd, MAPPROPERTY_NOTHING);
+	clif_maptypeproperty2(&sd->bl,SELF);
 }
 
 void duel_accept(const unsigned int did, struct map_session_data* sd)
@@ -157,6 +159,7 @@ void duel_accept(const unsigned int did, struct map_session_data* sd)
 	clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
 
 	clif_map_property(sd, MAPPROPERTY_FREEPVPZONE);
+	clif_maptypeproperty2(&sd->bl,SELF);
 	//clif_misceffect2(&sd->bl, 159);
 }
 

+ 35 - 3
src/map/script.c

@@ -10854,6 +10854,7 @@ static int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
 		sd->pvp_lost = 0;
 	}
 	clif_map_property(sd, MAPPROPERTY_FREEPVPZONE);
+	clif_maptypeproperty2(&sd->bl,SELF);
 	return 0;
 }
 BUILDIN_FUNC(setmapflag)
@@ -10884,9 +10885,14 @@ BUILDIN_FUNC(setmapflag)
 				break;
 			case MF_PVP_NOPARTY:		map[m].flag.pvp_noparty = 1; break;
 			case MF_PVP_NOGUILD:		map[m].flag.pvp_noguild = 1; break;
-			case MF_GVG:
+			case MF_GVG: {
+				struct block_list bl;
 				map[m].flag.gvg = 1;
 				clif_map_property_mapall(m, MAPPROPERTY_AGITZONE);
+				bl.type = BL_NUL;
+				bl.m = m;
+				clif_maptypeproperty2(&bl,ALL_SAMEMAP);
+				}
 				break;
 			case MF_GVG_NOPARTY:		map[m].flag.gvg_noparty = 1; break;
 			case MF_NOTRADE:			map[m].flag.notrade = 1; break;
@@ -10958,15 +10964,25 @@ BUILDIN_FUNC(removemapflag)
 			case MF_NOBRANCH:			map[m].flag.nobranch = 0; break;
 			case MF_NOPENALTY:			map[m].flag.noexppenalty = 0; map[m].flag.nozenypenalty = 0; break;
 			case MF_NOZENYPENALTY:		map[m].flag.nozenypenalty = 0; break;
-			case MF_PVP:
+			case MF_PVP: {
+				struct block_list bl;
+				bl.type = BL_NUL;
+				bl.m = m;
 				map[m].flag.pvp = 0;
 				clif_map_property_mapall(m, MAPPROPERTY_NOTHING);
+				clif_maptypeproperty2(&bl,ALL_SAMEMAP);
+				}
 				break;
 			case MF_PVP_NOPARTY:		map[m].flag.pvp_noparty = 0; break;
 			case MF_PVP_NOGUILD:		map[m].flag.pvp_noguild = 0; break;
-			case MF_GVG:
+			case MF_GVG: {
+				struct block_list bl;
+				bl.type = BL_NUL;
+				bl.m = m;
 				map[m].flag.gvg = 0;
 				clif_map_property_mapall(m, MAPPROPERTY_NOTHING);
+				clif_maptypeproperty2(&bl,ALL_SAMEMAP);
+				}
 				break;
 			case MF_GVG_NOPARTY:		map[m].flag.gvg_noparty = 0; break;
 			case MF_NOTRADE:			map[m].flag.notrade = 0; break;
@@ -11026,6 +11042,7 @@ BUILDIN_FUNC(pvpon)
 	const char *str;
 	TBL_PC* sd = NULL;
 	struct s_mapiterator* iter;
+	struct block_list bl;
 
 	str = script_getstr(st,2);
 	m = map_mapname2mapid(str);
@@ -11034,6 +11051,9 @@ BUILDIN_FUNC(pvpon)
 
 	map[m].flag.pvp = 1;
 	clif_map_property_mapall(m, MAPPROPERTY_FREEPVPZONE);
+	bl.type = BL_NUL;
+	bl.m = m;
+	clif_maptypeproperty2(&bl,ALL_SAMEMAP);
 
 	if(battle_config.pk_mode) // disable ranking functions if pk_mode is on [Valaris]
 		return 0;
@@ -11071,6 +11091,7 @@ BUILDIN_FUNC(pvpoff)
 {
 	int16 m;
 	const char *str;
+	struct block_list bl;
 
 	str=script_getstr(st,2);
 	m = map_mapname2mapid(str);
@@ -11079,6 +11100,9 @@ BUILDIN_FUNC(pvpoff)
 
 	map[m].flag.pvp = 0;
 	clif_map_property_mapall(m, MAPPROPERTY_NOTHING);
+	bl.type = BL_NUL;
+	bl.m = m;
+	clif_maptypeproperty2(&bl,ALL_SAMEMAP);
 
 	if(battle_config.pk_mode) // disable ranking options if pk_mode is on [Valaris]
 		return 0;
@@ -11091,12 +11115,16 @@ BUILDIN_FUNC(gvgon)
 {
 	int16 m;
 	const char *str;
+	struct block_list bl;
 
 	str=script_getstr(st,2);
 	m = map_mapname2mapid(str);
 	if(m >= 0 && !map[m].flag.gvg) {
 		map[m].flag.gvg = 1;
 		clif_map_property_mapall(m, MAPPROPERTY_AGITZONE);
+		bl.type = BL_NUL;
+		bl.m = m;
+		clif_maptypeproperty2(&bl,ALL_SAMEMAP);
 	}
 
 	return 0;
@@ -11109,8 +11137,12 @@ BUILDIN_FUNC(gvgoff)
 	str=script_getstr(st,2);
 	m = map_mapname2mapid(str);
 	if(m >= 0 && map[m].flag.gvg) {
+		struct block_list bl;
 		map[m].flag.gvg = 0;
 		clif_map_property_mapall(m, MAPPROPERTY_NOTHING);
+		bl.type = BL_NUL;
+		bl.m = m;
+		clif_maptypeproperty2(&bl,ALL_SAMEMAP);
 	}
 
 	return 0;