Browse Source

-Upd configure.in / configure
--add --enable-warn=extra to show -Wconversion issues
--move -Wno-switch from prod only to all case
-Update packet_db thx (TTest)
--fix index typo for itemlistwindowselected(all),cashshopbuy(2010-11-24 => v26-30, 2012-04-10 => v30-34) bugreport:7723
-Add utils::date2version (lookup a version with a date for later usage)
-Fix missing revert part in mmo_send_char bugreport:7734
-Merge little herc change:
--fix possible mapcrash in SCB_MATK with SC_RECOGNIZEDSPELL and change status->matk_min calculation order to speed up thing
--add OFFICIAL_WALKPATH exception for BL_NPC

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

glighta 12 years ago
parent
commit
50ded53db6
8 changed files with 186 additions and 84 deletions
  1. 35 6
      configure
  2. 39 18
      configure.in
  3. 14 14
      db/packet_db.txt
  4. 11 4
      src/char/char.c
  5. 43 3
      src/common/utils.c
  6. 2 0
      src/common/utils.h
  7. 39 37
      src/map/status.c
  8. 3 2
      src/map/unit.c

+ 35 - 6
configure

@@ -1,5 +1,5 @@
 #! /bin/sh
 #! /bin/sh
-# From configure.in Revision: 17181 .
+# From configure.in Revision: 17342 .
 # Guess values for system-dependent variables and create Makefiles.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69.
 # Generated by GNU Autoconf 2.69.
 #
 #
@@ -1325,7 +1325,7 @@ Optional Features:
   --enable-debug[=ARG]    Compiles extra debug code. (disabled by default)
   --enable-debug[=ARG]    Compiles extra debug code. (disabled by default)
                           (available options: yes, no, gdb)
                           (available options: yes, no, gdb)
   --enable-warn[=ARG]     Compiles with warnings. (disabled by default)
   --enable-warn[=ARG]     Compiles with warnings. (disabled by default)
-                          (available options: yes, no)
+                          (available options: yes, no, extra)
   --enable-buildbot[=ARG] (available options: yes, no)
   --enable-buildbot[=ARG] (available options: yes, no)
   --enable-rdtsc          Uses rdtsc as timing source (disabled by default)
   --enable-rdtsc          Uses rdtsc as timing source (disabled by default)
                           Enable it when you've timing issues. (For example:
                           Enable it when you've timing issues. (For example:
@@ -3479,6 +3479,7 @@ if test "${enable_warn+set}" = set; then :
 		case $enableval in
 		case $enableval in
 			"no");;
 			"no");;
 			"yes");;
 			"yes");;
+			"extra");;
 			*) as_fn_error $? "invalid argument --enable-warn=$enableval... stopping" "$LINENO" 5;;
 			*) as_fn_error $? "invalid argument --enable-warn=$enableval... stopping" "$LINENO" 5;;
 		esac
 		esac
 
 
@@ -4958,17 +4959,17 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 if ac_fn_c_try_compile "$LINENO"; then :
   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 $as_echo "yes" >&6; }
-		PROD_WARN="$PROD_WARN -Wno-switch"
 
 
 else
 else
 
 
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 $as_echo "no" >&6; }
+		CFLAGS="$OLD_CFLAGS"
 
 
 
 
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-CFLAGS="$OLD_CFLAGS"
+
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fPIC" >&5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fPIC" >&5
 $as_echo_n "checking whether $CC supports -fPIC... " >&6; }
 $as_echo_n "checking whether $CC supports -fPIC... " >&6; }
@@ -5020,6 +5021,31 @@ $as_echo "no" >&6; }
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
+#
+# check if support conversion check
+#
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wconversion" >&5
+$as_echo_n "checking whether $CC supports -Wconversion... " >&6; }
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wconversion"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+		EXTRA_WARN="-Wconversion"
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$OLD_CFLAGS"
+
 
 
 ###############################################################################
 ###############################################################################
 # Check for libraries and header files.
 # Check for libraries and header files.
@@ -5177,6 +5203,9 @@ case $enable_warn in
 	"yes")
 	"yes")
 		CFLAGS="$CFLAGS"
 		CFLAGS="$CFLAGS"
 		;;
 		;;
+	"extra")
+		CFLAGS="$CFLAGS $EXTRA_WARN"
+		;;
 esac
 esac
 
 
 #
 #
@@ -6119,8 +6148,8 @@ else
 $as_echo "no" >&6; }
 $as_echo "no" >&6; }
 fi
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: PROD_WARN= $PROD_WARN" >&5
-$as_echo "$as_me: PROD_WARN= $PROD_WARN" >&6;}
+#AC_MSG_NOTICE([PROD_WARN= $PROD_WARN])
+#AC_MSG_NOTICE([EXTRA_WARN= $EXTRA_WARN])
 { $as_echo "$as_me:${as_lineno-$LINENO}: Configure finish, CFLAG= $CFLAGS" >&5
 { $as_echo "$as_me:${as_lineno-$LINENO}: Configure finish, CFLAG= $CFLAGS" >&5
 $as_echo "$as_me: Configure finish, CFLAG= $CFLAGS" >&6;}
 $as_echo "$as_me: Configure finish, CFLAG= $CFLAGS" >&6;}
 ###############################################################################
 ###############################################################################

