EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Logging Spell Usage Bug (https://www.eqemulator.org/forums/showthread.php?t=8865)

velns 07-28-2003 07:31 AM

Logging Spell Usage Bug
 
The following are changes to zone/spells.cpp to fix the misorder of output in the spell logging code. The name of the castee and the name of the spell had been incorrectly inversed. I believe there may also be an issue with the spell power logic, as I haven't seen any spells logged at usage other than 50%. I will need to do more debugging to figure out exactly why.

>...>...>...if (partial && (random > chance - 0.10))
>...>...>...{
>...>...>...>...LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 50%% Hit!",
caster?caster->GetName():"unknown",
spells[spell_id].name, GetName());
>...>...>...>...return 50;
>...>...>...}
>...>...>...else if (partial && random > chance - 0.08)
>...>...>...{
>...>...>...>...LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 60%% Hit!",
caster?caster->GetName():"unknown",
spells[spell_id].name, GetName());
>...>...>...>...return 60;
>...>...>...}
>...>...>...else if (partial && random > chance - 0.06)
>...>...>...{
>...>...>...>...LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 70%% Hit!",
caster?caster->GetName():"unknown",
spells[spell_id].name, GetName());
>...>...>...>...return 70;
>...>...>...}
>...>...>...else if (partial && random > chance - 0.04)
>...>...>...{
>...>...>...>...LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 80%% Hit!",
caster?caster->GetName():"unknown",
spells[spell_id].name, GetName());
>...>...>...>...return 80;
>...>...>...}
>...>...>...else if (partial && random > chance - 0.02)
>...>...>...{
>...>...>...>...LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 90%% Hit!",
caster?caster->GetName():"unknown",
>... spells[spell_id].name, GetName());
>...>...>...>...return 90;
>...>...>...}
>...>...>...else if (random > chance)
>...>...>...{
>...>...>...>...LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: Full Hit!",
caster?caster->GetName():"unknown",
spells[spell_id].name, GetName());
>...>...>...>...return 100;
>...>...>...}

velns 07-29-2003 01:13 PM

Modifications to latest 0.5 code, various zone files (including better formatting of the above code change)

makefile change to use "common" mysql library / include paths rather than /usr/local path =>
Code:

--- makefile    25 Jul 2003 12:01:08 -0000      1.1.1.2
+++ makefile    30 Jul 2003 00:25:02 -0000
@@ -1,6 +1,6 @@
 APP=zone
 SF=../common/EQNetwork.o \
-  ../common/timer.o ../common/database.o ../common/packet_dump.o ../common/packet_functions.o \
+  ../common/timer.o ../common/EQEMuError.o ../common/database.o ../common/packet_dump.o ../common/packet_functions.o \
    ../common/unix.o ../common/packet_dump_file.o ../common/Mutex.o ../common/MiscFunctions.o \
    zone.o entity.o mob.o client.o client_process.o npc.o net.o spawn2.o attack.o hate_list.o \
    ../common/serverinfo.o ../common/moremath.o worldserver.o spells.o spawngroup.o loottables.o \
@@ -14,8 +14,8 @@

 CC=gcc
 LINKER=gcc
-MYSQL_FLAGS=-I/usr/local/mysql/include
-MYSQL_LIB=-L'/usr/local/mysql/lib' -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv
+MYSQL_FLAGS=-I/usr/include/mysql/
+MYSQL_LIB=-L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv
 DFLAGS=-DDEBUG=5 -DCATCH_CRASH -DNO_PIDLOG -DSHAREMEM -DSPELL_EFFECT_SPAM
 WFLAGS=-Wall -Wuninitialized -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wstrict-prototypes -Wno-deprecated -Wnested-externs -Wcomment -Wcast-align
 COPTS=$(WFLAGS) -O -ggdb -march=i686 -pthread -pipe -D_GNU_SOURCE -DINVERSEXY -DFX -DZONE $(DFLAGS) $(MYSQL_FLAGS)

parser.cpp change to make the itoa definition WIN32 only, as it is an invalid-redefinition when compiling on linux =>
Code:

--- parser.cpp  29 Jul 2003 00:30:19 -0000      1.2
+++ parser.cpp  30 Jul 2003 00:25:05 -0000
@@ -152,7 +152,10 @@
        return returnvalue;
 }

+#ifdef WIN32
 char* itoa(int integer) {char tmp[10];return itoa(integer,tmp,10);}
+#endif
+
 string strlwr(string tmp) {return strlwr((char*)tmp.c_str());}
 int strcmp(string com, string com2) {return strcmp(com.c_str(),com2.c_str());}

spells.cpp change, to fix improper wording in spell casing logger messages=>
Code:

--- spells.cpp  29 Jul 2003 00:30:20 -0000      1.2
+++ spells.cpp  30 Jul 2003 00:25:17 -0000
@@ -1458,43 +1458,43 @@
                        if (partial && (random > chance - 0.10))
                        {
                                LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 50%% Hit!",
-                          caster?caster->GetName():"unknown", GetName(),
-                          spells[spell_id].name);
+                          caster?caster->GetName():"unknown",
+                          spells[spell_id].name, GetName());
                                return 50;
                        }
                        else if (partial && random > chance - 0.08)
                        {
                                LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 60%% Hit!",
-                          caster?caster->GetName():"unknown", GetName(),
-                          spells[spell_id].name);
+                          caster?caster->GetName():"unknown",
+                          spells[spell_id].name, GetName());
                                return 60;
                        }
                        else if (partial && random > chance - 0.06)
                        {
                                LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 70%% Hit!",
-                          caster?caster->GetName():"unknown", GetName(),
-                          spells[spell_id].name);
+                          caster?caster->GetName():"unknown",
+                          spells[spell_id].name, GetName());
                                return 70;
                        }
                        else if (partial && random > chance - 0.04)
                        {
                                LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 80%% Hit!",
-                          caster?caster->GetName():"unknown", GetName(),
-                          spells[spell_id].name);
+                          caster?caster->GetName():"unknown",
+                          spells[spell_id].name, GetName());
                                return 80;
                        }
                        else if (partial && random > chance - 0.02)
                        {
                                LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: 90%% Hit!",
-                          caster?caster->GetName():"unknown", GetName(),
-                              spells[spell_id].name);
+                          caster?caster->GetName():"unknown",
+                              spells[spell_id].name, GetName());
                                return 90;
                        }
                        else if (random > chance)
                        {
                                LogFile->write(EQEMuLog::Normal, "%s casted %s on %s: Full Hit!",
-                          caster?caster->GetName():"unknown", GetName(),
-                          spells[spell_id].name);
+                          caster?caster->GetName():"unknown",
+                          spells[spell_id].name, GetName());
                                return 100;
                        }
                        return 0;


Trumpcard 07-29-2003 09:48 PM

moved this to the Development forum. Looks good , though Im hestitate to alter the makefiles. Mysql doesnt install to the same location based on your distro. I'll take a look though, I thought BP had modified it to dynamic work that out....

kathgar 08-03-2003 06:35 AM

Automake is the devil, if someone wants to do it, go for it.. a configure script would be good aswell..

Bigpull 08-03-2003 07:07 AM

Hmm dunno how i missed this post.. yeah i had fixed the makefile to use mysql_config, someone likely copied an older makefile in the merge


All times are GMT -4. The time now is 10:11 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.