+ 39 - 18
configure.in

@@ -85,7 +85,7 @@ AC_ARG_ENABLE(
 		[--enable-warn@<:@=ARG@:>@],
 		[--enable-warn@<:@=ARG@:>@],
 		[
 		[
 			Compiles with warnings. (disabled by default)
 			Compiles with warnings. (disabled by default)
-			(available options: yes, no)
+			(available options: yes, no, extra)
 		]
 		]
 	),
 	),
 	[
 	[
@@ -93,6 +93,7 @@ AC_ARG_ENABLE(
 		case $enableval in
 		case $enableval in
 			"no");;
 			"no");;
 			"yes");;
 			"yes");;
+			"extra");;
 			*) AC_MSG_ERROR([[invalid argument --enable-warn=$enableval... stopping]]);;
 			*) AC_MSG_ERROR([[invalid argument --enable-warn=$enableval... stopping]]);;
 		esac
 		esac
 	],
 	],
@@ -120,7 +121,7 @@ AC_ARG_ENABLE(
 )
 )
 
 
 #
 #
-# RDTSC as Tick Source 
+# RDTSC as Tick Source
 #
 #
 AC_ARG_ENABLE(
 AC_ARG_ENABLE(
 	[rdtsc],
 	[rdtsc],
@@ -131,7 +132,7 @@ AC_ARG_ENABLE(
 			Enable it when you've timing issues.
 			Enable it when you've timing issues.
 
 
 			(For example:  in conjunction with XEN or Other Virtualization mechanisms)
 			(For example:  in conjunction with XEN or Other Virtualization mechanisms)
-		
+
 			Note:
 			Note:
 				Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
 				Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
 				(On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual
 				(On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual
@@ -223,9 +224,9 @@ AC_ARG_WITH(
 	),
 	),
 	[
 	[
 		if test "$withval" == "no";	 then
 		if test "$withval" == "no";	 then
-			CFLAGS="$CFLAGS -DMAXCONN=16384"	
+			CFLAGS="$CFLAGS -DMAXCONN=16384"
 		else
 		else
-			
+
 			if ! test "$withval" -ge 0 -o "$withval" -lt 0 2>&- ; then
 			if ! test "$withval" -ge 0 -o "$withval" -lt 0 2>&- ; then
 				AC_MSG_ERROR([Invalid argument --with-maxconn=$withval ... stopping])
 				AC_MSG_ERROR([Invalid argument --with-maxconn=$withval ... stopping])
 			else
 			else
@@ -389,7 +390,7 @@ if test "$enable_64bit" = "no" ; then
 fi
 fi
 
 
 
 
-# 
+#
 # check if we're producing 32bit code - so well produce binarys for at least i686 (speedup: cmovs, and cmpchg8 support)
 # check if we're producing 32bit code - so well produce binarys for at least i686 (speedup: cmovs, and cmpchg8 support)
 #
 #
 AC_MSG_CHECKING([whether $CC produces 32bit code])
 AC_MSG_CHECKING([whether $CC produces 32bit code])
@@ -414,10 +415,10 @@ AC_RUN_IFELSE(
 )
 )
 
 
 
 
-# 
-# Check if CC supports __thread attribute (Thread Local Storage) 
+#
+# Check if CC supports __thread attribute (Thread Local Storage)
 # (Usually our OSX friends 're lacking support of it in older llvm versions ..)
 # (Usually our OSX friends 're lacking support of it in older llvm versions ..)
-# 
+#
 AC_MSG_CHECKING([whether $CC supports __thread specifier (TLS)])
 AC_MSG_CHECKING([whether $CC supports __thread specifier (TLS)])
 AC_RUN_IFELSE(
 AC_RUN_IFELSE(
 	[
 	[
@@ -425,7 +426,7 @@ AC_RUN_IFELSE(
 
 
 		int main(int argc, char **argv){
 		int main(int argc, char **argv){
 			g_Test = 0;
 			g_Test = 0;
-			return g_Test;		
+			return g_Test;
 		}
 		}
 	],
 	],
 	[
 	[
@@ -509,7 +510,7 @@ AC_COMPILE_IFELSE(
 		)
 		)
 	],
 	],
 	[
 	[
-		AC_MSG_RESULT([no])		
+		AC_MSG_RESULT([no])
 	]
 	]
 )
 )
 CFLAGS="$OLD_CFLAGS"
 CFLAGS="$OLD_CFLAGS"
@@ -521,13 +522,13 @@ CFLAGS="$CFLAGS -Wno-switch"
 AC_COMPILE_IFELSE(
 AC_COMPILE_IFELSE(
 	[int foo;],
 	[int foo;],
 	[	AC_MSG_RESULT([yes])
 	[	AC_MSG_RESULT([yes])
-		PROD_WARN="$PROD_WARN -Wno-switch"
 	],
 	],
 	[
 	[
 		AC_MSG_RESULT([no])
 		AC_MSG_RESULT([no])
+		CFLAGS="$OLD_CFLAGS"
 	]
 	]
 )
 )
-CFLAGS="$OLD_CFLAGS"
+
 
 
 AC_MSG_CHECKING([whether $CC supports -fPIC])
 AC_MSG_CHECKING([whether $CC supports -fPIC])
 OLD_CFLAGS="$CFLAGS"
 OLD_CFLAGS="$CFLAGS"
@@ -561,6 +562,22 @@ AC_COMPILE_IFELSE(
 	]
 	]
 )
 )
 
 
+#
+# check if support conversion check
+#
+AC_MSG_CHECKING([whether $CC supports -Wconversion])
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wconversion"
+AC_COMPILE_IFELSE(
+	[int foo;],
+	[
+		AC_MSG_RESULT([yes])
+		EXTRA_WARN="-Wconversion"
+	],
+	[AC_MSG_RESULT([no])]
+)
+CFLAGS="$OLD_CFLAGS"
+
 
 
 ###############################################################################
 ###############################################################################
 # Check for libraries and header files.
 # Check for libraries and header files.
@@ -648,7 +665,10 @@ case $enable_warn in
 	"yes")
 	"yes")
 		CFLAGS="$CFLAGS"
 		CFLAGS="$CFLAGS"
 		;;
 		;;
-esac		
+	"extra")
+		CFLAGS="$CFLAGS $EXTRA_WARN"
+		;;
+esac
 
 
 #
 #
 # Buildbot
 # Buildbot
@@ -727,7 +747,7 @@ if test "$ac_cv_search_clock_gettime" != "no" ; then
 			#include <sys/time.h>
 			#include <sys/time.h>
 			#include <time.h>
 			#include <time.h>
 			#include <unistd.h>
 			#include <unistd.h>
-			
+
 			int main(int argc, char** argv)
 			int main(int argc, char** argv)
 			{
 			{
 				struct timespec tval;
 				struct timespec tval;
@@ -807,7 +827,7 @@ AC_SUBST([MYSQL_LIBS])
 
 
 #
 #
 # PCRE library (optional)
 # PCRE library (optional)
-# 		
+#
 PCRE_LIBS=""
 PCRE_LIBS=""
 PCRE_CFLAGS=""
 PCRE_CFLAGS=""
 
 
@@ -815,7 +835,7 @@ if test "$want_pcre" = "no" ; then
 	AC_MSG_NOTICE([ignoring PCRE (optional)])
 	AC_MSG_NOTICE([ignoring PCRE (optional)])
 else
 else
 	host_os="`uname`"
 	host_os="`uname`"
-	if test "$host_os" = "FreeBSD" ; then 
+	if test "$host_os" = "FreeBSD" ; then
 		if test -z "$PCRE_HOME" ; then PCRE_HOME="/usr/local"; fi
 		if test -z "$PCRE_HOME" ; then PCRE_HOME="/usr/local"; fi
 	fi
 	fi
 	if test -z "$PCRE_HOME" ; then
 	if test -z "$PCRE_HOME" ; then
@@ -895,7 +915,8 @@ else
 	AC_MSG_RESULT([no])
 	AC_MSG_RESULT([no])
 fi
 fi
 
 
-AC_MSG_NOTICE([PROD_WARN= $PROD_WARN])
+#AC_MSG_NOTICE([PROD_WARN= $PROD_WARN])
+#AC_MSG_NOTICE([EXTRA_WARN= $EXTRA_WARN])
 AC_MSG_NOTICE([Configure finish, CFLAG= $CFLAGS])
 AC_MSG_NOTICE([Configure finish, CFLAG= $CFLAGS])
 ###############################################################################
 ###############################################################################
 AC_OUTPUT
 AC_OUTPUT

+ 14 - 14
db/packet_db.txt

@@ -1416,7 +1416,7 @@ packet_ver: 25
 
 
 //2009-08-18aRagexeRE
 //2009-08-18aRagexeRE
 0x07e3,6
 0x07e3,6
-0x07e4,-1,itemlistwindowselected,2:4:8
+0x07e4,-1,itemlistwindowselected,2:4:8:12
 0x07e6,8
 0x07e6,8
 
 
 //2009-08-25aRagexeRE
 //2009-08-25aRagexeRE
@@ -1612,7 +1612,7 @@ packet_ver: 25
 
 
 //2010-11-24aRagexeRE
 //2010-11-24aRagexeRE
 packet_ver: 26
 packet_ver: 26
-0x0288,-1,cashshopbuy,2:4:8:10
+0x0288,-1,cashshopbuy,2:4:6:10
 0x0436,19,wanttoconnection,2:6:10:14:18
 0x0436,19,wanttoconnection,2:6:10:14:18
 0x035f,5,walktoxy,2
 0x035f,5,walktoxy,2
 0x0360,6,ticksend,2
 0x0360,6,ticksend,2
@@ -1658,7 +1658,7 @@ packet_ver: 28
 0x083c,19,wanttoconnection,2:6:10:14:18
 0x083c,19,wanttoconnection,2:6:10:14:18
 0x08aa,7,actionrequest,2:6
 0x08aa,7,actionrequest,2:6
 0x02c4,10,useskilltoid,2:4:6
 0x02c4,10,useskilltoid,2:4:6
-0x0811,-1,itemlistwindowselected,2:4:8
+0x0811,-1,itemlistwindowselected,2:4:8:12
 0x890,8
 0x890,8
 0x08a5,18,bookingregreq,2:4:6
 0x08a5,18,bookingregreq,2:4:6
 0x0835,-1,reqopenbuyingstore,2:4:8:9:89
 0x0835,-1,reqopenbuyingstore,2:4:8:9:89
@@ -1689,7 +1689,7 @@ packet_ver:29
 0x0929,26,partyinvite2,2
 0x0929,26,partyinvite2,2
 0x0885,7,actionrequest,2:6
 0x0885,7,actionrequest,2:6
 0x0889,10,useskilltoid,2:4:6
 0x0889,10,useskilltoid,2:4:6
-0x0870,-1,itemlistwindowselected,2:4:8
+0x0870,-1,itemlistwindowselected,2:4:8:12
 //0x0926,18,bookingregreq,2:4:6
 //0x0926,18,bookingregreq,2:4:6
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0817,2,reqclosebuyingstore,0
 0x0817,2,reqclosebuyingstore,0
@@ -1707,13 +1707,13 @@ packet_ver: 30
 0x089c,26,friendslistadd,2
 0x089c,26,friendslistadd,2
 0x0885,5,hommenu,2:4
 0x0885,5,hommenu,2:4
 0x0961,36,storagepassword,2:4:20
 0x0961,36,storagepassword,2:4:20
-0x0288,-1,cashshopbuy,2:4:8:10
+0x0288,-1,cashshopbuy,2:4:6:10
 0x091c,26,partyinvite2,2
 0x091c,26,partyinvite2,2
 0x094b,19,wanttoconnection,2:6:10:14:18
 0x094b,19,wanttoconnection,2:6:10:14:18
 0x0369,7,actionrequest,2:6
 0x0369,7,actionrequest,2:6
 0x083c,10,useskilltoid,2:4:6
 0x083c,10,useskilltoid,2:4:6
 0x0439,8,useitem,2:4
 0x0439,8,useitem,2:4
-0x0945,-1,itemlistwindowselected,2:4:8
+0x0945,-1,itemlistwindowselected,2:4:8:12
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0817,2,reqclosebuyingstore,0
 0x0817,2,reqclosebuyingstore,0
 0x0360,6,reqclickbuyingstore,2
 0x0360,6,reqclickbuyingstore,2
@@ -1769,7 +1769,7 @@ packet_ver:31
 0x08A8,36,storagepassword,2:4:20
 0x08A8,36,storagepassword,2:4:20
 0x0802,26,partyinvite2,2
 0x0802,26,partyinvite2,2
 0x022D,19,wanttoconnection,2:6:10:14:18
 0x022D,19,wanttoconnection,2:6:10:14:18
-0x0281,-1,itemlistwindowselected,2:4:8
+0x0281,-1,itemlistwindowselected,2:4:8:12
 0x035F,6,ticksend,2
 0x035F,6,ticksend,2
 0x0202,5,changedir,2:4
 0x0202,5,changedir,2:4
 0x07E4,6,takeitem,2
 0x07E4,6,takeitem,2
@@ -1808,7 +1808,7 @@ packet_ver: 33
 packet_ver: 34
 packet_ver: 34
 0x014f,6,guildrequestinfo,2
 0x014f,6,guildrequestinfo,2
 0x01fd,15,repairitem,2:4:6:7:9:11:13
 0x01fd,15,repairitem,2:4:6:7:9:11:13
-//0x0281,-1,itemlistwindowselected,2:4:8
+//0x0281,-1,itemlistwindowselected,2:4:8:12
 0x035f,6,reqclickbuyingstore,2
 0x035f,6,reqclickbuyingstore,2
 0x0363,6,ticksend,2
 0x0363,6,ticksend,2
 0x0365,12,searchstoreinfolistitemclick,2:6:10
 0x0365,12,searchstoreinfolistitemclick,2:6:10
@@ -1821,7 +1821,7 @@ packet_ver: 34
 0x084b,19 //fallitem4
 0x084b,19 //fallitem4
 0x085a,90,useskilltoposinfo,2:4:6:8:10
 0x085a,90,useskilltoposinfo,2:4:6:8:10
 0x085d,18,bookingregreq,2:4:6
 0x085d,18,bookingregreq,2:4:6
-0x0868,-1,itemlistwindowselected,2:4:8
+0x0868,-1,itemlistwindowselected,2:4:8:12
 0x086d,26,partyinvite2,2
 0x086d,26,partyinvite2,2
 0x086f,26,friendslistadd,2
 0x086f,26,friendslistadd,2
 0x0874,8,movefromkafra,2:4
 0x0874,8,movefromkafra,2:4
@@ -1891,7 +1891,7 @@ packet_ver: 35
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x092D,18,bookingregreq,2:4:6
 0x092D,18,bookingregreq,2:4:6
 //0x08AA,8 CZ_JOIN_BATTLE_FIELD
 //0x08AA,8 CZ_JOIN_BATTLE_FIELD
-0x0963,-1,itemlistwindowselected,2:4:8
+0x0963,-1,itemlistwindowselected,2:4:8:12
 0x0943,19,wanttoconnection,2:6:10:14:18
 0x0943,19,wanttoconnection,2:6:10:14:18
 0x0947,26,partyinvite2,2
 0x0947,26,partyinvite2,2
 //0x0862,4 CZ_GANGSI_RANK
 //0x0862,4 CZ_GANGSI_RANK
@@ -1923,7 +1923,7 @@ packet_ver: 36
 0x0874,-1,reqopenbuyingstore,2:4:8:9:89
 0x0874,-1,reqopenbuyingstore,2:4:8:9:89
 0x089B,18,bookingregreq,2:4:6
 0x089B,18,bookingregreq,2:4:6
 //0x0965,8 CZ_JOIN_BATTLE_FIELD
 //0x0965,8 CZ_JOIN_BATTLE_FIELD
-0x086A,-1,itemlistwindowselected,2:4:8
+0x086A,-1,itemlistwindowselected,2:4:8:12
 0x08A9,19,wanttoconnection,2:6:10:14:18
 0x08A9,19,wanttoconnection,2:6:10:14:18
 0x0950,26,partyinvite2,2
 0x0950,26,partyinvite2,2
 //0x08AC,4 CZ_GANGSI_RANK
 //0x08AC,4 CZ_GANGSI_RANK
@@ -1955,7 +1955,7 @@ packet_ver: 37
 0x0869,-1,reqopenbuyingstore,2:4:8:9:89
 0x0869,-1,reqopenbuyingstore,2:4:8:9:89
 0x0874,41,bookingregreq,2,4:6
 0x0874,41,bookingregreq,2,4:6
 // 0x088E,8); // CZ_JOIN_BATTLE_FIELD
 // 0x088E,8); // CZ_JOIN_BATTLE_FIELD
-0x0958,-1,itemlistwindowselected,2:4:8
+0x0958,-1,itemlistwindowselected,2:4:8:12
 0x0919,19,wanttoconnection,2:6:10:14:18
 0x0919,19,wanttoconnection,2:6:10:14:18
 0x08A8,26,partyinvite2,2
 0x08A8,26,partyinvite2,2
 // 0x0888,4); // CZ_GANGSI_RANK
 // 0x0888,4); // CZ_GANGSI_RANK
@@ -1987,7 +1987,7 @@ packet_ver: 38
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0365,41,bookingregreq,2:4:6
 0x0365,41,bookingregreq,2:4:6
 // 0x0363,8 // CZ_JOIN_BATTLE_FIELD
 // 0x0363,8 // CZ_JOIN_BATTLE_FIELD
-0x0281,-1,itemlistwindowselected,2:4:8
+0x0281,-1,itemlistwindowselected,2:4:8:12
 0x022D,19,wanttoconnection,2:6:10:14:18
 0x022D,19,wanttoconnection,2:6:10:14:18
 0x0802,26,partyinvite2,2
 0x0802,26,partyinvite2,2
 // 0x0436,4 // CZ_GANGSI_RANK
 // 0x0436,4 // CZ_GANGSI_RANK
@@ -2019,7 +2019,7 @@ packet_ver: 39
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0815,-1,reqopenbuyingstore,2:4:8:9:89
 0x0365,18,bookingregreq,2:4:6
 0x0365,18,bookingregreq,2:4:6
 // 0x0363,8 CZ_JOIN_BATTLE_FIELD
 // 0x0363,8 CZ_JOIN_BATTLE_FIELD
-0x0281,-1,itemlistwindowselected,2:4:8
+0x0281,-1,itemlistwindowselected,2:4:8:12
 0x0919,19,wanttoconnection,2:6:10:14:18
 0x0919,19,wanttoconnection,2:6:10:14:18
 0x0802,26,partyinvite2,2
 0x0802,26,partyinvite2,2
 // 0x0436,4 CZ_GANGSI_RANK
 // 0x0436,4 CZ_GANGSI_RANK

+ 11 - 4
src/char/char.c

@@ -1960,19 +1960,24 @@ void char_parse_req_charlist(int fd, struct char_session_data* sd){
 //----------------------------------------
 //----------------------------------------
 int mmo_char_send006b(int fd, struct char_session_data* sd){
 int mmo_char_send006b(int fd, struct char_session_data* sd){
 	int j, offset = 0;
 	int j, offset = 0;
-	if(sd->version > 25) //20100413
+	//bool newvers = (sd->version >= date2version(20100413) );
+#if PACKETVER >= 20100413
+	//if(newvers) //20100413
 		offset += 3;
 		offset += 3;
+#endif
 	if (save_log)
 	if (save_log)
 		ShowInfo("Loading Char Data ("CL_BOLD"%d"CL_RESET")\n",sd->account_id);
 		ShowInfo("Loading Char Data ("CL_BOLD"%d"CL_RESET")\n",sd->account_id);
 
 
 	j = 24 + offset; // offset
 	j = 24 + offset; // offset
 	WFIFOHEAD(fd,j + MAX_CHARS*MAX_CHAR_BUF);
 	WFIFOHEAD(fd,j + MAX_CHARS*MAX_CHAR_BUF);
 	WFIFOW(fd,0) = 0x6b;
 	WFIFOW(fd,0) = 0x6b;
-	if(sd->version > 25){ //20100413
+#if PACKETVER >= 20100413
+//	if(newvers){ //20100413
 		WFIFOB(fd,4) = MAX_CHARS; // Max slots.
 		WFIFOB(fd,4) = MAX_CHARS; // Max slots.
 		WFIFOB(fd,5) = sd->char_slots; // Available slots. (PremiumStartSlot)
 		WFIFOB(fd,5) = sd->char_slots; // Available slots. (PremiumStartSlot)
 		WFIFOB(fd,6) = MAX_CHARS; // Premium slots. (Any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red)
 		WFIFOB(fd,6) = MAX_CHARS; // Premium slots. (Any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red)
-	}
+//	}
+#endif
 	memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes
 	memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes
 	j+=mmo_chars_fromsql(sd, WFIFOP(fd,j));
 	j+=mmo_chars_fromsql(sd, WFIFOP(fd,j));
 	WFIFOW(fd,2) = j; // packet len
 	WFIFOW(fd,2) = j; // packet len
@@ -2000,12 +2005,14 @@ void mmo_char_send082d(int fd, struct char_session_data* sd) {
 }
 }
 
 
 void mmo_char_send(int fd, struct char_session_data* sd){
 void mmo_char_send(int fd, struct char_session_data* sd){
-	ShowInfo("sd->version = %d\n",sd->version);
+	//ShowInfo("sd->version = %d\n",sd->version);
 #if PACKETVER >= 20130000
 #if PACKETVER >= 20130000
+	//if(sd->version > date2version(20130000) ){
 		mmo_char_send082d(fd,sd);
 		mmo_char_send082d(fd,sd);
 		char_charlist_notify(fd,sd);
 		char_charlist_notify(fd,sd);
 		char_block_character(fd,sd);
 		char_block_character(fd,sd);
 #endif
 #endif
+	//}
 	//@FIXME dump from kro doesn't show 6b transmission
 	//@FIXME dump from kro doesn't show 6b transmission
 	mmo_char_send006b(fd,sd);
 	mmo_char_send006b(fd,sd);
 }
 }

+ 43 - 3
src/common/utils.c

@@ -109,16 +109,16 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
 	WIN32_FIND_DATAA FindFileData;
 	WIN32_FIND_DATAA FindFileData;
 	HANDLE hFind;
 	HANDLE hFind;
 	char tmppath[MAX_PATH+1];
 	char tmppath[MAX_PATH+1];
-	
+
 	const char *path    = (p  ==NULL)? "." : p;
 	const char *path    = (p  ==NULL)? "." : p;
 	const char *pattern = (pat==NULL)? "" : pat;
 	const char *pattern = (pat==NULL)? "" : pat;
-	
+
 	checkpath(tmppath,path);
 	checkpath(tmppath,path);
 	if( PATHSEP != tmppath[strlen(tmppath)-1])
 	if( PATHSEP != tmppath[strlen(tmppath)-1])
 		strcat(tmppath, "\\*");
 		strcat(tmppath, "\\*");
 	else
 	else
 		strcat(tmppath, "*");
 		strcat(tmppath, "*");
-	
+
 	hFind = FindFirstFileA(tmppath, &FindFileData);
 	hFind = FindFirstFileA(tmppath, &FindFileData);
 	if (hFind != INVALID_HANDLE_VALUE)
 	if (hFind != INVALID_HANDLE_VALUE)
 	{
 	{
@@ -259,6 +259,46 @@ uint32 MakeDWord(uint16 word0, uint16 word1)
 		( (uint32)(word1 << 0x10) );
 		( (uint32)(word1 << 0x10) );
 }
 }
 
 
+int date2version(int date){
+	if(date < 20040906) return 5;
+	else if(date < 20040920) return 10;
+	else if(date < 20041005) return 11;
+	else if(date < 20041025) return 12;
+	else if(date < 20041129) return 13;
+	else if(date < 20050110) return 14;
+	else if(date < 20050509) return 15;
+	else if(date < 20050628) return 16;
+	else if(date < 20050718) return 17;
+	else if(date < 20050719) return 18;
+	else if(date < 20060327) return 19;
+	else if(date < 20070108) return 20;
+	else if(date < 20070212) return 21;
+	//wtf @FIXME
+	else if(date < 20080910) return 22;
+	else if(date < 20080827) return 23;
+	else if(date < 20080910) return 24;
+	//unable to solve from date
+	else if(date < 20101124) return 25;
+	else if(date < 20111005) return 26;
+	else if(date < 20111102) return 27;
+	else if(date < 20120307) return 28;
+	else if(date < 20120410) return 29;
+	else if(date < 20120418) return 30;
+	else if(date < 20120618) return 31;
+	else if(date < 20120702) return 32;
+	else if(date < 20130320) return 33;
+	else if(date < 20130515) return 34;
+	else if(date < 20130522) return 35;
+	else if(date < 20130529) return 36;
+	else if(date < 20130605) return 37;
+	else if(date < 20130612) return 38;
+	else if(date >= 20130612) return 39;
+//	else if(date < 20040920) return 40;
+//	else if(date < 20040920) return 41;
+//	else if(date < 20040920) return 42;
+//	else if(date < 20040920) return 43;
+	else return 30; //default
+}
 
 
 /// calculates the value of A / B, in percent (rounded down)
 /// calculates the value of A / B, in percent (rounded down)
 unsigned int get_percentage(const unsigned int A, const unsigned int B)
 unsigned int get_percentage(const unsigned int A, const unsigned int B)

+ 2 - 0
src/common/utils.h

@@ -29,4 +29,6 @@ extern uint16 GetWord(uint32 val, int idx);
 extern uint16 MakeWord(uint8 byte0, uint8 byte1);
 extern uint16 MakeWord(uint8 byte0, uint8 byte1);
 extern uint32 MakeDWord(uint16 word0, uint16 word1);
 extern uint32 MakeDWord(uint16 word0, uint16 word1);
 
 
+int date2version(int date);
+
 #endif /* _UTILS_H_ */
 #endif /* _UTILS_H_ */

+ 39 - 37
src/map/status.c

@@ -3950,8 +3950,8 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
 				status->matk_max += sd->bonus.ematk;
 				status->matk_max += sd->bonus.ematk;
 				status->matk_min += sd->bonus.ematk;
 				status->matk_min += sd->bonus.ematk;
 			}
 			}
-            status->matk_min = status_calc_ematk(bl, sc, status->matk_min);
-            status->matk_max = status_calc_ematk(bl, sc, status->matk_max);
+			status->matk_min = status_calc_ematk(bl, sc, status->matk_min);
+			status->matk_max = status_calc_ematk(bl, sc, status->matk_max);
 			//This is the only portion in MATK that varies depending on the weapon level and refinement rate.
 			//This is the only portion in MATK that varies depending on the weapon level and refinement rate.
 			if( status->rhw.matk > 0 ){
 			if( status->rhw.matk > 0 ){
 				int wMatk = status->rhw.matk;
 				int wMatk = status->rhw.matk;
@@ -3961,17 +3961,19 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
 			}
 			}
 		}
 		}
 #endif
 #endif
-        if (bl->type&BL_PC && sd->matk_rate != 100) {
+		if (bl->type&BL_PC && sd->matk_rate != 100) {
 			status->matk_max = status->matk_max * sd->matk_rate/100;
 			status->matk_max = status->matk_max * sd->matk_rate/100;
 			status->matk_min = status->matk_min * sd->matk_rate/100;
 			status->matk_min = status->matk_min * sd->matk_rate/100;
 		}
 		}
 
 
-		status->matk_min = status_calc_matk(bl, sc, status->matk_min);
+
 		status->matk_max = status_calc_matk(bl, sc, status->matk_max);
 		status->matk_max = status_calc_matk(bl, sc, status->matk_max);
 
 
-        if ((bl->type&BL_HOM && battle_config.hom_setting&0x20)  //Hom Min Matk is always the same as Max Matk
-			|| sc->data[SC_RECOGNIZEDSPELL])
-            status->matk_min = status->matk_max;
+		if ((bl->type&BL_HOM && battle_config.hom_setting&0x20)  //Hom Min Matk is always the same as Max Matk
+				|| (sc && sc->data[SC_RECOGNIZEDSPELL]))
+			status->matk_min = status->matk_max;
+		else
+			status->matk_min = status_calc_matk(bl, sc, status->matk_min);
 
 
 #ifdef RENEWAL
 #ifdef RENEWAL
 		if( sd && sd->right_weapon.overrefine > 0){
 		if( sd && sd->right_weapon.overrefine > 0){
@@ -4741,37 +4743,37 @@ static unsigned short status_calc_matk(struct block_list *bl, struct status_chan
 		return cap_value(matk,0,USHRT_MAX);
 		return cap_value(matk,0,USHRT_MAX);
 #ifndef RENEWAL
 #ifndef RENEWAL
 	// take note fixed value first before % modifiers
 	// take note fixed value first before % modifiers
-    if (sc->data[SC_MATKPOTION])
-        matk += sc->data[SC_MATKPOTION]->val1;
-    if (sc->data[SC_MATKFOOD])
-        matk += sc->data[SC_MATKFOOD]->val1;
-    if (sc->data[SC_MANA_PLUS])
-        matk += sc->data[SC_MANA_PLUS]->val1;
-    if (sc->data[SC_AQUAPLAY_OPTION])
-        matk += sc->data[SC_AQUAPLAY_OPTION]->val2;
-    if (sc->data[SC_CHILLY_AIR_OPTION])
-        matk += sc->data[SC_CHILLY_AIR_OPTION]->val2;
-    if (sc->data[SC_WATER_BARRIER])
-        matk -= sc->data[SC_WATER_BARRIER]->val3;
-    if (sc->data[SC_FIRE_INSIGNIA] && sc->data[SC_FIRE_INSIGNIA]->val1 == 3)
-        matk += 50;
-    if (sc->data[SC_ODINS_POWER])
-        matk += 40 + 30 * sc->data[SC_ODINS_POWER]->val1; //70 lvl1, 100lvl2
-    if (sc->data[SC_IZAYOI])
-        matk += 50 * sc->data[SC_IZAYOI]->val1;
+	if (sc->data[SC_MATKPOTION])
+		matk += sc->data[SC_MATKPOTION]->val1;
+	if (sc->data[SC_MATKFOOD])
+		matk += sc->data[SC_MATKFOOD]->val1;
+	if (sc->data[SC_MANA_PLUS])
+		matk += sc->data[SC_MANA_PLUS]->val1;
+	if (sc->data[SC_AQUAPLAY_OPTION])
+		matk += sc->data[SC_AQUAPLAY_OPTION]->val2;
+	if (sc->data[SC_CHILLY_AIR_OPTION])
+		matk += sc->data[SC_CHILLY_AIR_OPTION]->val2;
+	if (sc->data[SC_WATER_BARRIER])
+		matk -= sc->data[SC_WATER_BARRIER]->val3;
+	if (sc->data[SC_FIRE_INSIGNIA] && sc->data[SC_FIRE_INSIGNIA]->val1 == 3)
+		matk += 50;
+	if (sc->data[SC_ODINS_POWER])
+		matk += 40 + 30 * sc->data[SC_ODINS_POWER]->val1; //70 lvl1, 100lvl2
+	if (sc->data[SC_IZAYOI])
+		matk += 50 * sc->data[SC_IZAYOI]->val1;
 #endif
 #endif
-    if (sc->data[SC_MAGICPOWER] && sc->data[SC_MAGICPOWER]->val4)
-        matk += matk * sc->data[SC_MAGICPOWER]->val3/100;
-    if (sc->data[SC_MINDBREAKER])
-        matk += matk * sc->data[SC_MINDBREAKER]->val2/100;
-    if (sc->data[SC_INCMATKRATE])
-        matk += matk * sc->data[SC_INCMATKRATE]->val1/100;
-    if (sc->data[SC_MOONLITSERENADE])
-        matk += matk * sc->data[SC_MOONLITSERENADE]->val2/100;
-    if (sc->data[SC_MELODYOFSINK])
-        matk += matk * sc->data[SC_MELODYOFSINK]->val3/100;
-    if (sc->data[SC_BEYONDOFWARCRY])
-        matk -= matk * sc->data[SC_BEYONDOFWARCRY]->val3/100;
+	if (sc->data[SC_MAGICPOWER] && sc->data[SC_MAGICPOWER]->val4)
+		matk += matk * sc->data[SC_MAGICPOWER]->val3/100;
+	if (sc->data[SC_MINDBREAKER])
+		matk += matk * sc->data[SC_MINDBREAKER]->val2/100;
+	if (sc->data[SC_INCMATKRATE])
+		matk += matk * sc->data[SC_INCMATKRATE]->val1/100;
+	if (sc->data[SC_MOONLITSERENADE])
+		matk += matk * sc->data[SC_MOONLITSERENADE]->val2/100;
+	if (sc->data[SC_MELODYOFSINK])
+		matk += matk * sc->data[SC_MELODYOFSINK]->val3/100;
+	if (sc->data[SC_BEYONDOFWARCRY])
+		matk -= matk * sc->data[SC_BEYONDOFWARCRY]->val3/100;
 	if( sc->data[SC_ZANGETSU] )
 	if( sc->data[SC_ZANGETSU] )
 		matk += matk * sc->data[SC_ZANGETSU]->val2 / 100;
 		matk += matk * sc->data[SC_ZANGETSU]->val2 / 100;
 
 

+ 3 - 2
src/map/unit.c

@@ -384,8 +384,9 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
 	path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS); // Count walk path cells
 	path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS); // Count walk path cells
 #ifdef OFFICIAL_WALKPATH
 #ifdef OFFICIAL_WALKPATH
 	if( !path_search_long(NULL, bl->m, bl->x, bl->y, x, y, CELL_CHKNOPASS) // Check if there is an obstacle between
 	if( !path_search_long(NULL, bl->m, bl->x, bl->y, x, y, CELL_CHKNOPASS) // Check if there is an obstacle between
-		&& wpd.path_len > 14 ) // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett]
-		return 0;
+		&& wpd.path_len > 14	// Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett]
+		&& (bl->type != BL_NPC) ) // If type is a NPC, please disregard.
+			return 0;
 #endif
 #endif
 	if( (battle_config.max_walk_path < wpd.path_len) && (bl->type != BL_NPC) )
 	if( (battle_config.max_walk_path < wpd.path_len) && (bl->type != BL_NPC) )
 		return 0;
 		return 0;