From: Akiko Date: Sun, 17 May 2015 06:14:27 +0000 (+0200) Subject: - initial commit of Akios cmake branch (svn r162), include old svn logs X-Git-Url: http://community.linux-addicted.net/gitweb/?a=commitdiff_plain;h=1b3363fdc06db3b18b5c587c6a861ffe45fecc96;p=tinns.git - initial commit of Akios cmake branch (svn r162), include old svn logs --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1181bd4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required (VERSION 2.6) +project (TINNS C CXX) + +set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules") + +set (USE_SQLITE3 false CACHE BOOL "Use SQLITE3 instead of MySQL") +set (USE_MYSQL_INCLUDE_DIR false CACHE BOOL "MySQL includes in ../include/mysql/") + +add_definitions (-std=c++0x -W -Wall -march=native -mtune=native -O2 -D_THREAD_SAFE -D_REENTRANT) + +if (USE_SQLITE3) +add_definitions (-DSQLITE3) +endif (USE_SQLITE3) + +if (USE_MYSQL_INCLUDE_DIR) +add_definitions (-DMYSQL_INC_DIR) +endif (USE_MYSQL_INCLUDE_DIR) + +find_package (RT REQUIRED) +find_package (PTHREAD REQUIRED) +find_package (MYSQL REQUIRED) +find_package (SQLITE3 REQUIRED) +find_package (PCRE REQUIRED) +find_package (ZLIB REQUIRED) +find_package (Lua51 REQUIRED) +find_package (Boost REQUIRED) + +add_subdirectory (server) +add_subdirectory (tools) diff --git a/server/LICENSE.txt b/LICENSE.txt similarity index 100% rename from server/LICENSE.txt rename to LICENSE.txt diff --git a/cmake_README b/cmake_README new file mode 100644 index 0000000..5141c58 --- /dev/null +++ b/cmake_README @@ -0,0 +1,21 @@ +You need cmake to build tinns and its tools. + +cmake is part of nearly all linux distributions and you may need to install +first. + +debian/ubuntu: "apt-get install cmake" +suse (11.0+): "zypper in cmake" + +After installing cmake just use it with the CMakeLists.txt file in this +directory. + +"cmake CMakeLists.txt" + +cmake will now create a full buildsystem which can be used with the plain +GNU make and checks for all missing packages/libs. You will get notified if +something is missing. + +"cmake_distclean.sh" removes all cache and temp files from the cmake +buildsystem. + +- Akiko diff --git a/cmake_distclean.sh b/cmake_distclean.sh new file mode 100755 index 0000000..d0f6648 --- /dev/null +++ b/cmake_distclean.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +rm -rf CMakeCache.txt +rm -rf cmake_install.cmake +rm -rf Makefile +rm -rf CMakeFiles/ +rm -rf tools/cmake_install.cmake +rm -rf tools/Makefile +rm -rf tools/CMakeFiles/ +rm -rf tools/pak_decompress/cmake_install.cmake +rm -rf tools/pak_decompress/Makefile +rm -rf tools/pak_decompress/CMakeFiles/ +rm -rf tools/vfs_viewer/cmake_install.cmake +rm -rf tools/vfs_viewer/Makefile +rm -rf tools/vfs_viewer/CMakeFiles/ +rm -rf server/cmake_install.cmake +rm -rf server/Makefile server/CMakeFiles/ +rm -rf server/src/cmake_install.cmake +rm -rf server/src/Makefile server/src/CMakeFiles/ +rm -rf server/src/common/cmake_install.cmake +rm -rf server/src/common/Makefile +rm -rf server/src/common/CMakeFiles/ +rm -rf server/src/common/config/cmake_install.cmake +rm -rf server/src/common/config/Makefile +rm -rf server/src/common/config/CMakeFiles/ +rm -rf server/src/common/console/cmake_install.cmake +rm -rf server/src/common/console/Makefile +rm -rf server/src/common/console/CMakeFiles/ +rm -rf server/src/common/filesystem/cmake_install.cmake +rm -rf server/src/common/filesystem/Makefile +rm -rf server/src/common/filesystem/CMakeFiles/ +rm -rf server/src/common/misc/cmake_install.cmake +rm -rf server/src/common/misc/Makefile +rm -rf server/src/common/misc/CMakeFiles/ +rm -rf server/src/common/netcode/cmake_install.cmake +rm -rf server/src/common/netcode/Makefile +rm -rf server/src/common/netcode/CMakeFiles/ +rm -rf server/src/common/regex/cmake_install.cmake +rm -rf server/src/common/regex/Makefile +rm -rf server/src/common/regex/CMakeFiles/ +rm -rf server/src/dev-tools/cmake_install.cmake +rm -rf server/src/dev-tools/Makefile +rm -rf server/src/dev-tools/CMakeFiles/ +rm -rf server/src/game/cmake_install.cmake +rm -rf server/src/game/Makefile +rm -rf server/src/game/CMakeFiles/ +rm -rf server/src/game/decoder/cmake_install.cmake +rm -rf server/src/game/decoder/Makefile +rm -rf server/src/game/decoder/CMakeFiles/ +rm -rf server/src/game/def/cmake_install.cmake +rm -rf server/src/game/def/Makefile +rm -rf server/src/game/def/CMakeFiles/ +rm -rf server/src/game/gamecommands/cmake_install.cmake +rm -rf server/src/game/gamecommands/Makefile +rm -rf server/src/game/gamecommands/CMakeFiles/ +rm -rf server/src/info/cmake_install.cmake +rm -rf server/src/info/Makefile +rm -rf server/src/info/CMakeFiles/ +rm -rf server/src/patch/cmake_install.cmake +rm -rf server/src/patch/Makefile +rm -rf server/src/patch/CMakeFiles/ + +# code counter + +LOG="/tmp/log.$$" +LINES=0 +C=0 + +find|grep "\.c$" >$LOG +find|grep "\.cpp$" >>$LOG +find|grep "\.h$" >>$LOG +find|grep "\.hpp$" >>$LOG +find|grep "\.sh$" >>$LOG +find|grep "\.S$" >>$LOG +find|grep "install-script$" >>$LOG +find|grep "bar$" >>$LOG +find|grep "colors$" >>$LOG +find|grep "function$" >>$LOG +while read L +do + C=$((C+1)) + W=$(cat $L|wc -l) + S=$(cat $L|wc -c) + SIZE=$((SIZE+S)) + LINES=$((LINES+W)) +done <$LOG +rm $LOG + +echo +echo "--- REPOSITORY SUMMARY ---" +echo "source files: $C (c/cpp/h/hpp/sh/S)" +echo "lines of code: $LINES" +echo "size of code: $SIZE bytes" +echo diff --git a/cmake_modules/FindMYSQL.cmake b/cmake_modules/FindMYSQL.cmake new file mode 100644 index 0000000..25a8e62 --- /dev/null +++ b/cmake_modules/FindMYSQL.cmake @@ -0,0 +1,17 @@ +find_path (MYSQL_INCLUDE_DIR mysql.h /usr/include) + +find_library (MYSQL_LIBRARY NAMES mysqlclient PATHS /usr/lib64 /usr/lib) + +if (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY) + set (MYSQL_FOUND TRUE) +endif (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY) + +if (MYSQL_FOUND) + if (NOT mysqlclient_FIND_QUIETLY) + message (STATUS "Found mysql: ${MYSQL_LIBRARY}") + endif (NOT mysqlclient_FIND_QUIETLY) +else (MYSQL_FOUND) + if (mysqlclient_FIND_REQUIRED) + message (FATAL ERROR "mysql not found") + endif (mysqlclient_FIND_REQUIRED) +endif (MYSQL_FOUND) diff --git a/cmake_modules/FindPCRE.cmake b/cmake_modules/FindPCRE.cmake new file mode 100644 index 0000000..5f63232 --- /dev/null +++ b/cmake_modules/FindPCRE.cmake @@ -0,0 +1,17 @@ +find_path (PCRE_INCLUDE_DIR pcre.h /usr/include) + +find_library (PCRE_LIBRARY NAMES pcre PATHS /usr/lib64 /usr/lib) + +if (PCRE_INCLUDE_DIR AND PCRE_LIBRARY) + set (PCRE_FOUND TRUE) +endif (PCRE_INCLUDE_DIR AND PCRE_LIBRARY) + +if (PCRE_FOUND) + if (NOT pcre_FIND_QUIETLY) + message (STATUS "Found pcre: ${PCRE_LIBRARY}") + endif (NOT pcre_FIND_QUIETLY) +else (PCRE_FOUND) + if (PCRE_FIND_REQUIRED) + message (FATAL ERROR "pcre not found") + endif (PCRE_FIND_REQUIRED) +endif (PCRE_FOUND) diff --git a/cmake_modules/FindPTHREAD.cmake b/cmake_modules/FindPTHREAD.cmake new file mode 100644 index 0000000..6fefcd0 --- /dev/null +++ b/cmake_modules/FindPTHREAD.cmake @@ -0,0 +1,17 @@ +find_path (PTHREAD_INCLUDE_DIR pthread.h /usr/include) + +find_library (PTHREAD_LIBRARY NAMES pthread PATHS /usr/lib64 /usr/lib) + +if (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY) + set (PTHREAD_FOUND TRUE) +endif (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY) + +if (PTHREAD_FOUND) + if (NOT pthread_FIND_QUIETLY) + message (STATUS "Found pthread: ${PTHREAD_LIBRARY}") + endif (NOT pthread_FIND_QUIETLY) +else (PTHREAD_FOUND) + if (pthread_FIND_REQUIRED) + message (FATAL ERROR "pthread not found") + endif (pthread_FIND_REQUIRED) +endif (PTHREAD_FOUND) diff --git a/cmake_modules/FindRT.cmake b/cmake_modules/FindRT.cmake new file mode 100644 index 0000000..61b5b54 --- /dev/null +++ b/cmake_modules/FindRT.cmake @@ -0,0 +1,17 @@ +find_path (RT_INCLUDE_DIR time.h /usr/include) + +find_library (RT_LIBRARY NAMES rt PATHS /usr/lib64 /usr/lib) + +if (RT_INCLUDE_DIR AND RT_LIBRARY) + set (RT_FOUND TRUE) +endif (RT_INCLUDE_DIR AND RT_LIBRARY) + +if (RT_FOUND) + if (NOT rt_FIND_QUIETLY) + message (STATUS "Found librt: ${RT_LIBRARY}") + endif (NOT rt_FIND_QUIETLY) +else (RT_FOUND) + if (RT_FIND_REQUIRED) + message (FATAL ERROR "librt not found") + endif (RT_FIND_REQUIRED) +endif (RT_FOUND) diff --git a/cmake_modules/FindSQLITE3.cmake b/cmake_modules/FindSQLITE3.cmake new file mode 100644 index 0000000..d962c76 --- /dev/null +++ b/cmake_modules/FindSQLITE3.cmake @@ -0,0 +1,17 @@ +find_path (SQLITE3_INCLUDE_DIR sqlite3.h /usr/include) + +find_library (SQLITE3_LIBRARY NAMES sqlite3 PATHS /usr/lib64 /usr/lib) + +if (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY) + set (SQLITE3_FOUND TRUE) +endif (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY) + +if (SQLITE3_FOUND) + if (NOT sqlite3_FIND_QUIETLY) + message (STATUS "Found sqlite3: ${SQLITE3_LIBRARY}") + endif (NOT sqlite3_FIND_QUIETLY) +else (SQLITE3_FOUND) + if (SQLITE3_FIND_REQUIRED) + message (FATAL ERROR "sqlite3 not found") + endif (sqlite3_FIND_REQUIRED) +endif (SQLITE3_FOUND) diff --git a/server/docs/ISC Example.txt b/docs/ISC Example.txt similarity index 100% rename from server/docs/ISC Example.txt rename to docs/ISC Example.txt diff --git a/server/docs/ISC ProtDef.txt b/docs/ISC ProtDef.txt similarity index 100% rename from server/docs/ISC ProtDef.txt rename to docs/ISC ProtDef.txt diff --git a/docs/NPCs.txt b/docs/NPCs.txt index 77f31d2..7e5b6a3 100644 --- a/docs/NPCs.txt +++ b/docs/NPCs.txt @@ -1,13 +1,14 @@ -So far, if you type - @test 1 - A copbot will spawn at your current location - - @test 5 17 - the copbot will put out his weapon and run to a location in Plaza 1, left to medicare (i had to set a static pos here) - - @test 6 0 4863 - the copbot will start shooting you. - - type - @test 5 0 15 - and the copbot will put back his weapon and stop fire \ No newline at end of file +So far, if you type + @test 1 + A copbot will spawn at your current location + + @test 5 17 + the copbot will put out his weapon and run to a location in Plaza 1, left +to medicare (i had to set a static pos here) + + @test 6 0 4863 + the copbot will start shooting you. + + type + @test 5 0 15 + and the copbot will put back his weapon and stop fire diff --git a/docs/current_test_commands.txt b/docs/current_test_commands.txt index 3a0570d..0aadd2d 100644 --- a/docs/current_test_commands.txt +++ b/docs/current_test_commands.txt @@ -1,14 +1,17 @@ -Current @test commands are: - -@text 1 -- Let (use @debug it) attack which can be any npc or player - : For non-sql NPCs, you have to remove an offset of 255; So the left security officer - in plaza 1 would have id 48 instead of 303 - Unknown 1 is .. unknown yet and seems to be unimportant - attackAnim is the attack "style" of . Varies from npc type to npc type - -@test 2 -- Get relation of the 2 given factions. <0 means enemy - - -! IF you find out what an "unknown" value does, tell us ! \ No newline at end of file +Current @test commands are: + +@text 1 +- Let (use @debug it) attack which can be any npc or +player + : For non-sql NPCs, you have to remove an offset of 255; So the left +security officer + in plaza 1 would have id 48 instead of 303 + Unknown 1 is .. unknown yet and seems to be unimportant + attackAnim is the attack "style" of . Varies from npc type to npc +type + +@test 2 +- Get relation of the 2 given factions. <0 means enemy + + +! IF you find out what an "unknown" value does, tell us ! diff --git a/docs/how_npc_scripts_work.txt b/docs/how_npc_scripts_work.txt index 236f42f..4d58038 100644 --- a/docs/how_npc_scripts_work.txt +++ b/docs/how_npc_scripts_work.txt @@ -1,309 +1,340 @@ -(c) 2009; Written by Namikon for http://www.linux-addicted.net -Last Updated: 15.10.2009 ----------------------------------------------------------------- - - -Hi. In this document i'll try to explain how the NPC Script-System works in -Neocron. - -First off, we have the .lua scripts, like this one: - ---snip-- -function DIALOG() - NODE(0) - SAY("Hi there") - ANSWER("Yo man",1) - NODE(1) - SAY("See ya") - ENDDIALOG() -end ---snip-- - -if you ever worked with lua, you'll notice that NODE, SAY and ANSWER are no -common lua functions. -Those function calls are defined in either missionheader.lua and/or -dialogheader.lua. (Open scripts.def; The last entry tells you if the lua script -defined in that line includes mission or dialogheader). - -So the lua files in the scripts/ folder cannot be executed alone. They HAVE to be -combined with either dialogheader.lua or missionheader.lua. - -You might think now "What the heck, there is only one function, how is this supposed to work?" -Thats correct. Only DIALOG() is defined. I'll explain how that works exactly below. - -First, in order to communicate with your lua script from c/c++ source code, you need -a) An entry function, like main() that can be called from within your source -b) A "callback" function, if the script needs any action to be done, like give and item - let npc die, or whatever. -c) A function to deliver results back to the running script. If you call RAND(2), you might want - to know the result. Would you? - -For a), a function called "lSendAction" is defined -For b), a function called "SendScriptMsg" is defined -For c), a function called "SetResult" is defined - -So now how is this "single function dialog" working: -You see those NODE() lines in the source. NODE is defined as: - ---snip-- -function NODE(index) - node = index -end ---snip-- - -"index" is a variable which is set to 0 uppon every script-start (mission/dialogheader, 1st line) -So you have some variables, and a dozen of functions. If you start this lua script, nothing will happen. - -When you click on a NPC, your client sends "use item xx". -The server detects if this id is an npc. If so, the server will send -a packet back that tells the client what lua script to use. -(The short name in scripts.def, not the entire scriptfile name; NCPD for example) - -Right after that packet, another one follows. This packet tells the client to call "lSendAction", with -a given state number. After that, your dialog/mission script is running. - -lSendAction is defined as: ---snip-- -function lSendAction (in_dialogclass, newstate) - - dialogclass = in_dialogclass - state = newstate - counter = 0 - - DIALOG() -end ---snip-- - -There is our DIALOG() call. So what happens here? Look at the entire script that is processed after -a lSendAction call: - -------- -dialogclass, counter, state, node = 0 - -function lSendAction (in_dialogclass, newstate) - - dialogclass = in_dialogclass - state = newstate - counter = 0 - - DIALOG() -end - -function NODE(index) - node = index -end - -function SAY(text) - if (node==state) then - SendScriptMsg("say", dialogclass,text) - end -end - -function ANSWER(text,resultstate) - if (node==state) then - counter = counter + 1 - SendScriptMsg("setanswer", dialogclass,counter,text,resultstate, 0) - end -end - -function ENDDIALOG() - if (node==state) then - SendScriptMsg("enddialog", dialogclass) - end -end - -function DIALOG() - NODE(0) - SAY("Hi there") - ANSWER("Yo man",1) - NODE(1) - SAY("See ya") - ENDDIALOG() -end -------- - -- We call "lSendAction(0,0)" -- Global var "state" is now 0 (the other 2 dont matter here) -- NODE() is called: --- NODE(0) is called, global var "node" is now 0 --- SAY is called ---- if-statement is true, state is equal node, so we call the c/c++ callback function "SendScriptMsg", - Neocron now displays "Hi there" in a dialog screen --- ANSWER() is called ---- if-statement is true, state is equal node, so we call the c/c++ callback function "SendScriptMsg", - Neocron now displays "Yo man" in a dialog screen as selectable answer. --- NODE(1) is called, global var "node" is now 1 --- SAY is called ---- if-statement is now FALSE. state is still 0, but we're at NODE 1, nothing happens --- ENDDIALOG() is called ---- if-statement is FALSE. state is still 0, but we're at NODE 1, nothing happens --- function DIALOG ends -- Script execution finished - -Now, if we click the answer, the client sends the answernumber to us. !Nothing else! We ONLY get the -answer number. Thats why in ANSWER the var "counter" is increased every call. -Good for us, at the server is, lua does that for us. We only need to grab the correct answer number. - -Ok, we got the answernumber from our client. We know that our answer had this little 1 after its text. -That 1 tells us which NODE comes next. -So what would we send now to the client? Correct: - -- We call "lSendAction(0,1)" -- Global var "state" is now 1 -- NODE() is called: --- NODE(0) is called, global var "node" is now 0 --- SAY is called ---- if-statement is false (node = 0, state = 1) --- ANSWER is called ---- if-statement is false (node = 0, state = 1) --- NODE(1) is called, global var "node" is now 1 --- SAY is called ---- if-statement is true, (node = 1, state = 1) so we call the c/c++ callback function "SendScriptMsg", - Neocron now displays "See ya" in a dialog screen --- ENDDIALOG() is called ---- if-statement is true, (node = 1, state = 1) so we call the c/c++ callback function "SendScriptMsg", - Neocron closes the NPC dialog --- function DIALOG ends -- Script execution finished - -So far, thats how "normal" lua scripts work. Nothing special about that. -But NPC scripts are far more complex; KK wrote BlackJack and roulette games for NC2 -in lua. They handle epic runs, let NPCs attack and give you tons of nice items on christmas -if you where a good boy(girl) last year. - -So far, i know that the packet where you return a node Number can be extended with -and u32 (?) value; And i think this could be either a hidden result, or -a defined seed for an rand() generator, not sure about that yet. - -For takeitem/giveitem stuff, the script stops right after it called SendScriptMsg and returns -to our callback function. We have now the time to give / take any item, -check faction standings,... and return the result to our script before it continues. - -The client does *NOT* perform any action besides SAY.. and ANSWER.. stuff. -All actions that lead to an result are performed by the server. -Lets take TAKEITEM(90) as example and extend our basic script from above: - ---snip - - -function TAKEITEM(itemtype) - if (node==state) then - SendScriptMsg("takeitem", dialogclass,itemtype) - end -end - -NODE (10) - TAKEITEM(90) - if (result==1) then - SAY("Thanks for that copbot rifle") - ANSWER("You're welcome") - else - SAY("You dont have a Copbot rifle") - ANSWER("Too bad for you") - end -ENDDIALOG(); - ---snip - -You should already know what happens here, so i wont explain it again. -Remember: -- We choose the answer -- The server processes the destination node -- And sends us the Nodenumber back, together with results, if any. - -So, when the client reaches TAKEITEM(x), he will NOT take your item away, -he will stop the script for a moment, like we do it on the server. - -Difference: The client looks inside the last lSendAction packet -if there are any results. If so, he will call SendResults() and push -these value(s) back to the script. -You see, result is now set to the same value as it where on the server. - -One word about those values: -They ARE integer. But KK decided that it would be cool to have negative AND positive -results, they choose float as format. - - -This RAW packet could be a positive answer to our TAKEITEM command: -0E 03 91 00 1F 01 00 1A 0A 00 01 00 00 80 3F -Which splits up as: -0E - Packetlen -03 - Commandset 0x03 -09 00 - UDP ID -1F - Subcommand 1F -01 00 - Local PlayerID -1A - SubSubcommand Dialog -0A 00 - NODE ID to be processed next (u16 format) -01 - How many values will follow? -00 00 80 3F - 1.0 in float - - -===== !! THEORY !! ===== -===== !! This part is NOT verified yet !! ===== - -If you have more than one result, for example if you take away 2 or more items, -they are attached to the packet in the same order as they appear. -If the first result is 0 and the second is 1, -it would be like this: - -0E - Packetlen -03 - Commandset 0x03 -09 00 - UDP ID -1F - Subcommand 1F -01 00 - Local PlayerID -1A - SubSubcommand Dialog -0A 00 - NODE ID to be processed next (u16 format) -02 - How many values will follow? -00 00 00 00 - 0.0 in float (and any other format too i know...) -00 00 80 3F - 1.0 in float -======================================= - -PM me if you can proof that this is correct, thanks! - -END - -If you find any typos, errors, whatever, please tell me over PM -on linux-addicted.net. - --Namikon - -================== PACKETS BELOW ================== -The packets are defined as: - - -"LOADSCRIPT" Packet (After USE) // SERVER > CLIENT ----- - Len - 0x03 - UDP ID - 0x1F - Players ZoneID - 0x18 - NPCs WorldID - Some 32-bit value that changes everytime you click on an npc. We have *no* clue what this does :) - 0x00000000 -* Name of the script \0 terminated ----- - -"lSendAction" Packet // SERVER > CLIENT // Server tells client which node next, and what results to use ----- - Len - 0x03 - UDP ID - 0x1F - Players ZoneID - 0x1a - NodeID - # of Values to follow (float values) ----- - -"ANSWER x" // CLIENT > SERVER ----- - Len - 0x03 - UDP ID - 0x1F - Players ZoneID - 0x1a - AnswerNr ----- +(c) 2009; Written by Namikon for http://www.linux-addicted.net +Last Updated: 15.10.2009 +---------------------------------------------------------------- + + +Hi. In this document i'll try to explain how the NPC Script-System works in +Neocron. + +First off, we have the .lua scripts, like this one: + +--snip-- +function DIALOG() + NODE(0) + SAY("Hi there") + ANSWER("Yo man",1) + NODE(1) + SAY("See ya") + ENDDIALOG() +end +--snip-- + +if you ever worked with lua, you'll notice that NODE, SAY and ANSWER are no +common lua functions. +Those function calls are defined in either missionheader.lua and/or +dialogheader.lua. (Open scripts.def; The last entry tells you if the lua +script +defined in that line includes mission or dialogheader). + +So the lua files in the scripts/ folder cannot be executed alone. They HAVE +to be +combined with either dialogheader.lua or missionheader.lua. + +You might think now "What the heck, there is only one function, how is this +supposed to work?" +Thats correct. Only DIALOG() is defined. I'll explain how that works exactly +below. + +First, in order to communicate with your lua script from c/c++ source code, +you need +a) An entry function, like main() that can be called from within your +source +b) A "callback" function, if the script needs any action to be done, like +give and item + let npc die, or whatever. +c) A function to deliver results back to the running script. If you call +RAND(2), you might want + to know the result. Would you? + +For a), a function called "lSendAction" is defined +For b), a function called "SendScriptMsg" is defined +For c), a function called "SetResult" is defined + +So now how is this "single function dialog" working: +You see those NODE() lines in the source. NODE is defined as: + +--snip-- +function NODE(index) + node = index +end +--snip-- + +"index" is a variable which is set to 0 uppon every script-start +(mission/dialogheader, 1st line) +So you have some variables, and a dozen of functions. If you start this lua +script, nothing will happen. + +When you click on a NPC, your client sends "use item xx". +The server detects if this id is an npc. If so, the server will send +a packet back that tells the client what lua script to use. +(The short name in scripts.def, not the entire scriptfile name; NCPD for +example) + +Right after that packet, another one follows. This packet tells the client to +call "lSendAction", with +a given state number. After that, your dialog/mission script is running. + +lSendAction is defined as: +--snip-- +function lSendAction (in_dialogclass, newstate) + + dialogclass = in_dialogclass + state = newstate + counter = 0 + + DIALOG() +end +--snip-- + +There is our DIALOG() call. So what happens here? Look at the entire script +that is processed after +a lSendAction call: + +------- +dialogclass, counter, state, node = 0 + +function lSendAction (in_dialogclass, newstate) + + dialogclass = in_dialogclass + state = newstate + counter = 0 + + DIALOG() +end + +function NODE(index) + node = index +end + +function SAY(text) + if (node==state) then + SendScriptMsg("say", dialogclass,text) + end +end + +function ANSWER(text,resultstate) + if (node==state) then + counter = counter + 1 + SendScriptMsg("setanswer", dialogclass,counter,text,resultstate, 0) + end +end + +function ENDDIALOG() + if (node==state) then + SendScriptMsg("enddialog", dialogclass) + end +end + +function DIALOG() + NODE(0) + SAY("Hi there") + ANSWER("Yo man",1) + NODE(1) + SAY("See ya") + ENDDIALOG() +end +------- + +- We call "lSendAction(0,0)" +- Global var "state" is now 0 (the other 2 dont matter here) +- NODE() is called: +-- NODE(0) is called, global var "node" is now 0 +-- SAY is called +--- if-statement is true, state is equal node, so we call the c/c++ callback +function "SendScriptMsg", + Neocron now displays "Hi there" in a dialog screen +-- ANSWER() is called +--- if-statement is true, state is equal node, so we call the c/c++ callback +function "SendScriptMsg", + Neocron now displays "Yo man" in a dialog screen as selectable answer. +-- NODE(1) is called, global var "node" is now 1 +-- SAY is called +--- if-statement is now FALSE. state is still 0, but we're at NODE 1, nothing +happens +-- ENDDIALOG() is called +--- if-statement is FALSE. state is still 0, but we're at NODE 1, nothing +happens +-- function DIALOG ends +- Script execution finished + +Now, if we click the answer, the client sends the answernumber to us. +!Nothing else! We ONLY get the +answer number. Thats why in ANSWER the var "counter" is increased every +call. +Good for us, at the server is, lua does that for us. We only need to grab the +correct answer number. + +Ok, we got the answernumber from our client. We know that our answer had this +little 1 after its text. +That 1 tells us which NODE comes next. +So what would we send now to the client? Correct: + +- We call "lSendAction(0,1)" +- Global var "state" is now 1 +- NODE() is called: +-- NODE(0) is called, global var "node" is now 0 +-- SAY is called +--- if-statement is false (node = 0, state = 1) +-- ANSWER is called +--- if-statement is false (node = 0, state = 1) +-- NODE(1) is called, global var "node" is now 1 +-- SAY is called +--- if-statement is true, (node = 1, state = 1) so we call the c/c++ callback +function "SendScriptMsg", + Neocron now displays "See ya" in a dialog screen +-- ENDDIALOG() is called +--- if-statement is true, (node = 1, state = 1) so we call the c/c++ callback +function "SendScriptMsg", + Neocron closes the NPC dialog +-- function DIALOG ends +- Script execution finished + +So far, thats how "normal" lua scripts work. Nothing special about that. +But NPC scripts are far more complex; KK wrote BlackJack and roulette games +for NC2 +in lua. They handle epic runs, let NPCs attack and give you tons of nice +items on christmas +if you where a good boy(girl) last year. + +So far, i know that the packet where you return a node Number can be extended +with +and u32 (?) value; And i think this could be either a hidden result, or +a defined seed for an rand() generator, not sure about that yet. + +For takeitem/giveitem stuff, the script stops right after it called +SendScriptMsg and returns +to our callback function. We have now the time to give / take any item, +check faction standings,... and return the result to our script before it +continues. + +The client does *NOT* perform any action besides SAY.. and ANSWER.. stuff. +All actions that lead to an result are performed by the server. +Lets take TAKEITEM(90) as example and extend our basic script from above: + +--snip + + +function TAKEITEM(itemtype) + if (node==state) then + SendScriptMsg("takeitem", dialogclass,itemtype) + end +end + +NODE (10) + TAKEITEM(90) + if (result==1) then + SAY("Thanks for that copbot rifle") + ANSWER("You're welcome") + else + SAY("You dont have a Copbot rifle") + ANSWER("Too bad for you") + end +ENDDIALOG(); + +--snip + +You should already know what happens here, so i wont explain it again. +Remember: +- We choose the answer +- The server processes the destination node +- And sends us the Nodenumber back, together with results, if any. +So, when the client reaches TAKEITEM(x), he will NOT take your item away, +he will stop the script for a moment, like we do it on the server. + +Difference: The client looks inside the last lSendAction packet +if there are any results. If so, he will call SendResults() and push +these value(s) back to the script. +You see, result is now set to the same value as it where on the server. + +One word about those values: +They ARE integer. But KK decided that it would be cool to have negative AND +positive +results, they choose float as format. + + +This RAW packet could be a positive answer to our TAKEITEM command: +0E 03 91 00 1F 01 00 1A 0A 00 01 00 00 80 3F +Which splits up as: +0E - Packetlen +03 - Commandset 0x03 +09 00 - UDP ID +1F - Subcommand 1F +01 00 - Local PlayerID +1A - SubSubcommand Dialog +0A 00 - NODE ID to be processed next (u16 format) +01 - How many values will follow? +00 00 80 3F - 1.0 in float + + +===== !! THEORY !! ===== +===== !! This part is NOT verified yet !! ===== + +If you have more than one result, for example if you take away 2 or more +items, +they are attached to the packet in the same order as they appear. +If the first result is 0 and the second is 1, +it would be like this: + +0E - Packetlen +03 - Commandset 0x03 +09 00 - UDP ID +1F - Subcommand 1F +01 00 - Local PlayerID +1A - SubSubcommand Dialog +0A 00 - NODE ID to be processed next (u16 format) +02 - How many values will follow? +00 00 00 00 - 0.0 in float (and any other format too i know...) +00 00 80 3F - 1.0 in float +======================================= + +PM me if you can proof that this is correct, thanks! + +END + +If you find any typos, errors, whatever, please tell me over PM +on linux-addicted.net. + +-Namikon + +================== PACKETS BELOW ================== +The packets are defined as: + + +"LOADSCRIPT" Packet (After USE) // SERVER > CLIENT +---- + Len + 0x03 + UDP ID + 0x1F + Players ZoneID + 0x18 + NPCs WorldID + Some 32-bit value that changes everytime you click on an npc. We have +*no* clue what this does :) + 0x00000000 +* Name of the script \0 terminated +---- + +"lSendAction" Packet // SERVER > CLIENT // Server tells client which node +next, and what results to use +---- + Len + 0x03 + UDP ID + 0x1F + Players ZoneID + 0x1a + NodeID + # of Values to follow (float values) +---- + +"ANSWER x" // CLIENT > SERVER +---- + Len + 0x03 + UDP ID + 0x1F + Players ZoneID + 0x1a + AnswerNr +---- diff --git a/docs/lua_callbacks.xls b/docs/lua_callbacks.xls deleted file mode 100644 index df16f79..0000000 Binary files a/docs/lua_callbacks.xls and /dev/null differ diff --git a/docs/readme b/docs/readme deleted file mode 100644 index cb5fa45..0000000 --- a/docs/readme +++ /dev/null @@ -1,6 +0,0 @@ -trunk/src/developing -> newest branch -trunk/src/stable -> this is going to be a stable branch -trunk/src/testing -> this is for testing, right now it uses an older HawkNL -trunk/docs -> this documentation stuff -trunk/tools -> contains some tools useful for the server and the server files -trunk/datapack -> contains missing files, modified files and patches diff --git a/docs/subversion_logs_until_first_git_version.txt b/docs/subversion_logs_until_first_git_version.txt new file mode 100644 index 0000000..c022389 --- /dev/null +++ b/docs/subversion_logs_until_first_git_version.txt @@ -0,0 +1,4430 @@ +------------------------------------------------------------------------ +r162 | Akiko | 2012-10-05 13:20:21 +0200 (Fri, 05 Oct 2012) | 3 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/server/src/common/netcode.cpp + +- fixed a missing include (compiles now with GCC 4.7.2) + + +------------------------------------------------------------------------ +r161 | Namikon | 2012-06-03 01:59:16 +0200 (Sun, 03 Jun 2012) | 1 line +Changed paths: + M /branch/Akikos_tinns_with_cmake/CMakeLists.txt + +changed set boost to the real require boost... +------------------------------------------------------------------------ +r160 | Namikon | 2012-06-03 01:45:30 +0200 (Sun, 03 Jun 2012) | 1 line +Changed paths: + A /branch/Akikos_tinns_with_cmake/server/database/infoDB.s3db + +SQLite Database template added +------------------------------------------------------------------------ +r159 | Namikon | 2012-06-03 01:44:37 +0200 (Sun, 03 Jun 2012) | 2 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/server/conf/infoserver.conf + M /branch/Akikos_tinns_with_cmake/server/src/game/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/info/configtemplate.h + +prepared infoserver for SQLite stuff +fixed gameserver makefile to find lua.h directory +------------------------------------------------------------------------ +r158 | Namikon | 2012-06-03 00:53:36 +0200 (Sun, 03 Jun 2012) | 2 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/CMakeLists.txt + +Fixed lua engine for lua versions 5.1+ +changed CMakeLists.txt to include the boost libraries for later use +------------------------------------------------------------------------ +r157 | Namikon | 2012-06-03 00:52:59 +0200 (Sun, 03 Jun 2012) | 2 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/server/src/game/lua_engine.cpp + +Fixed lua engine for lua versions 5.1+ +changed CMakeLists.txt to include the boost libraries for later use +------------------------------------------------------------------------ +r156 | Akiko | 2011-08-23 12:25:17 +0200 (Tue, 23 Aug 2011) | 7 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/server/src/common/CMakeLists.txt + D /branch/Akikos_tinns_with_cmake/server/src/common/config + A /branch/Akikos_tinns_with_cmake/server/src/common/config.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/config.h (from /branch/Akikos_tinns_with_cmake/server/src/include/config.h:155) + D /branch/Akikos_tinns_with_cmake/server/src/common/console + A /branch/Akikos_tinns_with_cmake/server/src/common/console.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/console.h (from /branch/Akikos_tinns_with_cmake/server/src/include/console.h:155) + D /branch/Akikos_tinns_with_cmake/server/src/common/filesystem + A /branch/Akikos_tinns_with_cmake/server/src/common/filesystem.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/filesystem.h (from /branch/Akikos_tinns_with_cmake/server/src/include/filesystem.h:155) + A /branch/Akikos_tinns_with_cmake/server/src/common/message.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/message.h (from /branch/Akikos_tinns_with_cmake/server/src/include/message.h:155) + D /branch/Akikos_tinns_with_cmake/server/src/common/misc + A /branch/Akikos_tinns_with_cmake/server/src/common/misc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/misc.h (from /branch/Akikos_tinns_with_cmake/server/src/include/misc.h:155) + D /branch/Akikos_tinns_with_cmake/server/src/common/netcode + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode.h + D /branch/Akikos_tinns_with_cmake/server/src/common/regex + A /branch/Akikos_tinns_with_cmake/server/src/common/regex++.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/regex++.h (from /branch/Akikos_tinns_with_cmake/server/src/include/regex++.h:155) + M /branch/Akikos_tinns_with_cmake/server/src/game/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/def/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/accounts.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/chars.h + M /branch/Akikos_tinns_with_cmake/server/src/game/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/worlds.cpp + D /branch/Akikos_tinns_with_cmake/server/src/include/config.h + D /branch/Akikos_tinns_with_cmake/server/src/include/connection-tcp.h + D /branch/Akikos_tinns_with_cmake/server/src/include/connection-udp.h + D /branch/Akikos_tinns_with_cmake/server/src/include/console.h + D /branch/Akikos_tinns_with_cmake/server/src/include/filesystem.h + D /branch/Akikos_tinns_with_cmake/server/src/include/message.h + D /branch/Akikos_tinns_with_cmake/server/src/include/misc.h + D /branch/Akikos_tinns_with_cmake/server/src/include/netcode.h + D /branch/Akikos_tinns_with_cmake/server/src/include/regex++.h + D /branch/Akikos_tinns_with_cmake/server/src/include/serversocket.h + M /branch/Akikos_tinns_with_cmake/server/src/info/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/info/accounts.h + M /branch/Akikos_tinns_with_cmake/server/src/info/main.h + M /branch/Akikos_tinns_with_cmake/server/src/patch/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/patch/main.h + +- joined common directories +- joined all network stuff in two common files (netcode.*) +- started to clean up includes massacre +- started to to clean up code in the common parts +- more C++0x changes + + +------------------------------------------------------------------------ +r155 | Akiko | 2011-08-22 11:40:39 +0200 (Mon, 22 Aug 2011) | 6 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/game/container.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/vehicle.cpp + M /branch/Akikos_tinns_with_cmake/server/src/info/main.h + +- changed CMake system to support older mysql installations (different + include directory) +- fixed some "Container" issues to stay compatile to older compilers + (gcc 4.3) + + +------------------------------------------------------------------------ +r154 | Akiko | 2011-08-22 10:32:46 +0200 (Mon, 22 Aug 2011) | 7 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/cmake_distclean.sh + M /branch/Akikos_tinns_with_cmake/cmake_modules/FindMYSQL.cmake + A /branch/Akikos_tinns_with_cmake/cmake_modules/FindSQLITE3.cmake + M /branch/Akikos_tinns_with_cmake/server/src/common/config/main.h + M /branch/Akikos_tinns_with_cmake/server/src/common/console/main.h + M /branch/Akikos_tinns_with_cmake/server/src/common/filesystem/filesystem.cpp + M /branch/Akikos_tinns_with_cmake/server/src/common/filesystem/main.h + M /branch/Akikos_tinns_with_cmake/server/src/common/misc/main.h + M /branch/Akikos_tinns_with_cmake/server/src/common/misc/misc.cpp + M /branch/Akikos_tinns_with_cmake/server/src/common/netcode/connection-tcp.cpp + M /branch/Akikos_tinns_with_cmake/server/src/common/netcode/connection-udp.cpp + M /branch/Akikos_tinns_with_cmake/server/src/common/netcode/main.h + M /branch/Akikos_tinns_with_cmake/server/src/common/netcode/serversocket.cpp + M /branch/Akikos_tinns_with_cmake/server/src/dev-tools/getsvnrev.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/chars.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/def/def_trader.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/def/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/def/world_datparser.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/npc.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/rawf.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/include/defs.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/msgbuilder.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/multipart.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/npctemplate.h + M /branch/Akikos_tinns_with_cmake/server/src/game/item.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/msgbuilder.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/multipart.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/npc.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/npc_conversation.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_updatedb.cpp + M /branch/Akikos_tinns_with_cmake/server/src/info/main.h + M /branch/Akikos_tinns_with_cmake/server/src/patch/main.h + M /branch/Akikos_tinns_with_cmake/server/src/patch/patchserver.cpp + M /branch/Akikos_tinns_with_cmake/tools/pak_decompress/pak_decompress.cpp + +- enhanced distclean script to give a code summary +- added SQLITE3 to CMake scripts +- changed build options to C++0x +- made code C++0x compileable +- removed the damn "using namespace std" stuff + + +------------------------------------------------------------------------ +r153 | Akiko | 2011-08-21 11:37:01 +0200 (Sun, 21 Aug 2011) | 3 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/CMakeLists.txt + D /branch/Akikos_tinns_with_cmake/cmake_modules/FindLUA.cmake + M /branch/Akikos_tinns_with_cmake/cmake_modules/FindMYSQL.cmake + M /branch/Akikos_tinns_with_cmake/cmake_modules/FindPCRE.cmake + M /branch/Akikos_tinns_with_cmake/cmake_modules/FindPTHREAD.cmake + M /branch/Akikos_tinns_with_cmake/cmake_modules/FindRT.cmake + M /branch/Akikos_tinns_with_cmake/tools/pak_decompress/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/tools/vfs_viewer/CMakeLists.txt + +- updated CMAKE files to properly support multiarch environments + + +------------------------------------------------------------------------ +r152 | Akiko | 2011-04-22 17:39:46 +0200 (Fri, 22 Apr 2011) | 4 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/CMakeLists.txt + D /branch/Akikos_tinns_with_cmake/server/WORK_IN_PROGRESS + M /branch/Akikos_tinns_with_cmake/server/src/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/common/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/dev-tools/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/game/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/info/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/patch/CMakeLists.txt + +- cleaned up some cmake files +- removed useless files + + +------------------------------------------------------------------------ +r151 | Akiko | 2011-04-22 17:06:03 +0200 (Fri, 22 Apr 2011) | 5 lines +Changed paths: + M /branch/Akikos_tinns_with_cmake/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/cmake_modules/FindLUA.cmake + M /branch/Akikos_tinns_with_cmake/server/src/game/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/game/chars.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/commands.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x13.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_helditemaction.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_terminal.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/def/world_datparser.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/test.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/include/chars.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/globals.h + M /branch/Akikos_tinns_with_cmake/server/src/game/lua_engine.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/msgbuilder.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/npc.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/npc_ai.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/npc_conversation.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/npctemplate.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/outpost.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_querydb.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_receivedb.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_tryaccess.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_updatedb.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/worlddatatemplate.cpp + M /branch/Akikos_tinns_with_cmake/server/src/info/infoserver.h + +- fixed all remaining issues from the big patchset +- added lua cmake find script +- this branch is compiling now, but's not tested + + +------------------------------------------------------------------------ +r150 | Akiko | 2011-04-22 16:06:33 +0200 (Fri, 22 Apr 2011) | 5 lines +Changed paths: + D /branch/Akikos_tinns_with_cmake/CHANGELOG + A /branch/Akikos_tinns_with_cmake/docs/ISC Example.txt (from /branch/Akikos_tinns_with_cmake/server/docs/ISC Example.txt:149) + A /branch/Akikos_tinns_with_cmake/docs/ISC ProtDef.txt (from /branch/Akikos_tinns_with_cmake/server/docs/ISC ProtDef.txt:149) + A /branch/Akikos_tinns_with_cmake/docs/NPCs.txt + A /branch/Akikos_tinns_with_cmake/docs/current_test_commands.txt + A /branch/Akikos_tinns_with_cmake/docs/how_npc_scripts_work.txt + M /branch/Akikos_tinns_with_cmake/server/conf/commands.conf + M /branch/Akikos_tinns_with_cmake/server/conf/gameserver.conf + A /branch/Akikos_tinns_with_cmake/server/data + A /branch/Akikos_tinns_with_cmake/server/data/scripts + A /branch/Akikos_tinns_with_cmake/server/data/scripts/lua + A /branch/Akikos_tinns_with_cmake/server/data/scripts/lua/zippy.lua + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8 + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8/DB_v8_patch001.sql + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8/changes.txt + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8/patch_gamedb_rev7_to_rev8.sql + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8/readme.txt + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8/unified_game_DB_rev8.sql + A /branch/Akikos_tinns_with_cmake/server/database/DB_v8/unified_infoDB_rev8.sql + A /branch/Akikos_tinns_with_cmake/server/database/GameDB_patch_rev133-rev134.sql + A /branch/Akikos_tinns_with_cmake/server/database/GameDB_patch_rev134-rev140.sql + D /branch/Akikos_tinns_with_cmake/server/docs + M /branch/Akikos_tinns_with_cmake/server/init.d/tinns + M /branch/Akikos_tinns_with_cmake/server/src/common/misc/misc.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/CMakeLists.txt + M /branch/Akikos_tinns_with_cmake/server/src/game/chars.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/client.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/commands.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/configtemplate.h + M /branch/Akikos_tinns_with_cmake/server/src/game/container.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x13.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x1f.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_hack.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_hack.h + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_helditemaction.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_helditemaction.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_multipart.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_multipart.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_npcdialog.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_npcdialog.h + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_ping.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_ping.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_pvptrade.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_pvptrade.h + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_reqinfo.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_subskill.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_sync.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_terminal.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_terminal.h + M /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_useobject.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_worldIDinfo.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_worldIDinfo.h + M /branch/Akikos_tinns_with_cmake/server/src/game/def/def_factions.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/def/def_npc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_scripts.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/def/gamedefs.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/def/world_datparser.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/def/world_datstruct.h + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/givemoney.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/npc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/npc_shop.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/setlevel.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/setmainskill.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/setsubskill.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/t.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/test.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/globals.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/include/accounts.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/chars.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/commands.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/container.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/def_drugs.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/def_factions.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/def_items.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_scripts.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/defs.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/gamedefs.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/globals.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/lua_engine.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/msgbuilder.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/multipart.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/npc.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/npctemplate.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/outpost.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/skill.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/terminal.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/world_datparser.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/worlddatatemplate.h + M /branch/Akikos_tinns_with_cmake/server/src/game/include/worlds.h + A /branch/Akikos_tinns_with_cmake/server/src/game/lua_engine.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/main.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/main.h + M /branch/Akikos_tinns_with_cmake/server/src/game/msgbuilder.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/multipart.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/npc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/npc_ai.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/npc_conversation.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/npctemplate.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/outpost.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/skill.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/terminal_querydb.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_receivedb.cpp + D /branch/Akikos_tinns_with_cmake/server/src/game/terminal_servermessage.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_tryaccess.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/terminal_updatedb.cpp + M /branch/Akikos_tinns_with_cmake/server/src/game/worlddatatemplate.cpp + M /branch/Akikos_tinns_with_cmake/server/src/include/external.h + M /branch/Akikos_tinns_with_cmake/server/src/include/message.h + M /branch/Akikos_tinns_with_cmake/server/src/include/misc.h + M /branch/Akikos_tinns_with_cmake/server/src/include/svnrevision.h + M /branch/Akikos_tinns_with_cmake/server/src/info/accounts.cpp + M /branch/Akikos_tinns_with_cmake/server/src/info/accounts.h + M /branch/Akikos_tinns_with_cmake/server/src/info/infoserver.cpp + M /branch/Akikos_tinns_with_cmake/server/src/info/infoserver.h + +- 128-149 commits added to my cmake branch +- removed and moved some files +- this commit will not compile (missing cmake entries, will fix this in the next commit) + + +------------------------------------------------------------------------ +r149 | Namikon | 2009-10-26 21:48:24 +0100 (Mon, 26 Oct 2009) | 1 line +Changed paths: + A /server/database/DB_v8/DB_v8_patch001.sql + D /server/database/DB_v8_patch001.sql + +moved DB patchfile +------------------------------------------------------------------------ +r148 | Namikon | 2009-10-26 21:47:39 +0100 (Mon, 26 Oct 2009) | 3 lines +Changed paths: + A /server/database/DB_v8 + A /server/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql + A /server/database/DB_v8/changes.txt + A /server/database/DB_v8/patch_gamedb_rev7_to_rev8.sql + A /server/database/DB_v8/readme.txt + A /server/database/DB_v8/unified_game DB_rev8.sql + A /server/database/DB_v8/unified_infoDB_rev8.sql + D /server/database/DB_v8.zip + +Deleted .zip file with databases +Added single SQL files for structure only, and basedata for TinNS. +Also added changelog +------------------------------------------------------------------------ +r147 | Namikon | 2009-10-25 17:18:05 +0100 (Sun, 25 Oct 2009) | 6 lines +Changed paths: + M /server/conf/gameserver.conf + A /server/database/DB_v8_patch001.sql + M /server/src/common/netcode/connection-udp.cpp + M /server/src/game/decoder/main.h + M /server/src/game/decoder/udp_0x13.cpp + A /server/src/game/decoder/udp_multipart.cpp + A /server/src/game/decoder/udp_multipart.h + M /server/src/game/decoder/udp_ping.h + M /server/src/game/globals.cpp + M /server/src/game/include/globals.h + A /server/src/game/include/multipart.h + M /server/src/game/main.cpp + M /server/src/game/main.h + A /server/src/game/multipart.cpp + +Added support for incoming multipart messages +This is for UpdateDB only at the moment. +Added DB patch to DB8.1 +This version is able to handle emails, forumposts and every terminal action where you can type in more than 1 line of text. +However, its possible that you get an error on some actions, thats because the TerminalClass is not able yet to handle incomming +calls larger than ~1kb. But this will change soon! +------------------------------------------------------------------------ +r146 | Namikon | 2009-10-25 15:37:29 +0100 (Sun, 25 Oct 2009) | 1 line +Changed paths: + M /server/database/DB_v8.zip + +databse fix +------------------------------------------------------------------------ +r145 | Namikon | 2009-10-25 12:53:30 +0100 (Sun, 25 Oct 2009) | 1 line +Changed paths: + A /server/database/DB_v8.zip + +DBv8 +------------------------------------------------------------------------ +r144 | Namikon | 2009-10-25 12:48:15 +0100 (Sun, 25 Oct 2009) | 6 lines +Changed paths: + M /server/src/game/chars.cpp + M /server/src/game/client.cpp + M /server/src/game/container.cpp + M /server/src/game/decoder/main.h + M /server/src/game/decoder/udp_ping.cpp + M /server/src/game/decoder/udp_reqinfo.cpp + M /server/src/game/decoder/udp_sync.cpp + M /server/src/game/decoder/udp_terminal.cpp + M /server/src/game/decoder/udp_terminal.h + M /server/src/game/gamecommands/test.cpp + M /server/src/game/globals.cpp + M /server/src/game/include/chars.h + M /server/src/game/include/container.h + M /server/src/game/include/globals.h + M /server/src/game/include/msgbuilder.h + A /server/src/game/include/outpost.h + M /server/src/game/include/terminal.h + M /server/src/game/main.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc_ai.cpp + A /server/src/game/outpost.cpp + M /server/src/game/terminal.cpp + A /server/src/game/terminal_querydb.cpp + M /server/src/game/terminal_receivedb.cpp + D /server/src/game/terminal_servermessage.cpp + M /server/src/game/terminal_tryaccess.cpp + M /server/src/game/terminal_updatedb.cpp + M /server/src/info/accounts.cpp + M /server/src/info/accounts.h + M /server/src/info/infoserver.cpp + M /server/src/info/infoserver.h + +- Rewrote terminal stuff. Citycom and GMTool are now enabled +- Citycom and GMTool status: about 65% is working +- Outposts now show their clan and faction. You also get the bonus if you're on clan/faction/etc +- New GameDB and InfoDB: Rev8 +You MUST upgrade your database in order to use this revision! +- Patched infoserver and gameserver to work with DB rev8 +------------------------------------------------------------------------ +r143 | Namikon | 2009-10-18 18:49:42 +0200 (Sun, 18 Oct 2009) | 28 lines +Changed paths: + A /docs/current_test_commands.txt + M /server/src/game/chars.cpp + M /server/src/game/def/def_factions.cpp + M /server/src/game/gamecommands/npc.cpp + M /server/src/game/gamecommands/test.cpp + M /server/src/game/include/accounts.h + M /server/src/game/include/chars.h + M /server/src/game/include/commands.h + M /server/src/game/include/def_factions.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/npc.h + M /server/src/game/lua_engine.cpp + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + A /server/src/game/npc_ai.cpp + +Rev xxx + +- Some new permanent combat/skillranks: +Accountlevel 30+: Rank 50/50 +Accountlevel 50+: Rank 120/120 +Accountlevel 100: Rank 127/127 + +- Fixed factions.def parser +- Fixed servercrash when tried to spawn NPC in any location without SQL NPCs +- Added AI for NPCs +The "AI" is limited to SQL NPCs (worldid > 1000) only for now, and it +does only react on other NPCs nearby. +An spawned NPC will search its nearby location for enemies (Faction relation <0) +and start attacking the closest one. The range is limited to 800 (whatever, meters.. localchat is 1600) +If target runs out of sight (Distance 1500+) the attacker returns to normal + +Current @test commands are: + +@test 1 +- Let (use @debug it) attack which can be any npc or player + : For non-sql NPCs, you have to remove an offset of 255; So the left security officer + in plaza 1 would have id 48 instead of 303 + Unknown 1 is .. unknown yet and seems to be unimportant + attackAnim is the attack "style" of . Varies from npc type to npc type. We'll need + a list of those values for each npc to be able to script actions for him + +@test 2 +- Get relation of the 2 given factions. <0 means enemy +------------------------------------------------------------------------ +r142 | Namikon | 2009-10-17 16:23:49 +0200 (Sat, 17 Oct 2009) | 1 line +Changed paths: + M /server/src/game/include/lua_engine.h + M /server/src/include/external.h + D /server/src/include/lua + +Lua include fix +------------------------------------------------------------------------ +r141 | Namikon | 2009-10-17 04:12:56 +0200 (Sat, 17 Oct 2009) | 1 line +Changed paths: + M /server/conf/gameserver.conf + M /server/conf/infoserver.conf + + +------------------------------------------------------------------------ +r140 | Namikon | 2009-10-17 04:07:20 +0200 (Sat, 17 Oct 2009) | 1 line +Changed paths: + A /docs/how_npc_scripts_work.txt + A /docs/lua_callbacks.xls + M /server/conf/commands.conf + M /server/conf/gameserver.conf + M /server/conf/infoserver.conf + A /server/data + A /server/data/scripts + A /server/data/scripts/lua + A /server/data/scripts/lua/zippy.lua + A /server/database/GameDB_patch_rev134-rev140.sql + M /server/src/common/Makefile + M /server/src/common/misc/misc.cpp + M /server/src/game + M /server/src/game/Makefile + M /server/src/game/chars.cpp + M /server/src/game/client.cpp + M /server/src/game/commands.cpp + M /server/src/game/configtemplate.h + M /server/src/game/decoder + M /server/src/game/decoder/main.h + M /server/src/game/decoder/udp_reqinfo.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_worldIDinfo.cpp + M /server/src/game/decoder/udp_worldIDinfo.h + M /server/src/game/def + M /server/src/game/def/def_npc.cpp + M /server/src/game/def/def_scripts.cpp + M /server/src/game/gamecommands + A /server/src/game/gamecommands/npc.cpp + A /server/src/game/gamecommands/npc_shop.cpp + M /server/src/game/gamecommands/test.cpp + M /server/src/game/globals.cpp + M /server/src/game/include + M /server/src/game/include/chars.h + M /server/src/game/include/commands.h + M /server/src/game/include/def_items.h + M /server/src/game/include/def_npc.h + M /server/src/game/include/def_scripts.h + M /server/src/game/include/globals.h + A /server/src/game/include/lua_engine.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/npc.h + A /server/src/game/lua_engine.cpp + M /server/src/game/main.cpp + M /server/src/game/main.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + M /server/src/game/npc_conversation.cpp + M /server/src/game/sql.cpp + M /server/src/include/external.h + A /server/src/include/lua + A /server/src/include/lua/lapi.h + A /server/src/include/lua/lauxlib.h + A /server/src/include/lua/lcode.h + A /server/src/include/lua/ldebug.h + A /server/src/include/lua/ldo.h + A /server/src/include/lua/lfunc.h + A /server/src/include/lua/lgc.h + A /server/src/include/lua/llex.h + A /server/src/include/lua/llimits.h + A /server/src/include/lua/lmem.h + A /server/src/include/lua/lobject.h + A /server/src/include/lua/lopcodes.h + A /server/src/include/lua/lparser.h + A /server/src/include/lua/lstate.h + A /server/src/include/lua/lstring.h + A /server/src/include/lua/ltable.h + A /server/src/include/lua/ltm.h + A /server/src/include/lua/lua.h + A /server/src/include/lua/luaconf.h + A /server/src/include/lua/lualib.h + A /server/src/include/lua/lundump.h + A /server/src/include/lua/lvm.h + A /server/src/include/lua/lzio.h + M /server/src/include/misc.h + +Too much to write it here. See forums Rev.140 for details +------------------------------------------------------------------------ +r139 | Namikon | 2009-10-13 13:21:20 +0200 (Tue, 13 Oct 2009) | 2 lines +Changed paths: + M /server/src/game/chars.cpp + M /server/src/game/decoder/udp_0x1f.cpp + A /server/src/game/decoder/udp_npcdialog.cpp + A /server/src/game/decoder/udp_npcdialog.h + A /server/src/game/def/def_scripts.cpp + M /server/src/game/def/gamedefs.cpp + M /server/src/game/include/chars.h + M /server/src/game/include/def_items.h + A /server/src/game/include/def_scripts.h + M /server/src/game/include/defs.h + M /server/src/game/include/gamedefs.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/npc.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + M /server/src/game/npc_conversation.cpp + M /server/src/include/external.h + +NPC Dialogs work. (Well, at least the basic functions, no faction / money / item stuff yet) +This has do be redone soon, since the way the lua file is processed (thanks maxxjag) makes it impossible to interpret the script correctly +------------------------------------------------------------------------ +r138 | Namikon | 2009-10-12 21:09:37 +0200 (Mon, 12 Oct 2009) | 1 line +Changed paths: + M /server/src/game/gamecommands/test.cpp + +small fix, just a typo +------------------------------------------------------------------------ +r137 | Namikon | 2009-10-12 21:04:59 +0200 (Mon, 12 Oct 2009) | 2 lines +Changed paths: + M /server/src/game/gamecommands/test.cpp + M /server/src/game/npc_conversation.cpp + +Fixed NPC Dialog Out-Of-Order Problem +@test 12 <0-255> will spawn any item in your inventory. pretty buggy but it works, somehow:P +------------------------------------------------------------------------ +r136 | Namikon | 2009-10-11 23:23:34 +0200 (Sun, 11 Oct 2009) | 2 lines +Changed paths: + M /server/src/game/include/npc.h + M /server/src/game/npc_conversation.cpp + +NPCs are now talking to us, yehaw :D +Buggy, but working +------------------------------------------------------------------------ +r135 | Namikon | 2009-10-11 19:57:24 +0200 (Sun, 11 Oct 2009) | 2 lines +Changed paths: + M /server/database/GameDB_patch_rev133-rev134.sql + M /server/src/game/include/npc.h + M /server/src/game/npc_conversation.cpp + +- Fixed server crash uppon wrong TraderID +- Added "allbuyer" option. Set itemID to -1 in DB to make any non-trader NPC an Allbuyer +------------------------------------------------------------------------ +r134 | Namikon | 2009-10-11 17:22:25 +0200 (Sun, 11 Oct 2009) | 10 lines +Changed paths: + A /server/database/GameDB_patch_rev133-rev134.sql + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/def/world_datparser.cpp + M /server/src/game/def/world_datstruct.h + M /server/src/game/gamecommands/test.cpp + M /server/src/game/include/def_items.h + M /server/src/game/include/npc.h + M /server/src/game/include/npctemplate.h + M /server/src/game/npc.cpp + A /server/src/game/npc_conversation.cpp + M /server/src/game/npctemplate.cpp + +- NPC Subsystem Upgrade: +- Every NPC has now its unique name. The name is generated when the NPC data is loaded from dat or SQL uppon zone entry +and is valid as long as the zone is alive +- NPCs are now WORKING! They don't die anymore (BIG thanks to sting, he found that little "offset" we didn't see) +- NPC shops are working too (At least every trader has the correct list of items. You cannot buy items yet, +but you see the correct items, with prices) +- Custom spawned NPCs (From SQL) can have dynamic shops. Just add ZoneID, WorldID, itemID and price in npc_shops. +There will be an ingame command to manage NPCs, for now use this example to let the NCPD in P1 sell COPBOT rifles =) + +insert into `npc_shop`(`c_npc_id`,`c_zoneid`,`c_itemid`,`c_itemprice`) values ( '48','1','90','50000'); +------------------------------------------------------------------------ +r133 | Hammag | 2009-07-04 14:44:13 +0200 (Sat, 04 Jul 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/conf/gameserver.conf + M /server/conf/infoserver.conf + M /server/src/game/decoder/udp_0x1f.cpp + M /server/src/game/decoder/udp_hack.cpp + M /server/src/game/decoder/udp_hack.h + M /server/src/game/decoder/udp_helditemaction.cpp + M /server/src/game/decoder/udp_helditemaction.h + M /server/src/game/decoder/udp_ping.cpp + M /server/src/game/decoder/udp_pvptrade.cpp + M /server/src/game/decoder/udp_pvptrade.h + M /server/src/game/gamecommands/t.cpp + M /server/src/game/include/def_drugs.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/main.cpp + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + M /server/src/include/message.h + M /server/src/include/svnrevision.h + +Some new packets for items use, and some fixes +------------------------------------------------------------------------ +r132 | Namikon | 2009-06-23 16:36:42 +0200 (Tue, 23 Jun 2009) | 3 lines +Changed paths: + M /server/src/game/commands.cpp + M /server/src/game/decoder/udp_0x13.cpp + M /server/src/game/decoder/udp_0x1f.cpp + M /server/src/game/decoder/udp_pvptrade.cpp + M /server/src/game/decoder/udp_pvptrade.h + M /server/src/game/decoder/udp_subskill.cpp + M /server/src/game/decoder/udp_worldIDinfo.cpp + M /server/src/game/decoder/udp_worldIDinfo.h + M /server/src/game/def/world_datparser.cpp + M /server/src/game/def/world_datstruct.h + M /server/src/game/gamecommands/givemoney.cpp + M /server/src/game/gamecommands/setlevel.cpp + M /server/src/game/gamecommands/setmainskill.cpp + M /server/src/game/gamecommands/setsubskill.cpp + M /server/src/game/gamecommands/test.cpp + M /server/src/game/include/commands.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/npc.h + M /server/src/game/include/npctemplate.h + M /server/src/game/include/skill.h + M /server/src/game/include/world_datparser.h + M /server/src/game/include/worlddatatemplate.h + M /server/src/game/include/worlds.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + M /server/src/game/npctemplate.cpp + M /server/src/game/skill.cpp + M /server/src/game/worlddatatemplate.cpp + +As by request of Akkiko, (hopefully) fixed all files with \n\r. (Also switched by editor to only use \n now. +As by request of Sting (and to revert my mistake i did a few days ago) re-enabled mUnknown and mLoot values in NPC.cpp +Also reformattet the output, the old one was way to long +------------------------------------------------------------------------ +r131 | Namikon | 2009-06-21 22:00:52 +0200 (Sun, 21 Jun 2009) | 4 lines +Changed paths: + A /docs/NPCs.txt + M /server/src/game/def/world_datparser.cpp + M /server/src/game/def/world_datstruct.h + M /server/src/game/gamecommands/test.cpp + M /server/src/game/include/npc.h + A /server/src/game/include/npctemplate.h + M /server/src/game/include/world_datparser.h + M /server/src/game/include/worlddatatemplate.h + M /server/src/game/include/worlds.h + M /server/src/game/npc.cpp + A /server/src/game/npctemplate.cpp + M /server/src/game/worlddatatemplate.cpp + M /server/src/include/svnrevision.h + M /server/tinns + +Worked on NPC subsystem +Server does now load NPC defs from SQL and the zone .dat files correctly AND it will spawn those NPCs at their correct location. +however, they're all death and i dont know why... yet. +A small test has been added to play with NPCs, see docs/NPCs.txt for details +------------------------------------------------------------------------ +r130 | Namikon | 2009-06-20 23:51:31 +0200 (Sat, 20 Jun 2009) | 4 lines +Changed paths: + M /server/conf/commands.conf + M /server/conf/gameserver.conf + M /server/conf/infoserver.conf + M /server/src/game/commands.cpp + M /server/src/game/decoder/udp_0x13.cpp + M /server/src/game/decoder/udp_0x1f.cpp + A /server/src/game/decoder/udp_pvptrade.cpp + A /server/src/game/decoder/udp_pvptrade.h + M /server/src/game/decoder/udp_subskill.cpp + A /server/src/game/decoder/udp_worldIDinfo.cpp + A /server/src/game/decoder/udp_worldIDinfo.h + M /server/src/game/gamecommands/setlevel.cpp + A /server/src/game/gamecommands/setmainskill.cpp + A /server/src/game/gamecommands/setsubskill.cpp + M /server/src/game/gamecommands/test.cpp + M /server/src/game/include/commands.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/skill.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + M /server/src/game/skill.cpp + M /server/src/include/svnrevision.h + +- Added 2 new commands: setmainskill and setsubskill (The 1st for PSI, INT, STR,.. the 2nd for HCK,BRT, ...) +- Added 2 new decoders for yet-unknown packets +- Prepared future work on the npc subsystem. (They'll soon be able to shoot you :) ) +- Fixed subskill system. You can now increase any subskill without getting OOO Packets, as long as there are enough skillpoints left of course +------------------------------------------------------------------------ +r129 | Namikon | 2009-06-20 12:38:54 +0200 (Sat, 20 Jun 2009) | 2 lines +Changed paths: + M /server/src/game/gamecommands/givemoney.cpp + M /server/src/game/npc.cpp + +- Servercrash fixed in npc.cpp when debugmode enabled +- Givemoney fixed, wasn't showing help on incomplete command +------------------------------------------------------------------------ +r128 | Akiko | 2009-06-15 12:36:51 +0200 (Mon, 15 Jun 2009) | 5 lines +Changed paths: + A /branch + A /branch/Akikos_tinns_with_cmake + A /branch/Akikos_tinns_with_cmake/CHANGELOG + A /branch/Akikos_tinns_with_cmake/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/LICENSE.txt + A /branch/Akikos_tinns_with_cmake/cmake_README + A /branch/Akikos_tinns_with_cmake/cmake_distclean.sh + A /branch/Akikos_tinns_with_cmake/cmake_modules + A /branch/Akikos_tinns_with_cmake/cmake_modules/FindMYSQL.cmake + A /branch/Akikos_tinns_with_cmake/cmake_modules/FindPCRE.cmake + A /branch/Akikos_tinns_with_cmake/cmake_modules/FindPTHREAD.cmake + A /branch/Akikos_tinns_with_cmake/cmake_modules/FindRT.cmake + A /branch/Akikos_tinns_with_cmake/docs + A /branch/Akikos_tinns_with_cmake/docs/Neocron1.ChatProtocol.pdf + A /branch/Akikos_tinns_with_cmake/docs/Neocron1.MainProtocol.pdf + A /branch/Akikos_tinns_with_cmake/docs/TinNS.QuickInstallation.pdf + A /branch/Akikos_tinns_with_cmake/docs/itemtypes.txt + A /branch/Akikos_tinns_with_cmake/server + A /branch/Akikos_tinns_with_cmake/server/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/server/WORK_IN_PROGRESS + A /branch/Akikos_tinns_with_cmake/server/conf + A /branch/Akikos_tinns_with_cmake/server/conf/commands.conf + A /branch/Akikos_tinns_with_cmake/server/conf/gameserver.conf + A /branch/Akikos_tinns_with_cmake/server/conf/global.conf + A /branch/Akikos_tinns_with_cmake/server/conf/infoserver.conf + A /branch/Akikos_tinns_with_cmake/server/conf/patchserver.conf + A /branch/Akikos_tinns_with_cmake/server/database + A /branch/Akikos_tinns_with_cmake/server/database/GameDB.sql + A /branch/Akikos_tinns_with_cmake/server/database/GameDB_migration_rev107-rev108.sql + A /branch/Akikos_tinns_with_cmake/server/database/GameDB_migration_rev81-rev82.sql + A /branch/Akikos_tinns_with_cmake/server/database/InfoDB.sql + A /branch/Akikos_tinns_with_cmake/server/docs + A /branch/Akikos_tinns_with_cmake/server/docs/ISC Example.txt + A /branch/Akikos_tinns_with_cmake/server/docs/ISC ProtDef.txt + A /branch/Akikos_tinns_with_cmake/server/init.d + A /branch/Akikos_tinns_with_cmake/server/init.d/tinns + A /branch/Akikos_tinns_with_cmake/server/src + A /branch/Akikos_tinns_with_cmake/server/src/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/server/src/common + A /branch/Akikos_tinns_with_cmake/server/src/common/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/server/src/common/config + A /branch/Akikos_tinns_with_cmake/server/src/common/config/config.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/config/main.h + A /branch/Akikos_tinns_with_cmake/server/src/common/console + A /branch/Akikos_tinns_with_cmake/server/src/common/console/console.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/console/main.h + A /branch/Akikos_tinns_with_cmake/server/src/common/filesystem + A /branch/Akikos_tinns_with_cmake/server/src/common/filesystem/filesystem.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/filesystem/main.h + A /branch/Akikos_tinns_with_cmake/server/src/common/misc + A /branch/Akikos_tinns_with_cmake/server/src/common/misc/main.h + A /branch/Akikos_tinns_with_cmake/server/src/common/misc/misc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode/connection-tcp.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode/connection-udp.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode/main.h + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode/message.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode/serversocket.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/netcode/udpmanager.cpp + A /branch/Akikos_tinns_with_cmake/server/src/common/regex + A /branch/Akikos_tinns_with_cmake/server/src/common/regex/regex++.cpp + A /branch/Akikos_tinns_with_cmake/server/src/dev-tools + A /branch/Akikos_tinns_with_cmake/server/src/dev-tools/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/server/src/dev-tools/cleandepfile.c + A /branch/Akikos_tinns_with_cmake/server/src/dev-tools/getsvnrev.cpp + A /branch/Akikos_tinns_with_cmake/server/src/dev-tools/make-bin-tarball + A /branch/Akikos_tinns_with_cmake/server/src/dev-tools/make-src-tarball + A /branch/Akikos_tinns_with_cmake/server/src/game + A /branch/Akikos_tinns_with_cmake/server/src/game/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/server/src/game/accounts.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/appartements.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/buddylist.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/chars.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/chat.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/client.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/clientmanager.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/commands.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/configtemplate.h + A /branch/Akikos_tinns_with_cmake/server/src/game/container.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/main.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/msgdecoder.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x08.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x08.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x13.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x13.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x1f.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x1f.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x22.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x22.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x2b.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_0x2b.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_OOO.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_OOO.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_appartment.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_appartment.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_charmove.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_charmove.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_chat.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_chat.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_deathrespawn.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_deathrespawn.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_entityposreq.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_entityposreq.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_hack.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_hack.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_helditemaction.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_helditemaction.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_itemmanualreload.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_itemmanualreload.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_itemmove.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_itemmove.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_itemuse.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_itemuse.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_killself.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_killself.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_outfitter.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_outfitter.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_packet0.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_packet0.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_ping.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_ping.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_popupresponse.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_popupresponse.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_quickaccessbelt.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_quickaccessbelt.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_reqinfo.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_reqinfo.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_subskill.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_subskill.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_sync.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_sync.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_terminal.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_terminal.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_useobject.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_useobject.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_vhc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_vhc.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_zoning.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udp_zoning.h + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udpanalyser.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/decoder/udpanalyser.h + A /branch/Akikos_tinns_with_cmake/server/src/game/def + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_actionmod.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_ammo.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_appartements.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_appplaces.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_blueprintpieces.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_characters.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_charaction.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_charkinds.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_damage.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_drugs.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_factions.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_hack.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_implants.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_itemcontainer.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_itemmod.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_itemres.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_items.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_mission.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_npc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_npcarmor.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_npcgroupspawn.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_outposts.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_recycles.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_respawn.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_shots.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_skills.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_subskills.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_trader.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_vehicles.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_vehiclesits.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_weapons.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_weather.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_worldfile.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_worldmodels.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/def_worlds.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/defparser.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/gamedefs.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/main.h + A /branch/Akikos_tinns_with_cmake/server/src/game/def/world_datparser.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/def/world_datstruct.h + A /branch/Akikos_tinns_with_cmake/server/src/game/doortemplate.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/furnituretemplate.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/README + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/ban.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/brightness.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/broadcast.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/color.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/debug.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/effect.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/givemoney.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/h.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/info.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/jail.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/kick.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/listbans.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/main.h + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/online.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/rawf.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/recall.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/remove.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/setlevel.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/settime.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/shun.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/skin.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/spawnactor.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/speed.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/t.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/takemoney.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/teleport.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/test.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/unban.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/unjail.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/unshun.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/uptime.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/v.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/version.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/warp.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/warpto.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamecommands/weather.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/gamescript.cpp.inhib + A /branch/Akikos_tinns_with_cmake/server/src/game/gameserver.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/genreplist.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/globals.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/include + A /branch/Akikos_tinns_with_cmake/server/src/game/include/accounts.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/appartements.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/buddylist.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/chars.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/chat.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/client.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/clientmanager.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/commands.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/container.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_actionmod.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_ammo.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_appartements.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_appplaces.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_blueprintpieces.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_characters.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_charaction.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_charkinds.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_damage.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_drugs.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_factions.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_hack.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_implants.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_itemcontainer.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_itemmod.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_itemres.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_items.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_mission.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_npc.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_npcarmor.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_npcgroupspawn.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_outposts.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_recycles.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_respawn.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_shots.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_skills.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_subskills.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_trader.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_vehicles.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_vehiclesits.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_weapons.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_weather.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_worldfile.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_worldmodels.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/def_worlds.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/defmap.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/defparser.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/defs.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/doortemplate.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/furnituretemplate.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/gamedefs.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/gamescript.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/gameserver.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/genreplist.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/globals.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/inventory.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/isc.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/item.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/msgbuilder.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/msgdecoder.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/npc.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/rconsole.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/server.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/skill.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/sql.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/subway.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/terminal.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/vehicle.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/vhcaccessrequest.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/world_datparser.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/worldactors.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/worlddatatemplate.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/worlds.h + A /branch/Akikos_tinns_with_cmake/server/src/game/include/zoning.h + A /branch/Akikos_tinns_with_cmake/server/src/game/inventory.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/isc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/item.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/main.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/main.h + A /branch/Akikos_tinns_with_cmake/server/src/game/msgbuilder.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/npc.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/rconsole.cpp.inhib + A /branch/Akikos_tinns_with_cmake/server/src/game/server.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/skill.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/sql.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/subway.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/terminal.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/terminal_receivedb.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/terminal_servermessage.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/terminal_tryaccess.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/terminal_updatedb.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/vehicle.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/vhcaccessrequest.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/worldactors.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/worlddatatemplate.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/worlds.cpp + A /branch/Akikos_tinns_with_cmake/server/src/game/zoning.cpp + A /branch/Akikos_tinns_with_cmake/server/src/include + A /branch/Akikos_tinns_with_cmake/server/src/include/config.h + A /branch/Akikos_tinns_with_cmake/server/src/include/connection-tcp.h + A /branch/Akikos_tinns_with_cmake/server/src/include/connection-udp.h + A /branch/Akikos_tinns_with_cmake/server/src/include/console.h + A /branch/Akikos_tinns_with_cmake/server/src/include/external.h + A /branch/Akikos_tinns_with_cmake/server/src/include/filesystem.h + A /branch/Akikos_tinns_with_cmake/server/src/include/message.h + A /branch/Akikos_tinns_with_cmake/server/src/include/misc.h + A /branch/Akikos_tinns_with_cmake/server/src/include/netcode.h + A /branch/Akikos_tinns_with_cmake/server/src/include/regex++.h + A /branch/Akikos_tinns_with_cmake/server/src/include/serversocket.h + A /branch/Akikos_tinns_with_cmake/server/src/include/svnrevision.h + A /branch/Akikos_tinns_with_cmake/server/src/include/tinns_mutex.h + A /branch/Akikos_tinns_with_cmake/server/src/include/tinns_semaphore.h + A /branch/Akikos_tinns_with_cmake/server/src/include/tinns_thread.h + A /branch/Akikos_tinns_with_cmake/server/src/include/types.h + A /branch/Akikos_tinns_with_cmake/server/src/include/version.h + A /branch/Akikos_tinns_with_cmake/server/src/info + A /branch/Akikos_tinns_with_cmake/server/src/info/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/server/src/info/accounts.cpp + A /branch/Akikos_tinns_with_cmake/server/src/info/accounts.h + A /branch/Akikos_tinns_with_cmake/server/src/info/client.cpp + A /branch/Akikos_tinns_with_cmake/server/src/info/client.h + A /branch/Akikos_tinns_with_cmake/server/src/info/configtemplate.h + A /branch/Akikos_tinns_with_cmake/server/src/info/globals.cpp + A /branch/Akikos_tinns_with_cmake/server/src/info/globals.h + A /branch/Akikos_tinns_with_cmake/server/src/info/infoserver.cpp + A /branch/Akikos_tinns_with_cmake/server/src/info/infoserver.h + A /branch/Akikos_tinns_with_cmake/server/src/info/main.cpp + A /branch/Akikos_tinns_with_cmake/server/src/info/main.h + A /branch/Akikos_tinns_with_cmake/server/src/info/server.cpp + A /branch/Akikos_tinns_with_cmake/server/src/info/server.h + A /branch/Akikos_tinns_with_cmake/server/src/info/sql.cpp + A /branch/Akikos_tinns_with_cmake/server/src/info/sql.h + A /branch/Akikos_tinns_with_cmake/server/src/patch + A /branch/Akikos_tinns_with_cmake/server/src/patch/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/server/src/patch/client.cpp + A /branch/Akikos_tinns_with_cmake/server/src/patch/client.h + A /branch/Akikos_tinns_with_cmake/server/src/patch/configtemplate.h + A /branch/Akikos_tinns_with_cmake/server/src/patch/globals.cpp + A /branch/Akikos_tinns_with_cmake/server/src/patch/globals.h + A /branch/Akikos_tinns_with_cmake/server/src/patch/main.cpp + A /branch/Akikos_tinns_with_cmake/server/src/patch/main.h + A /branch/Akikos_tinns_with_cmake/server/src/patch/patchserver.cpp + A /branch/Akikos_tinns_with_cmake/server/src/patch/patchserver.h + A /branch/Akikos_tinns_with_cmake/server/src/patch/server.cpp + A /branch/Akikos_tinns_with_cmake/server/src/patch/server.h + A /branch/Akikos_tinns_with_cmake/tools + A /branch/Akikos_tinns_with_cmake/tools/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/tools/pak_decompress + A /branch/Akikos_tinns_with_cmake/tools/pak_decompress/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/tools/pak_decompress/pak_decompress.cpp + A /branch/Akikos_tinns_with_cmake/tools/pak_decompress/pak_decompress.jar + A /branch/Akikos_tinns_with_cmake/tools/vfs_viewer + A /branch/Akikos_tinns_with_cmake/tools/vfs_viewer/CMakeLists.txt + A /branch/Akikos_tinns_with_cmake/tools/vfs_viewer/vfs_viewer.c + +- New branch with cmake buildsystem (version 2.6+) +- Cleanups +- Small Fixes + + +------------------------------------------------------------------------ +r127 | Hammag | 2009-05-12 18:29:52 +0200 (Tue, 12 May 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/conf/commands.conf + M /server/src/game/client.cpp + M /server/src/game/commands.cpp + M /server/src/game/decoder/udp_0x1f.cpp + M /server/src/game/decoder/udp_helditemaction.cpp + M /server/src/game/decoder/udp_helditemaction.h + M /server/src/game/gamecommands/t.cpp + A /server/src/game/gamecommands/weather.cpp + M /server/src/game/include/commands.h + M /server/src/game/include/inventory.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/msgbuilder.cpp + M /server/src/include/svnrevision.h + +multiuser weapon visualisation, weather control +------------------------------------------------------------------------ +r126 | Hammag | 2009-05-10 23:56:24 +0200 (Sun, 10 May 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/decoder/udp_0x13.cpp + M /server/src/game/decoder/udp_0x1f.cpp + A /server/src/game/decoder/udp_deathrespawn.cpp + A /server/src/game/decoder/udp_deathrespawn.h + M /server/src/game/decoder/udp_helditemaction.cpp + M /server/src/game/decoder/udp_helditemaction.h + M /server/src/game/decoder/udp_itemmanualreload.cpp + M /server/src/game/decoder/udp_itemmanualreload.h + M /server/src/game/decoder/udp_killself.cpp + M /server/src/game/decoder/udp_quickaccessbelt.cpp + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/decoder/udp_zoning.h + M /server/src/game/gamecommands/t.cpp + M /server/src/game/include/msgbuilder.h + M /server/src/game/msgbuilder.cpp + M /server/src/include/svnrevision.h + +More on weapon reload +------------------------------------------------------------------------ +r125 | Hammag | 2009-05-10 02:15:46 +0200 (Sun, 10 May 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/decoder/udp_0x1f.cpp + M /server/src/game/decoder/udp_helditemaction.cpp + M /server/src/game/decoder/udp_helditemaction.h + A /server/src/game/decoder/udp_itemmanualreload.cpp + A /server/src/game/decoder/udp_itemmanualreload.h + M /server/src/game/decoder/udp_itemmove.cpp + M /server/src/game/decoder/udp_itemmove.h + A /server/src/game/decoder/udp_itemuse.cpp + A /server/src/game/decoder/udp_itemuse.h + M /server/src/game/def/def_weapons.cpp + M /server/src/game/gamecommands/t.cpp + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/vehicle.h + M /server/src/game/msgbuilder.cpp + M /server/src/include/svnrevision.h + +basic weapon reload anxrdxs weapon.def loading fix +------------------------------------------------------------------------ +r124 | Hammag | 2009-05-01 12:51:36 +0200 (Fri, 01 May 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/def/def_itemmod.cpp + M /server/src/game/def/def_mission.cpp + M /server/src/game/def/def_npcarmor.cpp + M /server/src/game/def/def_outposts.cpp + M /server/src/game/def/def_recycles.cpp + M /server/src/game/def/defparser.cpp + M /server/src/game/include/def_itemmod.h + M /server/src/game/include/def_npcarmor.h + M /server/src/game/include/def_recycles.h + M /server/src/game/include/defmap.h + M /server/src/include/svnrevision.h + +Addition of remaining .def support +------------------------------------------------------------------------ +r123 | Hammag | 2009-04-29 19:30:26 +0200 (Wed, 29 Apr 2009) | 1 line +Changed paths: + M /server/src/game/client.cpp + M /server/src/game/decoder/udp_terminal.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/def/def_actionmod.cpp + M /server/src/game/def/def_blueprintpieces.cpp + M /server/src/game/def/def_charaction.cpp + M /server/src/game/def/def_damage.cpp + M /server/src/game/def/def_drugs.cpp + A /server/src/game/def/def_implants.cpp + M /server/src/game/def/def_itemres.cpp + M /server/src/game/def/def_shots.cpp + M /server/src/game/def/def_trader.cpp + M /server/src/game/include/client.h + M /server/src/game/include/def_blueprintpieces.h + M /server/src/game/include/def_drugs.h + M /server/src/game/include/def_implants.h + M /server/src/game/include/def_itemres.h + M /server/src/game/include/def_shots.h + M /server/src/game/include/furnituretemplate.h + M /server/src/game/include/worlds.h + M /server/src/game/vehicle.cpp + M /server/src/game/worlddatatemplate.cpp + M /server/src/game/worlds.cpp + M /server/src/include/svnrevision.h + +some more .def support and various small fixes +------------------------------------------------------------------------ +r122 | Hammag | 2009-04-28 13:36:48 +0200 (Tue, 28 Apr 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/common/netcode/message.cpp + M /server/src/game/chars.cpp + M /server/src/game/client.cpp + M /server/src/game/clientmanager.cpp + M /server/src/game/decoder/udp_charmove.cpp + M /server/src/game/decoder/udp_helditemaction.cpp + M /server/src/game/decoder/udp_itemmove.cpp + M /server/src/game/decoder/udp_popupresponse.cpp + M /server/src/game/decoder/udp_quickaccessbelt.cpp + M /server/src/game/decoder/udp_sync.cpp + M /server/src/game/decoder/udp_terminal.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/decoder/udp_vhc.h + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/gamecommands/jail.cpp + M /server/src/game/gamecommands/recall.cpp + M /server/src/game/gamecommands/t.cpp + M /server/src/game/gamecommands/unjail.cpp + M /server/src/game/gamecommands/warp.cpp + M /server/src/game/gamecommands/warpto.cpp + M /server/src/game/include/chars.h + M /server/src/game/include/client.h + M /server/src/game/include/clientmanager.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/msgdecoder.h + M /server/src/game/include/npc.h + M /server/src/game/include/vehicle.h + M /server/src/game/include/worlds.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + M /server/src/game/vehicle.cpp + M /server/src/game/worlds.cpp + M /server/src/include/svnrevision.h + +Various fixes and more work on vhc +------------------------------------------------------------------------ +r121 | Hammag | 2009-04-21 17:55:19 +0200 (Tue, 21 Apr 2009) | 1 line +Changed paths: + M /server/src/game/client.cpp + M /server/src/game/decoder/udp_0x22.cpp + M /server/src/game/decoder/udp_ping.cpp + M /server/src/game/decoder/udp_ping.h + M /server/src/game/decoder/udp_sync.cpp + M /server/src/game/decoder/udp_sync.h + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/def/world_datparser.cpp + M /server/src/game/gamecommands/t.cpp + M /server/src/game/gamecommands/test.cpp + M /server/src/game/include/msgbuilder.h + M /server/src/game/msgbuilder.cpp + M /server/src/include/svnrevision.h + +Some source formatting, minor additions and fixes, on-going protocol investigations +------------------------------------------------------------------------ +r120 | Hammag | 2009-04-18 20:02:40 +0200 (Sat, 18 Apr 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/client.cpp + M /server/src/game/decoder/udp_charmove.cpp + M /server/src/include/svnrevision.h + +Fixed bug that caused crash in some circumstances +------------------------------------------------------------------------ +r119 | Hammag | 2009-04-18 19:25:46 +0200 (Sat, 18 Apr 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/client.cpp + M /server/src/game/clientmanager.cpp + M /server/src/game/commands.cpp + M /server/src/game/decoder/udp_charmove.cpp + M /server/src/game/decoder/udp_charmove.h + M /server/src/game/decoder/udp_helditemaction.cpp + M /server/src/game/decoder/udp_helditemaction.h + M /server/src/game/decoder/udp_outfitter.h + M /server/src/game/decoder/udp_terminal.cpp + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/def/def_mission.cpp + M /server/src/game/gamecommands/ban.cpp + M /server/src/game/gamecommands/jail.cpp + M /server/src/game/gamecommands/kick.cpp + M /server/src/game/gamecommands/recall.cpp + M /server/src/game/gamecommands/t.cpp + M /server/src/game/gamecommands/teleport.cpp + M /server/src/game/gamecommands/unjail.cpp + M /server/src/game/gamecommands/warp.cpp + M /server/src/game/gamecommands/warpto.cpp + M /server/src/game/include/chars.h + M /server/src/game/include/client.h + M /server/src/game/include/clientmanager.h + M /server/src/game/include/commands.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/vehicle.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/vehicle.cpp + M /server/src/include/svnrevision.h + +mutlichar vhc fixes and access management +------------------------------------------------------------------------ +r118 | Hammag | 2009-04-17 01:04:18 +0200 (Fri, 17 Apr 2009) | 1 line +Changed paths: + M /server/src/game/commands.cpp + M /server/src/game/decoder/udp_appartment.cpp + M /server/src/game/decoder/udp_chat.cpp + M /server/src/game/decoder/udp_hack.cpp + M /server/src/game/decoder/udp_packet0.cpp + M /server/src/game/decoder/udp_ping.cpp + M /server/src/game/decoder/udp_popupresponse.cpp + M /server/src/game/decoder/udp_quickaccessbelt.cpp + M /server/src/game/decoder/udp_reqinfo.cpp + M /server/src/game/decoder/udp_subskill.cpp + M /server/src/game/decoder/udp_sync.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/gamecommands/givemoney.cpp + M /server/src/game/gamecommands/jail.cpp + M /server/src/game/gamecommands/recall.cpp + M /server/src/game/gamecommands/takemoney.cpp + M /server/src/game/gamecommands/teleport.cpp + M /server/src/game/gamecommands/test.cpp + M /server/src/game/gamecommands/unjail.cpp + M /server/src/game/gamecommands/warp.cpp + M /server/src/game/gamecommands/warpto.cpp + M /server/src/game/include/client.h + M /server/src/game/include/vehicle.h + M /server/src/game/include/vhcaccessrequest.h + M /server/src/game/npc.cpp + M /server/src/game/terminal.cpp + M /server/src/game/terminal_tryaccess.cpp + M /server/src/game/vehicle.cpp + M /server/src/game/vhcaccessrequest.cpp + M /server/src/game/worldactors.cpp + M /server/src/include/svnrevision.h + +Continuation of work on vhc access requests +------------------------------------------------------------------------ +r117 | Hammag | 2009-04-16 16:40:57 +0200 (Thu, 16 Apr 2009) | 1 line +Changed paths: + M /server/src/game/chars.cpp + M /server/src/game/clientmanager.cpp + M /server/src/game/commands.cpp + M /server/src/game/decoder/udp_popupresponse.cpp + M /server/src/game/decoder/udp_popupresponse.h + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/decoder/udp_vhc.h + M /server/src/game/include/chars.h + M /server/src/game/include/clientmanager.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/vehicle.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/vehicle.cpp + M /server/src/game/vhcaccessrequest.cpp + M /server/src/include/svnrevision.h + +Intermediate rev. DO NOT USE +------------------------------------------------------------------------ +r116 | Hammag | 2009-04-15 01:11:08 +0200 (Wed, 15 Apr 2009) | 1 line +Changed paths: + M /server/src/game/decoder/udp_0x1f.cpp + A /server/src/game/decoder/udp_popupresponse.cpp + A /server/src/game/decoder/udp_popupresponse.h + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/decoder/udp_zoning.h + A /server/src/game/include/vhcaccessrequest.h + A /server/src/game/vhcaccessrequest.cpp + M /server/src/include/svnrevision.h + +more work on vhc +------------------------------------------------------------------------ +r115 | Hammag | 2009-04-14 17:56:30 +0200 (Tue, 14 Apr 2009) | 1 line +Changed paths: + M /server/src/game/chars.cpp + M /server/src/game/decoder/udp_0x1f.cpp + M /server/src/game/decoder/udp_itemmove.cpp + A /server/src/game/decoder/udp_killself.cpp + A /server/src/game/decoder/udp_killself.h + M /server/src/game/decoder/udp_terminal.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/include/chars.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/vehicle.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/vehicle.cpp + M /server/src/include/svnrevision.h + +various minor things +------------------------------------------------------------------------ +r114 | Hammag | 2009-04-13 01:20:51 +0200 (Mon, 13 Apr 2009) | 1 line +Changed paths: + M /server/src/game/decoder/udp_0x13.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/decoder/udp_vhc.h + M /server/src/game/def/def_vehicles.cpp + M /server/src/game/include/def_vehicles.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/vehicle.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/vehicle.cpp + M /server/src/include/svnrevision.h + +Some work on vehicles +------------------------------------------------------------------------ +r113 | Hammag | 2009-04-11 23:40:02 +0200 (Sat, 11 Apr 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/common/misc/misc.cpp + M /server/src/game/appartements.cpp + M /server/src/game/container.cpp + M /server/src/game/decoder/udp_charmove.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/def/def_ammo.cpp + M /server/src/game/def/def_itemcontainer.cpp + M /server/src/game/def/def_items.cpp + M /server/src/game/def/def_npc.cpp + M /server/src/game/def/def_npcgroupspawn.cpp + M /server/src/game/def/def_trader.cpp + M /server/src/game/def/def_weather.cpp + M /server/src/game/def/def_worlds.cpp + M /server/src/game/gameserver.cpp + M /server/src/game/include/container.h + M /server/src/game/include/def_itemcontainer.h + M /server/src/game/include/def_items.h + M /server/src/game/include/gameserver.h + M /server/src/game/item.cpp + M /server/src/include/misc.h + M /server/src/include/svnrevision.h + +More .def files supported +------------------------------------------------------------------------ +r112 | Hammag | 2009-04-07 00:46:45 +0200 (Tue, 07 Apr 2009) | 1 line +Changed paths: + M /server/src/game/decoder/udp_vhc.cpp + M /server/src/game/decoder/udp_vhc.h + M /server/src/game/def/def_vehicles.cpp + M /server/src/game/def/def_vehiclesits.cpp + M /server/src/game/include/def_vehicles.h + M /server/src/game/msgbuilder.cpp + M /server/src/include/svnrevision.h + +Implement vehicles.def and vehiclesits.def support +------------------------------------------------------------------------ +r111 | Hammag | 2009-04-04 16:49:02 +0200 (Sat, 04 Apr 2009) | 1 line +Changed paths: + M /server/CHANGELOG + A /server/src/game/def/def_actionmod.cpp + A /server/src/game/def/def_ammo.cpp + M /server/src/game/def/def_appartements.cpp + M /server/src/game/def/def_appplaces.cpp + A /server/src/game/def/def_blueprintpieces.cpp + M /server/src/game/def/def_characters.cpp + A /server/src/game/def/def_charaction.cpp + A /server/src/game/def/def_damage.cpp + A /server/src/game/def/def_drugs.cpp + M /server/src/game/def/def_factions.cpp + M /server/src/game/def/def_hack.cpp + A /server/src/game/def/def_itemcontainer.cpp + A /server/src/game/def/def_itemmod.cpp + A /server/src/game/def/def_itemres.cpp + M /server/src/game/def/def_items.cpp + A /server/src/game/def/def_mission.cpp + A /server/src/game/def/def_npc.cpp + A /server/src/game/def/def_npcarmor.cpp + A /server/src/game/def/def_npcgroupspawn.cpp + A /server/src/game/def/def_outposts.cpp + A /server/src/game/def/def_recycles.cpp + M /server/src/game/def/def_respawn.cpp + A /server/src/game/def/def_shots.cpp + A /server/src/game/def/def_trader.cpp + A /server/src/game/def/def_vehicles.cpp + A /server/src/game/def/def_vehiclesits.cpp + M /server/src/game/def/def_weapons.cpp + A /server/src/game/def/def_weather.cpp + M /server/src/game/def/def_worldfile.cpp + M /server/src/game/def/def_worldmodels.cpp + M /server/src/game/def/def_worlds.cpp + M /server/src/game/def/gamedefs.cpp + M /server/src/game/def/main.h + A /server/src/game/include/def.h + A /server/src/game/include/def_actionmod.h + A /server/src/game/include/def_ammo.h + M /server/src/game/include/def_appartements.h + M /server/src/game/include/def_appplaces.h + A /server/src/game/include/def_blueprintpieces.h + M /server/src/game/include/def_characters.h + A /server/src/game/include/def_charaction.h + M /server/src/game/include/def_charkinds.h + A /server/src/game/include/def_damage.h + A /server/src/game/include/def_drugs.h + M /server/src/game/include/def_factions.h + M /server/src/game/include/def_hack.h + A /server/src/game/include/def_implants.h + A /server/src/game/include/def_itemcontainer.h + A /server/src/game/include/def_itemmod.h + A /server/src/game/include/def_itemres.h + M /server/src/game/include/def_items.h + A /server/src/game/include/def_mission.h + A /server/src/game/include/def_npc.h + A /server/src/game/include/def_npcarmor.h + A /server/src/game/include/def_npcgroupspawn.h + A /server/src/game/include/def_outposts.h + A /server/src/game/include/def_recycles.h + M /server/src/game/include/def_respawn.h + A /server/src/game/include/def_shots.h + M /server/src/game/include/def_skills.h + M /server/src/game/include/def_subskills.h + A /server/src/game/include/def_trader.h + A /server/src/game/include/def_vehicles.h + A /server/src/game/include/def_vehiclesits.h + M /server/src/game/include/def_weapons.h + A /server/src/game/include/def_weather.h + M /server/src/game/include/def_worldfile.h + M /server/src/game/include/def_worldmodels.h + M /server/src/game/include/def_worlds.h + M /server/src/game/include/defmap.h + M /server/src/game/include/defs.h + M /server/src/game/include/gamedefs.h + M /server/src/include/svnrevision.h + +Declarations and start of definition for .def files support +------------------------------------------------------------------------ +r110 | Hammag | 2009-03-31 02:40:13 +0200 (Tue, 31 Mar 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/appartements.cpp + M /server/src/game/chars.cpp + M /server/src/game/container.cpp + M /server/src/game/decoder/udp_hack.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/def/def_charkinds.cpp + M /server/src/game/def/def_items.cpp + M /server/src/game/def/def_respawn.cpp + M /server/src/game/def/def_skills.cpp + M /server/src/game/def/def_worldfile.cpp + M /server/src/game/def/gamedefs.cpp + M /server/src/game/def/world_datparser.cpp + M /server/src/game/include/def_appartements.h + M /server/src/game/include/def_hack.h + M /server/src/game/include/def_items.h + M /server/src/game/include/def_respawn.h + M /server/src/game/include/def_weapons.h + M /server/src/game/include/def_worldfile.h + A /server/src/game/include/defmap.h + M /server/src/game/include/defs.h + M /server/src/game/include/gamedefs.h + M /server/src/game/include/gamescript.h + M /server/src/game/item.cpp + M /server/src/game/main.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/worldactors.cpp + M /server/src/game/worlds.cpp + M /server/src/include/svnrevision.h + +gamedefs architecture revamping +------------------------------------------------------------------------ +r109 | Hammag | 2009-03-30 16:34:46 +0200 (Mon, 30 Mar 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/decoder/udp_itemmove.cpp + M /server/src/game/def/def_items.cpp + A /server/src/game/def/def_weapons.cpp + M /server/src/game/def/gamedefs.cpp + M /server/src/game/def/main.h + A /server/src/game/include/def_weapons.h + M /server/src/game/include/defs.h + M /server/src/game/include/gamedefs.h + M /server/src/game/msgbuilder.cpp + M /server/src/include/svnrevision.h + +Added support for weapons.def +------------------------------------------------------------------------ +r108 | Hammag | 2009-03-28 20:02:40 +0100 (Sat, 28 Mar 2009) | 1 line +Changed paths: + M /server/CHANGELOG + A /server/database/GameDB.sql + D /server/database/GameDB5_to_GameDB6.sql + D /server/database/GameDB6.zip + A /server/database/GameDB_migration_rev107-rev108.sql + A /server/database/GameDB_migration_rev81-rev82.sql (from /server/database/GameDB5_to_GameDB6.sql:102) + A /server/database/InfoDB.sql + D /server/database/InfoDB2.zip + M /server/src/game/include/item.h + M /server/src/game/include/npc.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/npc.cpp + M /server/src/include/svnrevision.h + +Database, inventory and subway changes +------------------------------------------------------------------------ +r107 | Hammag | 2009-03-28 10:46:49 +0100 (Sat, 28 Mar 2009) | 1 line +Changed paths: + M /server/src/game/commands.cpp + M /server/src/game/decoder/udp_charmove.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/include/msgbuilder.h + M /server/src/game/msgbuilder.cpp + M /server/src/include/svnrevision.h + +Subway cab entering fix +------------------------------------------------------------------------ +r106 | Hammag | 2009-03-27 20:22:48 +0100 (Fri, 27 Mar 2009) | 1 line +Changed paths: + M /server/src/game/chars.cpp + M /server/src/game/container.cpp + M /server/src/game/decoder/udp_0x13.cpp + M /server/src/game/decoder/udp_0x1f.cpp + M /server/src/game/decoder/udp_charmove.cpp + A /server/src/game/decoder/udp_helditemaction.cpp + A /server/src/game/decoder/udp_helditemaction.h + M /server/src/game/decoder/udp_itemmove.cpp + M /server/src/game/decoder/udp_itemmove.h + M /server/src/game/gamecommands/t.cpp + M /server/src/game/gamecommands/v.cpp + M /server/src/game/include/chars.h + M /server/src/game/include/item.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/item.cpp + M /server/src/game/msgbuilder.cpp + M /server/src/game/skill.cpp + M /server/src/include/svnrevision.h + +Experiments on item attributes encoding +------------------------------------------------------------------------ +r105 | Hammag | 2009-03-20 14:22:21 +0100 (Fri, 20 Mar 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/chars.cpp + M /server/src/game/decoder/udp_0x1f.cpp + A /server/src/game/decoder/udp_outfitter.cpp + A /server/src/game/decoder/udp_outfitter.h + M /server/src/game/def/def_characters.cpp + M /server/src/game/include/def_characters.h + M /server/src/include/svnrevision.h + +Outfitter implementation +------------------------------------------------------------------------ +r104 | Hammag | 2009-03-19 23:01:19 +0100 (Thu, 19 Mar 2009) | 1 line +Changed paths: + M /server/CHANGELOG + M /server/src/game/decoder/udp_0x1f.cpp + M /server/src/game/decoder/udp_entityposreq.cpp + M /server/src/game/decoder/udp_useobject.cpp + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/decoder/udp_zoning.h + M /server/src/game/include/msgbuilder.h + M /server/src/game/include/worlddatatemplate.h + M /server/src/game/msgbuilder.cpp + M /server/src/game/worlddatatemplate.cpp + M /server/src/include/svnrevision.h + +Apt Genrep code fixes, Venture Wrap implementation +------------------------------------------------------------------------ +r103 | Hammag | 2009-03-15 19:24:33 +0100 (Sun, 15 Mar 2009) | 1 line +Changed paths: + M /server + M /server/CHANGELOG + M /server/src + M /server/src/Makefile + M /server/src/common/netcode/connection-tcp.cpp + M /server/src/common/netcode/connection-udp.cpp + M /server/src/common/netcode/message.cpp + M /server/src/dev-tools + M /server/src/game/chat.cpp + M /server/src/game/container.cpp + M /server/src/game/decoder/udp_chat.cpp + M /server/src/game/decoder/udp_terminal.cpp + M /server/src/game/decoder/udp_zoning.cpp + M /server/src/game/gamecommands/debug.cpp + M /server/src/game/include/chat.h + M /server/src/game/include/client.h + M /server/src/game/include/def_items.h + M /server/src/game/include/doortemplate.h + M /server/src/game/include/furnituretemplate.h + M /server/src/game/include/item.h + M /server/src/game/subway.cpp + M /server/src/game/vehicle.cpp + M /server/src/include/message.h + M /server/src/include/svnrevision.h + A /server/src/options.local.exemple + +Fixed various compilation warnings +------------------------------------------------------------------------ +r102 | Akiko | 2008-08-26 21:21:14 +0200 (Tue, 26 Aug 2008) | 5 lines +Changed paths: + M /server/src/Makefile + M /server/src/common/config/config.cpp + M /server/src/game/accounts.cpp + M /server/src/game/appartements.cpp + M /server/src/game/buddylist.cpp + M /server/src/game/chars.cpp + M /server/src/game/commands.cpp + M /server/src/game/container.cpp + M /server/src/game/def/def_appartements.cpp + M /server/src/game/def/def_appplaces.cpp + M /server/src/game/def/def_characters.cpp + M /server/src/game/def/def_charkinds.cpp + M /server/src/game/def/def_factions.cpp + M /server/src/game/def/def_hack.cpp + M /server/src/game/def/def_items.cpp + M /server/src/game/def/def_respawn.cpp + M /server/src/game/def/def_skills.cpp + M /server/src/game/def/def_subskills.cpp + M /server/src/game/def/def_worldfile.cpp + M /server/src/game/def/def_worldmodels.cpp + M /server/src/game/def/def_worlds.cpp + M /server/src/game/genreplist.cpp + M /server/src/game/include/worldactors.h + M /server/src/game/npc.cpp + M /server/src/game/terminal.cpp + M /server/src/game/worldactors.cpp + M /server/src/include/svnrevision.h + M /server/src/info/accounts.cpp + +- temporarly removed -Werrors option to stop breaking on gcc 4.3 +- who the fuck moved the atoi c-function into the std namespace of + c++?!? I want to see the system where that compiles! + + +------------------------------------------------------------------------ +r101 | Akiko | 2008-08-26 19:31:07 +0200 (Tue, 26 Aug 2008) | 4 lines +Changed paths: + A /docs (from /trunk/docs:100) + A /server (from /trunk/tinns-v2:100) + A /tools (from /trunk/tools:100) + D /trunk + +- refreshed directory struture +- removed obsolete stuff + + +------------------------------------------------------------------------ +r100 | Hammag | 2008-04-20 00:52:32 +0200 (Sun, 20 Apr 2008) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/item.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/item.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Trader testing & Initial inventory fix +------------------------------------------------------------------------ +r99 | Hammag | 2008-02-11 20:38:32 +0100 (Mon, 11 Feb 2008) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/decoder/udp_terminal.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Fixed a (dumb) compilation issue +------------------------------------------------------------------------ +r98 | Hammag | 2008-02-02 16:10:16 +0100 (Sat, 02 Feb 2008) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/include/svnrevision.h + M /trunk/tinns-v2/src/info/accounts.cpp + +Correction of the account creation/update SQL query +------------------------------------------------------------------------ +r97 | Hammag | 2008-01-20 20:10:22 +0100 (Sun, 20 Jan 2008) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/console/console.cpp + M /trunk/tinns-v2/src/common/misc/misc.cpp + M /trunk/tinns-v2/src/common/netcode/message.cpp + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/appartements.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/container.cpp + M /trunk/tinns-v2/src/game/decoder/udp_reqinfo.cpp + M /trunk/tinns-v2/src/game/decoder/udp_terminal.cpp + M /trunk/tinns-v2/src/game/gamecommands/rawf.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/sql.h + M /trunk/tinns-v2/src/game/npc.cpp + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/game/terminal.cpp + M /trunk/tinns-v2/src/game/worldactors.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + M /trunk/tinns-v2/src/info/accounts.cpp + M /trunk/tinns-v2/src/info/sql.cpp + M /trunk/tinns-v2/src/info/sql.h + M /trunk/tinns-v2/src/patch/patchserver.cpp + +Correction of some string-related security issues +------------------------------------------------------------------------ +r96 | Hammag | 2007-12-28 00:52:21 +0100 (Fri, 28 Dec 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/appartements.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/decoder/main.h + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.h + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/decoder/udp_terminal.cpp + M /trunk/tinns-v2/src/game/decoder/udp_terminal.h + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_vhc.cpp + M /trunk/tinns-v2/src/game/decoder/udp_vhc.h + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/gamecommands/main.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/subway.h + M /trunk/tinns-v2/src/game/include/vehicle.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/vehicle.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Vehicles basis +------------------------------------------------------------------------ +r95 | Hammag | 2007-11-18 18:51:25 +0100 (Sun, 18 Nov 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/subway.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Small removal of a debug log +------------------------------------------------------------------------ +r94 | Hammag | 2007-11-18 18:41:38 +0100 (Sun, 18 Nov 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_terminal.cpp + M /trunk/tinns-v2/src/game/decoder/udp_terminal.h + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_vhc.cpp + M /trunk/tinns-v2/src/game/gamecommands/debug.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/subway.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/subway.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Subway should be working now +------------------------------------------------------------------------ +r93 | Hammag | 2007-11-09 23:27:43 +0100 (Fri, 09 Nov 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/container.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_vhc.cpp + M /trunk/tinns-v2/src/game/decoder/udp_vhc.h + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/gamecommands/t.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + A /trunk/tinns-v2/src/game/include/subway.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + A /trunk/tinns-v2/src/game/subway.cpp + M /trunk/tinns-v2/src/game/worldactors.cpp + M /trunk/tinns-v2/src/game/zoning.cpp + M /trunk/tinns-v2/src/include/message.h + M /trunk/tinns-v2/src/include/svnrevision.h + +Neocron city subway +------------------------------------------------------------------------ +r92 | Hammag | 2007-10-28 16:32:43 +0100 (Sun, 28 Oct 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/container.cpp + M /trunk/tinns-v2/src/game/decoder/udp_entityposreq.cpp + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/gamecommands/warpto.cpp + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/container.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Warpto working +------------------------------------------------------------------------ +r91 | Hammag | 2007-10-27 18:43:27 +0200 (Sat, 27 Oct 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/appartements.cpp + M /trunk/tinns-v2/src/game/client.cpp + A /trunk/tinns-v2/src/game/container.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/def/gamedefs.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + A /trunk/tinns-v2/src/game/include/container.h + M /trunk/tinns-v2/src/game/include/gamedefs.h + M /trunk/tinns-v2/src/game/include/worlddatatemplate.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/game/zoning.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Zoning fix and random box content improvement +------------------------------------------------------------------------ +r90 | Hammag | 2007-10-25 08:56:07 +0200 (Thu, 25 Oct 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x1f.cpp + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.h + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/inventory.h + M /trunk/tinns-v2/src/game/include/item.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/msgdecoder.h + M /trunk/tinns-v2/src/game/inventory.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Item management changes - CHANGELOG not updated +------------------------------------------------------------------------ +r89 | Hammag | 2007-09-02 23:40:04 +0200 (Sun, 02 Sep 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.h + M /trunk/tinns-v2/src/game/decoder/udp_quickaccessbelt.cpp + M /trunk/tinns-v2/src/game/decoder/udp_quickaccessbelt.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/inventory.h + M /trunk/tinns-v2/src/game/include/item.h + M /trunk/tinns-v2/src/game/inventory.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Some more work on containers +------------------------------------------------------------------------ +r88 | Hammag | 2007-08-17 17:08:12 +0200 (Fri, 17 Aug 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_quickaccessbelt.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/def_items.h + M /trunk/tinns-v2/src/game/include/inventory.h + M /trunk/tinns-v2/src/game/include/item.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/inventory.cpp + M /trunk/tinns-v2/src/game/item.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Intermediate dev rev: Item management changes +------------------------------------------------------------------------ +r87 | Hammag | 2007-07-15 19:00:31 +0200 (Sun, 15 Jul 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/WORK_IN_PROGRESS + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/conf/global.conf + M /trunk/tinns-v2/conf/infoserver.conf + M /trunk/tinns-v2/src/common/config/config.cpp + M /trunk/tinns-v2/src/game/Makefile + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/appartements.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/game/include/appartements.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/sql.h + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/game/zoning.cpp + M /trunk/tinns-v2/src/include/config.h + M /trunk/tinns-v2/src/include/regex++.h + M /trunk/tinns-v2/src/include/svnrevision.h + M /trunk/tinns-v2/src/info/Makefile + M /trunk/tinns-v2/src/info/accounts.cpp + M /trunk/tinns-v2/src/info/accounts.h + M /trunk/tinns-v2/src/info/client.cpp + M /trunk/tinns-v2/src/info/client.h + M /trunk/tinns-v2/src/info/configtemplate.h + M /trunk/tinns-v2/src/info/globals.cpp + M /trunk/tinns-v2/src/info/globals.h + M /trunk/tinns-v2/src/info/infoserver.cpp + M /trunk/tinns-v2/src/info/main.cpp + M /trunk/tinns-v2/src/info/sql.h + M /trunk/tinns-v2/src/patch/Makefile + +config include directive and PCRE names filters +------------------------------------------------------------------------ +r86 | Hammag | 2007-06-21 01:44:21 +0200 (Thu, 21 Jun 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/decoder/udp_entityposreq.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +small bugfix +------------------------------------------------------------------------ +r85 | Hammag | 2007-06-19 21:11:22 +0200 (Tue, 19 Jun 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/WORK_IN_PROGRESS + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_entityposreq.cpp + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.h + M /trunk/tinns-v2/src/game/gamecommands/warp.cpp + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +Fixed most zoning +------------------------------------------------------------------------ +r84 | Hammag | 2007-06-09 00:07:43 +0200 (Sat, 09 Jun 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/WORK_IN_PROGRESS + M /trunk/tinns-v2/src/common/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x22.cpp + A /trunk/tinns-v2/src/game/decoder/udp_entityposreq.cpp + A /trunk/tinns-v2/src/game/decoder/udp_entityposreq.h + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/gamecommands/h.cpp + M /trunk/tinns-v2/src/game/gamecommands/setlevel.cpp + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/worlddatatemplate.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +UDP OOO management crash bugfix +------------------------------------------------------------------------ +r83 | Hammag | 2007-06-05 01:36:04 +0200 (Tue, 05 Jun 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/netcode/message.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/decoder/msgdecoder.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.h + M /trunk/tinns-v2/src/game/decoder/udp_packet0.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/gamecommands/h.cpp + M /trunk/tinns-v2/src/game/gamecommands/t.cpp + M /trunk/tinns-v2/src/game/gamecommands/v.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/clientmanager.h + M /trunk/tinns-v2/src/game/include/gameserver.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/message.h + M /trunk/tinns-v2/src/include/svnrevision.h + +multiuser crashbug fix (try) - movement improvements +------------------------------------------------------------------------ +r82 | Hammag | 2007-05-28 23:25:02 +0200 (Mon, 28 May 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + D /trunk/tinns-v2/database/GameDB4_to_GameDB5.sql + D /trunk/tinns-v2/database/GameDB5.zip + A /trunk/tinns-v2/database/GameDB5_to_GameDB6.sql + A /trunk/tinns-v2/database/GameDB6.zip + D /trunk/tinns-v2/database/tinns_sqldumb_rev77.zip + M /trunk/tinns-v2/src/common/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/common/netcode/message.cpp + M /trunk/tinns-v2/src/common/netcode/udpmanager.cpp + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/commands.cpp + D /trunk/tinns-v2/src/game/database.cpp + M /trunk/tinns-v2/src/game/decoder/main.h + M /trunk/tinns-v2/src/game/decoder/udp_chat.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/gamecommands/ban.cpp + M /trunk/tinns-v2/src/game/gamecommands/givemoney.cpp + M /trunk/tinns-v2/src/game/gamecommands/h.cpp + M /trunk/tinns-v2/src/game/gamecommands/info.cpp + M /trunk/tinns-v2/src/game/gamecommands/jail.cpp + M /trunk/tinns-v2/src/game/gamecommands/kick.cpp + M /trunk/tinns-v2/src/game/gamecommands/main.h + M /trunk/tinns-v2/src/game/gamecommands/recall.cpp + D /trunk/tinns-v2/src/game/gamecommands/rehash.cpp + M /trunk/tinns-v2/src/game/gamecommands/setlevel.cpp + M /trunk/tinns-v2/src/game/gamecommands/shun.cpp + M /trunk/tinns-v2/src/game/gamecommands/skin.cpp + M /trunk/tinns-v2/src/game/gamecommands/takemoney.cpp + M /trunk/tinns-v2/src/game/gamecommands/teleport.cpp + M /trunk/tinns-v2/src/game/gamecommands/unjail.cpp + M /trunk/tinns-v2/src/game/gamecommands/unshun.cpp + M /trunk/tinns-v2/src/game/gamecommands/warpto.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/commands.h + D /trunk/tinns-v2/src/game/include/database.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/game/terminal_tryaccess.cpp + M /trunk/tinns-v2/src/game/zoning.cpp + M /trunk/tinns-v2/src/include/message.h + M /trunk/tinns-v2/src/include/svnrevision.h + +Changed for dynamic account and char management +------------------------------------------------------------------------ +r81 | Hammag | 2007-05-27 12:11:18 +0200 (Sun, 27 May 2007) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/Makefile + M /trunk/tinns-v2/src/dev-tools/Makefile + M /trunk/tinns-v2/src/dev-tools/setsvnrev + M /trunk/tinns-v2/src/game/decoder/udp_appartment.cpp + M /trunk/tinns-v2/src/game/decoder/udp_appartment.h + M /trunk/tinns-v2/src/include/svnrevision.h + +Disable use of getsvnrev. Other minor changes +------------------------------------------------------------------------ +r80 | Namikon | 2007-01-13 10:59:05 +0100 (Sat, 13 Jan 2007) | 3 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/decoder/udp_terminal.cpp + M /trunk/tinns-v2/src/game/include/terminal.h + M /trunk/tinns-v2/src/game/npc.cpp + M /trunk/tinns-v2/src/game/terminal.cpp + A /trunk/tinns-v2/src/game/terminal_receivedb.cpp + A /trunk/tinns-v2/src/game/terminal_servermessage.cpp + A /trunk/tinns-v2/src/game/terminal_tryaccess.cpp + A /trunk/tinns-v2/src/game/terminal_updatedb.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added a few comments in npc.cpp and removed most debug outputs +- Splitted up terminal.cpp into 5 files (All stuff in one file will get too big later) +- Moved TryAccess handling for terminal stuff to PTerminal class +------------------------------------------------------------------------ +r79 | Namikon | 2007-01-11 19:33:07 +0100 (Thu, 11 Jan 2007) | 5 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/decoder/main.h + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + A /trunk/tinns-v2/src/game/decoder/udp_0x2b.cpp + A /trunk/tinns-v2/src/game/decoder/udp_0x2b.h + A /trunk/tinns-v2/src/game/decoder/udp_terminal.cpp + A /trunk/tinns-v2/src/game/decoder/udp_terminal.h + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/globals.h + A /trunk/tinns-v2/src/game/include/terminal.h + M /trunk/tinns-v2/src/game/main.h + A /trunk/tinns-v2/src/game/terminal.cpp + M /trunk/tinns-v2/src/game/worldactors.cpp + M /trunk/tinns-v2/src/include/message.h + M /trunk/tinns-v2/src/include/version.h + +- Added up-to-date SQL dump to SVN. (But better use the newest neoX db!) +- Fixed bug in worldactors that caused the following problems: +> Spawned actors where removed uppon next serverstart/re-zone +> Only one actor in a zone at once +- Added first steps for ingame terminal handling +------------------------------------------------------------------------ +r78 | Namikon | 2007-01-08 19:41:04 +0100 (Mon, 08 Jan 2007) | 1 line +Changed paths: + A /trunk/tinns-v2/database/tinns_sqldumb_rev77.zip + +- Added SQL dumb. This dumb works with all Revisions up to R77 +------------------------------------------------------------------------ +r77 | Namikon | 2007-01-08 15:46:19 +0100 (Mon, 08 Jan 2007) | 4 lines +Changed paths: + M /trunk/tinns-v2/src/common/netcode/udpmanager.cpp + +Fixed compiler error: +In member function 'void ConnectionUDP::InsertUDPMessage(PMessage*)': +udpmanager.cpp:133: error: conversion from 'int' to non-scalar type 'std::_Rb_tree_const_iterator >' requested +on some systems +------------------------------------------------------------------------ +r76 | Namikon | 2007-01-07 21:56:53 +0100 (Sun, 07 Jan 2007) | 4 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/netcode/udpmanager.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x1f.cpp + M /trunk/tinns-v2/src/game/decoder/udp_hack.cpp + M /trunk/tinns-v2/src/game/decoder/udp_hack.h + M /trunk/tinns-v2/src/game/gamecommands/remove.cpp + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/worldactors.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/npc.cpp + M /trunk/tinns-v2/src/game/worldactors.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added hacking ability to hackbuttons (Both static and dynamic worldactors) + Itemcontainers will follow when we have a management class for them +- Removed several debug outputs, and changed others +- Fixed an typo in command remove +------------------------------------------------------------------------ +r75 | Namikon | 2007-01-07 19:51:02 +0100 (Sun, 07 Jan 2007) | 35 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/commands.conf + M /trunk/tinns-v2/src/common/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/common/netcode/message.cpp + M /trunk/tinns-v2/src/common/netcode/udpmanager.cpp + M /trunk/tinns-v2/src/game/buddylist.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/decoder/main.h + A /trunk/tinns-v2/src/game/decoder/udp_0x08.cpp + A /trunk/tinns-v2/src/game/decoder/udp_0x08.h + M /trunk/tinns-v2/src/game/decoder/udp_OOO.cpp + M /trunk/tinns-v2/src/game/decoder/udp_reqinfo.cpp + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udpanalyser.cpp + M /trunk/tinns-v2/src/game/gamecommands/main.h + M /trunk/tinns-v2/src/game/gamecommands/remove.cpp + M /trunk/tinns-v2/src/game/gamecommands/spawnactor.cpp + M /trunk/tinns-v2/src/game/gamecommands/test.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/genreplist.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/clientmanager.h + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/game/include/globals.h + A /trunk/tinns-v2/src/game/include/npc.h + M /trunk/tinns-v2/src/game/include/worldactors.h + M /trunk/tinns-v2/src/game/inventory.cpp + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + A /trunk/tinns-v2/src/game/npc.cpp + M /trunk/tinns-v2/src/game/worldactors.cpp + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/include/connection-udp.h + M /trunk/tinns-v2/src/include/version.h + +Huge update! + +- Changed default level for @remove from 100 to 50, since we can now also remove dynamic actors with it +- Added security check to @remove command: You cannot remove Dynamic actors over their IDs anymore. + Remove them with @remove actor command +- UDPManager rewritten. Was almost completely wrong, dunno what happend with me when i first wrote it :P + However, it works now. The last 20 UDP messages with 0x03 commandset are saved, and get resend uppon + OOO notice from the client. + The manager also watches the outgoing UDP IDs. With his, it was possible to fix an udp increment bug in the zoning process. +- Messages in the VIP queue arent parsed over the udpmanager. We'll have to rename this later on (or add a new queue) +- The UDP/SessionID offset is now defined in connection-udp.h +- NPC subsystem added. (Yeah ^^) + All NPCs that are in npc_spawns database spawn and stay in their world. We dont have an AI, so dont expect NPCs to + do *anything* yet. (Same goes for traders or copbots) But everything is prepared +- Added function "IsWorldInUse" to clientmanager. In first line required for NPC manager, to check if a world is in use or not +- Reformatted several files for better readability. +- Extended dynamic worldactor management: + - Spawned worldactors are functional now. (Eg: Spawn a chair and sit on it) (Function is not 100% tested, it *could* procude an segfault, report it + if the server crashes for you on a certain actorID) + - Only valid worldmodel templates are accepted now while spawning actors + - If given worldmodel template needs an linked object (For example an door) you have to add the doorID in the @spawnactor command (example below) + - On serverstart and every initworld, the database is checked for duplicate worldactor IDs. If some are found, they get deleted + - Another check is done when an worldactor is spawned. If (for any reason) an invalid worldactorset is in the Database, + it is ignored uppon spawning. (invalid means, that the actor points to an invalid object, for example door or world) +- Added detailed output for SQL errors (Prints not only "ERROR" or just returns nothing, instead a full errormessage is written to console) +- MsgBuilder: + - Baselinepacket changed, monsters are now "red" + - Fixed increase_udp issue in BuildZoning1Msg +- Added new decoder: + - 0x08: This small (only 1 byte) "packet" is only sent when the client exits abnormal (crash, sometimes on alt+f4) + Does nothing else than closing the connection serverside. + +*Note* Due the massive update of sourcecode, its likely that i forgot some debug outputs (You'll see D1, D2,.. or whatever else senseless text +on the console). If you find something, tell me please over forum or bugtracker. But i will remove all outputs when i find some in the next +releases +------------------------------------------------------------------------ +r74 | Namikon | 2007-01-04 16:24:05 +0100 (Thu, 04 Jan 2007) | 13 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/decoder/main.h + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/gamecommands/main.h + M /trunk/tinns-v2/src/game/gamecommands/remove.cpp + M /trunk/tinns-v2/src/game/gamecommands/spawnactor.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + A /trunk/tinns-v2/src/game/include/worldactors.h + M /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + A /trunk/tinns-v2/src/game/worldactors.cpp + M /trunk/tinns-v2/src/include/version.h + +- WorldActor management class added. + Spawned actors now stay in that zone until someone removes them. + + To remove spawned worldactors, the @remove command has been improved: + Type "@remove actor" to set your client into "REMOVE ACTOR" mode (You'll get + an ingame notice about this) + Then simply click on any dynamic worldactors to remove them. To leave this remove mode, + type "@remove actor" again. (And again you'll get a notice about that) + + Note: You cannot remove static worldactors (those who are in the .dat files) with this. + It is possible to let them disappear (type @remove ) but they'll respawn when you re-zone. + +IMPORTANT: This release requires an database update! Make sure you have the latest mysql table availeable. +------------------------------------------------------------------------ +r73 | Namikon | 2007-01-02 20:53:40 +0100 (Tue, 02 Jan 2007) | 10 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/commands.conf + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/gamecommands/debug.cpp + A /trunk/tinns-v2/src/game/gamecommands/spawnactor.cpp + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added new command @spawnactor + Usage: @spawnactor + - ActorID can be found in models/pak_models.ini + - FunctionType defines the type of the actor. + This can be almost everything, from item containers to + apartmentlift accesspanels + This command spawns and static worldactor next to your current + position. Everyone who is within the range of UDP broadcast + can see / "use" the new actor. It isnt saved to sql yet, nor is it + managed. (You cant spawn an itemcontainer and open it) +------------------------------------------------------------------------ +r72 | Namikon | 2007-01-01 23:35:13 +0100 (Mon, 01 Jan 2007) | 7 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x1f.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.h + A /trunk/tinns-v2/src/game/decoder/udp_hack.cpp + A /trunk/tinns-v2/src/game/decoder/udp_hack.h + M /trunk/tinns-v2/src/game/decoder/udp_itemmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_quickaccessbelt.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/chat.h + M /trunk/tinns-v2/src/game/include/inventory.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/inventory.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/version.h + +**** Happy new year!! **** + +- Item movement within quickbelt works +- Added hacktool to QB to test hacking +- Added the last missing staffchar (GM>) +- Added decoder for inithack and starthack messages +- A few more changes i cannot remember +------------------------------------------------------------------------ +r71 | Namikon | 2006-12-30 19:42:51 +0100 (Sat, 30 Dec 2006) | 4 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x1f.cpp + A /trunk/tinns-v2/src/game/decoder/udp_itemmove.cpp + A /trunk/tinns-v2/src/game/decoder/udp_itemmove.h + A /trunk/tinns-v2/src/game/decoder/udp_quickaccessbelt.cpp + A /trunk/tinns-v2/src/game/decoder/udp_quickaccessbelt.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added handling class for item movement (QB<>Inv<>GoGu<>Ground), no real function yet, but its decoded +- Added handling class for QuickBelt management. You can activate the flashlight in slot 0 now, and others can see it + The functions are prepared to handle any item that exists, but we dont have items working until now. +- Removed Debug output from sql.cpp +------------------------------------------------------------------------ +r70 | Namikon | 2006-12-30 08:16:09 +0100 (Sat, 30 Dec 2006) | 5 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/gamecommands/givemoney.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added "life" to hackbuttons and entrance-fee buttons. (Level GM and higher can just "use" hackbuttons, lower levels + must hack it. For entrance fee buttons, everyone must pay. Why? Well, for what is the @givemoney command ^.^) + Since hacking is not working yet, (we have to add item-usage first) make sure to set your own level to 50+, or you + wont get these doors open) +- Disabled some debug outputs forgotten in the last release +------------------------------------------------------------------------ +r69 | Namikon | 2006-12-28 20:05:09 +0100 (Thu, 28 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/common/netcode/udpmanager.cpp + M /trunk/tinns-v2/src/game/decoder/udp_OOO.cpp + M /trunk/tinns-v2/src/include/version.h + +HotFix: OOO Manager +------------------------------------------------------------------------ +r68 | Namikon | 2006-12-28 18:46:34 +0100 (Thu, 28 Dec 2006) | 6 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/commands.conf + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + A /trunk/tinns-v2/src/game/gamecommands/givemoney.cpp + A /trunk/tinns-v2/src/game/gamecommands/takemoney.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/version.h + +- 2 new ingame commands: + @givemoney [] + @takemoney [] + I dont think i have to explain what they do :) + +- Added universal udpmessage to trigger messages from text.ini +------------------------------------------------------------------------ +r67 | Namikon | 2006-12-27 19:07:16 +0100 (Wed, 27 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added 2 error messages for genrep activation. (Wrong faction and MC5 "broken") +------------------------------------------------------------------------ +r66 | Namikon | 2006-12-27 00:10:46 +0100 (Wed, 27 Dec 2006) | 2 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/netcode/udpmanager.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x1f.cpp + A /trunk/tinns-v2/src/game/decoder/udp_appartment.cpp + A /trunk/tinns-v2/src/game/decoder/udp_appartment.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added, by Stings request, serveranswer to worldroute query: "Where is the Primary App" works now. +- "Fixed" SQL function GetAptLocID(). Now only decreases the location value if the given AppartmentID is higher than 100000 +------------------------------------------------------------------------ +r65 | Namikon | 2006-12-26 22:36:21 +0100 (Tue, 26 Dec 2006) | 4 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/netcode/connection-udp.cpp + A /trunk/tinns-v2/src/common/netcode/udpmanager.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/decoder/udp_OOO.cpp + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/gamecommands/info.cpp + M /trunk/tinns-v2/src/game/gamecommands/jail.cpp + M /trunk/tinns-v2/src/game/gamecommands/recall.cpp + M /trunk/tinns-v2/src/game/gamecommands/teleport.cpp + M /trunk/tinns-v2/src/game/gamecommands/test.cpp + M /trunk/tinns-v2/src/game/gamecommands/unjail.cpp + M /trunk/tinns-v2/src/game/gamecommands/warp.cpp + M /trunk/tinns-v2/src/game/gamecommands/warpto.cpp + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/connection-udp.h + M /trunk/tinns-v2/src/include/version.h + +- Added UDPManager functions to connection_udp. Keeps the last 20 important UDP messages in a queue, for + possible resend after a OOO notice by the client +- Finally fixed the warpcircle and charvanish! The mentioned commands in Rev 62-63 now work as announced +- UDP_ID and all related stuff moved to connection_udp. Will be more controlled in the future from there +------------------------------------------------------------------------ +r64 | Namikon | 2006-12-25 00:28:34 +0100 (Mon, 25 Dec 2006) | 3 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/version.h + +- Fixed Blacksync issue when logging in +- Disabled position update on warpto and recall commands. It's not possible at the moment to + force the client to update the charposition. +------------------------------------------------------------------------ +r63 | Namikon | 2006-12-24 01:30:14 +0100 (Sun, 24 Dec 2006) | 9 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/commands.cpp + A /trunk/tinns-v2/src/game/gamecommands/README + D /trunk/tinns-v2/src/game/gamecommands/adddoor.cpp + D /trunk/tinns-v2/src/game/gamecommands/addworlditem.cpp + M /trunk/tinns-v2/src/game/gamecommands/ban.cpp + D /trunk/tinns-v2/src/game/gamecommands/delworlditem.cpp + M /trunk/tinns-v2/src/game/gamecommands/jail.cpp + M /trunk/tinns-v2/src/game/gamecommands/kick.cpp + M /trunk/tinns-v2/src/game/gamecommands/recall.cpp + M /trunk/tinns-v2/src/game/gamecommands/teleport.cpp + A /trunk/tinns-v2/src/game/gamecommands/test.cpp + M /trunk/tinns-v2/src/game/gamecommands/unjail.cpp + M /trunk/tinns-v2/src/game/gamecommands/warp.cpp + M /trunk/tinns-v2/src/game/gamecommands/warpto.cpp + M /trunk/tinns-v2/src/game/include/chat.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/clientmanager.h + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/include/version.h + +- Added experimental char warp-aura and char disappear packets to all warp-commands + (Worked while testing, but not after implementation into the commands) +- Worked on Chatsystem: Localchat 99% working. Localchat is now limited to a small area around the player + (However, the chat is sent over TCP, like all other packets. It should be UDP, but this isnt working + for some reason. If anyone finds out why, tell us please) +- Added Developercommand "@test". It has no fixed function, and is not configureable by config file. + Devs can easily add stuff there to test various things. +- Removed adddoor, delworlditem and addworlditem completely from SVN, they're not needed anymore +- And a few things i cant remember -.- +------------------------------------------------------------------------ +r62 | Namikon | 2006-12-23 13:38:32 +0100 (Sat, 23 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/include/commands.h + +Fixed multiline comment error on some compilers +------------------------------------------------------------------------ +r61 | Namikon | 2006-12-23 09:36:18 +0100 (Sat, 23 Dec 2006) | 3 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/commands.conf + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/gamecommands/adddoor.cpp + M /trunk/tinns-v2/src/game/gamecommands/addworlditem.cpp + M /trunk/tinns-v2/src/game/gamecommands/delworlditem.cpp + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/include/version.h + +Small update: +- Removed ingamecommands "addworlditem", "delworlditem" and "adddoor". TinNS gets the worlddata dynamicly from loaded + .dat files instead of MySQL Database. +------------------------------------------------------------------------ +r60 | Namikon | 2006-12-23 00:36:21 +0100 (Sat, 23 Dec 2006) | 3 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + M /trunk/tinns-v2/src/game/gamecommands/ban.cpp + M /trunk/tinns-v2/src/game/gamecommands/info.cpp + M /trunk/tinns-v2/src/game/gamecommands/jail.cpp + M /trunk/tinns-v2/src/game/gamecommands/recall.cpp + M /trunk/tinns-v2/src/game/gamecommands/shun.cpp + M /trunk/tinns-v2/src/game/gamecommands/teleport.cpp + M /trunk/tinns-v2/src/game/gamecommands/unjail.cpp + M /trunk/tinns-v2/src/game/gamecommands/unshun.cpp + M /trunk/tinns-v2/src/game/gamecommands/warpto.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/include/version.h + +- Added several security checks to game commands +- Added missing status outputs on successfull gamecommand +- Added solution to send an delayed positionupdate after warping +------------------------------------------------------------------------ +r59 | Namikon | 2006-12-22 22:56:08 +0100 (Fri, 22 Dec 2006) | 6 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + A /trunk/tinns-v2/src/game/gamecommands/Makefile + M /trunk/tinns-v2/src/game/gamecommands/jail.cpp + M /trunk/tinns-v2/src/game/gamecommands/shun.cpp + M /trunk/tinns-v2/src/game/gamecommands/teleport.cpp + M /trunk/tinns-v2/src/game/gamecommands/unjail.cpp + M /trunk/tinns-v2/src/game/gamecommands/unshun.cpp + M /trunk/tinns-v2/src/game/gamecommands/warp.cpp + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/include/version.h + +- Added missing Makefile for gamecommands/ subfolder +- Removed check for ZoneID 552 from jail.cpp and unjail.cpp; This zone is never used +- Moved mShunned from Account to chars +- Added mJailed to chars with methods to identify a jailed player +- Added explicit override to GM teleport and jail/unjail commands (The only way to move someone if target is jailed) +- Completed shun/unshun command +------------------------------------------------------------------------ +r58 | Namikon | 2006-12-22 17:34:02 +0100 (Fri, 22 Dec 2006) | 8 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/dev-tools/Makefile + A /trunk/tinns-v2/src/dev-tools/getsvnrev.cpp + M /trunk/tinns-v2/src/dev-tools/setsvnrev + M /trunk/tinns-v2/src/game/Makefile + M /trunk/tinns-v2/src/game/commands.cpp + A /trunk/tinns-v2/src/game/gamecommands + A /trunk/tinns-v2/src/game/gamecommands/adddoor.cpp + A /trunk/tinns-v2/src/game/gamecommands/addworlditem.cpp + A /trunk/tinns-v2/src/game/gamecommands/ban.cpp + A /trunk/tinns-v2/src/game/gamecommands/brightness.cpp + A /trunk/tinns-v2/src/game/gamecommands/broadcast.cpp + A /trunk/tinns-v2/src/game/gamecommands/color.cpp + A /trunk/tinns-v2/src/game/gamecommands/debug.cpp + A /trunk/tinns-v2/src/game/gamecommands/delworlditem.cpp + A /trunk/tinns-v2/src/game/gamecommands/effect.cpp + A /trunk/tinns-v2/src/game/gamecommands/h.cpp + A /trunk/tinns-v2/src/game/gamecommands/info.cpp + A /trunk/tinns-v2/src/game/gamecommands/jail.cpp + A /trunk/tinns-v2/src/game/gamecommands/kick.cpp + A /trunk/tinns-v2/src/game/gamecommands/listbans.cpp + A /trunk/tinns-v2/src/game/gamecommands/main.h + A /trunk/tinns-v2/src/game/gamecommands/online.cpp + A /trunk/tinns-v2/src/game/gamecommands/rawf.cpp + A /trunk/tinns-v2/src/game/gamecommands/recall.cpp + A /trunk/tinns-v2/src/game/gamecommands/rehash.cpp + A /trunk/tinns-v2/src/game/gamecommands/remove.cpp + A /trunk/tinns-v2/src/game/gamecommands/setlevel.cpp + A /trunk/tinns-v2/src/game/gamecommands/settime.cpp + A /trunk/tinns-v2/src/game/gamecommands/shun.cpp + A /trunk/tinns-v2/src/game/gamecommands/skin.cpp + A /trunk/tinns-v2/src/game/gamecommands/speed.cpp + A /trunk/tinns-v2/src/game/gamecommands/t.cpp + A /trunk/tinns-v2/src/game/gamecommands/teleport.cpp + A /trunk/tinns-v2/src/game/gamecommands/unban.cpp + A /trunk/tinns-v2/src/game/gamecommands/unjail.cpp + A /trunk/tinns-v2/src/game/gamecommands/unshun.cpp + A /trunk/tinns-v2/src/game/gamecommands/uptime.cpp + A /trunk/tinns-v2/src/game/gamecommands/v.cpp + A /trunk/tinns-v2/src/game/gamecommands/version.cpp + A /trunk/tinns-v2/src/game/gamecommands/warp.cpp + A /trunk/tinns-v2/src/game/gamecommands/warpto.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + A /trunk/tools/getsvnrev + A /trunk/tools/getsvnrev/Makefile + A /trunk/tools/getsvnrev/getsvnrev.cpp + M /trunk/tools/pak_decompress/pak_decompress.cpp + + +- Improved pak_decompress tool from Akiko +- Added tool "getsvnrev" (Same again in src/dev_tools, required for make process) +- Improved Hammag's setsvnrev bash script (Now does errorcheck and has an alternative way to + grab SVN revision if SVN is not installed) +- Splitup of commands.cpp. Every command has now its own .cpp file in gamecommands/. + Makes it a lot easier to handle new commands or change/fix/remove existing ones +- ReEnabled debug-output while loading world .dat files. Was commented out for some reason +------------------------------------------------------------------------ +r57 | Namikon | 2006-12-21 21:51:07 +0100 (Thu, 21 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + + +------------------------------------------------------------------------ +r56 | Namikon | 2006-12-21 21:47:41 +0100 (Thu, 21 Dec 2006) | 8 lines +Changed paths: + M /trunk/tools/pak_decompress/pak_decompress.cpp + +Improved pak_decompress script from Akiko: +- Added errorcheck for in/output file +- Added check for NC and normal zLib files + (Can unpak both) +- Added optional details-output + +The script is now capable to be used in batchfiles, since the only output is either [OK] or [ERROR] . +if you dont want this, you can specify detailed output with all errors. +------------------------------------------------------------------------ +r55 | Namikon | 2006-12-21 19:29:54 +0100 (Thu, 21 Dec 2006) | 34 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/commands.conf + M /trunk/tinns-v2/src/game + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/include/external.h + M /trunk/tinns-v2/src/include/version.h + A /trunk/tinns-v2/tinns + +*Note* +The new commands have to be tested first! Dont expect them to work yet, its just a upload +since the entire command files got rewritten. + + + - Rewritten entire commands.cpp/.h files + - Fixed ingame command @kick. Works now as it should. + Also sets a temp-ban for a configureable amount of seconds to prevent instant-relog. + - Added new ingame coommands: + @ban /// || @ban EvilUser 20m <- Bans "EvilUser" for 20 minutes. + - Bans given player for given time. You can only set ONE timevalue. (Either S/M/H or D. Not case sensitive) + + @unban + - Not working yet. Has to be done by direct SQL access + @listbans + - Not working yet. Has to be done by direct SQL access + + @shun + - Blocks all incoming char/command traffic from given client until re relogs + Returns error if already shunned + + @unshun + - Remove shun instantly. Returns error if not shunned + + @jail + - Warp given player to Regants legacy. Returns error if player is already in Regants + + @unjail + - Free given player from Regants. Returns error if player is not in Regants/Jailed + + @teleport + - Teleport given player to given world + + - Added (experimental) startscript for TinNS. Has to be testen/debugged +------------------------------------------------------------------------ +r54 | Hammag | 2006-12-20 20:52:20 +0100 (Wed, 20 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/filesystem/filesystem.cpp + M /trunk/tinns-v2/src/game/def/defparser.cpp + M /trunk/tinns-v2/src/game/def/gamedefs.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/include/filesystem.h + M /trunk/tinns-v2/src/include/svnrevision.h + M /trunk/tinns-v2/src/patch/patchserver.cpp + +Fixed NC datafiles lookup +------------------------------------------------------------------------ +r53 | Namikon | 2006-12-19 03:07:53 +0100 (Tue, 19 Dec 2006) | 8 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/commands.conf + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/commands.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + +its a pity, but the workaround didnt work. Still investigating this! +MANY changes to the source, cant remember all. Here is what my brain has stored: + +- Direct chat completed. (If target player isnt online, you'll get this nice "Player not online" message) +- ReEnabled AutoRehash, wasnt responsible for the crash +- Added @kick, @info, @warpto, @recall and @setlevel. @info is tested and verified, @kick does nothing (yet) the + rest is untested but should work. (Hard to test with only 1 char online...) +- Some more very small changes. If you want a detailed log, ask SVN history :D +------------------------------------------------------------------------ +r52 | Namikon | 2006-12-18 02:01:53 +0100 (Mon, 18 Dec 2006) | 3 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chars.cpp + +- Fixed bug that you could'nt see the welcome message after login +- Added (hopefully) a workaround for our SegFault problem (2 user online, 3rd is trying to connect -> SegFault) + +------------------------------------------------------------------------ +r51 | Namikon | 2006-12-18 00:24:21 +0100 (Mon, 18 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/accounts.cpp + +Fixed small issue in accounts.cpp. (Forgot the break; in the select() statement) +------------------------------------------------------------------------ +r50 | Namikon | 2006-12-17 22:42:43 +0100 (Sun, 17 Dec 2006) | 8 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + A /trunk/tinns-v2/conf/commands.conf + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/info/configtemplate.h + M /trunk/tinns-v2/src/info/infoserver.cpp + +[GAME] +- Fixed errors from last SVN release (Caused several segmentation faults) +- Added configfile commands.conf +- Added check for required accountlevel when trying to use ingame command + +[INFO] +- Fixed errors from last SVN release (Caused several segmentation faults) +- Added default values for isc stuff to configtemplate.h. I forgot to add them in the last revision +------------------------------------------------------------------------ +r49 | Namikon | 2006-12-16 15:39:08 +0100 (Sat, 16 Dec 2006) | 8 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/conf/infoserver.conf + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/info/accounts.cpp + M /trunk/tinns-v2/src/info/configtemplate.h + M /trunk/tinns-v2/src/info/infoserver.cpp + + +- Changed default error-return for Sql Checkaccount from -12 to -99, to create free place for further errormessages +- Added require_validation to infoserver.conf. You can enable this if you like to create accounts on your own, + not by autoaccount. + + +- Removed traces of old AutoAccount creation in GameServer. AutoAcc should *only* be done by Infoserver! +- Added accountlevel check. +------------------------------------------------------------------------ +r48 | Namikon | 2006-12-15 20:06:34 +0100 (Fri, 15 Dec 2006) | 2 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/infoserver.conf + M /trunk/tinns-v2/docs/ISC ProtDef.txt + +Minor changes +ISC additions +------------------------------------------------------------------------ +r47 | Hammag | 2006-12-15 16:37:58 +0100 (Fri, 15 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/dev-tools/make-bin-tarball + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + M /trunk/tinns-v2/src/game/decoder/udp_OOO.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.h + M /trunk/tinns-v2/src/include/svnrevision.h + +Minor fixes and additions +------------------------------------------------------------------------ +r46 | Hammag | 2006-12-14 23:13:23 +0100 (Thu, 14 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + A /trunk/tinns-v2/LICENSE.txt + M /trunk/tinns-v2/WORK_IN_PROGRESS + M /trunk/tinns-v2/src/Makefile + M /trunk/tinns-v2/src/Rules.make + A /trunk/tinns-v2/src/dev-tools/make-bin-tarball + A /trunk/tinns-v2/src/dev-tools/make-src-tarball + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/include/svnrevision.h + +tarball tools and warning fixes +------------------------------------------------------------------------ +r45 | Namikon | 2006-12-14 23:03:15 +0100 (Thu, 14 Dec 2006) | 3 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + A /trunk/tinns-v2/docs/ISC Example.txt + M /trunk/tinns-v2/docs/ISC ProtDef.txt + M /trunk/tinns-v2/src/game/include/isc.h + +- Updated ISC definition file (v2) +- Updated isc.h: Added enum for ISC connection stages +- Added ISC Example.txt to show a few examples of an "normal" datatransfer between game and infoserver +------------------------------------------------------------------------ +r44 | Hammag | 2006-12-13 17:23:28 +0100 (Wed, 13 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/Makefile + M /trunk/tinns-v2/src/Rules.make + A /trunk/tinns-v2/src/dev-tools (from /trunk/tinns-v2/src/tools:43) + M /trunk/tinns-v2/src/dev-tools/Makefile + M /trunk/tinns-v2/src/dev-tools/cleandepfile.c + M /trunk/tinns-v2/src/dev-tools/setsvnrev + M /trunk/tinns-v2/src/include/svnrevision.h + D /trunk/tinns-v2/src/tools + +Added GPL file, some Makefile additions +------------------------------------------------------------------------ +r43 | Namikon | 2006-12-13 12:12:23 +0100 (Wed, 13 Dec 2006) | 3 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chat.cpp + +- Quick update: I replaced the "old" function to check if a customchannel is enabled or not with a much + faster one. (Bitwise comparison) +- Fixed an typo in chat.cpp +------------------------------------------------------------------------ +r42 | Namikon | 2006-12-11 21:50:34 +0100 (Mon, 11 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chat.cpp + +Fixed (hopefully) custom channels. They're not loaded/saved from/to SQL yet, but you should be able to enable/disable them. upon entry, all channels are disabled, so you have to tick them every time you login +------------------------------------------------------------------------ +r41 | Hammag | 2006-12-11 20:06:50 +0100 (Mon, 11 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/Makefile + M /trunk/tinns-v2/src/Rules.make + M /trunk/tinns-v2/src/common/Makefile + M /trunk/tinns-v2/src/common/config/main.h + M /trunk/tinns-v2/src/common/console/main.h + M /trunk/tinns-v2/src/common/filesystem/main.h + M /trunk/tinns-v2/src/common/misc/main.h + M /trunk/tinns-v2/src/common/misc/misc.cpp + M /trunk/tinns-v2/src/common/netcode/main.h + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/decoder/main.h + M /trunk/tinns-v2/src/game/def/main.h + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/include/misc.h + A /trunk/tinns-v2/src/include/svnrevision.h + M /trunk/tinns-v2/src/include/version.h + M /trunk/tinns-v2/src/info/globals.cpp + M /trunk/tinns-v2/src/info/globals.h + M /trunk/tinns-v2/src/info/main.h + M /trunk/tinns-v2/src/patch/globals.cpp + M /trunk/tinns-v2/src/patch/globals.h + M /trunk/tinns-v2/src/patch/main.h + A /trunk/tinns-v2/src/tools + A /trunk/tinns-v2/src/tools/Makefile + A /trunk/tinns-v2/src/tools/cleandepfile.c + A /trunk/tinns-v2/src/tools/setsvnrev + +added version command and dependency files fix +------------------------------------------------------------------------ +r40 | Hammag | 2006-12-11 13:07:58 +0100 (Mon, 11 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/Makefile + M /trunk/tinns-v2/src/common/Makefile + M /trunk/tinns-v2/src/game/decoder/udp_0x1f.cpp + M /trunk/tinns-v2/src/game/decoder/udp_chat.cpp + M /trunk/tinns-v2/src/game/decoder/udp_chat.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/patch/patchserver.cpp + +Added Custom Chat Channel selection retrieval from client packets +------------------------------------------------------------------------ +r39 | Namikon | 2006-12-11 00:58:54 +0100 (Mon, 11 Dec 2006) | 4 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/chat.h + +Last update for this weekend lol ^^ +- Worked again on Chat subsystem. (What else) + This release may break tinns from working, until Hammag found a way to grab the data i need for the CustomChannels. + +------------------------------------------------------------------------ +r38 | Namikon | 2006-12-10 23:22:34 +0100 (Sun, 10 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/include/chat.h + +Direct-Chat works now +------------------------------------------------------------------------ +r37 | Namikon | 2006-12-10 20:06:03 +0100 (Sun, 10 Dec 2006) | 2 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/buddylist.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/include/buddylist.h + M /trunk/tinns-v2/src/game/include/chars.h + +- Worked again on Chat subsystem. Current status: +> Buddy - Done. (100%) +------------------------------------------------------------------------ +r36 | Namikon | 2006-12-10 15:47:12 +0100 (Sun, 10 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/conf/gameserver.conf + +Forgot correct gameserver.conf +------------------------------------------------------------------------ +r35 | Namikon | 2006-12-10 15:46:15 +0100 (Sun, 10 Dec 2006) | 17 lines +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/chat.h + +- Added @broadcast. GM and higher can now send out "ADMIN> Server: " broadcasts +- Worked on Chat subsystem. Current status: +> Buddy - Sends text to Buddy, everyone in the same Zone can read. No Buddylist yet +> Local - Another problem, local is TCP on retail, we use UDP. Works for now, needs further research +> Clan - Same as Buddy +> Team - Same as Buddy +> Direct - No function yet +> GM - Done. (100%) +> Admin - Done. (100%) +> All others - Nearly done. Sends/Receives to/from correct channel, including zone/fraction/etc + limitation. However, you cant disable channels yet, needs further research. + +- 2 new options in gameserver.cfg: +> broadcast_new - If set to 1, the server will send out an broadcast to channel OOC with + a welcome message. Default is 0. +> broadcast_new_hidestaff - If set to 1, all "non-players" are not announced over OOC. Default is 0. +- Fixed some typos in chat.h/.cpp +------------------------------------------------------------------------ +r34 | Hammag | 2006-12-10 14:51:55 +0100 (Sun, 10 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/Rules.make + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/def/gamedefs.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/furnituretemplate.h + M /trunk/tinns-v2/src/game/include/gamedefs.h + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/info/infoserver.cpp + M /trunk/tinns-v2/src/info/infoserver.h + D /trunk/tinns-v2/src/netcode + +Done GR without DB, Fixed Makefile issue +------------------------------------------------------------------------ +r33 | Namikon | 2006-12-10 11:36:52 +0100 (Sun, 10 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/gameserver.h + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/include/external.h + +- Added @uptime to view server's uptime ingame +------------------------------------------------------------------------ +r32 | Hammag | 2006-12-09 17:18:19 +0100 (Sat, 09 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/Makefile + A /trunk/tinns-v2/src/common/regex + A /trunk/tinns-v2/src/common/regex/Makefile + A /trunk/tinns-v2/src/common/regex/regex++.cpp + M /trunk/tinns-v2/src/game/Makefile + M /trunk/tinns-v2/src/game/main.cpp + A /trunk/tinns-v2/src/include/regex++.h + +Added regex support for futur use, plus minor other modif +------------------------------------------------------------------------ +r31 | Namikon | 2006-12-09 01:36:18 +0100 (Sat, 09 Dec 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + + +------------------------------------------------------------------------ +r30 | Namikon | 2006-12-09 01:23:31 +0100 (Sat, 09 Dec 2006) | 7 lines +Changed paths: + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/database.cpp + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/game/include/database.h + M /trunk/tinns-v2/src/game/main.cpp + +EXPERIMENTAL +Compiled: Y +Verified: N + +Changes: +- Dynamic load/update of Account data every 30 seconds +- @rehash: Reloads accountdata on request +------------------------------------------------------------------------ +r29 | Hammag | 2006-11-26 03:21:46 +0100 (Sun, 26 Nov 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/doortemplate.cpp + M /trunk/tinns-v2/src/game/furnituretemplate.cpp + M /trunk/tinns-v2/src/game/include/doortemplate.h + M /trunk/tinns-v2/src/game/include/furnituretemplate.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/worlddatatemplate.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/include/misc.h + +Triggered doors made to work as expected +------------------------------------------------------------------------ +r28 | Hammag | 2006-11-25 16:40:29 +0100 (Sat, 25 Nov 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/netcode/connection-tcp.cpp + M /trunk/tinns-v2/src/common/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/common/netcode/main.h + M /trunk/tinns-v2/src/game/appartements.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_packet0.cpp + M /trunk/tinns-v2/src/game/decoder/udp_subskill.cpp + M /trunk/tinns-v2/src/game/decoder/udp_subskill.h + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/appartements.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/skill.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + +Multiple improvements in zoning, chair use and subskill increase +------------------------------------------------------------------------ +r27 | Hammag | 2006-11-21 01:45:13 +0100 (Tue, 21 Nov 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + A /trunk/tinns-v2/src/game/appartements.cpp + M /trunk/tinns-v2/src/game/buddylist.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/globals.cpp + A /trunk/tinns-v2/src/game/include/appartements.h + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/def_appartements.h + M /trunk/tinns-v2/src/game/include/furnituretemplate.h + M /trunk/tinns-v2/src/game/include/gameserver.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + +Fixed chairs related issues, added start apt creation +------------------------------------------------------------------------ +r26 | Hammag | 2006-11-08 21:33:04 +0100 (Wed, 08 Nov 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.h + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/def/def_appplaces.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/def/world_datstruct.h + A /trunk/tinns-v2/src/game/doortemplate.cpp + M /trunk/tinns-v2/src/game/furnituretemplate.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/include/def_worldmodels.h + A /trunk/tinns-v2/src/game/include/doortemplate.h + M /trunk/tinns-v2/src/game/include/furnituretemplate.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/include/isc.h + M /trunk/tinns-v2/src/game/include/msgbuilder.h + M /trunk/tinns-v2/src/game/include/world_datparser.h + M /trunk/tinns-v2/src/game/include/worlddatatemplate.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/isc.cpp + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/game/zoning.cpp + +Improvements on chairs, doors and zoning doors, as well as some bug fixes +------------------------------------------------------------------------ +r25 | Hammag | 2006-10-26 02:14:07 +0200 (Thu, 26 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/def/world_datstruct.h + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + +Finished on-demand world loading minimal functionalities +------------------------------------------------------------------------ +r24 | Hammag | 2006-10-24 16:07:13 +0200 (Tue, 24 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/worlds.cpp + +Internal work only +------------------------------------------------------------------------ +r23 | Hammag | 2006-10-13 22:15:05 +0200 (Fri, 13 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/src/common/filesystem/filesystem.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/def/gamedefs.cpp + M /trunk/tinns-v2/src/game/def/main.h + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/gamedefs.h + M /trunk/tinns-v2/src/game/include/globals.h + M /trunk/tinns-v2/src/game/include/isc.h + M /trunk/tinns-v2/src/game/include/world_datparser.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/isc.cpp + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/info/infoserver.cpp + M /trunk/tinns-v2/src/info/infoserver.h + +serverlist update working, some bug fixes and other internazl stuff +------------------------------------------------------------------------ +r22 | Hammag | 2006-10-13 01:11:15 +0200 (Fri, 13 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/conf/infoserver.conf + M /trunk/tinns-v2/src/Rules.make + M /trunk/tinns-v2/src/game/Makefile + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/isc.h + M /trunk/tinns-v2/src/game/include/sql.h + A /trunk/tinns-v2/src/game/isc.cpp (from /trunk/tinns-v2/src/game/isc.cpp.inhib:15) + D /trunk/tinns-v2/src/game/isc.cpp.inhib + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/server.cpp + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/info/Makefile + M /trunk/tinns-v2/src/info/accounts.cpp + M /trunk/tinns-v2/src/info/configtemplate.h + M /trunk/tinns-v2/src/info/globals.cpp + M /trunk/tinns-v2/src/info/infoserver.cpp + M /trunk/tinns-v2/src/info/main.cpp + M /trunk/tinns-v2/src/info/sql.cpp + M /trunk/tinns-v2/src/info/sql.h + M /trunk/tinns-v2/src/patch/Makefile + +MySQL keepalive and other MySQL related fix +------------------------------------------------------------------------ +r21 | Hammag | 2006-10-09 21:39:10 +0200 (Mon, 09 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/filesystem/filesystem.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/include/accounts.h + M /trunk/tinns-v2/src/game/include/client.h + M /trunk/tinns-v2/src/game/include/world_datparser.h + M /trunk/tinns-v2/src/game/include/worlddatatemplate.h + M /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/worlddatatemplate.cpp + M /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/include/filesystem.h + +Implemented new version of @debug ingame admin command +------------------------------------------------------------------------ +r20 | Hammag | 2006-10-08 01:25:59 +0200 (Sun, 08 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/src/common/filesystem/filesystem.cpp + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/def/def_appartements.cpp + M /trunk/tinns-v2/src/game/def/def_worldfile.cpp + M /trunk/tinns-v2/src/game/def/def_worlds.cpp + M /trunk/tinns-v2/src/game/def/gamedefs.cpp + M /trunk/tinns-v2/src/game/def/world_datparser.cpp + M /trunk/tinns-v2/src/game/def/world_datstruct.h + A /trunk/tinns-v2/src/game/furnituretemplate.cpp + M /trunk/tinns-v2/src/game/include/def_appartements.h + M /trunk/tinns-v2/src/game/include/def_worldfile.h + M /trunk/tinns-v2/src/game/include/def_worlds.h + A /trunk/tinns-v2/src/game/include/furnituretemplate.h + M /trunk/tinns-v2/src/game/include/gamedefs.h + M /trunk/tinns-v2/src/game/include/world_datparser.h + A /trunk/tinns-v2/src/game/include/worlddatatemplate.h + A /trunk/tinns-v2/src/game/include/worlds.h + M /trunk/tinns-v2/src/game/main.cpp + A /trunk/tinns-v2/src/game/worlddatatemplate.cpp + A /trunk/tinns-v2/src/game/worlds.cpp + M /trunk/tinns-v2/src/game/zoning.cpp + +Various small fixes and more work on .dat world files +------------------------------------------------------------------------ +r19 | Hammag | 2006-10-04 11:53:18 +0200 (Wed, 04 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + D /trunk/tinns-v2/defs + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/msgbuilder.cpp + +warning fixes and def dir removal +------------------------------------------------------------------------ +r18 | Hammag | 2006-10-03 18:17:47 +0200 (Tue, 03 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/src/common/netcode/message.cpp + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/include/chars.h + M /trunk/tinns-v2/src/game/inventory.cpp + M /trunk/tinns-v2/src/game/sql.cpp + +Critical bug correction in char creation process. Other changes linked with char creation and deletion +------------------------------------------------------------------------ +r17 | Hammag | 2006-10-02 21:55:01 +0200 (Mon, 02 Oct 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/src/Makefile + M /trunk/tinns-v2/src/common/config/config.cpp + M /trunk/tinns-v2/src/common/filesystem/filesystem.cpp + M /trunk/tinns-v2/src/common/netcode/message.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + A /trunk/tinns-v2/src/game/def/world_datparser.cpp + A /trunk/tinns-v2/src/game/def/world_datstruct.h + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/include/globals.h + A /trunk/tinns-v2/src/game/include/world_datparser.h + M /trunk/tinns-v2/src/game/main.cpp + D /trunk/tinns-v2/src/game/ttt.out + +Minor cleanup for public release and beginig of world file support +------------------------------------------------------------------------ +r16 | Hammag | 2006-09-29 00:05:31 +0200 (Fri, 29 Sep 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/WORK_IN_PROGRESS + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/src/Rules.make + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/configtemplate.h + M /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + M /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + A /trunk/tinns-v2/src/game/def/def_worldfile.cpp + M /trunk/tinns-v2/src/game/def/gamedefs.cpp + M /trunk/tinns-v2/src/game/def/main.h + A /trunk/tinns-v2/src/game/include/def_worldfile.h + M /trunk/tinns-v2/src/game/include/defs.h + M /trunk/tinns-v2/src/game/include/gamedefs.h + M /trunk/tinns-v2/src/game/zoning.cpp + +Full NC-file based zoning, GR registration fixed +------------------------------------------------------------------------ +r15 | Hammag | 2006-09-28 17:34:24 +0200 (Thu, 28 Sep 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + +CHANGELOG update +------------------------------------------------------------------------ +r14 | Hammag | 2006-09-28 17:03:56 +0200 (Thu, 28 Sep 2006) | 1 line +Changed paths: + A /trunk/tinns-v2/database/GameDB4_to_GameDB5.sql + +Added SQL file to migrate gameserver DB from V4 to v5 +------------------------------------------------------------------------ +r13 | Hammag | 2006-09-28 15:32:06 +0200 (Thu, 28 Sep 2006) | 1 line +Changed paths: + A /trunk/tinns-v2/database/GameDB5.zip + +Some additions to gameserver DB +------------------------------------------------------------------------ +r12 | Hammag | 2006-09-28 15:30:01 +0200 (Thu, 28 Sep 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/Makefile + M /trunk/tinns-v2/WORK_IN_PROGRESS + D /trunk/tinns-v2/database/GameDB4.zip + A /trunk/tinns-v2/src/Makefile + A /trunk/tinns-v2/src/Rules.make + A /trunk/tinns-v2/src/common/Makefile + A /trunk/tinns-v2/src/common/config/Makefile + A /trunk/tinns-v2/src/common/config/config.cpp + A /trunk/tinns-v2/src/common/config/main.h + A /trunk/tinns-v2/src/common/console/Makefile + A /trunk/tinns-v2/src/common/console/console.cpp + A /trunk/tinns-v2/src/common/console/main.h + A /trunk/tinns-v2/src/common/filesystem/Makefile + A /trunk/tinns-v2/src/common/filesystem/filesystem.cpp + A /trunk/tinns-v2/src/common/filesystem/main.h + A /trunk/tinns-v2/src/common/misc/Makefile + A /trunk/tinns-v2/src/common/misc/main.h + A /trunk/tinns-v2/src/common/misc/misc.cpp + A /trunk/tinns-v2/src/common/netcode + A /trunk/tinns-v2/src/common/netcode/Makefile + A /trunk/tinns-v2/src/common/netcode/connection-tcp.cpp + A /trunk/tinns-v2/src/common/netcode/connection-udp.cpp + A /trunk/tinns-v2/src/common/netcode/main.h + A /trunk/tinns-v2/src/common/netcode/message.cpp + A /trunk/tinns-v2/src/common/netcode/serversocket.cpp + M /trunk/tinns-v2/src/game/Makefile + D /trunk/tinns-v2/src/game/_inc + D /trunk/tinns-v2/src/game/accounts.h + A /trunk/tinns-v2/src/game/buddylist.cpp + M /trunk/tinns-v2/src/game/chars.cpp + D /trunk/tinns-v2/src/game/chars.h + D /trunk/tinns-v2/src/game/chat.h + M /trunk/tinns-v2/src/game/client.cpp + D /trunk/tinns-v2/src/game/client.h + M /trunk/tinns-v2/src/game/clientmanager.cpp + D /trunk/tinns-v2/src/game/clientmanager.h + M /trunk/tinns-v2/src/game/commands.cpp + D /trunk/tinns-v2/src/game/commands.h + D /trunk/tinns-v2/src/game/config.cpp + D /trunk/tinns-v2/src/game/config.h + A /trunk/tinns-v2/src/game/configtemplate.h + D /trunk/tinns-v2/src/game/console.cpp + D /trunk/tinns-v2/src/game/console.h + D /trunk/tinns-v2/src/game/database.h + A /trunk/tinns-v2/src/game/decoder + A /trunk/tinns-v2/src/game/decoder/Makefile + A /trunk/tinns-v2/src/game/decoder/main.h + A /trunk/tinns-v2/src/game/decoder/msgdecoder.cpp + A /trunk/tinns-v2/src/game/decoder/udp_0x13.cpp + A /trunk/tinns-v2/src/game/decoder/udp_0x13.h + A /trunk/tinns-v2/src/game/decoder/udp_0x1f.cpp + A /trunk/tinns-v2/src/game/decoder/udp_0x1f.h + A /trunk/tinns-v2/src/game/decoder/udp_0x22.cpp + A /trunk/tinns-v2/src/game/decoder/udp_0x22.h + A /trunk/tinns-v2/src/game/decoder/udp_OOO.cpp + A /trunk/tinns-v2/src/game/decoder/udp_OOO.h + A /trunk/tinns-v2/src/game/decoder/udp_charmove.cpp + A /trunk/tinns-v2/src/game/decoder/udp_charmove.h + A /trunk/tinns-v2/src/game/decoder/udp_chat.cpp + A /trunk/tinns-v2/src/game/decoder/udp_chat.h + A /trunk/tinns-v2/src/game/decoder/udp_packet0.cpp + A /trunk/tinns-v2/src/game/decoder/udp_packet0.h + A /trunk/tinns-v2/src/game/decoder/udp_ping.cpp + A /trunk/tinns-v2/src/game/decoder/udp_ping.h + A /trunk/tinns-v2/src/game/decoder/udp_reqinfo.cpp + A /trunk/tinns-v2/src/game/decoder/udp_reqinfo.h + A /trunk/tinns-v2/src/game/decoder/udp_subskill.cpp + A /trunk/tinns-v2/src/game/decoder/udp_subskill.h + A /trunk/tinns-v2/src/game/decoder/udp_sync.cpp + A /trunk/tinns-v2/src/game/decoder/udp_sync.h + A /trunk/tinns-v2/src/game/decoder/udp_useobject.cpp + A /trunk/tinns-v2/src/game/decoder/udp_useobject.h + A /trunk/tinns-v2/src/game/decoder/udp_vhc.cpp + A /trunk/tinns-v2/src/game/decoder/udp_vhc.h + A /trunk/tinns-v2/src/game/decoder/udp_zoning.cpp + A /trunk/tinns-v2/src/game/decoder/udp_zoning.h + A /trunk/tinns-v2/src/game/decoder/udpanalyser.cpp + A /trunk/tinns-v2/src/game/decoder/udpanalyser.h + A /trunk/tinns-v2/src/game/def + A /trunk/tinns-v2/src/game/def/Makefile + A /trunk/tinns-v2/src/game/def/def_appartements.cpp + A /trunk/tinns-v2/src/game/def/def_appplaces.cpp + A /trunk/tinns-v2/src/game/def/def_characters.cpp + A /trunk/tinns-v2/src/game/def/def_charkinds.cpp + A /trunk/tinns-v2/src/game/def/def_factions.cpp + A /trunk/tinns-v2/src/game/def/def_hack.cpp + A /trunk/tinns-v2/src/game/def/def_items.cpp + A /trunk/tinns-v2/src/game/def/def_respawn.cpp + A /trunk/tinns-v2/src/game/def/def_skills.cpp + A /trunk/tinns-v2/src/game/def/def_subskills.cpp + A /trunk/tinns-v2/src/game/def/def_worldmodels.cpp + A /trunk/tinns-v2/src/game/def/def_worlds.cpp + A /trunk/tinns-v2/src/game/def/defparser.cpp + A /trunk/tinns-v2/src/game/def/gamedefs.cpp + A /trunk/tinns-v2/src/game/def/main.h + D /trunk/tinns-v2/src/game/def_characters.cpp + D /trunk/tinns-v2/src/game/def_characters.h + D /trunk/tinns-v2/src/game/def_charkinds.cpp + D /trunk/tinns-v2/src/game/def_charkinds.h + D /trunk/tinns-v2/src/game/def_factions.cpp + D /trunk/tinns-v2/src/game/def_factions.h + D /trunk/tinns-v2/src/game/def_hack.cpp + D /trunk/tinns-v2/src/game/def_hack.h + D /trunk/tinns-v2/src/game/def_items.cpp + D /trunk/tinns-v2/src/game/def_items.h + D /trunk/tinns-v2/src/game/def_skills.cpp + D /trunk/tinns-v2/src/game/def_skills.h + D /trunk/tinns-v2/src/game/def_subskills.cpp + D /trunk/tinns-v2/src/game/def_subskills.h + D /trunk/tinns-v2/src/game/def_worlds.cpp + D /trunk/tinns-v2/src/game/def_worlds.h + D /trunk/tinns-v2/src/game/defparser.cpp + D /trunk/tinns-v2/src/game/defparser.h + D /trunk/tinns-v2/src/game/filesystem.cpp + D /trunk/tinns-v2/src/game/filesystem.h + D /trunk/tinns-v2/src/game/gamedefs.cpp + D /trunk/tinns-v2/src/game/gamedefs.h + A /trunk/tinns-v2/src/game/gamescript.cpp.inhib + M /trunk/tinns-v2/src/game/gameserver.cpp + D /trunk/tinns-v2/src/game/gameserver.h + A /trunk/tinns-v2/src/game/genreplist.cpp + M /trunk/tinns-v2/src/game/globals.cpp + D /trunk/tinns-v2/src/game/globals.h + A /trunk/tinns-v2/src/game/include + A /trunk/tinns-v2/src/game/include/accounts.h + A /trunk/tinns-v2/src/game/include/buddylist.h + A /trunk/tinns-v2/src/game/include/chars.h + A /trunk/tinns-v2/src/game/include/chat.h + A /trunk/tinns-v2/src/game/include/client.h + A /trunk/tinns-v2/src/game/include/clientmanager.h + A /trunk/tinns-v2/src/game/include/commands.h + A /trunk/tinns-v2/src/game/include/database.h + A /trunk/tinns-v2/src/game/include/def_appartements.h + A /trunk/tinns-v2/src/game/include/def_appplaces.h + A /trunk/tinns-v2/src/game/include/def_characters.h + A /trunk/tinns-v2/src/game/include/def_charkinds.h + A /trunk/tinns-v2/src/game/include/def_factions.h + A /trunk/tinns-v2/src/game/include/def_hack.h + A /trunk/tinns-v2/src/game/include/def_items.h + A /trunk/tinns-v2/src/game/include/def_respawn.h + A /trunk/tinns-v2/src/game/include/def_skills.h + A /trunk/tinns-v2/src/game/include/def_subskills.h + A /trunk/tinns-v2/src/game/include/def_worldmodels.h + A /trunk/tinns-v2/src/game/include/def_worlds.h + A /trunk/tinns-v2/src/game/include/defparser.h + A /trunk/tinns-v2/src/game/include/defs.h + A /trunk/tinns-v2/src/game/include/gamedefs.h + A /trunk/tinns-v2/src/game/include/gamescript.h + A /trunk/tinns-v2/src/game/include/gameserver.h + A /trunk/tinns-v2/src/game/include/genreplist.h + A /trunk/tinns-v2/src/game/include/globals.h + A /trunk/tinns-v2/src/game/include/inventory.h + A /trunk/tinns-v2/src/game/include/isc.h + A /trunk/tinns-v2/src/game/include/item.h + A /trunk/tinns-v2/src/game/include/msgbuilder.h + A /trunk/tinns-v2/src/game/include/msgdecoder.h + A /trunk/tinns-v2/src/game/include/rconsole.h + A /trunk/tinns-v2/src/game/include/server.h + A /trunk/tinns-v2/src/game/include/skill.h + A /trunk/tinns-v2/src/game/include/sql.h + A /trunk/tinns-v2/src/game/include/vehicle.h + A /trunk/tinns-v2/src/game/include/zoning.h + M /trunk/tinns-v2/src/game/inventory.cpp + D /trunk/tinns-v2/src/game/inventory.h + A /trunk/tinns-v2/src/game/isc.cpp.inhib + D /trunk/tinns-v2/src/game/item.h + M /trunk/tinns-v2/src/game/main.h + D /trunk/tinns-v2/src/game/misc.cpp + D /trunk/tinns-v2/src/game/misc.h + A /trunk/tinns-v2/src/game/msgbuilder.cpp + D /trunk/tinns-v2/src/game/mutex.h + A /trunk/tinns-v2/src/game/rconsole.cpp.inhib + D /trunk/tinns-v2/src/game/semaphore.h + D /trunk/tinns-v2/src/game/server.h + D /trunk/tinns-v2/src/game/skill.h + M /trunk/tinns-v2/src/game/sql.cpp + D /trunk/tinns-v2/src/game/sql.h + D /trunk/tinns-v2/src/game/thread.h + A /trunk/tinns-v2/src/game/ttt.out + D /trunk/tinns-v2/src/game/types.h + D /trunk/tinns-v2/src/game/vehicle.h + M /trunk/tinns-v2/src/game/zoning.cpp + D /trunk/tinns-v2/src/game/zoning.h + A /trunk/tinns-v2/src/include/config.h + A /trunk/tinns-v2/src/include/connection-tcp.h + A /trunk/tinns-v2/src/include/connection-udp.h + A /trunk/tinns-v2/src/include/console.h + A /trunk/tinns-v2/src/include/external.h + A /trunk/tinns-v2/src/include/filesystem.h + A /trunk/tinns-v2/src/include/message.h + A /trunk/tinns-v2/src/include/misc.h + A /trunk/tinns-v2/src/include/netcode.h + A /trunk/tinns-v2/src/include/serversocket.h + A /trunk/tinns-v2/src/include/tinns_mutex.h + A /trunk/tinns-v2/src/include/tinns_semaphore.h + A /trunk/tinns-v2/src/include/tinns_thread.h + A /trunk/tinns-v2/src/include/types.h + A /trunk/tinns-v2/src/include/version.h + M /trunk/tinns-v2/src/info/Makefile + D /trunk/tinns-v2/src/info/config.cpp + D /trunk/tinns-v2/src/info/config.h + A /trunk/tinns-v2/src/info/configtemplate.h + D /trunk/tinns-v2/src/info/console.cpp + D /trunk/tinns-v2/src/info/console.h + M /trunk/tinns-v2/src/info/globals.cpp + M /trunk/tinns-v2/src/info/globals.h + M /trunk/tinns-v2/src/info/infoserver.cpp + M /trunk/tinns-v2/src/info/main.h + D /trunk/tinns-v2/src/info/misc.cpp + D /trunk/tinns-v2/src/info/misc.h + M /trunk/tinns-v2/src/info/server.cpp + M /trunk/tinns-v2/src/info/server.h + D /trunk/tinns-v2/src/info/types.h + A /trunk/tinns-v2/src/lib + M /trunk/tinns-v2/src/patch/Makefile + D /trunk/tinns-v2/src/patch/config.cpp + D /trunk/tinns-v2/src/patch/config.h + A /trunk/tinns-v2/src/patch/configtemplate.h + D /trunk/tinns-v2/src/patch/console.cpp + D /trunk/tinns-v2/src/patch/console.h + D /trunk/tinns-v2/src/patch/filesystem.cpp + D /trunk/tinns-v2/src/patch/filesystem.h + M /trunk/tinns-v2/src/patch/globals.cpp + M /trunk/tinns-v2/src/patch/main.h + D /trunk/tinns-v2/src/patch/misc.cpp + D /trunk/tinns-v2/src/patch/misc.h + M /trunk/tinns-v2/src/patch/server.cpp + D /trunk/tinns-v2/src/patch/types.h + D /trunk/tinns-v2/src/version.h + +Major filetree, make system and internal structure changes as well as some functionnal additions +------------------------------------------------------------------------ +r11 | Hammag | 2006-09-28 14:54:48 +0200 (Thu, 28 Sep 2006) | 1 line +Changed paths: + A /trunk/tinns-v2/src/common + A /trunk/tinns-v2/src/common/config + A /trunk/tinns-v2/src/common/console + A /trunk/tinns-v2/src/common/filesystem + A /trunk/tinns-v2/src/common/misc + A /trunk/tinns-v2/src/include + +Creating new dirs +------------------------------------------------------------------------ +r10 | Namikon | 2006-08-13 21:47:24 +0200 (Sun, 13 Aug 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/CHANGELOG + A /trunk/tinns-v2/WORK_IN_PROGRESS + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/conf/infoserver.conf + A /trunk/tinns-v2/database + A /trunk/tinns-v2/database/GameDB4.zip + A /trunk/tinns-v2/database/InfoDB2.zip + A /trunk/tinns-v2/docs + A /trunk/tinns-v2/docs/ISC ProtDef.txt + M /trunk/tinns-v2/src/game/Makefile + A /trunk/tinns-v2/src/game/_inc + A /trunk/tinns-v2/src/game/_inc/README + A /trunk/tinns-v2/src/game/_inc/baseline.inc.cpp + A /trunk/tinns-v2/src/game/_inc/chat_direct.inc.cpp + A /trunk/tinns-v2/src/game/_inc/player_jump.inc.cpp + A /trunk/tinns-v2/src/game/_inc/player_movement.inc.cpp + A /trunk/tinns-v2/src/game/_inc/subskills.inc.cpp + A /trunk/tinns-v2/src/game/_inc/udp_0x4c.inc.cpp + A /trunk/tinns-v2/src/game/_inc/use_aptaccess.inc.cpp + A /trunk/tinns-v2/src/game/_inc/use_chair.inc.cpp + A /trunk/tinns-v2/src/game/_inc/use_genrep.inc.cpp + A /trunk/tinns-v2/src/game/_inc/use_main.inc.cpp + A /trunk/tinns-v2/src/game/_inc/use_vehicle.inc.cpp + A /trunk/tinns-v2/src/game/_inc/zoning.inc.cpp + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chars.h + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/client.h + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/clientmanager.h + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/config.cpp + M /trunk/tinns-v2/src/game/database.cpp + M /trunk/tinns-v2/src/game/database.h + M /trunk/tinns-v2/src/game/def_characters.cpp + M /trunk/tinns-v2/src/game/def_characters.h + M /trunk/tinns-v2/src/game/def_charkinds.cpp + M /trunk/tinns-v2/src/game/def_charkinds.h + M /trunk/tinns-v2/src/game/def_items.cpp + M /trunk/tinns-v2/src/game/def_items.h + M /trunk/tinns-v2/src/game/def_worlds.h + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/gameserver.h + M /trunk/tinns-v2/src/game/globals.cpp + A /trunk/tinns-v2/src/game/inventory.cpp + A /trunk/tinns-v2/src/game/inventory.h + A /trunk/tinns-v2/src/game/item.cpp + A /trunk/tinns-v2/src/game/item.h + M /trunk/tinns-v2/src/game/main.cpp + M /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/game/misc.cpp + M /trunk/tinns-v2/src/game/misc.h + M /trunk/tinns-v2/src/game/skill.h + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/game/sql.h + M /trunk/tinns-v2/src/game/zoning.cpp + M /trunk/tinns-v2/src/game/zoning.h + M /trunk/tinns-v2/src/info/Makefile + M /trunk/tinns-v2/src/info/accounts.cpp + M /trunk/tinns-v2/src/info/client.h + M /trunk/tinns-v2/src/info/infoserver.cpp + M /trunk/tinns-v2/src/info/main.cpp + M /trunk/tinns-v2/src/info/main.h + M /trunk/tinns-v2/src/info/misc.cpp + M /trunk/tinns-v2/src/info/misc.h + M /trunk/tinns-v2/src/netcode/connection-tcp.cpp + M /trunk/tinns-v2/src/netcode/connection-tcp.h + M /trunk/tinns-v2/src/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/netcode/connection-udp.h + A /trunk/tinns-v2/src/netcode/main.h + A /trunk/tinns-v2/src/netcode/message.cpp + A /trunk/tinns-v2/src/netcode/message.h + M /trunk/tinns-v2/src/netcode/serversocket.cpp + M /trunk/tinns-v2/src/netcode/serversocket.h + M /trunk/tinns-v2/src/patch/Makefile + M /trunk/tinns-v2/src/patch/client.h + M /trunk/tinns-v2/src/patch/main.cpp + M /trunk/tinns-v2/src/patch/main.h + M /trunk/tinns-v2/src/patch/patchserver.cpp + M /trunk/tinns-v2/src/version.h + +http://forum.linux-addicted.org/viewtopic.php?p=3069#3069 +------------------------------------------------------------------------ +r9 | Namikon | 2006-05-31 22:19:12 +0200 (Wed, 31 May 2006) | 1 line +Changed paths: + A /trunk/tinns-v2/CHANGELOG + M /trunk/tinns-v2/conf/gameserver.conf + M /trunk/tinns-v2/conf/infoserver.conf + D /trunk/tinns-v2/database + M /trunk/tinns-v2/src/game/accounts.cpp + M /trunk/tinns-v2/src/game/chars.cpp + M /trunk/tinns-v2/src/game/chat.cpp + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/clientmanager.cpp + M /trunk/tinns-v2/src/game/commands.cpp + M /trunk/tinns-v2/src/game/config.cpp + M /trunk/tinns-v2/src/game/console.cpp + M /trunk/tinns-v2/src/game/database.cpp + M /trunk/tinns-v2/src/game/def_characters.cpp + M /trunk/tinns-v2/src/game/def_charkinds.cpp + M /trunk/tinns-v2/src/game/def_factions.cpp + M /trunk/tinns-v2/src/game/def_hack.cpp + M /trunk/tinns-v2/src/game/def_items.cpp + M /trunk/tinns-v2/src/game/def_skills.cpp + M /trunk/tinns-v2/src/game/def_subskills.cpp + M /trunk/tinns-v2/src/game/def_worlds.cpp + M /trunk/tinns-v2/src/game/defparser.cpp + M /trunk/tinns-v2/src/game/filesystem.cpp + M /trunk/tinns-v2/src/game/gamedefs.cpp + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/game/globals.cpp + M /trunk/tinns-v2/src/game/globals.h + M /trunk/tinns-v2/src/game/main.cpp + A /trunk/tinns-v2/src/game/main.h + M /trunk/tinns-v2/src/game/misc.cpp + M /trunk/tinns-v2/src/game/misc.h + M /trunk/tinns-v2/src/game/server.cpp + M /trunk/tinns-v2/src/game/skill.cpp + M /trunk/tinns-v2/src/game/sql.cpp + M /trunk/tinns-v2/src/game/sql.h + D /trunk/tinns-v2/src/game/tinns.h + M /trunk/tinns-v2/src/game/vehicle.cpp + M /trunk/tinns-v2/src/game/zoning.cpp + M /trunk/tinns-v2/src/info/config.cpp + M /trunk/tinns-v2/src/info/console.cpp + M /trunk/tinns-v2/src/info/globals.cpp + M /trunk/tinns-v2/src/info/infoserver.cpp + M /trunk/tinns-v2/src/info/main.h + M /trunk/tinns-v2/src/info/misc.cpp + M /trunk/tinns-v2/src/netcode/connection-tcp.cpp + M /trunk/tinns-v2/src/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/netcode/serversocket.cpp + M /trunk/tinns-v2/src/patch/client.cpp + M /trunk/tinns-v2/src/patch/config.cpp + M /trunk/tinns-v2/src/patch/console.cpp + M /trunk/tinns-v2/src/patch/filesystem.cpp + M /trunk/tinns-v2/src/patch/globals.cpp + M /trunk/tinns-v2/src/patch/globals.h + M /trunk/tinns-v2/src/patch/main.cpp + A /trunk/tinns-v2/src/patch/main.h + M /trunk/tinns-v2/src/patch/misc.cpp + M /trunk/tinns-v2/src/patch/patchserver.cpp + M /trunk/tinns-v2/src/patch/server.cpp + D /trunk/tinns-v2/src/patch/tinns.h + A /trunk/tinns-v2/src/version.h + +See CHANGELOG file for all recent changes +------------------------------------------------------------------------ +r8 | Namikon | 2006-05-28 22:54:56 +0200 (Sun, 28 May 2006) | 2 lines +Changed paths: + M /trunk/tinns-v2/src/game/Makefile + M /trunk/tinns-v2/src/game/client.cpp + M /trunk/tinns-v2/src/game/client.h + M /trunk/tinns-v2/src/game/gameserver.cpp + M /trunk/tinns-v2/src/info/client.cpp + M /trunk/tinns-v2/src/netcode/connection-udp.cpp + M /trunk/tinns-v2/src/netcode/connection-udp.h + M /trunk/tinns-v2/src/netcode/serversocket.cpp + M /trunk/tinns-v2/src/netcode/serversocket.h + M /trunk/tinns-v2/src/patch/client.cpp + +Fixed networklib, should work on every system now. +Many temp solutions are in this source, we will fix that later +------------------------------------------------------------------------ +r7 | bakkdoor | 2006-03-20 16:56:02 +0100 (Mon, 20 Mar 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/netcode/connection-udp.h + + +------------------------------------------------------------------------ +r6 | bakkdoor | 2006-03-20 16:54:38 +0100 (Mon, 20 Mar 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/netcode/connection-udp.h + + +------------------------------------------------------------------------ +r5 | bakkdoor | 2006-03-20 16:52:01 +0100 (Mon, 20 Mar 2006) | 1 line +Changed paths: + M /trunk/tinns-v2/src/netcode/connection-udp.h + + +------------------------------------------------------------------------ +r4 | bakkdoor | 2006-03-20 14:26:37 +0100 (Mon, 20 Mar 2006) | 1 line +Changed paths: + D /trunk/tinns-v2/src/game/gamescript.cpp + D /trunk/tinns-v2/src/game/gamescript.h + D /trunk/tinns-v2/src/game/rconsole.cpp + D /trunk/tinns-v2/src/game/rconsole.h + +dont work yet. +------------------------------------------------------------------------ +r3 | bakkdoor | 2006-03-17 02:51:46 +0100 (Fri, 17 Mar 2006) | 1 line +Changed paths: + D /trunk/tinnl + +no need for it anymore. +------------------------------------------------------------------------ +r2 | bakkdoor | 2006-03-17 02:50:30 +0100 (Fri, 17 Mar 2006) | 8 lines +Changed paths: + A /trunk/tinns-v2 + A /trunk/tinns-v2/Makefile + A /trunk/tinns-v2/conf + A /trunk/tinns-v2/conf/gameserver.conf + A /trunk/tinns-v2/conf/global.conf + A /trunk/tinns-v2/conf/infoserver.conf + A /trunk/tinns-v2/conf/patchserver.conf + A /trunk/tinns-v2/database + A /trunk/tinns-v2/database/config.cfg + A /trunk/tinns-v2/database/gameserver.sql.gz + A /trunk/tinns-v2/database/infoserver.sql.gz + A /trunk/tinns-v2/defs + A /trunk/tinns-v2/defs/pak_actionmod.def + A /trunk/tinns-v2/defs/pak_ammo.def + A /trunk/tinns-v2/defs/pak_appartements.def + A /trunk/tinns-v2/defs/pak_appplaces.def + A /trunk/tinns-v2/defs/pak_blueprintpieces.def + A /trunk/tinns-v2/defs/pak_characters.def + A /trunk/tinns-v2/defs/pak_charaction.def + A /trunk/tinns-v2/defs/pak_charkinds.def + A /trunk/tinns-v2/defs/pak_customanimstrings.def + A /trunk/tinns-v2/defs/pak_damage.def + A /trunk/tinns-v2/defs/pak_drugs.def + A /trunk/tinns-v2/defs/pak_effects.def + A /trunk/tinns-v2/defs/pak_fractions.def + A /trunk/tinns-v2/defs/pak_gameplaysettings.def + A /trunk/tinns-v2/defs/pak_hack.def + A /trunk/tinns-v2/defs/pak_implants.def + A /trunk/tinns-v2/defs/pak_itemcontainer.def + A /trunk/tinns-v2/defs/pak_itemmod.def + A /trunk/tinns-v2/defs/pak_itemplan.def + A /trunk/tinns-v2/defs/pak_itemres.def + A /trunk/tinns-v2/defs/pak_items.def + A /trunk/tinns-v2/defs/pak_maps.def + A /trunk/tinns-v2/defs/pak_menu.def + A /trunk/tinns-v2/defs/pak_missionbase.def + A /trunk/tinns-v2/defs/pak_modeltextures.def + A /trunk/tinns-v2/defs/pak_npc.def + A /trunk/tinns-v2/defs/pak_npcarmor.def + A /trunk/tinns-v2/defs/pak_npcgroupspawn.def + A /trunk/tinns-v2/defs/pak_npcloot.def + A /trunk/tinns-v2/defs/pak_outposts.def + A /trunk/tinns-v2/defs/pak_recycles.def + A /trunk/tinns-v2/defs/pak_respawn.def + A /trunk/tinns-v2/defs/pak_routemenu.def + A /trunk/tinns-v2/defs/pak_routesubmenu.def + A /trunk/tinns-v2/defs/pak_rsctables.def + A /trunk/tinns-v2/defs/pak_scripts.def + A /trunk/tinns-v2/defs/pak_shots.def + A /trunk/tinns-v2/defs/pak_skills.def + A /trunk/tinns-v2/defs/pak_subskill.def + A /trunk/tinns-v2/defs/pak_subskill_deu.def + A /trunk/tinns-v2/defs/pak_terminals.def + A /trunk/tinns-v2/defs/pak_trader.def + A /trunk/tinns-v2/defs/pak_tutorialchar.dat + A /trunk/tinns-v2/defs/pak_vehiclefx.def + A /trunk/tinns-v2/defs/pak_vehicles.def + A /trunk/tinns-v2/defs/pak_vehiclesits.def + A /trunk/tinns-v2/defs/pak_weapons.def + A /trunk/tinns-v2/defs/pak_weather.def + A /trunk/tinns-v2/defs/pak_worldinfo.def + A /trunk/tinns-v2/defs/pak_worldmodel.def + A /trunk/tinns-v2/src + A /trunk/tinns-v2/src/game + A /trunk/tinns-v2/src/game/Makefile + A /trunk/tinns-v2/src/game/accounts.cpp + A /trunk/tinns-v2/src/game/accounts.h + A /trunk/tinns-v2/src/game/chars.cpp + A /trunk/tinns-v2/src/game/chars.h + A /trunk/tinns-v2/src/game/chat.cpp + A /trunk/tinns-v2/src/game/chat.h + A /trunk/tinns-v2/src/game/client.cpp + A /trunk/tinns-v2/src/game/client.h + A /trunk/tinns-v2/src/game/clientmanager.cpp + A /trunk/tinns-v2/src/game/clientmanager.h + A /trunk/tinns-v2/src/game/commands.cpp + A /trunk/tinns-v2/src/game/commands.h + A /trunk/tinns-v2/src/game/config.cpp + A /trunk/tinns-v2/src/game/config.h + A /trunk/tinns-v2/src/game/console.cpp + A /trunk/tinns-v2/src/game/console.h + A /trunk/tinns-v2/src/game/database.cpp + A /trunk/tinns-v2/src/game/database.h + A /trunk/tinns-v2/src/game/def_characters.cpp + A /trunk/tinns-v2/src/game/def_characters.h + A /trunk/tinns-v2/src/game/def_charkinds.cpp + A /trunk/tinns-v2/src/game/def_charkinds.h + A /trunk/tinns-v2/src/game/def_factions.cpp + A /trunk/tinns-v2/src/game/def_factions.h + A /trunk/tinns-v2/src/game/def_hack.cpp + A /trunk/tinns-v2/src/game/def_hack.h + A /trunk/tinns-v2/src/game/def_items.cpp + A /trunk/tinns-v2/src/game/def_items.h + A /trunk/tinns-v2/src/game/def_skills.cpp + A /trunk/tinns-v2/src/game/def_skills.h + A /trunk/tinns-v2/src/game/def_subskills.cpp + A /trunk/tinns-v2/src/game/def_subskills.h + A /trunk/tinns-v2/src/game/def_worlds.cpp + A /trunk/tinns-v2/src/game/def_worlds.h + A /trunk/tinns-v2/src/game/defparser.cpp + A /trunk/tinns-v2/src/game/defparser.h + A /trunk/tinns-v2/src/game/filesystem.cpp + A /trunk/tinns-v2/src/game/filesystem.h + A /trunk/tinns-v2/src/game/gamedefs.cpp + A /trunk/tinns-v2/src/game/gamedefs.h + A /trunk/tinns-v2/src/game/gamescript.cpp + A /trunk/tinns-v2/src/game/gamescript.h + A /trunk/tinns-v2/src/game/gameserver.cpp + A /trunk/tinns-v2/src/game/gameserver.h + A /trunk/tinns-v2/src/game/globals.cpp + A /trunk/tinns-v2/src/game/globals.h + A /trunk/tinns-v2/src/game/main.cpp + A /trunk/tinns-v2/src/game/misc.cpp + A /trunk/tinns-v2/src/game/misc.h + A /trunk/tinns-v2/src/game/mutex.h + A /trunk/tinns-v2/src/game/rconsole.cpp + A /trunk/tinns-v2/src/game/rconsole.h + A /trunk/tinns-v2/src/game/semaphore.h + A /trunk/tinns-v2/src/game/server.cpp + A /trunk/tinns-v2/src/game/server.h + A /trunk/tinns-v2/src/game/skill.cpp + A /trunk/tinns-v2/src/game/skill.h + A /trunk/tinns-v2/src/game/sql.cpp + A /trunk/tinns-v2/src/game/sql.h + A /trunk/tinns-v2/src/game/thread.h + A /trunk/tinns-v2/src/game/tinns.h + A /trunk/tinns-v2/src/game/types.h + A /trunk/tinns-v2/src/game/vehicle.cpp + A /trunk/tinns-v2/src/game/vehicle.h + A /trunk/tinns-v2/src/game/zoning.cpp + A /trunk/tinns-v2/src/game/zoning.h + A /trunk/tinns-v2/src/info + A /trunk/tinns-v2/src/info/Makefile + A /trunk/tinns-v2/src/info/accounts.cpp + A /trunk/tinns-v2/src/info/accounts.h + A /trunk/tinns-v2/src/info/client.cpp + A /trunk/tinns-v2/src/info/client.h + A /trunk/tinns-v2/src/info/config.cpp + A /trunk/tinns-v2/src/info/config.h + A /trunk/tinns-v2/src/info/console.cpp + A /trunk/tinns-v2/src/info/console.h + A /trunk/tinns-v2/src/info/globals.cpp + A /trunk/tinns-v2/src/info/globals.h + A /trunk/tinns-v2/src/info/infoserver.cpp + A /trunk/tinns-v2/src/info/infoserver.h + A /trunk/tinns-v2/src/info/main.cpp + A /trunk/tinns-v2/src/info/main.h + A /trunk/tinns-v2/src/info/misc.cpp + A /trunk/tinns-v2/src/info/misc.h + A /trunk/tinns-v2/src/info/server.cpp + A /trunk/tinns-v2/src/info/server.h + A /trunk/tinns-v2/src/info/sql.cpp + A /trunk/tinns-v2/src/info/sql.h + A /trunk/tinns-v2/src/info/types.h + A /trunk/tinns-v2/src/netcode + A /trunk/tinns-v2/src/netcode/connection-tcp.cpp + A /trunk/tinns-v2/src/netcode/connection-tcp.h + A /trunk/tinns-v2/src/netcode/connection-udp.cpp + A /trunk/tinns-v2/src/netcode/connection-udp.h + A /trunk/tinns-v2/src/netcode/serversocket.cpp + A /trunk/tinns-v2/src/netcode/serversocket.h + A /trunk/tinns-v2/src/patch + A /trunk/tinns-v2/src/patch/Makefile + A /trunk/tinns-v2/src/patch/client.cpp + A /trunk/tinns-v2/src/patch/client.h + A /trunk/tinns-v2/src/patch/config.cpp + A /trunk/tinns-v2/src/patch/config.h + A /trunk/tinns-v2/src/patch/console.cpp + A /trunk/tinns-v2/src/patch/console.h + A /trunk/tinns-v2/src/patch/filesystem.cpp + A /trunk/tinns-v2/src/patch/filesystem.h + A /trunk/tinns-v2/src/patch/globals.cpp + A /trunk/tinns-v2/src/patch/globals.h + A /trunk/tinns-v2/src/patch/main.cpp + A /trunk/tinns-v2/src/patch/misc.cpp + A /trunk/tinns-v2/src/patch/misc.h + A /trunk/tinns-v2/src/patch/patchserver.cpp + A /trunk/tinns-v2/src/patch/patchserver.h + A /trunk/tinns-v2/src/patch/server.cpp + A /trunk/tinns-v2/src/patch/server.h + A /trunk/tinns-v2/src/patch/tinns.h + A /trunk/tinns-v2/src/patch/types.h + +tinns-v2 added: +- new netcode (check out /src/netcode) +- split into 3 executables (patch/info/gameserver) +- some other stuff +-> it works for me here in my (bakkdoor) lan, but not over internet. there's still a problem with the udp-code i believe. tcp works perfectly. try it out on lan etc. +- besides, there's still an error, if a client is connected and another one tries to connect (login error at gameserver) - should be fixable though. + +bakkdoor. +------------------------------------------------------------------------ +r1 | Akiko | 2006-01-30 07:42:59 +0100 (Mon, 30 Jan 2006) | 3 lines +Changed paths: + A /trunk + A /trunk/datapack + A /trunk/datapack/defs + A /trunk/datapack/patches + A /trunk/docs + A /trunk/docs/Neocron1.ChatProtocol.pdf + A /trunk/docs/Neocron1.MainProtocol.pdf + A /trunk/docs/TinNS.QuickInstallation.pdf + A /trunk/docs/itemtypes.txt + A /trunk/docs/readme + A /trunk/tinnl + A /trunk/tinns + A /trunk/tinns/development + A /trunk/tinns/development/HawkNL + A /trunk/tinns/development/HawkNL/crc.c + A /trunk/tinns/development/HawkNL/err.c + A /trunk/tinns/development/HawkNL/errorstr.c + A /trunk/tinns/development/HawkNL/group.c + A /trunk/tinns/development/HawkNL/hawklib.h + A /trunk/tinns/development/HawkNL/hawkthreads.h + A /trunk/tinns/development/HawkNL/htcondition.c + A /trunk/tinns/development/HawkNL/hthread.c + A /trunk/tinns/development/HawkNL/htinternal.h + A /trunk/tinns/development/HawkNL/htmutex.c + A /trunk/tinns/development/HawkNL/ipx.c + A /trunk/tinns/development/HawkNL/ipx.h + A /trunk/tinns/development/HawkNL/loopback.c + A /trunk/tinns/development/HawkNL/loopback.h + A /trunk/tinns/development/HawkNL/nl.c + A /trunk/tinns/development/HawkNL/nl.h + A /trunk/tinns/development/HawkNL/nlinternal.h + A /trunk/tinns/development/HawkNL/nltime.c + A /trunk/tinns/development/HawkNL/parallel.h + A /trunk/tinns/development/HawkNL/serial.h + A /trunk/tinns/development/HawkNL/sock.c + A /trunk/tinns/development/HawkNL/sock.h + A /trunk/tinns/development/HawkNL/wsock.h + A /trunk/tinns/development/Makefile + A /trunk/tinns/development/README + A /trunk/tinns/development/TinyXML + A /trunk/tinns/development/TinyXML/tinystr.cpp + A /trunk/tinns/development/TinyXML/tinystr.h + A /trunk/tinns/development/TinyXML/tinyxml.cpp + A /trunk/tinns/development/TinyXML/tinyxml.h + A /trunk/tinns/development/TinyXML/tinyxmlerror.cpp + A /trunk/tinns/development/TinyXML/tinyxmlparser.cpp + A /trunk/tinns/development/accounts.cpp + A /trunk/tinns/development/accounts.h + A /trunk/tinns/development/chars.cpp + A /trunk/tinns/development/chars.h + A /trunk/tinns/development/chat.cpp + A /trunk/tinns/development/chat.h + A /trunk/tinns/development/client.cpp + A /trunk/tinns/development/client.h + A /trunk/tinns/development/clientmanager.cpp + A /trunk/tinns/development/clientmanager.h + A /trunk/tinns/development/commands.cpp + A /trunk/tinns/development/commands.h + A /trunk/tinns/development/config.cpp + A /trunk/tinns/development/config.h + A /trunk/tinns/development/console.cpp + A /trunk/tinns/development/console.h + A /trunk/tinns/development/database + A /trunk/tinns/development/database/config.cfg + A /trunk/tinns/development/database.cpp + A /trunk/tinns/development/database.h + A /trunk/tinns/development/def_characters.cpp + A /trunk/tinns/development/def_characters.h + A /trunk/tinns/development/def_charkinds.cpp + A /trunk/tinns/development/def_charkinds.h + A /trunk/tinns/development/def_factions.cpp + A /trunk/tinns/development/def_factions.h + A /trunk/tinns/development/def_hack.cpp + A /trunk/tinns/development/def_hack.h + A /trunk/tinns/development/def_items.cpp + A /trunk/tinns/development/def_items.h + A /trunk/tinns/development/def_skills.cpp + A /trunk/tinns/development/def_skills.h + A /trunk/tinns/development/def_subskills.cpp + A /trunk/tinns/development/def_subskills.h + A /trunk/tinns/development/def_worlds.cpp + A /trunk/tinns/development/def_worlds.h + A /trunk/tinns/development/defparser.cpp + A /trunk/tinns/development/defparser.h + A /trunk/tinns/development/filesystem.cpp + A /trunk/tinns/development/filesystem.h + A /trunk/tinns/development/gamedefs.cpp + A /trunk/tinns/development/gamedefs.h + A /trunk/tinns/development/gameserver.cpp + A /trunk/tinns/development/gameserver.h + A /trunk/tinns/development/globals.cpp + A /trunk/tinns/development/globals.h + A /trunk/tinns/development/infoserver.cpp + A /trunk/tinns/development/infoserver.h + A /trunk/tinns/development/main.cpp + A /trunk/tinns/development/misc.cpp + A /trunk/tinns/development/misc.h + A /trunk/tinns/development/mutex.h + A /trunk/tinns/development/patchserver.cpp + A /trunk/tinns/development/patchserver.h + A /trunk/tinns/development/rconsole.cpp + A /trunk/tinns/development/rconsole.h + A /trunk/tinns/development/semaphore.h + A /trunk/tinns/development/server.cpp + A /trunk/tinns/development/server.h + A /trunk/tinns/development/skill.cpp + A /trunk/tinns/development/skill.h + A /trunk/tinns/development/socket.cpp + A /trunk/tinns/development/socket.h + A /trunk/tinns/development/sql.cpp + A /trunk/tinns/development/sql.h + A /trunk/tinns/development/thread.h + A /trunk/tinns/development/tinns.h + A /trunk/tinns/development/types.h + A /trunk/tinns/development/vehicle.cpp + A /trunk/tinns/development/vehicle.h + A /trunk/tinns/development/zoning.cpp + A /trunk/tinns/development/zoning.h + A /trunk/tinns/stable + A /trunk/tinns/testing + A /trunk/tinns/testing/HawkNL + A /trunk/tinns/testing/HawkNL/condition.c + A /trunk/tinns/testing/HawkNL/crc.c + A /trunk/tinns/testing/HawkNL/err.c + A /trunk/tinns/testing/HawkNL/errorstr.c + A /trunk/tinns/testing/HawkNL/group.c + A /trunk/tinns/testing/HawkNL/ipx.c + A /trunk/tinns/testing/HawkNL/ipx.h + A /trunk/tinns/testing/HawkNL/loopback.c + A /trunk/tinns/testing/HawkNL/loopback.h + A /trunk/tinns/testing/HawkNL/mutex.c + A /trunk/tinns/testing/HawkNL/nl.c + A /trunk/tinns/testing/HawkNL/nl.h + A /trunk/tinns/testing/HawkNL/nlinternal.h + A /trunk/tinns/testing/HawkNL/nltime.c + A /trunk/tinns/testing/HawkNL/parallel.h + A /trunk/tinns/testing/HawkNL/serial.h + A /trunk/tinns/testing/HawkNL/sock.c + A /trunk/tinns/testing/HawkNL/sock.h + A /trunk/tinns/testing/HawkNL/thread.c + A /trunk/tinns/testing/HawkNL/wsock.h + A /trunk/tinns/testing/Makefile + A /trunk/tinns/testing/TinyXML + A /trunk/tinns/testing/TinyXML/tinystr.cpp + A /trunk/tinns/testing/TinyXML/tinystr.h + A /trunk/tinns/testing/TinyXML/tinyxml.cpp + A /trunk/tinns/testing/TinyXML/tinyxml.h + A /trunk/tinns/testing/TinyXML/tinyxmlerror.cpp + A /trunk/tinns/testing/TinyXML/tinyxmlparser.cpp + A /trunk/tinns/testing/accounts.cpp + A /trunk/tinns/testing/accounts.h + A /trunk/tinns/testing/chars.cpp + A /trunk/tinns/testing/chars.h + A /trunk/tinns/testing/client.cpp + A /trunk/tinns/testing/client.h + A /trunk/tinns/testing/config.cpp + A /trunk/tinns/testing/config.h + A /trunk/tinns/testing/console.cpp + A /trunk/tinns/testing/console.h + A /trunk/tinns/testing/database + A /trunk/tinns/testing/database/accounts.xml + A /trunk/tinns/testing/database/chars.xml + A /trunk/tinns/testing/database/config.xml + A /trunk/tinns/testing/database/playerchars + A /trunk/tinns/testing/database/playerchars/1.xml + A /trunk/tinns/testing/database.cpp + A /trunk/tinns/testing/database.h + A /trunk/tinns/testing/def_characters.cpp + A /trunk/tinns/testing/def_characters.h + A /trunk/tinns/testing/def_charkinds.cpp + A /trunk/tinns/testing/def_charkinds.h + A /trunk/tinns/testing/def_factions.cpp + A /trunk/tinns/testing/def_factions.h + A /trunk/tinns/testing/def_hack.cpp + A /trunk/tinns/testing/def_hack.h + A /trunk/tinns/testing/def_items.cpp + A /trunk/tinns/testing/def_items.h + A /trunk/tinns/testing/def_skills.cpp + A /trunk/tinns/testing/def_skills.h + A /trunk/tinns/testing/def_subskills.cpp + A /trunk/tinns/testing/def_subskills.h + A /trunk/tinns/testing/def_worlds.cpp + A /trunk/tinns/testing/def_worlds.h + A /trunk/tinns/testing/defparser.cpp + A /trunk/tinns/testing/defparser.h + A /trunk/tinns/testing/filesystem.cpp + A /trunk/tinns/testing/filesystem.h + A /trunk/tinns/testing/gamedefs.cpp + A /trunk/tinns/testing/gamedefs.h + A /trunk/tinns/testing/gameserver.cpp + A /trunk/tinns/testing/gameserver.h + A /trunk/tinns/testing/globals.cpp + A /trunk/tinns/testing/globals.h + A /trunk/tinns/testing/infoserver.cpp + A /trunk/tinns/testing/infoserver.h + A /trunk/tinns/testing/main.cpp + A /trunk/tinns/testing/misc.cpp + A /trunk/tinns/testing/misc.h + A /trunk/tinns/testing/mutex.h + A /trunk/tinns/testing/patchserver.cpp + A /trunk/tinns/testing/patchserver.h + A /trunk/tinns/testing/rconsole.cpp + A /trunk/tinns/testing/rconsole.h + A /trunk/tinns/testing/semaphore.h + A /trunk/tinns/testing/server.cpp + A /trunk/tinns/testing/server.h + A /trunk/tinns/testing/socket.cpp + A /trunk/tinns/testing/socket.h + A /trunk/tinns/testing/thread.h + A /trunk/tinns/testing/tinns.h + A /trunk/tinns/testing/types.h + A /trunk/tinns/testing/zoning.cpp + A /trunk/tinns/testing/zoning.h + A /trunk/tools + A /trunk/tools/pak_decompress + A /trunk/tools/pak_decompress/Makefile + A /trunk/tools/pak_decompress/pak_decompress.cpp + A /trunk/tools/pak_decompress/pak_decompress.jar + A /trunk/tools/vfs_viewer + A /trunk/tools/vfs_viewer/Makefile + A /trunk/tools/vfs_viewer/vfs_viewer.c + +- reimport of tinns after repository crash (what ever that was) + + +------------------------------------------------------------------------ diff --git a/server/CHANGELOG b/server/CHANGELOG deleted file mode 100644 index 97e4502..0000000 --- a/server/CHANGELOG +++ /dev/null @@ -1,1818 +0,0 @@ - - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - - -Developers: -- Akiko -- bakkdoor -- Namikon -- Hammag - -> Recent changes -==================== -Namikon; 31.05.2006 22:12 GMT+1 ----------- - -- Introduced CHANGELOG file -- Added version.h to enable a way to create release tarballs/binaries -- Fixed a dozen of typos and bugs from the additions of the last 2 days -- "Clean build"; Should compile without any error now. (Note: Not "work", "compile" :) ) - - - -[GAME] -globals.cpp :: ShutdownTinNS() - - Renamed to Shutdown() - - Added svn version output to startup procedure - - Fixed minor typos/console outputs -config.cpp :: LoadOptions() - - Changed configfile, now loads data from /conf/gameserver.cfg - - Added full 2 DB support (was: "sql_*" now: "info_sql_*" and "game_sql_*") - -[INFO] - -[PATCH] -globals.cpp :: ShutdownTinNS() - - Renamed to Shutdown() - -[ALL] -misc.cpp :: GetSVNRev() - - Added handling for version.h defines -==================== -Hammag; 06.07.2006 02:17 GMT+1 ----------- - -- Put UDP sockets in non-blocking mode. -- Checked and modified all socket related stuff to work in non-blocking mode. -- Lowered CPU use from 100% to ~0% by changing from sched_yield() to I/O wait sleep using Select. - This avoid runingthe main loop when there's nothing to do (some more improvements are to come - on this topic). -- The socket Select now waits for any tcp OR UDP socket incoming data. -- Fixed some pointer issues in netcode. - - - -[GAME] - -[INFO] -misc.h - - added declaration of utility function IPlongToString() -misc.cpp :: IPlongToString() - - implemented function to convert IP address in u32 format to string -infoserver.cpp :: HandleServerList() - - now use IPlongToString() to display server IP on Console - -[PATCH] - -[ALL] -patchserver.cpp, infoserver.cpp, gameserver.cpp :: Start() - - set 10 msec timeout for socket select, which sets the max wait time - for the main loop when no activity. - -main.cpp - - commented out sched_yield() in main loop, as it is not needed anymore. - -main.h - - moved-up tinns-specific types include to ready them for netcode compilation - -[NETCODE] -connection-tcp.cpp :: ConnectionTCP() - - moved-in non-blocking setting from ServerSocket::getTCPConnection() - for better class coherency -connection-tcp.cpp :: update() - - modified to deal correctly with would-block socket writes. - - fixed a pointer and size issue in socket recv - -connection-udp.h :: class - - added private member m_ServerSocket - - added ServerSocket parameter in constructor prototype - -connection-udp.cpp :: ConnectionUDP() - - modified to set m_ServerSocket from constructor parameters -connection-udp.cpp :: ~ConnectionUDP() - - added socket removal from fd sets by calling m_ServerSocket->delSocketFromSet -connection-udp.cpp :: update() - - modified to check m_ServerSocket->isDataAvailable() before trying to read from socket - - fixed a pointer and size issue in socket recv - -serversocket.h :: class - - added settimeout public method - - added fd_set m_MainSetUDP private member - - added fd_set m_MainSetGlobal private member (= m_MainSetTCP + m_MainSetUDP) - -serversocket.cpp :: ServerSocket() - - moved m_TimeOut initialization in constructor - - added m_MainSetUDP and m_MainSetGlobal init -serversocket.cpp :: settimeout() - - implemented method to set m_TimeOut to permit tuning -serversocket.cpp :: open() - - added m_MainSetUDP and m_MainSetGlobal init - - added m_ListenerTCP to m_MainSetGlobal too -serversocket.cpp :: update() - - now m_MainSetGlobal is copied to m_ReadSetTCP set, - - added a local fdMax for select - - use a temp timeout structure in select as select doc says select implementation - for Linux could change this value -serversocket.cpp :: getUDPConnection() - - now pass this pointer to new ConnectionUDP constructor - - new UDP sockets are added to m_MainSetUDP and m_MainSetGlobal, - and kept track of in m_FdMaxUDP -serversocket.cpp :: getTCPConnection() - - fixed a struct length issue (?) in accept - - now new TCP sockets are added to m_MainSetGlobal too - - moved non-blocking setting to ConnectionTCP::ConnectionTCP() for better class coherency -serversocket.cpp :: delSocketFromSet() - - added removal of sockfd from m_MainSetUDP and m_MainSetGlobal too - -==================== -Hammag; 30.07.2006 02:17 GMT+1 ----------- - - - Baseline fixed, full zoning now really works with multiplayer - - Multiuser now works. Multiple login + mutual viewing. - Now a char displays as expected ingame for himself as for others.(some movement/positionning glitches remain) - - Warning: code for using items hasn't been fixed, so every thing 2nd+ user does will be - attriuted to 1st user and provoque OOO flood. - So don't try using items, except for the first user. - - added @skin command. Reminder use by @skin, little mode description in commands.cpp header - - -[GAME] - - Many changes in many files - - amongst other, rewrited baseline.inc.cpp with new PMessage object as an exemple - - added PItem & PInventory classes - -[NETCODE] - - Added PMessage class for network message input/output - - UDP & TCP connection classes now has an interface for PMessages - -==================== -Hammag; 06.08.2006 02:17 GMT+1 ----------- - - - code for using items should now be fixed for most case (see above) so activating items in multiuser mode is no longer a limitation - - a similar issue in @warp command has been solved (and spawn location added as an optional command line parameter as in NeoX) - - further modifications to the netcode to cope with NAT. New options added to config file - - rework of the config.cpp implementation, to enable easy addition of new option and more explicit error checking. See comments at begining of config.cpp - - gametime flow fixed. Start time is set to 0 ATM - - other minor changes. See source files starts for info - - conf/gameserver.conf extended with NAT related options - - -[GAME] - - Many changes in many files for modifications stated above - - Changes to ClientManager to make it work and add methods to dispatch messages to clients - - game/Makefile updated - -[NETCODE] - - Changes in most files for modifications stated above - -[INFO] -client.cpp :: GetAdress() - - updated implementation to use ConnectionTCP::GetRemoteAddress() - -[PATCH] -client.cpp :: GetAdress() - - updated implementation to use ConnectionTCP::GetRemoteAddress() - -==================== -Hammag; 24.08.2006 02:17 GMT+1 ----------- - - - movement/positionning in multiuser is now fixed - - implemented NC messages decoding new base classes. Not used yet - - -[GAME] - - added PUdpMsgDecoder class, which objects manage UDP packets decoding - - added PUdpMsgAnalyser class, which is the base class that real packet analyser objects will be derived from - Analysis exemple is not yet implemented - - added PUdpMsgUnknown class, which is the most simple exemple of final packet analyser object (used for unkown packets) - -==================== -Hammag; 26.08.2006 02:17 GMT+1 ----------- - - - A modified source tree is now used. The corresponding changes have been applied to the whole source code, - resulting in some move to some common components directories, common includes and corresponding changes - in servers source - - A new Makefile system is now used. All makefiles have been remade accordingly. - - -[ALL] -Put version.h in include dir -Created include/external.h -Removed corresponding includes from all main.h, and replaced by external.h - -[CONSOLE] -Moved console *.cpp files in common/console -Moved console's *.h in include dir -Added a main.h in common/console for specific private includes -Made Console class generic, added output file as constructor parameter, - changed servers code accordingly -Removed Console-> in Console->ColorText(...) in PConsole::~PConsole() - -[NETCODE] -Moved netcode .cpp files in common/netcode -Moved netcode's *.h in include dir, changed netcode's main.h to netcode.h -Added a main.h in common/netcode for specific private includes - -==================== -Hammag; 27.08.2006 18:30 GMT+1 ----------- - - - Changed config class as a common component - - Changed "misc" functions as a common components - - Removed some old code, some old defines, and changed some defines to config entry - -[CONFIG] -Moved config .cpp file in common/config -Moved config *.h in include dir -Added a main.h in common/config for specific private includes -Made Config class generic, added option tempate and config file as LoadOptions parameter, - changed servers code accordingly, by making use of the shared class - and adding a templateconfig.h file included in the place where config loading is done - -[MISC] -Merged all misc functions in a single misc.h and a single misc.cpp files -Moved config *.h in include dir -Move the misc.cpp in common/misc -Added a main.h in common/misc for specific private includes - -[ALL SERVERS] -Modified global.cpp and main.h to use shared PConfig class and shared misc functions -Removed misc.* and config.* from servers sources - -==================== -Hammag; 10.09.2006 00:00 GMT+1 ----------- - - - Changed filesystem class as a common component - - Added command @effect to play with skins effect (see commands.cpp for details) - - Added command @speed to play with speed (see commands.cpp for details) - - Removed some more #include directive from some main.h files to put them only - when needed in .cpp file. This eliminated some unnecessary dependencies and - makes recompile faster. - - Migrated message decoding to new system for all messages types except 0x13/0x1f (yes... stil lots to do) - - -[ALL SERVERS] -Moved filesystem.h to include dir, and filesystem.cpp to common/filesystem dir -Removed filesystem.* from servers sources -Changed patchserver and gameserver accordingly - - -[GAME] -Added game/include dir to put all .h file to highly facilitate includes. -Added corresponding include directory path directive in game and game/* makefiles - -Put all .def related stuff in game/def subdir. -*.h files are in game/include - -Put all message decoding related stuff in game/decoder subdir. -msgdecoder.h file are in game/include. -Other .h files which are not exposed to other gameserver componenets are in game/decoder subdir. - -Created a PMsgBuilder class to put message creating methods in it. -A global PMsgBuilder* MsgBuilder instance is added to gameserver. -Modified globals.*, gameserver.*, clientmanager.cpp, commands.cpp and various game/_inc accordingly - -Moved PGameState definition from gameserver.cpp to gameserver.h - -Added PChar* GetChar() method to PClient - -Added WorldMap request basic support in PMsgBuilder::BuildReqInfoAnswerMsg() (for futur use) -Added BodyEffect and SpeedOverride members to PChar class, as well as methods to set and get these values -Added support for BodyEffect and SpeedOverride in PMsgBuilder::BuildCharHelloMsg() - -Reorganised code related to UDP Sync in order to avoid duplicate code. -Put most of corresponding message building functions in PMsgBuilder class. - -==================== -Hammag; 22.09.2006 00:00 GMT+1 ----------- - - - Added Buddy list management (just the list though, buddy chat isn't working yet) - Added a new gameserver DB table ti save the buddy list: buddy_list - - Added Direct chat management (just char selection though, direct chat isn't working yet, and selection isn't saved in DB yet) - - Added Genrep list management. List is now working and saved. Registration of GR doesn't register the right GR though (working on that) - - Added loading of worldmodel.def and appplace.def files for later (very soon) use. - - Migrated most of message handling to new decoder system. - Item use is migrated in "a compatibility mode" until item management is fully based on world .dat and worldmodel.def files - -[GAME] -Removed game/_inc directory -Removed all UDP message analysis and handling from gameserver.cpp -Created mode decoder classes in game/decoder -Moved most UDP packet creation code from gameserver.cpp to msgbuilder.cpp, using PMessages -Added PBuddyList class -Added PGenrepList class -Added loading/saving of Buddy List and Genrep List to char loading/saving in chars.cpp - -Added new members to PChar to store skin color and brightness (aka "darkness") in chars.h and char.cpp (not saved in DB yet) - and corresponding support in PMsgBuilder::BuildCharHelloMsg() -Added new commands "@color" and "@brightness" - -==================== -Hammag; 27.09.2006 20:00 GMT+1 ----------- - - - Added loading of appartements.def and respawn.def files for later (very soon) use. - - Corrected and modified dependencies management in make system. - No unwanted file date change should occure anymore - -[GAME] -Zoning to appartment now make use of appartements.def data instead of hardcoded data (zoning.cpp) -Added PMySQL::GetAptLocation() method in sql.cpp -Prepared some modification for WorldItems and Appartments in sql.cpp (these methodes will later be put in specific classes) - -==================== -Hammag; 28.09.2006 17:30 GMT+1 ----------- - - - Updated the gamserver DB install file to version 5 (database/GameDB5.zip) needed - by the current TinNS version. - - Added a SQL file to update existing gamserver DB from version 4 to version 5 - (database/GameDB4_to_GameDB5.sql) - - Zoning is now fully based on NC files rather than hardcoded. - -[GAME] -Filename in now taken from appartments.def (for app zoning) or from worlds.ini (general case) -Zoning out of appartment (Lift exit) is based on appplaces.def (was in the 27.09.2006 version already) -Corrected GR use. Now GR gets it true name, and this good name can be registred in the char GR list - and seved in DB. -Changlog in command.cpp updated from last additions (22.09.2006) - -==================== -Hammag; 02.10.2006 23:30 GMT+1 ----------- - - - Started implementation of .dat worldfile parser - - added a gameserver config option dev_debug to control development debug outputs - -[GAME] -Added PWorldDatParser class, with files include/world_datparser.h and def/world_datparser.cpp - (this classes might change/be replaced by a PWorldTemplate class very soon) - -==================== -Hammag; 03.10.2006 16:30 GMT+1 ----------- - - - Fix a big bug in gameserver causing server crash when using new character - after its creation without server restart inbetween - - added a gameserver config option auto_save_period to control character autosave period (in sec) - -[GAME] -chars.cpp/.h : - added PChar::CreateNewChar() and moved effective char creation from PChars to PChar - added PChar::SQLDelete() (but not implemented yet) - added use of auto_save_period config option in PChars::update() - removed old XML-storage related code -accounts.cpp : - fixed an issue in PAccount::SetBannedStatus() that was causing the "can't update banned status" error message. -gameserver.cpp : - added some more DB cleanup when a char is deleted. Still incomplete and will later be done in PChar::SQLDelete() -various .cpp files: - put more log output under control of dev_debug config option - -==================== -Hammag; 04.10.2006 12:00 GMT+1 ----------- - - - Minor fixes to avoid some warnings - - def directory removed from repository - -==================== -Hammag; 08.10.2006 01:25 GMT+1 ----------- -[rev. 20] - - - - fixed .pak archive deep file reading - - implemented world furniture loading from world dat file (static furniture only atm) - - implemented loading of worlds templates from .dat files (just for test now, will be used very soon) - -WARNING: more NC files & dirs will be needed for the gameserver from now on: -./def/* (as already used by previous revisions) -./worlds.pak -./worlds/* -./terrain.pak -./terrain/* - -with . being the gameserver's starting dir (a config option will be added soon to set this dir to something else if wanted) - -[COMMON] -filesystem.cpp : - Fixed package reading to enable access to "subdirectories" in archive, - as well as translation from unix to dos path separator for in-archive search - Removed the "file not found" message the PFileSystem::Open() was issuing in the corresponding case. - A NULL returned for PFile* is sufficient for the calling proc to manage the situation. - Changed file search in archives to case-insensitive. - -[GAME] -def_worlds.cpp : - added quotes and spaces trim to mName and mDatFile. -def/gamedefs.cpp : - minor changes in PGameDefs::LoadWorldFileDefs() to make it more silent -added furnituretemplate.cpp/.h (PFurnitureItemTemplate class) -added worlddatatemplate.cpp/.h (PWorldDataTemplate class) -added worlds.cpp/.h (PWorld and PWorlds classes) - -==================== -Hammag; 08.10.2006 01:25 GMT+1 ----------- -[rev. 21] - - - - changed ingame debug management for a more generic @debug command: - @debug 0|1 : disable|enable all debug outputs - @debug loc[ation] 0|1 : disable|enable location output on move - @debug it[emid] 0|1 : disable|enable item ID output on item use - in the last two forms, omiting 0 or 1 just toggles the debug output - - some additions on worlds data checking/loading - -[GAME] -accounts.h : - removed IsAdminDebug() and SetAdminDebug() methods -client.cpp/.h : - added GetDebugMode() and SetDebugMode() methods, along with mDebugMode[] private member. -commands.cpp : - implemented new version of @debug command -decoder/udp_charmove.cpp : - implemented ingame location debug output on move -decoder/udp_charmove.cpp : - implemented ingame item use debug output - -==================== -Hammag; 11.10.2006 01:25 GMT+1 ----------- -[rev. 22] - - - - added MySQL keepalive function to avoid connection loss on long server inactivity periods - - fixed unreleased MYSQL_RES after all DB Res queries in infoserver leading to memory leak - - reintroduced Namikon's ISC - -[Make] -Rules.make: - fixed libs order in linker args to avoid lib not found on some systems -patch/Makefile : - commented out some unused libs in linker args -info/Makefile : - fixed libs order in linker args to avoid lib not found on some systems - commented out some unused libs in linker args -game/Makefile : - fixed libs order in linker args to avoid lib not found on some systems - commented out some unused libs in linker args - -[GAME] -configtemplate.h, gameserver.conf : - added 'mysql_wait_timeout' config option, to be set to value of the - wait_timout system variable from the MySQL server (default 28800 sec). - It triggers the MySQL keepalive for both gameDB and infoDB connections. - Value 0 disables this keepalive function. -sql.cpp/.h : - added Update() method, which now include MySQL keepalive management and CheckResCount() - added mKeepaliveDelay and mLastKeepaliveSent members -main.cpp : - updated main loop to call MySQL->Update() instead of MySQL->CheckResCount() -global.cpp : - added Hammag to the coders list -isc.cpp/.h : reintroduced Namikon's ISC for implementation of serverlist update - through MySQL in the coming days. - -[INFO] -configtemplate.h, infoserver.conf : - added 'mysql_wait_timeout' config option (see [GAME]) -sql.cpp/.h : - added Update() method, which now include MySQL keepalive management - added mKeepaliveDelay and mLastKeepaliveSent members - added FreeSQLResult() method to perform mysql_free_result() -main.cpp : - added call to MySQL->Update() in the main loop -accounts.cpp, infoserver.cpp : - added call to FreeSQLResult() where required -global.cpp : - added Hammag to the coders list - -==================== -Hammag; 13.10.2006 20:00 GMT+1 ----------- -[rev. 23] - - - - activated modified ISC component. Server list and user count displayed by the infoserver - are now updated by the gameserver using the "MySQL" method (same as Neopolis X) - - added 'nc_data_path' option to gameserver.conf. It must be set to the root path of the nc data, - either the NC1 directory or a copy. ./ means reative to gameserver start dir - - 'defs_path' and 'worlds_path' are not used anymore in gameserver.conf - -[GAME] -isc.cpp/isc.h : - implemented MySQL mode - some other generic addition to the PISC class -configtemplate.h : - set 'isc_method' default to 1 (i.e. MySQL mode only) - set 'isc_update_intervall' default to 60 sec -def/main.h : - values of DEF_* defines for def filenames now include patgh relative to nc_data_path -gamedefs.cpp : - modified to take into account main.h modifs and nc_data_path - -[INFO] -infoserver.cpp : - modified PInfoSrver::GSLiveCheck() to be independant of gameserver time. - No time sync is needed between servers anymore. - -[COMMON] -filesystem.cpp : - fixed a bug when handling some files .pak archives with path starting with ./ - -==================== -Hammag; 24.10.2006 17:00 GMT+1 ----------- -[rev. 24] - -Internal changes only - -==================== -Hammag; 26.10.2006 02:15 GMT+1 ----------- -[rev. 25] - - - - finished world data on-demand loading - - fixed an issue in world "furniture" data loading - -[GAME] -added a Worlds global object (class PWorlds) -modified PChar and PClient classes to Lease/Release world when char changes location, - which shall now be done using the new PClient::ChangeCharLocation method -modified decoder/udp_zoning accordingly -modified def/world_datstruct.h and def/world_datparser.cpp to fix world data loading - -==================== -Hammag; 08.11.2006 22:00 GMT+1 ----------- -[rev. 26] - - - - added isc_server_id in gameserver.conf, to be set to s_id value from infoserver DB. - server status should then be kept up to date in the server selection window of NC client - - fixed a bug leading to char location being reset to bad zone when login in under some circumstances - - sitting on chairs now works again and is seen by others chars. Some more thing are to be added to this though. - - all dungeon/sewers/UG entries should work. But spawning place are not always right, as it seems that info in - appplaces.def is not allways the right one (about the "entity") - - all doors should open and be seen opening by other chars. Locked doors will open like any others - as I haven't found the link bewteen button and door - - other internal changes - -==================== -Hammag; 21.11.2006 02:00 GMT+1 ----------- -[rev. 27] - - - - fixed teleport-to-nowhere-when-leaving-chair issue - - implemented free chair check - - implemented nice position when leaving chair (orientation still not fixed ...) - => problem of char disapearing for others when sitting for some time still not fixed* - - added "new_char_location" option in gameserver.conf, with default to mc5 starting zone - - added starting apartment creation - -==================== -Hammag; 25.11.2006 16:45 GMT+1 ----------- -[rev. 28] - - - - fixed a bug when zoning to holomatch zones - - fixed Holomatch exit (but still same problem for spawning entity as in some dungeon zoning) - - fixed UG exit (but still same problem for spawning entity as in some dungeon zoning) - - fixed appartement lift use - - fixed char-vanish-for-others-when-sitting-too-long issue - (but already sitting char still invisible for loggin-in chars) - - fixed a bug in starting apartment creation - - increased TCP timeout which caused connection loss when taking too much time creating a char - - subskill increasing now works (freely, ie. without any check against class or available skill points) - -==================== -Hammag; 26.11.2006 02:00 GMT+1 ----------- -[rev. 29] - - - - triggered doors now work as expected (hopefully... the trigger button is the one - closest to the door). Hack button an money button just work like standard buttons for the moment. - -==================== -Namikon; 09.12.2006 01:20 GMT+1 ----------- -[rev. 30] - -[GAME] - - (Hopefully) Fixed Autoaccount problem with Gameserver (Rehashing accountdata now every 30 seconds. However, - this isnt verified.) - - New command: @rehash. Does the same as the server every 30 seconds, for those who cant wait :P - -==================== -Namikon; 09.12.2006 01:32 GMT+1 ----------- -[rev. 31] -- Forget to update the Changelog, ^_^ - -==================== -Hammag; 09.12.2006 16:40 GMT+1 ----------- -[rev. 32] -This revision is mostly a commit of intermediate change to avoid future conflicts, with no new functionnalty added - - - - added regexsupport for futur use in user strings control (username, password, charname, etc) - -[GAME] -main.cpp: changed type used for time in DB rehash from u32 (causing complile warning) to std::time_t which - is the time type (for seconds) now used in gameserver. - -[COMMON] -regex : added the RegEx class (Simple C++ wrapper for PCRE) to the tinns lib : - common/regex/regex++.cpp - include/regex++.h - -==================== -Namikon; 10.12.2006 11:35 GMT+1 ----------- -[rev. 33] - - -- Added @uptime to view server's uptime ingame - -[GAME] -gameserver.h: Added "std::time_t mServerStartupTime" and public inline "GetStartTime()" to receive Server's - startup timestamp anywhere in the source -gameserver.cpp: Added mServerStartupTime to gameserver's class constructor (Var gets set one time uppon startup) -commands.cpp: Added @uptime. Generates readeable output in the form (Years, Months, Weeks, Days, ...) from the - difference between mServerStartUp and the current timestamp - -==================== -Hammag; 10.12.2006 14:50 GMT+1 ----------- -[rev. 34] - - - - GenReps now dont need database info anymore. - However, the solution is not satisfaying, but will do until we find better - - Fixed Makefile issue about buggy dependency files - - Removed old unused src/netcode directory (the right dir is in src/common) - -[GAME] -worlddatatemplate.cpp : in SetLinkedObjects(), added storage of GR order to later access to entity info -def/gamedef.h/.cpp : added GetRespawnEntity() to get GR entity value from respawn.def, by entry order, - with management of exceptions in zones 1 & 2 -decoder/udp_useobject.cpp : now use PGameDefs::GetRespawnEntity() to get the entity of a GR object - -[INFO] -Minor change in client connection message after checking for what looked to be a memleak (but was not ! :-D ) - -==================== -Namikon; 10.12.2006 15:30 GMT+1 ----------- -[rev. 35] - -- Added @broadcast. GM and higher can now send out "ADMIN> Server: " broadcasts -- Worked on Chat subsystem. Current status: -> Buddy - Sends text to Buddy, everyone in the same Zone can read. No Buddylist yet -> Local - Another problem, local is TCP on retail, we use UDP. Works for now, needs further research -> Clan - Same as Buddy -> Team - Same as Buddy -> Direct - No function yet -> GM - Done. (100%) -> Admin - Done. (100%) -> All others - Nearly done. Sends/Receives to/from correct channel, including zone/fraction/etc - limitation. However, you cant disable channels yet, needs further research. - -- 2 new options in gameserver.cfg: -> broadcast_new - If set to 1, the server will send out an broadcast to channel OOC with - a welcome message. Default is 0. -> broadcast_new_hidestaff - If set to 1, all "non-players" are not announced over OOC. Default is 0. -- Fixed some typos in chat.h/.cpp - -[GAME] -chat.h/.cpp : Corrected some typos. - Added sendBroadcast (Admin channel) - Added sendOOCBroadcast (OOC channel) - Added all missing sendXXX functions - Removed several Console outputs. We know it works, no need to debug it anymore. -gameserver.cpp : Changed current welcome message to new OOC broadcast method -configtemplate.h: Added 2 new default values for broadcast on connect -commands.cpp : Added @broadcast command. First command which checks your accesslevel. (as announced before) - -==================== -Namikon; 10.12.2006 15:30 GMT+1 ----------- -[rev. 36+37] - -- Worked again on Chat subsystem. Current status: -> Buddy - Done. (100%) - -[GAME] -buddylist.cpp / .h : Added function "IsInBuddy()" to perform a simple check "Is a buddy? y/n" -chars.h : Added inline to pass IsBuddy to buddylist->IsInBuddy() -chat.cpp : Fixed sendBuddy function. Working as it should now - -==================== -Namikon; 10.12.2006 23:20 GMT+1 ----------- -[rev. 38] -- Worked again on Chat subsystem. Current status: -> Direct - Done. (100%) - -[GAME] -chat.cpp/.h : Added new function sendPlayerDirect, altered main-chatloop, order is now Local, Direct, others - -==================== -Namikon; 11.12.2006 00:59 GMT+1 ----------- -[rev. 39] -Last update for this weekend lol ^^ -- Worked again on Chat subsystem. (What else) - This release may break tinns from working, until Hammag found a way to grab the data i need for the CustomChannels. - -[GAME] -chat.cpp/.h : Added check for every custom channel if its enabled or not -chars.cpp/.h : Added inline and variable to hold custom channel info - -==================== -Hammag; 11.12.2006 13:00 GMT+1 ----------- -[rev. 40] - - added Custom Chat Channel selection retrieval from client packets - - temp deactivated regex lib compilation as there still are some issues with dependencies - -[GAME] -chars.h : Added SetActiveChannels method - Regrouped some method declarations by theme -decoder/udp_chat.h/.cpp : added PUdpChatChannels class for custom channel info decoding - -[PATCH] -Minor change in client connection message, same as what has been done for infoserver. - -==================== -Hammag; 11.12.2006 20:10 GMT+1 ----------- -[rev. 41] - - - - added @version command - - added directory src/tools for compile tools and corresponding makefile - - dependency files issues should hopefully be solved now once for all - -[GAME] -commands.cpp: added @version command - -[PATCH] -Minor change in client connection message, same as what has been done for infoserver. - -[All Servers] -Added src/include/svnrevision.h (automatically updated) -Removed inclusion of version.h for everywhere, and added it to each global.cpp -Added ServerVersion and SVNRevision as global strings (globals.h) for each server -Modified accordingly version display at server start in global.cpp - -[LIBS] -misc.h/.cpp: Commented out GetSVNRev() that is not used anymore - -[TOOLS] - - added src/tools/cleandepfile.c - cleandepfile is used to clean dependency files generated by g++ - - added src/tools/setsvnrev script to update the new src/include/svnrevision.h - when needed - - updated src/Makefile and src/Rules.make accordingly - No manual action should be needed to manage svn revision number inclusion in source - Game/Info/Patch servers version can still be set in version.h - -==================== -Namikon; 11.12.2006 21:46 GMT+1 ----------- -[rev. 42] - - -- Fixed (hopefully) customchannels. They're not loaded / saved from/to SQL yet, but you should be able to enable/disable them. - uppon entry, all channels are disabled. - -Hopefully, because i cant verify it. (No time to compile and try it). Will verify (and debug) it in the next few days - -==================== -Namikon; 13.12.2006 12:02 GMT+1 ----------- -[rev. 43] -- Quick update: I replaced the "old" function to check if a customchannel is enabled or not with a much - faster one. (Bitwise comparison) -- Fixed an typo in chat.cpp - -==================== -Hammag; 13.12.2006 17:10 GMT+1 ----------- -[rev. 44] - - - - Added missing GPL licence file LICENCE.txt - - Renamed directory tools to dev-tools to distinguish from futur NC tools - - Fixed a small prototype issue causing compile warnings in dev-tools/cleandepfile.c - - Added option DO_DEBUG in Makefile to be uncommented if you want debug symbols and not stripped binaries - - Added inclusion of src/options.local (if exists, which is not mandatory) in Makefile to set local Makefile options - This is mostly for developer use, as it enables local compilation customization without propagation to SVN, - and avoids the need to use 'svn revert Makefile' each time... - - My current options.local file looks like: -# -# Local Makefile custom options -# not in SVN ! -# -DO_DEBUG = y -CXXFLAGS += -march=pentium4 - - If I don't want to use these additonal options and test the real config, I just rename it to something else. - -==================== -Namikon; 14.12.2006 22:58 GMT+1 ----------- -[rev. 45] -- Updated ISC definition file (v2) -- Updated isc.h: Added enum for ISC connection stages -- Added ISC Example.txt to show a few examples of an "normal" datatransfer between game and infoserver - - -==================== -Hammag; 14.12.2006 23:10 GMT+1 ----------- -[rev. 46] - - - - Really added missing GPL licence file LICENCE.txt this time (hopefully...) - - Some compilation warning fixes - - Added internal tools to ease sources & bin packages generation - - make sourcetar : Builds a clean archive of all that is needed to compile and run TinNS (except NC data) - make bin tar : Builds a clean archive of TinNS binaries and other files needed to run TinNS (except NC data) - Also alerts about src/options.local presence. (To be improved as check is done AFTER compilation right now ...) - Destination directory for tarballs is set in Makefile with TARBALLS_DEST (default ~) - -[DEV-TOOLS] -Modifies src/Makefile (added sourcetar and bintar targets) and src/Rules.make -Added make-src-tarball and make-bin-tarball in src/dev-tools - -==================== -Hammag; 15.12.2006 16:40 GMT+1 ----------- -[rev. 47] - - - - minor internal changes only - -[GAME] -decoder/udp_useobject.cpp : fixed again some signed to unsigned cast issue. -decoder/udp_zoning.cpp .h : added PUdpEndOfZoning class -decoder/udp_OOO.cpp : made message reception verbose - -==================== -Namikon; 15.12.2006 20:02 GMT+1 ----------- -[rev. 48] - - - - minor internal changes only - -[GAME] -Updated ISC ProtDef again. The protocol itself will be called ISCP from now on (Inter-Server-Communication-Protocol) -Updated infoserver.conf, added ISC config values - -==================== -Namikon; 16.12.2006 15:36 GMT+1 ----------- -[rev. 49] - -[IMPORTANT] -From this release on, TinNS will check more and more for accountlevels. -If you want admin access, you have to edit your MySQL table. (Admin: Level 100) -Its not much yet, but the first steps have been made, and more will follow. -Next step will be the gamemaster/admin commands. - - -- Changed default error-return for Sql Checkaccount from -12 to -99, to create free place for further errormessages -- Added require_validation to infoserver.conf. You can enable this if you like to create accounts on your own, - not by autoaccount. - - -- Removed traces of old AutoAccount creation in GameServer. AutoAcc should *only* be done by Infoserver! -- Added accountlevel check. - -==================== -Namikon; 17.12.2006 22:42 GMT+1 ----------- -[rev. 50] - -IMPORTANT: -This rev keeps crashing and it also causes OutOfOrder packets, for whatever reason. we have to trace -this down first. - -[GAME] -- Fixed errors from last SVN release (Caused several segmentation faults) -- Added configfile commands.conf -- Added check for required accountlevel when trying to use ingame command - -[INFO] -- Fixed errors from last SVN release (Caused several segmentation faults) -- Added default values for isc stuff to configtemplate.h. I forgot to add them in the last revision - -==================== -Namikon; 18.12.2006 00:23 GMT+1 ----------- -[rev. 51] - -Small update: -- Fixed AccountLevel (You always got full admin access after login) - -==================== -Namikon; 18.12.2006 01:57 GMT+1 ----------- -[rev. 52] - -- Fixed bug that you could'nt see the welcome message after login -- Added (hopefully) a workaround for our SegFault problem (2 user online, 3rd is trying to connect -> SegFault) - -==================== -Namikon; 19.12.2006 03:03 GMT+1 ----------- -[rev. 53] - -its a pity, but the workaround didnt work. Still investigating this! -MANY changes to the source, cant remember all. Here is what my brain has stored: - -- Direct chat completed. (If target player isnt online, you'll get this nice "Player not online" message) -- ReEnabled AutoRehash, wasnt responsible for the crash -- Added @kick, @info, @warpto, @recall and @setlevel. @info is tested and verified, @kick does nothing (yet) the - rest is untested but should work. (Hard to test with only 1 char online...) -- Some more very small changes. If you want a detailed log, ask SVN history :D - -==================== -Hammag; 20.12.2006 21:00 GMT+1 ----------- -[rev. 54] - - - - fixed bug in NC datafiles lookup when nc_data_path was set to something else than . - -[LIBS] -filesystem/filesystem.cpp .h : added base path arg to file open method. - -[GAME] -def/defparser.cpp, def/world_dataparser.cpp : modified accordingly to changes made to PFileSystem - -[PATCH] -patchserver.cpp : modified accordingly to changes made to PFileSystem - - -==================== -Namikon; 21.12.2006 19:28 GMT+1 ----------- -[rev. 55] - -*Note* -The new commands have to be tested first! Dont expect them to work yet, its just a upload -since the entire command files got rewritten. - - - - Rewritten entire commands.cpp/.h files - - Fixed ingame command @kick. Works now as it should. - Also sets a temp-ban for a configureable amount of seconds to prevent instant-relog. - - Added new ingame coommands: - @ban /// || @ban EvilUser 20m <- Bans "EvilUser" for 20 minutes. - - Bans given player for given time. You can only set ONE timevalue. (Either S/M/H or D. Not case sensitive) - - @unban - - Not working yet. Has to be done by direct SQL access - @listbans - - Not working yet. Has to be done by direct SQL access - - @shun - - Blocks all incoming char/command traffic from given client until re relogs - Returns error if already shunned - - @unshun - - Remove shun instantly. Returns error if not shunned - - @jail - - Warp given player to Regants legacy. Returns error if player is already in Regants - - @unjail - - Free given player from Regants. Returns error if player is not in Regants/Jailed - - @teleport - - Teleport given player to given world - - - Added (experimental) startscript for TinNS. Has to be testen/debugged - -[COMMON] - Added to get access to isdigit() function - Increased VerNr - -[GAME] - Added vars&methods to store shunned status - Added global class for gamecommands - Changed GameCommand call to work with the new command class - Completely rewritten. Moved every ingame command into own method, called by - a main function which takes care of all args. Maybe has to be improved later, but its ok for now. - -==================== -Namikon; 21.12.2006 21:50 GMT+1 ----------- -[rev. 56] - -Improved pak_decompress script from Akiko -- Added errorcheck for in/output file -- Added check for NC and normal zLib files - (Can unpak both) -- Added optional details-output - -The script is now capable to be used in batchfiles, since the only output is either [OK] or [ERROR] . -if you dont want this, you can specify detailed output with all errors. - -==================== -Namikon; 21.12.2006 21:55 GMT+1 ----------- -[rev. 57] - -Forgot the CHANGELOG ^^ - -==================== -Namikon; 22.12.2006 17:33 GMT+1 ----------- -[rev. 58] - - -- Improved pak_decompress tool from Akiko -- Added tool "getsvnrev" (Same again in src/dev_tools, required for make process) -- Improved Hammag's setsvnrev bash script (Now does errorcheck and has an alternative way to - grab SVN revision if SVN is not installed) -- Splitup of commands.cpp. Every command has now its own .cpp file in gamecommands/. - Makes it a lot easier to handle new commands or change/fix/remove existing ones -- ReEnabled debug-output while loading world .dat files. Was commented out for some reason - -No real "changes" or "fixes" to main-source files. Only splitup's and new/improved devtools. -See SVN->Diff for details - -==================== -Namikon; 22.12.2006 22:55 GMT+1 ----------- -[rev. 59] - - -- Added missing Makefile for gamecommands/ subfolder -- Removed check for ZoneID 552 from jail.cpp and unjail.cpp; This zone is never used -- Moved mShunned from Account to chars -- Added mJailed to chars with methods to identify a jailed player -- Added explicit override to GM teleport and jail/unjail commands (The only way to move someone if target is jailed) -- Completed shun/unshun command - -==================== -Namikon; 22.12.2006 22:55 GMT+1 ----------- -[rev. 60] - - -- Added several security checks to game commands -- Added missing status outputs on successfull gamecommand -- Added solution to send an delayed positionupdate after warping - -==================== -Namikon; 23.12.2006 09:31 GMT+1 ----------- -[rev. 61] - - -Small update: -- Removed ingamecommands "addworlditem", "delworlditem" and "adddoor". TinNS gets the worlddata dynamicly from loaded - .dat files instead of MySQL Database. - -commands.conf : Removed config settings for the 3 commands mentioned above -commands.cpp/.h : Commented out the 3 mentioned commands -adddoor.cpp : Commented out entire file -delworlditem.cpp: Commented out entire file -addworlditem.cpp: Commented out entire file - -==================== -Namikon; 24.12.2006 01:30 GMT+1 ----------- -[rev. 62-63] - - -- Added experimental char warp-aura and char disappear packets to all warp-commands - (Worked while testing, but not after implementation into the commands) -- Worked on Chatsystem: Localchat 99% working. Localchat is now limited to a small area around the player - (However, the chat is sent over TCP, like all other packets. It should be UDP, but this isnt working - for some reason. If anyone finds out why, tell us please) -- Added Developercommand "@test". It has no fixed function, and is not configureable by config file. - Devs can easily add stuff there to test various things. -- Removed adddoor, delworlditem and addworlditem completely from SVN, they're not needed anymore -- And a few things i cant remember -.- - -==================== -Namikon; 25.12.2006 00:24 GMT+1 ----------- -[rev. 64] - - -- Fixed Blacksync issue when logging in -- Disabled position update on warpto and recall commands. It's not possible at the moment to - force the client to update the charposition. - -==================== -Namikon; 26.12.2006 22:33 GMT+1 ----------- -[rev. 65] - - -- Added UDPManager functions to connection_udp. Keeps the last 20 important UDP messages in a queue, for - possible resend after a OOO notice by the client -- Finally fixed the warpcircle and charvanish! The mentioned commands in Rev 62-63 now work as announced -- UDP_ID and all related stuff moved to connection_udp. Will be more controlled in the future from there - -==================== -Namikon; 26.12.2006 22:33 GMT+1 ----------- -[rev. 66] - - -- Added, by Stings request, serveranswer to worldroute query: "Where is the Primary App" works now. -- "Fixed" SQL function GetAptLocID(). Now only decreases the location value if the given AppartmentID is higher than 100000 - -==================== -Namikon; 27.12.2006 19:05 GMT+1 ----------- -[rev. 67] - - -Small update -- Added 2 error messages for genrep activation. (Wrong faction and MC5 "broken") - -==================== -Namikon; 28.12.2006 18:45 GMT+1 ----------- -[rev. 68] - - -- 2 new ingame commands: - @givemoney [] - @takemoney [] - I dont think i have to explain what they do :) - -- Added universal udpmessage to trigger messages from text.ini - -==================== -Namikon; 28.12.2006 20:02 GMT+1 ----------- -[rev. 69] - - -Internal Release / "Hotfix" -The udpmanager was planned to cancel OOO notices, but he causes an segfault when trying to send the message. -Its not clear yet why, therefore, the OOO handling got disabled. It will be re-enabled when this is fixed. - -==================== -Namikon; 30.12.2006 08:11 GMT+1 ----------- -[rev. 70] - - -- Added "life" to hackbuttons and entrance-fee buttons. (Level GM and higher can just "use" hackbuttons, lower levels - must hack it. For entrance fee buttons, everyone must pay. Why? Well, for what is the @givemoney command ^.^) - Since hacking is not working yet, (we have to add item-usage first) make sure to set your own level to 50+, or you - wont get these doors open) -- Disabled some debug outputs forgotten in the last release - -==================== -Namikon; 30.12.2006 19:41 GMT+1 ----------- -[rev. 71] - - -- Added handling class for item movement (QB<>Inv<>GoGu<>Ground), no real function yet, but its decoded -- Added handling class for QuickBelt management. You can activate the flashlight in slot 0 now, and others can see it - The functions are prepared to handle any item that exists, but we dont have items working until now. -- Removed Debug output from sql.cpp - -==================== -Namikon; 01.01.2007 23:32 GMT+1 ----------- -[rev. 72] - - -**** Happy new year!! **** - -- Item movement within quickbelt works -- Added hacktool to QB to test hacking -- Added the last missing staffchar (GM>) -- Added decoder for inithack and starthack messages -- A few more changes i cannot remember - -==================== -Namikon; 02.01.2007 20:52 GMT+1 ----------- -[rev. 73] - - -- Added new command @spawnactor - Usage: @spawnactor - - ActorID can be found in models/pak_models.ini - - FunctionType defines the type of the actor. - This can be almost everything, from item containers to - apartmentlift accesspanels - This command spawns and static worldactor next to your current - position. Everyone who is within the range of UDP broadcast - can see / "use" the new actor. It isnt saved to sql yet, nor is it - managed. (You cant spawn an itemcontainer and open it) - -Thanks to Sting for this release! We where working on hack-stuff (doors, hackboxes,..) -when he found the required information to make this possible. - -==================== -Namikon; 04.01.2007 16:15 GMT+1 ----------- -[rev. 74] - - -- WorldActor management class added. - Spawned actors now stay in that zone as long until someone removes them. - - To remove spawned worldactors, the @remove command has been improved: - Type "@remove actor" to set your client into "REMOVE ACTOR" mode (You'll get - an ingame notice about this) - Then simply click on any dynamic worldactors to remove them. To leave this remove mode, - type "@remove actor" again. (And again you'll get a notice about that) - - Note: You cannot remove static worldactors (those who are in the .dat files) with this. - It is possible to let them disappear (type @remove ) but they'll respawn when you re-zone. - -IMPORTANT: This release requires an database update! Make sure you have the latest mysql table availeable. - -==================== -Namikon; 07.01.2007 19:40 GMT+1 ----------- -[rev. 75] - - -Huge update! - -- Changed default level for @remove from 100 to 50, since we can now also remove dynamic actors with it -- Added security check to @remove command: You cannot remove Dynamic actors over their IDs anymore. - Remove them with @remove actor command -- UDPManager rewritten. Was almost completely wrong, dunno what happend with me when i first wrote it :P - However, it works now. The last 20 UDP messages with 0x03 commandset are saved, and get resend uppon - OOO notice from the client. - The manager also watches the outgoing UDP IDs. With his, it was possible to fix an udp increment bug in the zoning process. -- Messages in the VIP queue arent parsed over the udpmanager. We'll have to rename this later on (or add a new queue) -- The UDP/SessionID offset is now defined in connection-udp.h -- NPC subsystem added. (Yeah ^^) - All NPCs that are in npc_spawns database spawn and stay in their world. We dont have an AI, so dont expect NPCs to - do *anything* yet. (Same goes for traders or copbots) But everything is prepared -- Added function "IsWorldInUse" to clientmanager. In first line required for NPC manager, to check if a world is in use or not -- Reformatted several files for better readability. -- Extended dynamic worldactor management: - - Spawned worldactors are functional now. (Eg: Spawn a chair and sit on it) (Function is not 100% tested, it *could* procude an segfault, report it - if the server crashes for you on a certain actorID) - - Only valid worldmodel templates are accepted now while spawning actors - - If given worldmodel template needs an linked object (For example an door) you have to add the doorID in the @spawnactor command (example below) - - On serverstart and every initworld, the database is checked for duplicate worldactor IDs. If some are found, they get deleted - - Another check is done when an worldactor is spawned. If (for any reason) an invalid worldactorset is in the Database, - it is ignored uppon spawning. (invalid means, that the actor points to an invalid object, for example door or world) -- Added detailed output for SQL errors (Prints not only "ERROR" or just returns nothing, instead a full errormessage is written to console) -- MsgBuilder: - - Baselinepacket changed, monsters are now "red" - - Fixed increase_udp issue in BuildZoning1Msg -- Added new decoder: - - 0x08: This small (only 1 byte) "packet" is only sent when the client exits abnormal (crash, sometimes on alt+f4) - Does nothing else than closing the connection serverside. - -*Note* Due the massive update of sourcecode, its likely that i forgot some debug outputs (You'll see D1, D2,.. or whatever else senseless text -on the console). If you find something, tell me please over forum or bugtracker. But i will remove all outputs when i find some in the next -releases - -==================== -Namikon; 07.01.2007 21:52 GMT+1 ----------- -[rev. 76] - - -- Added hacking ability to hackbuttons (Both static and dynamic worldactors) - Itemcontainers will follow when we have a management class for them -- Removed several debug outputs, and changed others -- Fixed an typo in command remove - -==================== -Namikon; 08.01.2007 15:47 GMT+1 ----------- -[rev. 77] - - -Fixed compiler error: -In member function 'void ConnectionUDP::InsertUDPMessage(PMessage*)': -udpmanager.cpp:133: error: conversion from 'int' to non-scalar type 'std::_Rb_tree_const_iterator >' requested -on some systems - -==================== -Namikon; 11.01.2007 19:31 GMT+1 ----------- -[rev. 78-79] - - -- Added up-to-date SQL dump to SVN. (But better use the newest neoX db!) -- Fixed bug in worldactors that caused the following problems: -> Spawned actors where removed uppon next serverstart/re-zone -> Only one actor in a zone at once -- Added first steps for ingame terminal handling - -==================== -Namikon; 13.01.2007 10:57 GMT+1 ----------- -[rev. 80] - - -- Added a few comments in npc.cpp and removed most debug outputs -- Splitted up terminal.cpp into 5 files (All stuff in one file will get too big later) -- Moved TryAccess handling for terminal stuff to PTerminal class - -==================== -Hammag; 27.05.2007 12:15 GMT+2 ----------- -[rev. 81] - - - - Minor internal changes - -[MAKEFILE] -- Makefile, dev_tools/Makefile, setsvnrev: Disabled the use of getsvnrev. - If someone has no SVN, and got sources from tarball, he can compile with the included svnversion.h - If he does coding, he needs SVN to commit changes, so there's no need for getsvnrev. - If he's doing coding and hasn't SVN, and got sources from tarball, then he won't have .svn files - needed by getsvnrev at hand. - As I don't see the use of getsvnrev, I disabled it. If it is really needed sometimes,I can add - a local option to enable it on a case by case basis. - Anyway, if someone submits code changes without having be given write access to SVN, he must submit - them to a tinNS dev who has access, so code review, testing and SVN management will be done properly. -- Other minor change on files cleanup - -[GAME] -- game/decoder/udp_appartment.* : minor correction on files info - -==================== -Hammag; 28.05.2007 23:15 GMT+2 ----------- -[rev. 82] - - - - Major change to account management and character loading: - Accounts are not stored in-mem anymore, and database is queried when needed instead. - Chars are loaded when needed, and unloaded when not neaded anymore. - - New Gameserver Database version (6) - - Various fixes. - -[DATABASE] - - GameDB5.zip has been replaced by GameDB6.zip holding the full gameserver dump to be used - to get a fresh new DB needed by this revision of TinNS - - GameDB5_to_GameDB6.sql can also be applied to migrate from version 5 to 6 of gameserver DB - - infoserver DB is not changed (i.e. version 2) - -[GAME] -More than 50 files changed. - - in addition to the changes stated above, Char creation and charslot assignement is now - fixed. - **** PLEASE MANUALLY FIX THE SLOT NUM OF EXISTING CHARS OR RECREATE THE CHARS **** - (Server will complain in logs and won't be hurt by muliple SLOT 0 chars anyway) - - @rehash command has been removed as not used anymore - - database.cpp and inclide/database.h have been deleted along with PDatabase class - - PAccounts class has been removed - -[NETCODE] - - Fixed mem leak in ConnectionUDP: - PMessage held in UDP backlog not being released in object destructor - - The static member PMessage::ListPools() can now be used anywhere to get a view of - message buffer pools use (in use / free buffers) - -==================== -Hammag; 05.06.2007 01:30 GMT+2 ----------- -[rev. 83] - - - - fixed a bug which might be the cause of the "multiuser+char creation crash" - (hopefully solved now) - - many improvements in char movement (now much more responsively seen by others) - - Sitting chars are now visible by later login-in chars - - internal changes to PClient - -[GAME] - - udp_charmove.* : PUdpCharAttitudeUpdate and PUdpCharSitting code is now taken - care of in PUdpCharPosUpdate. - These two classes are removed. - - msgbuilder.* : added MsgBuilder::BuildCharPosUpdate2Msg - - client.* : added PClient::FillInUDP_ID() to take care in one place of all UDP_ID - filling-in of USP packets - added PClient::SendTCPMessage() and PClient::SendUDPMessage(), which take care - of NULL TCP or UDP sockets. - - chars.* : added PChars::CharExist() to check for char existence by name - - chat.cpp : fixed a repeated bug that led to crash when some client was connected - without a char ingame (like in char selection, creation or deletion phase) and - some chat was sent to him (like when someone else was coming ingame) - -==================== -Hammag; 09.06.2007 00:10 GMT+2 ----------- -[rev. 84] - - - - fixed a bug causing the server to crash under some conditions - - fixed account management so that ingame account level setting doesn't need relog - to be effective - -[GAME] -Started work on the type 0x20 zoning doors. -Added decoder/udp_entityposreq.cpp decoder/udp_entityposreq.h - -[LIBS] -connection-udp.cpp: Fixed a bug causing server to crash when resending packet. - -==================== -Hammag; 19.06.2007 21:10 GMT+2 ----------- -[rev. 85] - - - - fixed zoning (hopefully) - -[GAME] -Fixed zoning for "2nd type zoning" in sewers/caves and UG exits. -There might remain some wrong zoning points in some case, as there seem to be some duplicate -zoning spawn location in some zone data... but the "keep last spawn location" policy seem to work ok. -Only spawn point issue when GRing in apt should remain. - -==================== -Hammag; 21.06.2007 01:45 GMT+2 ----------- -[rev. 86] - - - - bug fix - -[GAME] -decoder/udp_entityposreq.cpp: fixed a bug - -==================== -Hammag; 15.07.2007 19:00 GMT+2 ----------- -[rev. 87] - - - - infoserver & gameserver now make use of common config/global.conf file (as least in - default conf/*.conf files) - -[LIBS] -config.* : - - conf/*.conf file can now use the 'include' directive to include other config files - - Now use PCRE RegEx instead of "strtok", enabling rentrance and removing potential issues. - - Added GetOption & GetOptionInt with const std::string parameter - - Fixed a bug in EOF detection in the main file reading loop - -conf/global.conf : Moved/added following directives in conf/global.conf - minlevel = 0 - username_filter = ^[a-z][\w\-]{2-14}$ - password_filter = ^[[:graph:]]{3-15}$ - -[INFO] - Added username and password syntax filter in config (username_filter and password_filter - directives, see above). Filters are case insensivite PCRE RegEx. - Note: theses filter need to protect at least against sql injection. - accounts.* : built common code with gamseserver (Not put in common tinns lib atm - because of DB access and log issues) - -[GAME] - Added charname and clanname (for future use) syntax filter in config/gameserver.conf : - charname_filter = ^[a-z]+([\-\ ]?[a-z]+){0-2}$ - clanname_filter = ^[a-z][\w\-\ ]{2-14}$ - Filters are case insensivite PCRE RegEx. - Note: theses filter need to protect at least against sql injection. - - sql.*, appartments.* : Moved Apt request methods from PMySQL to PAppartements - -==================== -Hammag; 27.10.2007 19:00 GMT+2 ----------- -[rev. 88 to 90] - - Items management - -[GAME] - Added container.cpp & container.h to implement classes used to manage all containers (including backpack, belt, armor, implant, processor, gogo, boxes, etc.) - Implemented basic item moves between containers. - Box content is randomly generated, and are not saved (you can use them to get rid of items) - No partial quantity move/stacking management yet - "take all" from boxes doesn't work yet (couldn't figure out yet how it works in detail) - No item to/from ground yet, no trading yet, no item type recognition/pre-req/management for implants & armors yet - -[LIBS] - Netcode: a bug in packet decoding was revealed, which seem to somtime lead to (maybe) infinite loop. Not fixed yet. - -==================== -Hammag; 27.10.2007 19:00 GMT+2 ----------- -[rev. 91] - -[GAME] - Zoning issue fixed (a bug was leading to always load the same zone data for all zones with the same .bsp file, which is wrong) - Improved random-filled boxes - Excluded "temporary-items" from available item catalog (ItemsDef) - -==================== -Hammag; 28.10.2007 16:15 GMT+2 ----------- -[rev. 92] - - @warpto command now works. - -[GAME] - Improved container loading in odrer not lo load invalid items from DB. - Items are not deleted from DB because it could cause loss of inventory - in case of issue with items.def content or loading. - -Hammag; 9.11.2007 23:30 GMT+2 ----------- -[rev. 93] - - Worked on subway. - Subway cabs are now spawned, can be entered, and can be exited but with a wrong pos (you get back to your starting pos :-D ) - There is a delay between cab door opening/closing, and the acceptance of your entering request, so try multiple times. - Visibility between subway travellers isn't working. - - More work needed on that topic, and some server-side computations need to be fully recreated/emulated. - -[GAME] - subway.cpp/.h : Added PSubway class to manage Neocron subway cabs. - Many files: Extended the Chair system to a general Seat system, used for subway and maybe for vhc. - -Hammag; 18.11.2007 18:45 GMT+2 ----------- -[rev. 94] - - Subway is now apparently running well. - Much work was needed to achieve that as some server-side computations were needed to emulate the subway movements. - There still may be some timing issues about the subway cab positions and door status on the long run... - Visibility between subway travellers isn't working yet. It will be done when working on vehicules to try make it all the same way. - - Added subcommand @debug subway - -[GAME] - subway.cpp/.h : Various changes - decoder/udp_charmove.cpp/.h , decoder/udp_useobject.cpp/.h : Various changes for subway use - chars.cpp/.h : moved PCharPosition class out of PChar, and added some required methods to it - decoder/udp_terminal.h/.cpp : started some work on that - -Hammag; 28.12.2007 00:50 GMT+2 ----------- -[rev. 96] - - Basic vehicle is in place. - One vhc of each type is available to every character. No prereq limitation. - Only pilot access available, and for the owner only. - No zoning yet. - Orientation issues from the others chars point of view. - Many things not implemented (and a good part still to be decoded) - -[GAME] - Many changes in decoders and char, client and vehicle code. - -Hammag; 20.01.2008 20:00 GMT+2 ----------- -[rev. 97] - - [GAME + INFO] - sql.cpp/.h : added EscapeString() methode to PMySQL class, to permit string escape in SQL queries - *.cpp : escape all strings used in SQL queries, which is now mandatory. - [GAME + INFO + PATCH] - *.cpp : replaced strcpy(), strcat(), sprintf() with respectively strncpy(), strncat(), snprintf() - The first ones are now forbidden. - -Hammag; 2.02.2008 16:15 GMT+2 ----------- -[rev. 98] - -[Infoserver] -accounts.cpp : Correction of the account creation/update SQL query - thank to drhawk ;) - -Hammag; 11.02.2008 20:30 GMT+2 ----------- -[rev. 99] -Correction of an initialization issue that caused compilation error on some environments. - -Hammag; 20.04.2008 00:50 GMT+1 ----------- -[rev. 100] - - -msgbuilder.h/.cpp: added method PMessage* BuildTraderItemListMsg() (test version) -decoded/upd_useobject.cpp: change so that only vhc terminal opens vhc interface -client.cpp: added fragmented message type 0xac for traders -chars.cpp: fixed initial inventory saving -item.cpp/.h: added new method PItem::MakeStandardItem() - -Hammag; 15.03.2009 19:25 GMT+1 ----------- -[rev. 103] -Fixed various warnings due to C++ compiler being more picky. - TinNS should now compile without warning on gcc version 4.3.2 - Abort compliation on warning reactivated in makefile (-Werror) - -Added file options.local.exemple to set custom complilation options (read it for more info) - -Hammag; 19.03.2009 13:00 GMT+1 ----------- -[rev. 104] - - - Fixed some errors in apartment Genrep'ing code - Implemted Venture Warp - -Hammag; 20.03.2009 14:20 GMT+1 ----------- -[rev. 105] - - - Implemted Outfitter (not persistent yet. No need for that now) - -Hammag; 28.03.2009 14:20 GMT+1 ----------- -[rev. 106 - 108] - - (by Sting) - Slight changes to npcspawn table in Game Database. - Removal of most npc out of J01 - - - Fixed inventory so that items found in boxes and put in inventory are saved as expected - Some testing code for inventory - Fixed entry in Subway cabs, which had been broken during addition of vhc - - - Removed zipped database sql files, and put a non-compressed version instead. this will allow to track the changes made to these file. - Nota: We should later split these files in database structure files on the one hand, and database data on the other hand. - -Hammag; 30.03.2009 14:20 GMT+1 ----------- -[rev. 109] - - - Added support for weapons.def - -Hammag; 31.03.2009 02:35 GMT+1 ----------- -[rev. 110] - - - Modified the gamedefs system to allow easier, cleaner and C++ oriented integration of currently missing def files support. - Access to gamedefs data has changed a (little) bit, so take a look at changes in exiting code. - -Hammag; 04.04.2009 02:35 GMT+1 ----------- -[rev. 111] - - - Added all .h files and declarations for all needed .def files. - Added all corresponding .cpp file with skeleton. Effective file parsing method still needed to be implemented for each .def. TinNS should complile and run however, with only a bunch of .def loading error at server start (but that's not blocking) - - -Hammag; 11.04.2009 23:40 GMT+1 ----------- -[rev. 112-113] - - - Implemented support for more .def files - Moved random number generation methods out of PGameServer to global functions in common/misc - Content of item boxes, trashcans, bags, etc. is now based on .def files. Cabinet content is kept as before, i.e generating fully random items. - -Hammag; 18.04.2009 19:10 GMT+1 ----------- -[rev. 114-119] - - - Implemented multi-char vhc support: - - vhc should now be seen the right way (good pos, good direction) by all present chars - - Access to spawned vhc requires owner autorization [This is still bugging for some part though] - Fixed various small things - Tried an implementation of Jumping (in order to have jumps seen by other chars) [Not tested at all] - - As these various things require at least 2 simultaneous connexions, and as I can't easily do that atm, it has not been fully tested. - - Warning: my server crashed while I was away with 2 chars connected. I didn't search for the reason, so don't let your server running on an Internet accessible host when you're away. - -Hammag; 18.04.2009 20:00 GMT+1 ----------- -[rev. 120] - - - Fixed and added bug in handling deconnection of seating char that was causing the crash mentinned in the previous rev. - -Hammag; 28.04.2009 13:30 GMT+1 ----------- -[rev. 121-122] - - - Fixed many little accessory things, potential bugs and discrepencies - Cleaned up source code format in some files - Deactivated as most debug output when dev_debug is not set in conf file (but setting it will generate lots of output !) - Continued work on vhc. Some small fixes and multichar tests still need to be performed - -Hammag; 01.05.2009 13:10 GMT+1 ----------- -[rev. 123-124] - - - Small fixes on vhc zoning - Support for all remaining .def added. Good loading of expected data has not been validated yet. - -Hammag; 10.05.2009 02:15 GMT+1 ----------- -[rev. 125] - - - Fixed loading of weapons.def - Started implementation of multiuser viewing of weapon use and basic manual weapon reload - -Hammag; 10.05.2009 23:55 GMT+1 ----------- -[rev. 126] - - - Improved working and multiuser viewing of weapon reload - Started implementation of char death and respawn - -Hammag; 12.05.2009 18:00 GMT+1 ----------- -[rev. 127] - - - Added support for weapon addons effects activation (flashlight/zoom(not tested)/silencer/laser) - Added weather control packet - Added zone weather control command @weather ?| [] - Added command @who as alias of @online - Added command @whois as alias of @info - - -????? -[rev. 128 to 132] -NO ONE BOTHERED TO PUT A COMMENT IN THE CHANGELOG -so.. taken from SVN log: -... ------------------------------------------------------------------------- -r130 | Namikon | 2009-06-20 23:51:31 +0200 (sam 20 jun 2009) | 4 lines - -- Added 2 new commands: setmainskill and setsubskill (The 1st for PSI, INT, STR,.. the 2nd for HCK,BRT, ...) -- Added 2 new decoders for yet-unknown packets -- Prepared future work on the npc subsystem. (They'll soon be able to shoot you :) ) -- Fixed subskill system. You can now increase any subskill without getting OOO Packets, as long as there are enough skillpoints left of course ------------------------------------------------------------------------- -r132 | Namikon | 2009-06-23 16:36:42 +0200 (mar 23 jun 2009) | 3 lines - -As by request of Akkiko, (hopefully) fixed all files with \n\r. (Also switched by editor to only use \n now. -As by request of Sting (and to revert my mistake i did a few days ago) re-enabled mUnknown and mLoot values in NPC.cpp -Also reformattet the output, the old one was way to long ------------------------------------------------------------------------- - -Hammag; 07.07.2009 14:40 GMT+2 ----------- -[rev. 133] - - - Reverted gameserver.conf and infoserver.conf to their previous content which shouldn't be changed to installation-specific values !!! - - - Fixed naming of added class "PPvPTrade" to PUdpPvPTrade to try a bit to keep coherent... - Added packets for held item use, drug use, recration unit use (experimental, not fully functionnal) - Fixed use of decoded packed initially taken as "hack init/start" - Fixed 2 compil-fatal SYNTAX ERRORS in npc.cpp ... - diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt new file mode 100644 index 0000000..2cc858d --- /dev/null +++ b/server/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory (src) diff --git a/server/Makefile b/server/Makefile deleted file mode 100644 index 0808a96..0000000 --- a/server/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -.DEFAULT_GOAL := all - -all .DEFAULT : - $(MAKE) -C src $(MAKECMDGOALS) - diff --git a/server/WORK_IN_PROGRESS b/server/WORK_IN_PROGRESS deleted file mode 100644 index edbccc5..0000000 --- a/server/WORK_IN_PROGRESS +++ /dev/null @@ -1,75 +0,0 @@ -The purpose of this proposed file is to give a fairly up to date view -on the work in progress, to avoid double work... - -Hammag; 08.07.2006 - updated 21.09.2006 ------ -The aim of current modifications are to change a bit of the general architecture of TinNS -[DONE] Source tree, Makefiles, and includes will first be reorganised to permit more modularity and code sharing amongst the 3 servers, - and easy exclusion of unfinished code. - Some Makefile targets to facilitate common code individual compilation remains to be done - -The aim of some modifications I'll restart later will be to to finish the full character login, -that is a char that displays as expected ingame (for himself at first), -and has his stats, equipment and changes well kept in DB. - -It involves modification of: - - [DONE] full char creation with use of profession templates (for money and inventory) - except for : - - remaining SP calculation - - starting XP calculation - - additions and modifications on some char data definitions - - char items and containers management - - [DONE] char data saving in DB including inventory - But belt, implants & armor, chat conf and other secondary info not implemented yet - - modifications to char loading from DB - [DONE] for inventory - [NOT DONE] for rest of char items and complementary infos (see above) - - minor modifications to autosave - [DONE] but more improvements will have to be done when more efficiency needed - - [DONE]full filling-in of the baseline for char visual aspects, stats and inventory - - [DONE] make use of worldinfo.def, appplaces.def, appartments.def, respawn.def to manage genreping and - appartment in/out rather than hardcoded info (e.g. zoning.cpp) and manually built database. - - [DONE] make use of world .dat files and worldmodels.def to manage item use rather than - a manually built database. - - [DONE] dynamic loading/unloading of chars, non mem-resident account info - -Notes ----------------- -command @skin to play with skins - Usage: @skin # - for use with the index id from characters.def - or @skin |-|# [[ [ ]]] - is the model id found after the model name in characters.def - # resets to real char skin - - means current skin - incrementaly optional , and are values 0-9 - As a side effect, just doing @skin - will display you current skin infos (and change to the same ...) - -command @effect to play with skins effect - Usage: @effect [] - with = 0 to 17 and = 0 (max density) to 255 (min density) - is meaningfull for some of the effects only - Note: you won't see the effect on yourself. Only other chars will see it ... - Effects found: - 0 = no effect - 1 = poison smoke - 2 = electricity - 3 = deflector (instant white flash) - 4 = heal bubbles - 5 = be a light in the darkness !!! - 6 = flames - 7 = stun particles - 8 = group heal - 9 = group deflector (?) - 10= damage boost - 11= group damage boost - 12= shelter (instant yellow flash) - 13= group deflector (?) - 14= stealth - 15= anti poison aura - 16= I don't remember this one: swarming yellow & blue bubbles - 17= true sight - -command @speed to play with speed - Usage: @speed | # - with = 0 (no move).. 254 , 255 or # meaning "no speed override" diff --git a/server/conf/commands.conf b/server/conf/commands.conf index d13953f..0f779ac 100644 --- a/server/conf/commands.conf +++ b/server/conf/commands.conf @@ -114,4 +114,3 @@ setsubskill = 50 // do actions with NPCs npc = 50 - diff --git a/server/conf/gameserver.conf b/server/conf/gameserver.conf index 64d4ca8..595da62 100644 --- a/server/conf/gameserver.conf +++ b/server/conf/gameserver.conf @@ -70,12 +70,12 @@ isc_connect_pw = changeme server_name = Irata // IP Adress of the Gameserver when reached without NAT (what you care for on your local network) -server_ip = 127.0.0.1 +server_ip = 85.65.85.65 // Network adress that is to be considered as non-NATed. Put 0 if no NAT is used at all no_nat_net = 1 // IP Adress of the Gameserver when reached with NAT (e.g. for users connecting from Internet thought your firewall or router when you have multiple computers) // no effect if no_nat_net is 0 -server_nat_ip = 123.123.123.123 +server_nat_ip = 192.168.1.1 // TCP port the gameserver listens on. // Default is 12000 diff --git a/server/conf/infoserver.conf b/server/conf/infoserver.conf index d23cb86..eff7956 100644 --- a/server/conf/infoserver.conf +++ b/server/conf/infoserver.conf @@ -1,6 +1,12 @@ // TinNS Infoserver configuration file // ===================================== +// Database settings +// Define what Database you want to use. +// Possible values = mysql, sqlite +// Defaults to sqlite +database_type = sqlite + // MySQL settings //================ // Hostname of the MySQL Database (under linux, you may use "localhost") @@ -26,6 +32,11 @@ global_sql_database = infoserver // or 0 to disable keepalive. 28800 is the usual default value on MySQL servers mysql_wait_timeout = 28800 +// SQLite settings +//================ +// Location and name of the Database file +sqlite_databasefile = infoDB.s3db + // ISC settings // ================ // Method of data exchange diff --git a/server/data/scripts/lua/zippy.lua b/server/data/scripts/lua/zippy.lua index 0abf19e..45ff23c 100644 --- a/server/data/scripts/lua/zippy.lua +++ b/server/data/scripts/lua/zippy.lua @@ -1,18 +1,18 @@ -function DIALOG() - -NODE(0) - SAY("Hi. Please choose, time is money!") - ANSWER("Give me 100000 NC!",2) - ANSWER("Take 100000 NC!",3) - -NODE(2) - GIVEMONEY(100000) - SAY("Here you go, have fun") - ENDDIALOG() - -NODE(3) - TAKEMONEY(100000) - SAY("Cool, thanks :)") - ENDDIALOG() - -end \ No newline at end of file +function DIALOG() + +NODE(0) + SAY("Hi. Please choose, time is money!") + ANSWER("Give me 100000 NC!",2) + ANSWER("Take 100000 NC!",3) + +NODE(2) + GIVEMONEY(100000) + SAY("Here you go, have fun") + ENDDIALOG() + +NODE(3) + TAKEMONEY(100000) + SAY("Cool, thanks :)") + ENDDIALOG() + +end diff --git a/server/database/DB_v8/DB_v8_patch001.sql b/server/database/DB_v8/DB_v8_patch001.sql index 119ce72..69e5e86 100644 --- a/server/database/DB_v8/DB_v8_patch001.sql +++ b/server/database/DB_v8/DB_v8_patch001.sql @@ -1,3 +1,3 @@ -use gameserver; - -alter table `emails` change `e_body` `e_body` varchar(2048) character set latin1 collate latin1_swedish_ci NOT NULL; \ No newline at end of file +use gameserver; + +alter table `emails` change `e_body` `e_body` varchar(2048) character set latin1 collate latin1_swedish_ci NOT NULL; diff --git a/server/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql b/server/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql index 1edc36e..c7782c8 100644 --- a/server/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql +++ b/server/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql @@ -1,17 +1,17 @@ -USE `gameserver`; - -/*Data for the table `forums` */ - -insert into `forums`(`f_id`,`f_name`,`f_area`,`f_showname`) values (1,'bbsnctradeweap',1,'nc.trading.weapons/armor'),(2,'bbsnctraderare',1,'nc.trading.rareparts'),(3,'bbsnctradeimp',1,'nc.trading.implants/boneenforcements'),(4,'bbsnctradepsi',1,'nc.trading.psi equipment'),(5,'bbsnctradeblue',1,'nc.trading.blueprints'),(6,'bbsnctradeitem',1,'nc.trading.itemparts/raw materials'),(7,'bbsnctradedrug',1,'nc.trading.drugs'),(8,'bbsneocronmarket',1,'nc.trading.miscellaneous'),(9,'bbsncrunnerano',2,'nc.runner.anouncements'),(10,'bbsncrunnerserv',2,'nc.runner.services'),(11,'bbsncrunnereven',2,'nc.runner.events'),(12,'bbsncrunnerauct',2,'nc.runner.auctions'),(13,'bbsncrunnerclan',2,'nc.runner.clan recruitment'),(14,'bbsncrunnerfind',2,'nc.runner.find team'),(15,'bbsncrunnerhelp',2,'nc.runner.runner2runnerhelp'),(16,'bbsneocrongeneral',3,'nc.talk.general'),(17,'bbsnctalkpolitics',3,'nc.talk.political discussions'),(18,'bbfgeneral',11,'private.faction.general'),(19,'bbcgeneral',12,'private.clan.general'); - -/*Data for the table `npc_spawns` */ - -insert into `npc_spawns`(`npc_id`,`npc_worldid`,`npc_nameid`,`npc_typeid`,`npc_name`,`npc_location`,`npc_x`,`npc_y`,`npc_z`,`npc_angle`,`npc_clothing`,`npc_loot`,`npc_unknown`,`npc_trader`,`npc_customname`,`npc_customscript`,`npc_shop_quality`,`npc_scripting`) values (9942,1020,385,61093,'WSK',1,33808,31332,32512,30,6612,0,8814,0,'Zippy the Trader','scripts/lua/zippy.lua',50,1),(9943,1020,388,17634,'WSK',3,30063,34111,33136,90,6616,0,14035,0,'Event Info',NULL,50,1),(9944,1018,387,32772,'WSK',101,31938,32165,32512,130,6616,0,16675,0,'Event Info',NULL,50,1),(9945,1019,215,50585,'WSK',101,34209,33864,32512,359,197,0,19499,195,NULL,NULL,50,1),(9946,1020,385,13542,'WSK',101,33261,33113,32672,2,4342,0,17892,0,'VotR Paperboy',NULL,50,1),(9947,1019,389,10890,'WSK',401,31105,32463,31936,92,6613,0,14572,0,'Event Info',NULL,50,1),(9948,1020,1629,26858,'WSK',401,31265,30718,31952,177,2827,0,12567,0,NULL,NULL,50,1),(9949,256,151,31996,'WSK',2046,32168,36946,33946,30,9888,0,738,1,NULL,NULL,50,1),(9950,261,143,58099,'WSK',2046,34016,36182,33970,30,22655,0,2306,200,NULL,NULL,50,1),(9951,963,216,356,'WSK',2046,32703,34945,33818,25,4191,0,3154,196,NULL,NULL,50,1),(9952,976,2818,15528,'WSK',2071,23436,21380,35220,185,7214,0,9785,0,NULL,NULL,50,1),(9953,971,386,5040,'WSK',2181,38000,24127,33854,264,6622,0,2590,0,NULL,NULL,50,1),(9954,1020,836,43282,'MBOTFLY',2181,43068,26020,34020,0,31788,0,405,0,NULL,NULL,50,1),(9955,988,836,41913,'MBOTFLY',2181,41537,28260,33860,0,50146,0,380,0,NULL,NULL,50,1),(9956,1006,800,15709,'MBOT',2181,42047,28256,33786,0,14348,0,220,0,NULL,NULL,50,1),(9957,1005,800,28598,'MBOT',2181,44419,23412,33445,0,8332,0,585,0,NULL,NULL,50,1),(9958,1014,672,28153,'DOGBOT',2181,38041,29414,34088,0,21948,0,221,0,NULL,NULL,50,1),(9959,984,677,32746,'WBADGUY',2181,37985,31043,33939,0,21616,0,222,0,NULL,NULL,50,1),(9960,973,606,26878,'MUTANTB',2181,26220,27158,34106,0,20679,0,490,0,NULL,NULL,50,1),(9961,975,800,11783,'MBOT',2181,31285,23969,33970,0,722,0,38,0,NULL,NULL,50,1),(9962,981,640,61001,'FLYMUT',2181,26672,26657,34281,0,20684,0,1510,0,NULL,NULL,50,1),(9963,985,610,1100,'MGMUT',2181,28040,26301,34083,0,21559,0,628,0,NULL,NULL,50,1),(9964,986,640,1159,'FLYMUT',2181,27424,27264,34328,0,21560,0,1503,0,NULL,NULL,50,1),(9965,987,626,53397,'MUTANTB',2181,26386,27672,34135,0,20680,0,407,0,NULL,NULL,50,1),(9966,999,602,19865,'MUTANTB',2181,26771,26119,34228,0,21559,0,271,0,NULL,NULL,50,1),(9967,1003,730,39449,'BROBOT',2181,25425,32173,34055,0,20939,0,4285,0,NULL,NULL,50,1); - -/*Data for the table `outposts` */ - -insert into `outposts`(`o_id`,`o_outnum`,`o_security`,`o_clan`,`o_gr`) values (1,2006,0,0,0),(2,2028,0,0,0),(3,2031,0,0,0),(4,2047,0,0,0),(5,2049,0,0,0),(6,2052,9,3,0),(7,2066,0,0,0),(8,2067,0,0,0),(9,2069,0,0,0),(10,2071,0,0,0),(11,2073,0,0,0),(12,2090,0,0,0),(13,2105,0,0,0),(14,2111,0,0,0),(15,2112,0,0,0),(16,2128,0,0,0),(17,2132,0,0,0),(18,2143,0,0,0),(19,2147,0,0,0),(20,2149,0,0,0),(21,2151,0,0,0),(22,2153,0,0,0),(23,2155,0,0,0),(24,2156,0,0,0),(25,2164,0,0,0),(26,2165,0,0,0),(27,2167,0,0,0),(28,2168,0,0,0),(29,2171,0,0,0),(30,2175,0,0,0),(31,2189,0,0,0),(32,2194,0,0,0),(33,2204,0,0,0),(34,2205,0,0,0),(35,2207,0,0,0),(36,2212,0,0,0); - -/*Data for the table `stockx` */ - -insert into `stockx`(`st_id`,`st_factid`,`st_curval`,`st_oldval`) values (1,9,1227,1227),(2,2,2499,2400),(3,6,1269,1269),(4,10,1387,1387),(5,8,676,676),(6,14,783,783),(7,15,591,591),(8,3,1779,1779),(9,5,879,879),(10,11,1581,2000),(11,4,1544,1544); +USE `gameserver`; + +/*Data for the table `forums` */ + +insert into `forums`(`f_id`,`f_name`,`f_area`,`f_showname`) values (1,'bbsnctradeweap',1,'nc.trading.weapons/armor'),(2,'bbsnctraderare',1,'nc.trading.rareparts'),(3,'bbsnctradeimp',1,'nc.trading.implants/boneenforcements'),(4,'bbsnctradepsi',1,'nc.trading.psi equipment'),(5,'bbsnctradeblue',1,'nc.trading.blueprints'),(6,'bbsnctradeitem',1,'nc.trading.itemparts/raw materials'),(7,'bbsnctradedrug',1,'nc.trading.drugs'),(8,'bbsneocronmarket',1,'nc.trading.miscellaneous'),(9,'bbsncrunnerano',2,'nc.runner.anouncements'),(10,'bbsncrunnerserv',2,'nc.runner.services'),(11,'bbsncrunnereven',2,'nc.runner.events'),(12,'bbsncrunnerauct',2,'nc.runner.auctions'),(13,'bbsncrunnerclan',2,'nc.runner.clan recruitment'),(14,'bbsncrunnerfind',2,'nc.runner.find team'),(15,'bbsncrunnerhelp',2,'nc.runner.runner2runnerhelp'),(16,'bbsneocrongeneral',3,'nc.talk.general'),(17,'bbsnctalkpolitics',3,'nc.talk.political discussions'),(18,'bbfgeneral',11,'private.faction.general'),(19,'bbcgeneral',12,'private.clan.general'); + +/*Data for the table `npc_spawns` */ + +insert into `npc_spawns`(`npc_id`,`npc_worldid`,`npc_nameid`,`npc_typeid`,`npc_name`,`npc_location`,`npc_x`,`npc_y`,`npc_z`,`npc_angle`,`npc_clothing`,`npc_loot`,`npc_unknown`,`npc_trader`,`npc_customname`,`npc_customscript`,`npc_shop_quality`,`npc_scripting`) values (9942,1020,385,61093,'WSK',1,33808,31332,32512,30,6612,0,8814,0,'Zippy the Trader','scripts/lua/zippy.lua',50,1),(9943,1020,388,17634,'WSK',3,30063,34111,33136,90,6616,0,14035,0,'Event Info',NULL,50,1),(9944,1018,387,32772,'WSK',101,31938,32165,32512,130,6616,0,16675,0,'Event Info',NULL,50,1),(9945,1019,215,50585,'WSK',101,34209,33864,32512,359,197,0,19499,195,NULL,NULL,50,1),(9946,1020,385,13542,'WSK',101,33261,33113,32672,2,4342,0,17892,0,'VotR Paperboy',NULL,50,1),(9947,1019,389,10890,'WSK',401,31105,32463,31936,92,6613,0,14572,0,'Event Info',NULL,50,1),(9948,1020,1629,26858,'WSK',401,31265,30718,31952,177,2827,0,12567,0,NULL,NULL,50,1),(9949,256,151,31996,'WSK',2046,32168,36946,33946,30,9888,0,738,1,NULL,NULL,50,1),(9950,261,143,58099,'WSK',2046,34016,36182,33970,30,22655,0,2306,200,NULL,NULL,50,1),(9951,963,216,356,'WSK',2046,32703,34945,33818,25,4191,0,3154,196,NULL,NULL,50,1),(9952,976,2818,15528,'WSK',2071,23436,21380,35220,185,7214,0,9785,0,NULL,NULL,50,1),(9953,971,386,5040,'WSK',2181,38000,24127,33854,264,6622,0,2590,0,NULL,NULL,50,1),(9954,1020,836,43282,'MBOTFLY',2181,43068,26020,34020,0,31788,0,405,0,NULL,NULL,50,1),(9955,988,836,41913,'MBOTFLY',2181,41537,28260,33860,0,50146,0,380,0,NULL,NULL,50,1),(9956,1006,800,15709,'MBOT',2181,42047,28256,33786,0,14348,0,220,0,NULL,NULL,50,1),(9957,1005,800,28598,'MBOT',2181,44419,23412,33445,0,8332,0,585,0,NULL,NULL,50,1),(9958,1014,672,28153,'DOGBOT',2181,38041,29414,34088,0,21948,0,221,0,NULL,NULL,50,1),(9959,984,677,32746,'WBADGUY',2181,37985,31043,33939,0,21616,0,222,0,NULL,NULL,50,1),(9960,973,606,26878,'MUTANTB',2181,26220,27158,34106,0,20679,0,490,0,NULL,NULL,50,1),(9961,975,800,11783,'MBOT',2181,31285,23969,33970,0,722,0,38,0,NULL,NULL,50,1),(9962,981,640,61001,'FLYMUT',2181,26672,26657,34281,0,20684,0,1510,0,NULL,NULL,50,1),(9963,985,610,1100,'MGMUT',2181,28040,26301,34083,0,21559,0,628,0,NULL,NULL,50,1),(9964,986,640,1159,'FLYMUT',2181,27424,27264,34328,0,21560,0,1503,0,NULL,NULL,50,1),(9965,987,626,53397,'MUTANTB',2181,26386,27672,34135,0,20680,0,407,0,NULL,NULL,50,1),(9966,999,602,19865,'MUTANTB',2181,26771,26119,34228,0,21559,0,271,0,NULL,NULL,50,1),(9967,1003,730,39449,'BROBOT',2181,25425,32173,34055,0,20939,0,4285,0,NULL,NULL,50,1); + +/*Data for the table `outposts` */ + +insert into `outposts`(`o_id`,`o_outnum`,`o_security`,`o_clan`,`o_gr`) values (1,2006,0,0,0),(2,2028,0,0,0),(3,2031,0,0,0),(4,2047,0,0,0),(5,2049,0,0,0),(6,2052,9,3,0),(7,2066,0,0,0),(8,2067,0,0,0),(9,2069,0,0,0),(10,2071,0,0,0),(11,2073,0,0,0),(12,2090,0,0,0),(13,2105,0,0,0),(14,2111,0,0,0),(15,2112,0,0,0),(16,2128,0,0,0),(17,2132,0,0,0),(18,2143,0,0,0),(19,2147,0,0,0),(20,2149,0,0,0),(21,2151,0,0,0),(22,2153,0,0,0),(23,2155,0,0,0),(24,2156,0,0,0),(25,2164,0,0,0),(26,2165,0,0,0),(27,2167,0,0,0),(28,2168,0,0,0),(29,2171,0,0,0),(30,2175,0,0,0),(31,2189,0,0,0),(32,2194,0,0,0),(33,2204,0,0,0),(34,2205,0,0,0),(35,2207,0,0,0),(36,2212,0,0,0); + +/*Data for the table `stockx` */ + +insert into `stockx`(`st_id`,`st_factid`,`st_curval`,`st_oldval`) values (1,9,1227,1227),(2,2,2499,2400),(3,6,1269,1269),(4,10,1387,1387),(5,8,676,676),(6,14,783,783),(7,15,591,591),(8,3,1779,1779),(9,5,879,879),(10,11,1581,2000),(11,4,1544,1544); diff --git a/server/database/DB_v8/changes.txt b/server/database/DB_v8/changes.txt index beeaf17..66cfca0 100644 --- a/server/database/DB_v8/changes.txt +++ b/server/database/DB_v8/changes.txt @@ -1,75 +1,82 @@ -CHANGELOG FOR GameDB 8 and InfoDB 8 ------------------------------------ - -v7 > v8: -INFOSERVER: -- No changes so far - -GAMESERVER: -Renamed table 'bug report' to 'bug_report' -- Changed br_desc from VARCHAR(256) to VARCHAR(1024) as this is the size found in .tsc files - -Changed table "characters": -- Added col c_online -- Added col c_clan -- Added col c_soullight - -Added table "clanlevels" - -Changed table "clans": -- Renamed c_faction to cl_faction, also changed type from INT(10) to INT(2) -- Renamed c_id to cl_id -- Renamed c_longname to cl_name, also changed type from VARCHAR(45) to CHAR(16) as this is the size found in .tsc files -- Renamed c_shortname to cl_shortdesc, also changed type from VARCHAR(45) to CHAR(64) as this is the size found in .tsc files -- Added col cl_appid -- Added col cl_description -- Added col cl_leader -- Added col cl_minsympathy -- Added col cl_money -- Added col cl_representative - -Added table "clanwars" - -Added table "datacubes" - -Changed table "forum_posts" -- Added col fp_factionid -- Added col fp_clanid -- Changed col fp_content from VARCHAR(1024) to VARCHAR(2048) as this is the size found in .tsc files - -Changed table "guides" -- Changed col g_content from VARCHAR(512) to TEXT, as the size in .tsc files is set to 32768 -- Added col g_language -- Added col g_chapter -- Added col g_part - -Added table "moneytransactions" - -Changed table "neochronicle" -- Changed col nc_content from VARCHAR(512) to TEXT, as the size in .tsc files is set to 32768 -- Added col nc_lang -- Added col nc_approved -- Added col nc_author -- Added col nc_icon - -Changed table "neocron articles" -- Changed col na_content from VARCHAR(512) to TEXT, as the size in .tsc files is set to 32768 - -Added table "npc_shop" - -Changed table "npc_spawns" -- Added col npc_unknown -- Added col npc_trader -- Added col npc_customname -- Added col npc_customscript -- Added col npc_shop_quality -- Added col npc_scripting - -Added table "stockx_depots" - -Added table "support" - -Changed table "vehicles" -- Added col v_world - -Added table "worlds" \ No newline at end of file +CHANGELOG FOR GameDB 8 and InfoDB 8 +----------------------------------- + +v7 > v8: +INFOSERVER: +- No changes so far + +GAMESERVER: +Renamed table 'bug report' to 'bug_report' +- Changed br_desc from VARCHAR(256) to VARCHAR(1024) as this is the size +found in .tsc files + +Changed table "characters": +- Added col c_online +- Added col c_clan +- Added col c_soullight + +Added table "clanlevels" + +Changed table "clans": +- Renamed c_faction to cl_faction, also changed type from INT(10) to INT(2) +- Renamed c_id to cl_id +- Renamed c_longname to cl_name, also changed type from VARCHAR(45) to +CHAR(16) as this is the size found in .tsc files +- Renamed c_shortname to cl_shortdesc, also changed type from VARCHAR(45) to +CHAR(64) as this is the size found in .tsc files +- Added col cl_appid +- Added col cl_description +- Added col cl_leader +- Added col cl_minsympathy +- Added col cl_money +- Added col cl_representative + +Added table "clanwars" + +Added table "datacubes" + +Changed table "forum_posts" +- Added col fp_factionid +- Added col fp_clanid +- Changed col fp_content from VARCHAR(1024) to VARCHAR(2048) as this is the +size found in .tsc files + +Changed table "guides" +- Changed col g_content from VARCHAR(512) to TEXT, as the size in .tsc files +is set to 32768 +- Added col g_language +- Added col g_chapter +- Added col g_part + +Added table "moneytransactions" + +Changed table "neochronicle" +- Changed col nc_content from VARCHAR(512) to TEXT, as the size in .tsc files +is set to 32768 +- Added col nc_lang +- Added col nc_approved +- Added col nc_author +- Added col nc_icon + +Changed table "neocron articles" +- Changed col na_content from VARCHAR(512) to TEXT, as the size in .tsc files +is set to 32768 + +Added table "npc_shop" + +Changed table "npc_spawns" +- Added col npc_unknown +- Added col npc_trader +- Added col npc_customname +- Added col npc_customscript +- Added col npc_shop_quality +- Added col npc_scripting + +Added table "stockx_depots" + +Added table "support" + +Changed table "vehicles" +- Added col v_world + +Added table "worlds" diff --git a/server/database/DB_v8/patch_gamedb_rev7_to_rev8.sql b/server/database/DB_v8/patch_gamedb_rev7_to_rev8.sql index 7968922..c7680b9 100644 --- a/server/database/DB_v8/patch_gamedb_rev7_to_rev8.sql +++ b/server/database/DB_v8/patch_gamedb_rev7_to_rev8.sql @@ -1,164 +1,164 @@ -/* Create table in target */ -DROP TABLE `bug report`; - -CREATE TABLE `bug_report`( - `br_id` int(10) unsigned NOT NULL auto_increment , - `br_type` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Type' , - `br_desc` varchar(1024) COLLATE latin1_swedish_ci NOT NULL COMMENT 'Description' , - `br_fromid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Char ID of reporter' , - `br_location` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Location where problem occured' , - `br_status` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Status' , - `br_datetime` varchar(45) COLLATE latin1_swedish_ci NOT NULL COMMENT 'Date/Time' , - `br_supid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Supporter ID' , - PRIMARY KEY (`br_id`) -) ENGINE=InnoDB DEFAULT CHARSET='latin1'; - - -/* Alter table in target */ -ALTER TABLE `characters` - ADD COLUMN `c_online` int(1) NULL DEFAULT '0' after `c_slot`, - ADD COLUMN `c_clan` int(10) NULL DEFAULT '0' after `c_online`, - ADD COLUMN `c_soullight` int(3) NULL DEFAULT '10' after `c_clan`, COMMENT=''; - -/* Create table in target */ -CREATE TABLE `clanlevels`( - `cll_id` int(10) NOT NULL auto_increment , - `cll_clanid` int(10) NULL DEFAULT '0' , - `cll_level` int(2) NULL DEFAULT '0' , - `cll_desc` char(255) COLLATE latin1_general_ci NULL , - `cll_charid` int(10) NULL , - PRIMARY KEY (`cll_id`) -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; - - -/* Alter table in target */ -ALTER TABLE `clans` - ADD COLUMN `cl_id` int(10) unsigned NOT NULL auto_increment first, - ADD COLUMN `cl_shortdesc` char(16) COLLATE latin1_general_ci NULL after `cl_id`, - ADD COLUMN `cl_name` char(64) COLLATE latin1_general_ci NULL after `cl_shortdesc`, - ADD COLUMN `cl_faction` int(2) NULL after `cl_name`, - ADD COLUMN `cl_description` varchar(256) COLLATE latin1_general_ci NULL after `cl_faction`, - ADD COLUMN `cl_leader` int(10) NULL DEFAULT '0' after `cl_description`, - ADD COLUMN `cl_money` int(10) NULL DEFAULT '0' after `cl_leader`, - ADD COLUMN `cl_minsympathy` int(3) NULL DEFAULT '70' after `cl_money`, - ADD COLUMN `cl_appid` int(10) NULL DEFAULT '0' after `cl_minsympathy`, - ADD COLUMN `cl_representative` int(10) NULL DEFAULT '0' after `cl_appid`, - DROP COLUMN `c_id`, - DROP COLUMN `c_shortname`, - DROP COLUMN `c_longname`, - DROP COLUMN `c_faction`, - DROP KEY `PRIMARY`, add PRIMARY KEY(`cl_id`), ENGINE=MyISAM, COMMENT=''; - -/* Create table in target */ -CREATE TABLE `clanwars`( - `cw_id` int(10) NOT NULL auto_increment , - `cw_initclan` int(10) NULL DEFAULT '0' , - `cw_enemyclan` int(10) NULL DEFAULT '0' , - `cw_starttime` varchar(45) COLLATE latin1_general_ci NULL , - `cw_status` int(2) NULL DEFAULT '0' , - `cw_statement_initiator` varchar(512) COLLATE latin1_general_ci NULL , - `cw_statement_enemy` varchar(512) COLLATE latin1_general_ci NULL , - PRIMARY KEY (`cw_id`) -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; - - -/* Create table in target */ -CREATE TABLE `datacubes`( - `cb_id` int(10) NOT NULL auto_increment , - `cb_securitycode` char(30) COLLATE latin1_general_ci NULL , - `cb_inscription` tinytext COLLATE latin1_general_ci NULL , - PRIMARY KEY (`cb_id`) -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; - - -/* Alter table in target */ -ALTER TABLE `forum_posts` - CHANGE `fp_content` `fp_content` varchar(2048) COLLATE latin1_swedish_ci NOT NULL after `fp_fromid`, - ADD COLUMN `fp_factionid` int(2) NULL DEFAULT '0' after `fp_forumid`, - ADD COLUMN `fp_clanid` int(10) NULL DEFAULT '0' after `fp_factionid`, COMMENT=''; - -/* Alter table in target */ -ALTER TABLE `guides` - ADD COLUMN `g_language` int(2) NULL after `g_title`, - CHANGE `g_content` `g_content` text COLLATE latin1_swedish_ci NOT NULL after `g_language`, - ADD COLUMN `g_chapter` int(1) NULL DEFAULT '0' after `g_content`, - ADD COLUMN `g_part` int(1) NULL DEFAULT '0' after `g_chapter`, COMMENT=''; - -/* Create table in target */ -CREATE TABLE `moneytransactions`( - `mt_id` int(10) NOT NULL auto_increment , - `mt_clanid` int(10) NULL DEFAULT '0' , - `mt_amount` int(10) NULL DEFAULT '0' , - `mt_player` int(10) NULL DEFAULT '0' , - `mt_date` char(45) COLLATE latin1_general_ci NULL DEFAULT '2750-01-01 00:00:00' , - `mt_comment` char(255) COLLATE latin1_general_ci NULL DEFAULT '0' , - PRIMARY KEY (`mt_id`) -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; - - -/* Alter table in target */ -ALTER TABLE `neochronicle` - CHANGE `nc_content` `nc_content` text COLLATE latin1_swedish_ci NOT NULL after `nc_name`, - ADD COLUMN `nc_lang` int(2) NULL after `nc_datetime`, - ADD COLUMN `nc_approved` int(1) NULL DEFAULT '0' after `nc_lang`, - ADD COLUMN `nc_author` char(45) COLLATE latin1_swedish_ci NULL after `nc_approved`, - ADD COLUMN `nc_icon` int(10) NULL DEFAULT '0' after `nc_author`, COMMENT=''; - -/* Alter table in target */ -ALTER TABLE `neocron articles` - CHANGE `na_content` `na_content` text COLLATE latin1_swedish_ci NOT NULL after `na_name`, COMMENT=''; - -/* Create table in target */ -CREATE TABLE `npc_shop`( - `c_npc_id` int(11) NULL COMMENT 'The NPC WorldID' , - `c_zoneid` int(11) NULL COMMENT 'The ZoneID in which the NPC is' , - `c_itemid` int(11) NULL COMMENT 'ItemID for sale' , - `c_itemprice` int(11) NULL COMMENT 'Price for this item' -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; - - -/* Alter table in target */ -ALTER TABLE `npc_spawns` - ADD COLUMN `npc_unknown` int(10) unsigned NOT NULL DEFAULT '0' after `npc_loot`, - ADD COLUMN `npc_trader` int(10) unsigned NOT NULL DEFAULT '0' after `npc_unknown`, - ADD COLUMN `npc_customname` varchar(80) COLLATE latin1_swedish_ci NULL after `npc_trader`, - ADD COLUMN `npc_customscript` varchar(100) COLLATE latin1_swedish_ci NULL after `npc_customname`, - ADD COLUMN `npc_shop_quality` int(3) NULL DEFAULT '50' COMMENT 'The quality of items if this npc has items to sell' after `npc_customscript`, - ADD COLUMN `npc_scripting` int(1) NULL DEFAULT '1' COMMENT '1: Scripts enabled 0: Scripts disabled' after `npc_shop_quality`, COMMENT=''; - -/* Create table in target */ -CREATE TABLE `stockx_depots`( - `sxd_id` int(10) NOT NULL auto_increment , - `sxd_playerid` int(10) NULL DEFAULT '0' , - `sxd_st_id` int(10) NULL DEFAULT '0' , - `sxd_amount` int(10) NULL DEFAULT '0' , - `sxd_paid` int(10) NULL DEFAULT '0' , - PRIMARY KEY (`sxd_id`) -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; - - -/* Create table in target */ -CREATE TABLE `support`( - `su_id` int(10) NOT NULL auto_increment , - `su_player` int(10) NULL DEFAULT '0' , - `su_datetime` varchar(45) COLLATE latin1_general_ci NULL , - `su_supporterid` int(10) NULL DEFAULT '0' , - `su_desc` char(255) COLLATE latin1_general_ci NULL , - `su_type` int(1) NULL DEFAULT '0' , - `su_worldid` int(10) NULL DEFAULT '0' , - `su_inwork` int(1) NULL DEFAULT '0' , - `su_finished` int(1) NULL DEFAULT '0' , - PRIMARY KEY (`su_id`) -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; - - -/* Alter table in target */ -ALTER TABLE `vehicles` - ADD COLUMN `v_world` int(10) NULL DEFAULT '0' after `v_status`, COMMENT=''; - -/* Create table in target */ -CREATE TABLE `worlds`( - `wr_id` int(10) NOT NULL DEFAULT '0' , - `wr_group` int(10) NULL DEFAULT '0' , - PRIMARY KEY (`wr_id`) -) ENGINE=MyISAM DEFAULT CHARSET='latin1'; +/* Create table in target */ +DROP TABLE `bug report`; + +CREATE TABLE `bug_report`( + `br_id` int(10) unsigned NOT NULL auto_increment , + `br_type` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Type' , + `br_desc` varchar(1024) COLLATE latin1_swedish_ci NOT NULL COMMENT 'Description' , + `br_fromid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Char ID of reporter' , + `br_location` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Location where problem occured' , + `br_status` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Status' , + `br_datetime` varchar(45) COLLATE latin1_swedish_ci NOT NULL COMMENT 'Date/Time' , + `br_supid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Supporter ID' , + PRIMARY KEY (`br_id`) +) ENGINE=InnoDB DEFAULT CHARSET='latin1'; + + +/* Alter table in target */ +ALTER TABLE `characters` + ADD COLUMN `c_online` int(1) NULL DEFAULT '0' after `c_slot`, + ADD COLUMN `c_clan` int(10) NULL DEFAULT '0' after `c_online`, + ADD COLUMN `c_soullight` int(3) NULL DEFAULT '10' after `c_clan`, COMMENT=''; + +/* Create table in target */ +CREATE TABLE `clanlevels`( + `cll_id` int(10) NOT NULL auto_increment , + `cll_clanid` int(10) NULL DEFAULT '0' , + `cll_level` int(2) NULL DEFAULT '0' , + `cll_desc` char(255) COLLATE latin1_general_ci NULL , + `cll_charid` int(10) NULL , + PRIMARY KEY (`cll_id`) +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; + + +/* Alter table in target */ +ALTER TABLE `clans` + ADD COLUMN `cl_id` int(10) unsigned NOT NULL auto_increment first, + ADD COLUMN `cl_shortdesc` char(16) COLLATE latin1_general_ci NULL after `cl_id`, + ADD COLUMN `cl_name` char(64) COLLATE latin1_general_ci NULL after `cl_shortdesc`, + ADD COLUMN `cl_faction` int(2) NULL after `cl_name`, + ADD COLUMN `cl_description` varchar(256) COLLATE latin1_general_ci NULL after `cl_faction`, + ADD COLUMN `cl_leader` int(10) NULL DEFAULT '0' after `cl_description`, + ADD COLUMN `cl_money` int(10) NULL DEFAULT '0' after `cl_leader`, + ADD COLUMN `cl_minsympathy` int(3) NULL DEFAULT '70' after `cl_money`, + ADD COLUMN `cl_appid` int(10) NULL DEFAULT '0' after `cl_minsympathy`, + ADD COLUMN `cl_representative` int(10) NULL DEFAULT '0' after `cl_appid`, + DROP COLUMN `c_id`, + DROP COLUMN `c_shortname`, + DROP COLUMN `c_longname`, + DROP COLUMN `c_faction`, + DROP KEY `PRIMARY`, add PRIMARY KEY(`cl_id`), ENGINE=MyISAM, COMMENT=''; + +/* Create table in target */ +CREATE TABLE `clanwars`( + `cw_id` int(10) NOT NULL auto_increment , + `cw_initclan` int(10) NULL DEFAULT '0' , + `cw_enemyclan` int(10) NULL DEFAULT '0' , + `cw_starttime` varchar(45) COLLATE latin1_general_ci NULL , + `cw_status` int(2) NULL DEFAULT '0' , + `cw_statement_initiator` varchar(512) COLLATE latin1_general_ci NULL , + `cw_statement_enemy` varchar(512) COLLATE latin1_general_ci NULL , + PRIMARY KEY (`cw_id`) +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; + + +/* Create table in target */ +CREATE TABLE `datacubes`( + `cb_id` int(10) NOT NULL auto_increment , + `cb_securitycode` char(30) COLLATE latin1_general_ci NULL , + `cb_inscription` tinytext COLLATE latin1_general_ci NULL , + PRIMARY KEY (`cb_id`) +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; + + +/* Alter table in target */ +ALTER TABLE `forum_posts` + CHANGE `fp_content` `fp_content` varchar(2048) COLLATE latin1_swedish_ci NOT NULL after `fp_fromid`, + ADD COLUMN `fp_factionid` int(2) NULL DEFAULT '0' after `fp_forumid`, + ADD COLUMN `fp_clanid` int(10) NULL DEFAULT '0' after `fp_factionid`, COMMENT=''; + +/* Alter table in target */ +ALTER TABLE `guides` + ADD COLUMN `g_language` int(2) NULL after `g_title`, + CHANGE `g_content` `g_content` text COLLATE latin1_swedish_ci NOT NULL after `g_language`, + ADD COLUMN `g_chapter` int(1) NULL DEFAULT '0' after `g_content`, + ADD COLUMN `g_part` int(1) NULL DEFAULT '0' after `g_chapter`, COMMENT=''; + +/* Create table in target */ +CREATE TABLE `moneytransactions`( + `mt_id` int(10) NOT NULL auto_increment , + `mt_clanid` int(10) NULL DEFAULT '0' , + `mt_amount` int(10) NULL DEFAULT '0' , + `mt_player` int(10) NULL DEFAULT '0' , + `mt_date` char(45) COLLATE latin1_general_ci NULL DEFAULT '2750-01-01 00:00:00' , + `mt_comment` char(255) COLLATE latin1_general_ci NULL DEFAULT '0' , + PRIMARY KEY (`mt_id`) +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; + + +/* Alter table in target */ +ALTER TABLE `neochronicle` + CHANGE `nc_content` `nc_content` text COLLATE latin1_swedish_ci NOT NULL after `nc_name`, + ADD COLUMN `nc_lang` int(2) NULL after `nc_datetime`, + ADD COLUMN `nc_approved` int(1) NULL DEFAULT '0' after `nc_lang`, + ADD COLUMN `nc_author` char(45) COLLATE latin1_swedish_ci NULL after `nc_approved`, + ADD COLUMN `nc_icon` int(10) NULL DEFAULT '0' after `nc_author`, COMMENT=''; + +/* Alter table in target */ +ALTER TABLE `neocron articles` + CHANGE `na_content` `na_content` text COLLATE latin1_swedish_ci NOT NULL after `na_name`, COMMENT=''; + +/* Create table in target */ +CREATE TABLE `npc_shop`( + `c_npc_id` int(11) NULL COMMENT 'The NPC WorldID' , + `c_zoneid` int(11) NULL COMMENT 'The ZoneID in which the NPC is' , + `c_itemid` int(11) NULL COMMENT 'ItemID for sale' , + `c_itemprice` int(11) NULL COMMENT 'Price for this item' +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; + + +/* Alter table in target */ +ALTER TABLE `npc_spawns` + ADD COLUMN `npc_unknown` int(10) unsigned NOT NULL DEFAULT '0' after `npc_loot`, + ADD COLUMN `npc_trader` int(10) unsigned NOT NULL DEFAULT '0' after `npc_unknown`, + ADD COLUMN `npc_customname` varchar(80) COLLATE latin1_swedish_ci NULL after `npc_trader`, + ADD COLUMN `npc_customscript` varchar(100) COLLATE latin1_swedish_ci NULL after `npc_customname`, + ADD COLUMN `npc_shop_quality` int(3) NULL DEFAULT '50' COMMENT 'The quality of items if this npc has items to sell' after `npc_customscript`, + ADD COLUMN `npc_scripting` int(1) NULL DEFAULT '1' COMMENT '1: Scripts enabled 0: Scripts disabled' after `npc_shop_quality`, COMMENT=''; + +/* Create table in target */ +CREATE TABLE `stockx_depots`( + `sxd_id` int(10) NOT NULL auto_increment , + `sxd_playerid` int(10) NULL DEFAULT '0' , + `sxd_st_id` int(10) NULL DEFAULT '0' , + `sxd_amount` int(10) NULL DEFAULT '0' , + `sxd_paid` int(10) NULL DEFAULT '0' , + PRIMARY KEY (`sxd_id`) +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; + + +/* Create table in target */ +CREATE TABLE `support`( + `su_id` int(10) NOT NULL auto_increment , + `su_player` int(10) NULL DEFAULT '0' , + `su_datetime` varchar(45) COLLATE latin1_general_ci NULL , + `su_supporterid` int(10) NULL DEFAULT '0' , + `su_desc` char(255) COLLATE latin1_general_ci NULL , + `su_type` int(1) NULL DEFAULT '0' , + `su_worldid` int(10) NULL DEFAULT '0' , + `su_inwork` int(1) NULL DEFAULT '0' , + `su_finished` int(1) NULL DEFAULT '0' , + PRIMARY KEY (`su_id`) +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; + + +/* Alter table in target */ +ALTER TABLE `vehicles` + ADD COLUMN `v_world` int(10) NULL DEFAULT '0' after `v_status`, COMMENT=''; + +/* Create table in target */ +CREATE TABLE `worlds`( + `wr_id` int(10) NOT NULL DEFAULT '0' , + `wr_group` int(10) NULL DEFAULT '0' , + PRIMARY KEY (`wr_id`) +) ENGINE=MyISAM DEFAULT CHARSET='latin1'; diff --git a/server/database/DB_v8/readme.txt b/server/database/DB_v8/readme.txt index 3dc7e0c..39cb723 100644 --- a/server/database/DB_v8/readme.txt +++ b/server/database/DB_v8/readme.txt @@ -1,13 +1,13 @@ -This directory contains an UPDATE and a FULL DUMP -for both InfoDB and GameDB. -If you want to keep your data and just upgrade the structure, -use - patch_gamedb_rev7_to_rev8.sql - -to get up to date. However, it is recommended to use the FULL files -to build a new database. - -Note: For TinNS, you'll have to apply "TinNS_GameDB_rev8_BaseData.sql" -after creating the base-tables! - -See changes.txt for information about what has changed from DB7 to DB8 \ No newline at end of file +This directory contains an UPDATE and a FULL DUMP +for both InfoDB and GameDB. +If you want to keep your data and just upgrade the structure, +use + patch_gamedb_rev7_to_rev8.sql + +to get up to date. However, it is recommended to use the FULL files +to build a new database. + +Note: For TinNS, you'll have to apply "TinNS_GameDB_rev8_BaseData.sql" +after creating the base-tables! + +See changes.txt for information about what has changed from DB7 to DB8 diff --git a/server/database/DB_v8/unified_game DB_rev8.sql b/server/database/DB_v8/unified_game_DB_rev8.sql similarity index 97% rename from server/database/DB_v8/unified_game DB_rev8.sql rename to server/database/DB_v8/unified_game_DB_rev8.sql index 1a49c8e..4e897cb 100644 --- a/server/database/DB_v8/unified_game DB_rev8.sql +++ b/server/database/DB_v8/unified_game_DB_rev8.sql @@ -1,484 +1,484 @@ -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - -CREATE DATABASE /*!32312 IF NOT EXISTS*/`gameserver` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci */; - -USE `gameserver`; - -/*Table structure for table `apartments` */ - -DROP TABLE IF EXISTS `apartments`; - -CREATE TABLE `apartments` ( - `apt_id` int(10) unsigned NOT NULL auto_increment, - `apt_location` int(10) unsigned NOT NULL default '0', - `apt_type` int(10) unsigned NOT NULL default '0', - `apt_password` varchar(45) NOT NULL default '', - `apt_owner` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`apt_id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; - -/*Table structure for table `buddy_list` */ - -DROP TABLE IF EXISTS `buddy_list`; - -CREATE TABLE `buddy_list` ( - `bud_id` int(10) NOT NULL auto_increment, - `bud_charid` int(10) NOT NULL default '0', - `bud_buddyid` mediumint(10) NOT NULL default '0', - PRIMARY KEY (`bud_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -/*Table structure for table `bug_report` */ - -DROP TABLE IF EXISTS `bug_report`; - -CREATE TABLE `bug_report` ( - `br_id` int(10) unsigned NOT NULL auto_increment, - `br_type` int(10) unsigned NOT NULL default '0' COMMENT 'Type', - `br_desc` varchar(1024) NOT NULL COMMENT 'Description', - `br_fromid` int(10) unsigned NOT NULL default '0' COMMENT 'Char ID of reporter', - `br_location` int(10) unsigned NOT NULL default '0' COMMENT 'Location where problem occured', - `br_status` int(10) unsigned NOT NULL default '0' COMMENT 'Status', - `br_datetime` varchar(45) NOT NULL COMMENT 'Date/Time', - `br_supid` int(10) unsigned NOT NULL default '0' COMMENT 'Supporter ID', - PRIMARY KEY (`br_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -/*Table structure for table `characters` */ - -DROP TABLE IF EXISTS `characters`; - -CREATE TABLE `characters` ( - `c_id` int(10) unsigned NOT NULL auto_increment, - `c_name` varchar(45) default '', - `c_str_lvl` int(10) unsigned default '0', - `c_str_pts` int(10) unsigned default '0', - `c_int_lvl` int(10) unsigned default '0', - `c_int_pts` int(10) unsigned default '0', - `c_dex_lvl` int(10) unsigned default '0', - `c_dex_pts` int(10) unsigned default '0', - `c_con_lvl` int(10) unsigned default '0', - `c_con_pts` int(10) unsigned default '0', - `c_psi_lvl` int(10) unsigned default '0', - `c_psi_pts` int(10) unsigned default '0', - `a_id` int(10) unsigned default '0', - `c_class` int(10) unsigned default '0', - `c_profession` int(10) unsigned default '0', - `c_sex` int(10) unsigned default '0', - `c_location` int(10) unsigned default '1', - `c_mc` int(10) unsigned default '0', - `c_hc` int(10) unsigned default '0', - `c_tra` int(10) unsigned default '0', - `c_pc` int(10) unsigned default '0', - `c_rc` int(10) unsigned default '0', - `c_tc` int(10) unsigned default '0', - `c_vhc` int(10) unsigned default '0', - `c_agl` int(10) unsigned default '0', - `c_rep` int(10) unsigned default '0', - `c_rec` int(10) unsigned default '0', - `c_rcl` int(10) unsigned default '0', - `c_atl` int(10) unsigned default '0', - `c_end` int(10) unsigned default '0', - `c_for` int(10) unsigned default '0', - `c_fir` int(10) unsigned default '0', - `c_enr` int(10) unsigned default '0', - `c_xrr` int(10) unsigned default '0', - `c_por` int(10) unsigned default '0', - `c_htl` int(10) unsigned default '0', - `c_hck` int(10) unsigned default '0', - `c_brt` int(10) unsigned default '0', - `c_psu` int(10) unsigned default '0', - `c_wep` int(10) unsigned default '0', - `c_cst` int(10) unsigned default '0', - `c_res` int(10) unsigned default '0', - `c_imp` int(10) unsigned default '0', - `c_ppu` int(10) unsigned default '0', - `c_apu` int(10) unsigned default '0', - `c_mst` int(10) unsigned default '0', - `c_ppw` int(10) unsigned default '0', - `c_psr` int(10) unsigned default '0', - `c_wpw` int(10) unsigned default '0', - `c_apt` int(10) unsigned default '0', - `c_cash` int(10) unsigned default '0', - `c_head` int(10) unsigned default '0', - `c_torso` int(10) unsigned default '0', - `c_legs` int(10) unsigned default '0', - `c_str_xp` float default '0', - `c_int_xp` float default '0', - `c_dex_xp` float default '0', - `c_psi_xp` float default '0', - `c_con_xp` float default '0', - `c_pos_x` float NOT NULL default '0', - `c_pos_y` float NOT NULL default '0', - `c_pos_z` float NOT NULL default '0', - `c_angle_ud` float NOT NULL default '0', - `c_angle_lr` float NOT NULL default '0', - `c_faction` int(10) unsigned NOT NULL default '0', - `c_slot` smallint(5) unsigned NOT NULL default '0', - `c_online` int(1) default '0', - `c_clan` int(10) default '0', - `c_soullight` int(3) default '10', - PRIMARY KEY (`c_id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - -/*Table structure for table `clanlevels` */ - -DROP TABLE IF EXISTS `clanlevels`; - -CREATE TABLE `clanlevels` ( - `cll_id` int(10) NOT NULL auto_increment, - `cll_clanid` int(10) default '0', - `cll_level` int(2) default '0', - `cll_desc` char(255) collate latin1_general_ci default NULL, - `cll_charid` int(10) default NULL, - PRIMARY KEY (`cll_id`) -) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `clans` */ - -DROP TABLE IF EXISTS `clans`; - -CREATE TABLE `clans` ( - `cl_id` int(10) unsigned NOT NULL auto_increment, - `cl_shortdesc` char(16) collate latin1_general_ci default NULL, - `cl_name` char(64) collate latin1_general_ci default NULL, - `cl_faction` int(2) default NULL, - `cl_description` varchar(256) collate latin1_general_ci default NULL, - `cl_leader` int(10) default '0', - `cl_money` int(10) default '0', - `cl_minsympathy` int(3) default '70', - `cl_appid` int(10) default '0', - `cl_representative` int(10) default '0', - PRIMARY KEY (`cl_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1002 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `clanwars` */ - -DROP TABLE IF EXISTS `clanwars`; - -CREATE TABLE `clanwars` ( - `cw_id` int(10) NOT NULL auto_increment, - `cw_initclan` int(10) default '0', - `cw_enemyclan` int(10) default '0', - `cw_starttime` varchar(45) collate latin1_general_ci default '', - `cw_status` int(2) default '0', - `cw_statement_initiator` varchar(512) collate latin1_general_ci default '', - `cw_statement_enemy` varchar(512) collate latin1_general_ci default '', - PRIMARY KEY (`cw_id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `contacts` */ - -DROP TABLE IF EXISTS `contacts`; - -CREATE TABLE `contacts` ( - `c_id` int(10) unsigned NOT NULL auto_increment, - `c_listid` int(10) unsigned NOT NULL default '0' COMMENT 'Who''s list?', - `c_conid` int(10) unsigned NOT NULL default '0' COMMENT 'Char ID of person on list', - `c_type` int(10) unsigned NOT NULL default '0' COMMENT '1=Personal, 2=Business, 3=Allied', - `c_desc` varchar(256) NOT NULL, - PRIMARY KEY (`c_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; - -/*Table structure for table `datacubes` */ - -DROP TABLE IF EXISTS `datacubes`; - -CREATE TABLE `datacubes` ( - `cb_id` int(10) NOT NULL auto_increment, - `cb_securitycode` char(30) collate latin1_general_ci default '', - `cb_inscription` tinytext collate latin1_general_ci, - PRIMARY KEY (`cb_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `emails` */ - -DROP TABLE IF EXISTS `emails`; - -CREATE TABLE `emails` ( - `e_id` int(10) unsigned NOT NULL auto_increment, - `e_subject` varchar(128) NOT NULL default '', - `e_fromid` int(10) unsigned NOT NULL default '0', - `e_datetime` varchar(45) NOT NULL default '0', - `e_toid` int(10) unsigned NOT NULL default '0', - `e_body` varchar(512) NOT NULL, - `e_new` tinyint(1) NOT NULL default '1', - `e_replied` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`e_id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - -/*Table structure for table `forum_posts` */ - -DROP TABLE IF EXISTS `forum_posts`; - -CREATE TABLE `forum_posts` ( - `fp_id` int(10) unsigned NOT NULL auto_increment, - `fp_name` varchar(45) NOT NULL default '', - `fp_fromid` int(10) unsigned NOT NULL default '0', - `fp_content` varchar(2048) NOT NULL default '', - `fp_datetime` varchar(45) NOT NULL default '', - `fp_replyid` int(10) unsigned NOT NULL default '0', - `fp_forumid` int(10) unsigned NOT NULL default '0', - `fp_factionid` int(2) default '0', - `fp_clanid` int(10) default '0', - PRIMARY KEY (`fp_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; - -/*Table structure for table `forums` */ - -DROP TABLE IF EXISTS `forums`; - -CREATE TABLE `forums` ( - `f_id` int(10) unsigned NOT NULL auto_increment, - `f_name` varchar(45) NOT NULL default '', - `f_area` int(10) unsigned NOT NULL default '0', - `f_showname` varchar(45) NOT NULL default '', - PRIMARY KEY (`f_id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; - -/*Table structure for table `genrep` */ - -DROP TABLE IF EXISTS `genrep`; - -CREATE TABLE `genrep` ( - `g_id` int(10) unsigned NOT NULL auto_increment, - `g_worldid` int(10) unsigned NOT NULL default '0', - `g_stationid` int(10) unsigned NOT NULL default '0', - `g_charid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`g_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -/*Table structure for table `guides` */ - -DROP TABLE IF EXISTS `guides`; - -CREATE TABLE `guides` ( - `g_id` int(10) unsigned NOT NULL auto_increment, - `g_type` int(10) unsigned NOT NULL default '0', - `g_title` varchar(45) NOT NULL default '', - `g_language` int(2) default NULL, - `g_content` text NOT NULL, - `g_chapter` int(1) default '0', - `g_part` int(1) default '0', - PRIMARY KEY (`g_id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - -/*Table structure for table `inventory` */ - -DROP TABLE IF EXISTS `inventory`; - -CREATE TABLE `inventory` ( - `inv_id` int(10) unsigned NOT NULL auto_increment, - `inv_charid` int(10) unsigned NOT NULL default '0', - `inv_loc` int(10) unsigned NOT NULL default '0', - `inv_x` int(10) unsigned NOT NULL default '0', - `inv_y` int(10) unsigned NOT NULL default '0', - `inv_itemid` int(10) unsigned NOT NULL default '0', - `inv_flag` int(10) unsigned NOT NULL default '0', - `inv_qty` int(10) unsigned NOT NULL default '0', - `inv_sqty` int(10) unsigned NOT NULL default '0', - `inv_cdur` int(10) unsigned NOT NULL default '0', - `inv_dmg` int(10) unsigned NOT NULL default '0', - `inv_frq` int(10) unsigned NOT NULL default '0', - `inv_hnd` int(10) unsigned NOT NULL default '0', - `inv_rng` int(10) unsigned NOT NULL default '0', - `inv_mdur` int(10) unsigned NOT NULL default '0', - `inv_slots` int(10) unsigned NOT NULL default '0', - `inv_slt1` int(10) unsigned NOT NULL default '0', - `inv_slt2` int(10) unsigned NOT NULL default '0', - `inv_slt3` int(10) unsigned NOT NULL default '0', - `inv_slt4` int(10) unsigned NOT NULL default '0', - `inv_slt5` int(10) unsigned NOT NULL default '0', - `inv_atype` int(10) unsigned NOT NULL default '0', - `inv_contain` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`inv_id`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1; - -/*Table structure for table `moneytransactions` */ - -DROP TABLE IF EXISTS `moneytransactions`; - -CREATE TABLE `moneytransactions` ( - `mt_id` int(10) NOT NULL auto_increment, - `mt_clanid` int(10) default '0', - `mt_amount` int(10) default '0', - `mt_player` int(10) default '0', - `mt_date` char(45) collate latin1_general_ci default '2750-01-01 00:00:00', - `mt_comment` char(255) collate latin1_general_ci default '0', - PRIMARY KEY (`mt_id`) -) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `neochronicle` */ - -DROP TABLE IF EXISTS `neochronicle`; - -CREATE TABLE `neochronicle` ( - `nc_id` int(10) unsigned NOT NULL auto_increment, - `nc_name` varchar(45) NOT NULL default '', - `nc_content` text NOT NULL, - `nc_datetime` varchar(45) NOT NULL default '', - `nc_lang` int(2) default NULL, - `nc_approved` int(1) default '0', - `nc_author` char(45) default '', - `nc_icon` int(10) default '0', - PRIMARY KEY (`nc_id`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; - -/*Table structure for table `neocron articles` */ - -DROP TABLE IF EXISTS `neocron articles`; - -CREATE TABLE `neocron articles` ( - `na_id` int(10) unsigned NOT NULL auto_increment, - `na_datetime` varchar(45) NOT NULL default '', - `na_author` varchar(45) NOT NULL default '0', - `na_name` varchar(45) NOT NULL default '', - `na_content` text NOT NULL, - `na_approval` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`na_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -/*Table structure for table `npc_shop` */ - -DROP TABLE IF EXISTS `npc_shop`; - -CREATE TABLE `npc_shop` ( - `c_npc_id` int(11) default NULL COMMENT 'The NPC WorldID', - `c_zoneid` int(11) default NULL COMMENT 'The ZoneID in which the NPC is', - `c_itemid` int(11) default NULL COMMENT 'ItemID for sale', - `c_itemprice` int(11) default NULL COMMENT 'Price for this item' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `npc_spawns` */ - -DROP TABLE IF EXISTS `npc_spawns`; - -CREATE TABLE `npc_spawns` ( - `npc_id` int(10) unsigned NOT NULL auto_increment, - `npc_worldid` int(10) unsigned NOT NULL default '0', - `npc_nameid` int(10) unsigned NOT NULL default '0', - `npc_typeid` int(10) unsigned NOT NULL default '0', - `npc_name` varchar(45) NOT NULL default '', - `npc_location` int(10) unsigned NOT NULL default '0', - `npc_x` int(10) unsigned NOT NULL default '0', - `npc_y` int(10) unsigned NOT NULL default '0', - `npc_z` int(10) unsigned NOT NULL default '0', - `npc_angle` int(11) NOT NULL default '0', - `npc_clothing` int(10) unsigned NOT NULL default '0', - `npc_loot` int(10) unsigned NOT NULL default '0', - `npc_unknown` int(10) unsigned NOT NULL default '0', - `npc_trader` int(10) unsigned NOT NULL default '0', - `npc_customname` varchar(80) default NULL, - `npc_customscript` varchar(100) default NULL, - `npc_shop_quality` int(3) default '50' COMMENT 'The quality of items if this npc has items to sell', - `npc_scripting` int(1) default '1' COMMENT '1: Scripts enabled 0: Scripts disabled', - PRIMARY KEY (`npc_id`) -) ENGINE=InnoDB AUTO_INCREMENT=9968 DEFAULT CHARSET=latin1; - -/*Table structure for table `outposts` */ - -DROP TABLE IF EXISTS `outposts`; - -CREATE TABLE `outposts` ( - `o_id` int(10) unsigned NOT NULL auto_increment, - `o_outnum` int(10) unsigned NOT NULL default '0', - `o_security` int(10) unsigned NOT NULL default '0', - `o_clan` int(10) unsigned NOT NULL default '0', - `o_gr` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`o_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2213 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `stockx` */ - -DROP TABLE IF EXISTS `stockx`; - -CREATE TABLE `stockx` ( - `st_id` int(10) unsigned NOT NULL auto_increment, - `st_factid` int(10) unsigned NOT NULL default '0', - `st_curval` float NOT NULL default '0', - `st_oldval` float NOT NULL default '0', - PRIMARY KEY (`st_id`) -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; - -/*Table structure for table `stockx_depots` */ - -DROP TABLE IF EXISTS `stockx_depots`; - -CREATE TABLE `stockx_depots` ( - `sxd_id` int(10) NOT NULL auto_increment, - `sxd_playerid` int(10) default '0', - `sxd_st_id` int(10) default '0', - `sxd_amount` int(10) default '0', - `sxd_paid` int(10) default '0', - PRIMARY KEY (`sxd_id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `support` */ - -DROP TABLE IF EXISTS `support`; - -CREATE TABLE `support` ( - `su_id` int(10) NOT NULL auto_increment, - `su_player` int(10) default '0', - `su_datetime` varchar(45) collate latin1_general_ci default '', - `su_supporterid` int(10) default '0', - `su_desc` char(255) collate latin1_general_ci default '', - `su_type` int(1) default '0', - `su_worldid` int(10) default '0', - `su_inwork` int(1) default '0', - `su_finished` int(1) default '0', - PRIMARY KEY (`su_id`) -) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - -/*Table structure for table `vehicles` */ - -DROP TABLE IF EXISTS `vehicles`; - -CREATE TABLE `vehicles` ( - `v_id` int(10) unsigned NOT NULL auto_increment, - `v_owner` int(10) unsigned NOT NULL default '0', - `v_type` int(10) unsigned NOT NULL default '0', - `v_condition` int(10) unsigned NOT NULL default '0', - `v_status` int(10) unsigned NOT NULL default '0', - `v_world` int(10) default '0', - PRIMARY KEY (`v_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; - -/*Table structure for table `world_actors` */ - -DROP TABLE IF EXISTS `world_actors`; - -CREATE TABLE `world_actors` ( - `wa_id` int(10) unsigned NOT NULL auto_increment COMMENT 'Unique ID', - `wa_actor_id` int(10) unsigned default NULL COMMENT 'u32 ID for the worldactor', - `wa_actor_map` int(10) unsigned default NULL COMMENT 'World/Zone ID', - `wa_actor_model` int(10) unsigned default NULL COMMENT 'ID of worldactor (pak_models.ini)', - `wa_actor_type` int(10) unsigned default NULL COMMENT 'Function type of the actor', - `wa_posX` int(10) unsigned default NULL, - `wa_posY` int(10) unsigned default NULL, - `wa_posZ` int(10) unsigned default NULL, - `wa_rotX` int(10) unsigned default NULL, - `wa_rotY` int(10) unsigned default NULL, - `wa_rotZ` int(10) unsigned default NULL, - `wa_option1` int(10) unsigned default NULL, - `wa_option2` int(10) unsigned default NULL, - `wa_option3` int(10) unsigned default NULL, - PRIMARY KEY (`wa_id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; - -/*Table structure for table `worlds` */ - -DROP TABLE IF EXISTS `worlds`; - -CREATE TABLE `worlds` ( - `wr_id` int(10) NOT NULL default '0', - `wr_group` int(10) default '0', - PRIMARY KEY (`wr_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; - - +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`gameserver` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci */; + +USE `gameserver`; + +/*Table structure for table `apartments` */ + +DROP TABLE IF EXISTS `apartments`; + +CREATE TABLE `apartments` ( + `apt_id` int(10) unsigned NOT NULL auto_increment, + `apt_location` int(10) unsigned NOT NULL default '0', + `apt_type` int(10) unsigned NOT NULL default '0', + `apt_password` varchar(45) NOT NULL default '', + `apt_owner` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`apt_id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; + +/*Table structure for table `buddy_list` */ + +DROP TABLE IF EXISTS `buddy_list`; + +CREATE TABLE `buddy_list` ( + `bud_id` int(10) NOT NULL auto_increment, + `bud_charid` int(10) NOT NULL default '0', + `bud_buddyid` mediumint(10) NOT NULL default '0', + PRIMARY KEY (`bud_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Table structure for table `bug_report` */ + +DROP TABLE IF EXISTS `bug_report`; + +CREATE TABLE `bug_report` ( + `br_id` int(10) unsigned NOT NULL auto_increment, + `br_type` int(10) unsigned NOT NULL default '0' COMMENT 'Type', + `br_desc` varchar(1024) NOT NULL COMMENT 'Description', + `br_fromid` int(10) unsigned NOT NULL default '0' COMMENT 'Char ID of reporter', + `br_location` int(10) unsigned NOT NULL default '0' COMMENT 'Location where problem occured', + `br_status` int(10) unsigned NOT NULL default '0' COMMENT 'Status', + `br_datetime` varchar(45) NOT NULL COMMENT 'Date/Time', + `br_supid` int(10) unsigned NOT NULL default '0' COMMENT 'Supporter ID', + PRIMARY KEY (`br_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Table structure for table `characters` */ + +DROP TABLE IF EXISTS `characters`; + +CREATE TABLE `characters` ( + `c_id` int(10) unsigned NOT NULL auto_increment, + `c_name` varchar(45) default '', + `c_str_lvl` int(10) unsigned default '0', + `c_str_pts` int(10) unsigned default '0', + `c_int_lvl` int(10) unsigned default '0', + `c_int_pts` int(10) unsigned default '0', + `c_dex_lvl` int(10) unsigned default '0', + `c_dex_pts` int(10) unsigned default '0', + `c_con_lvl` int(10) unsigned default '0', + `c_con_pts` int(10) unsigned default '0', + `c_psi_lvl` int(10) unsigned default '0', + `c_psi_pts` int(10) unsigned default '0', + `a_id` int(10) unsigned default '0', + `c_class` int(10) unsigned default '0', + `c_profession` int(10) unsigned default '0', + `c_sex` int(10) unsigned default '0', + `c_location` int(10) unsigned default '1', + `c_mc` int(10) unsigned default '0', + `c_hc` int(10) unsigned default '0', + `c_tra` int(10) unsigned default '0', + `c_pc` int(10) unsigned default '0', + `c_rc` int(10) unsigned default '0', + `c_tc` int(10) unsigned default '0', + `c_vhc` int(10) unsigned default '0', + `c_agl` int(10) unsigned default '0', + `c_rep` int(10) unsigned default '0', + `c_rec` int(10) unsigned default '0', + `c_rcl` int(10) unsigned default '0', + `c_atl` int(10) unsigned default '0', + `c_end` int(10) unsigned default '0', + `c_for` int(10) unsigned default '0', + `c_fir` int(10) unsigned default '0', + `c_enr` int(10) unsigned default '0', + `c_xrr` int(10) unsigned default '0', + `c_por` int(10) unsigned default '0', + `c_htl` int(10) unsigned default '0', + `c_hck` int(10) unsigned default '0', + `c_brt` int(10) unsigned default '0', + `c_psu` int(10) unsigned default '0', + `c_wep` int(10) unsigned default '0', + `c_cst` int(10) unsigned default '0', + `c_res` int(10) unsigned default '0', + `c_imp` int(10) unsigned default '0', + `c_ppu` int(10) unsigned default '0', + `c_apu` int(10) unsigned default '0', + `c_mst` int(10) unsigned default '0', + `c_ppw` int(10) unsigned default '0', + `c_psr` int(10) unsigned default '0', + `c_wpw` int(10) unsigned default '0', + `c_apt` int(10) unsigned default '0', + `c_cash` int(10) unsigned default '0', + `c_head` int(10) unsigned default '0', + `c_torso` int(10) unsigned default '0', + `c_legs` int(10) unsigned default '0', + `c_str_xp` float default '0', + `c_int_xp` float default '0', + `c_dex_xp` float default '0', + `c_psi_xp` float default '0', + `c_con_xp` float default '0', + `c_pos_x` float NOT NULL default '0', + `c_pos_y` float NOT NULL default '0', + `c_pos_z` float NOT NULL default '0', + `c_angle_ud` float NOT NULL default '0', + `c_angle_lr` float NOT NULL default '0', + `c_faction` int(10) unsigned NOT NULL default '0', + `c_slot` smallint(5) unsigned NOT NULL default '0', + `c_online` int(1) default '0', + `c_clan` int(10) default '0', + `c_soullight` int(3) default '10', + PRIMARY KEY (`c_id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Table structure for table `clanlevels` */ + +DROP TABLE IF EXISTS `clanlevels`; + +CREATE TABLE `clanlevels` ( + `cll_id` int(10) NOT NULL auto_increment, + `cll_clanid` int(10) default '0', + `cll_level` int(2) default '0', + `cll_desc` char(255) collate latin1_general_ci default NULL, + `cll_charid` int(10) default NULL, + PRIMARY KEY (`cll_id`) +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `clans` */ + +DROP TABLE IF EXISTS `clans`; + +CREATE TABLE `clans` ( + `cl_id` int(10) unsigned NOT NULL auto_increment, + `cl_shortdesc` char(16) collate latin1_general_ci default NULL, + `cl_name` char(64) collate latin1_general_ci default NULL, + `cl_faction` int(2) default NULL, + `cl_description` varchar(256) collate latin1_general_ci default NULL, + `cl_leader` int(10) default '0', + `cl_money` int(10) default '0', + `cl_minsympathy` int(3) default '70', + `cl_appid` int(10) default '0', + `cl_representative` int(10) default '0', + PRIMARY KEY (`cl_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1002 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `clanwars` */ + +DROP TABLE IF EXISTS `clanwars`; + +CREATE TABLE `clanwars` ( + `cw_id` int(10) NOT NULL auto_increment, + `cw_initclan` int(10) default '0', + `cw_enemyclan` int(10) default '0', + `cw_starttime` varchar(45) collate latin1_general_ci default '', + `cw_status` int(2) default '0', + `cw_statement_initiator` varchar(512) collate latin1_general_ci default '', + `cw_statement_enemy` varchar(512) collate latin1_general_ci default '', + PRIMARY KEY (`cw_id`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `contacts` */ + +DROP TABLE IF EXISTS `contacts`; + +CREATE TABLE `contacts` ( + `c_id` int(10) unsigned NOT NULL auto_increment, + `c_listid` int(10) unsigned NOT NULL default '0' COMMENT 'Who''s list?', + `c_conid` int(10) unsigned NOT NULL default '0' COMMENT 'Char ID of person on list', + `c_type` int(10) unsigned NOT NULL default '0' COMMENT '1=Personal, 2=Business, 3=Allied', + `c_desc` varchar(256) NOT NULL, + PRIMARY KEY (`c_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; + +/*Table structure for table `datacubes` */ + +DROP TABLE IF EXISTS `datacubes`; + +CREATE TABLE `datacubes` ( + `cb_id` int(10) NOT NULL auto_increment, + `cb_securitycode` char(30) collate latin1_general_ci default '', + `cb_inscription` tinytext collate latin1_general_ci, + PRIMARY KEY (`cb_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `emails` */ + +DROP TABLE IF EXISTS `emails`; + +CREATE TABLE `emails` ( + `e_id` int(10) unsigned NOT NULL auto_increment, + `e_subject` varchar(128) NOT NULL default '', + `e_fromid` int(10) unsigned NOT NULL default '0', + `e_datetime` varchar(45) NOT NULL default '0', + `e_toid` int(10) unsigned NOT NULL default '0', + `e_body` varchar(512) NOT NULL, + `e_new` tinyint(1) NOT NULL default '1', + `e_replied` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`e_id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Table structure for table `forum_posts` */ + +DROP TABLE IF EXISTS `forum_posts`; + +CREATE TABLE `forum_posts` ( + `fp_id` int(10) unsigned NOT NULL auto_increment, + `fp_name` varchar(45) NOT NULL default '', + `fp_fromid` int(10) unsigned NOT NULL default '0', + `fp_content` varchar(2048) NOT NULL default '', + `fp_datetime` varchar(45) NOT NULL default '', + `fp_replyid` int(10) unsigned NOT NULL default '0', + `fp_forumid` int(10) unsigned NOT NULL default '0', + `fp_factionid` int(2) default '0', + `fp_clanid` int(10) default '0', + PRIMARY KEY (`fp_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; + +/*Table structure for table `forums` */ + +DROP TABLE IF EXISTS `forums`; + +CREATE TABLE `forums` ( + `f_id` int(10) unsigned NOT NULL auto_increment, + `f_name` varchar(45) NOT NULL default '', + `f_area` int(10) unsigned NOT NULL default '0', + `f_showname` varchar(45) NOT NULL default '', + PRIMARY KEY (`f_id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; + +/*Table structure for table `genrep` */ + +DROP TABLE IF EXISTS `genrep`; + +CREATE TABLE `genrep` ( + `g_id` int(10) unsigned NOT NULL auto_increment, + `g_worldid` int(10) unsigned NOT NULL default '0', + `g_stationid` int(10) unsigned NOT NULL default '0', + `g_charid` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`g_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Table structure for table `guides` */ + +DROP TABLE IF EXISTS `guides`; + +CREATE TABLE `guides` ( + `g_id` int(10) unsigned NOT NULL auto_increment, + `g_type` int(10) unsigned NOT NULL default '0', + `g_title` varchar(45) NOT NULL default '', + `g_language` int(2) default NULL, + `g_content` text NOT NULL, + `g_chapter` int(1) default '0', + `g_part` int(1) default '0', + PRIMARY KEY (`g_id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Table structure for table `inventory` */ + +DROP TABLE IF EXISTS `inventory`; + +CREATE TABLE `inventory` ( + `inv_id` int(10) unsigned NOT NULL auto_increment, + `inv_charid` int(10) unsigned NOT NULL default '0', + `inv_loc` int(10) unsigned NOT NULL default '0', + `inv_x` int(10) unsigned NOT NULL default '0', + `inv_y` int(10) unsigned NOT NULL default '0', + `inv_itemid` int(10) unsigned NOT NULL default '0', + `inv_flag` int(10) unsigned NOT NULL default '0', + `inv_qty` int(10) unsigned NOT NULL default '0', + `inv_sqty` int(10) unsigned NOT NULL default '0', + `inv_cdur` int(10) unsigned NOT NULL default '0', + `inv_dmg` int(10) unsigned NOT NULL default '0', + `inv_frq` int(10) unsigned NOT NULL default '0', + `inv_hnd` int(10) unsigned NOT NULL default '0', + `inv_rng` int(10) unsigned NOT NULL default '0', + `inv_mdur` int(10) unsigned NOT NULL default '0', + `inv_slots` int(10) unsigned NOT NULL default '0', + `inv_slt1` int(10) unsigned NOT NULL default '0', + `inv_slt2` int(10) unsigned NOT NULL default '0', + `inv_slt3` int(10) unsigned NOT NULL default '0', + `inv_slt4` int(10) unsigned NOT NULL default '0', + `inv_slt5` int(10) unsigned NOT NULL default '0', + `inv_atype` int(10) unsigned NOT NULL default '0', + `inv_contain` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`inv_id`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1; + +/*Table structure for table `moneytransactions` */ + +DROP TABLE IF EXISTS `moneytransactions`; + +CREATE TABLE `moneytransactions` ( + `mt_id` int(10) NOT NULL auto_increment, + `mt_clanid` int(10) default '0', + `mt_amount` int(10) default '0', + `mt_player` int(10) default '0', + `mt_date` char(45) collate latin1_general_ci default '2750-01-01 00:00:00', + `mt_comment` char(255) collate latin1_general_ci default '0', + PRIMARY KEY (`mt_id`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `neochronicle` */ + +DROP TABLE IF EXISTS `neochronicle`; + +CREATE TABLE `neochronicle` ( + `nc_id` int(10) unsigned NOT NULL auto_increment, + `nc_name` varchar(45) NOT NULL default '', + `nc_content` text NOT NULL, + `nc_datetime` varchar(45) NOT NULL default '', + `nc_lang` int(2) default NULL, + `nc_approved` int(1) default '0', + `nc_author` char(45) default '', + `nc_icon` int(10) default '0', + PRIMARY KEY (`nc_id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; + +/*Table structure for table `neocron articles` */ + +DROP TABLE IF EXISTS `neocron articles`; + +CREATE TABLE `neocron articles` ( + `na_id` int(10) unsigned NOT NULL auto_increment, + `na_datetime` varchar(45) NOT NULL default '', + `na_author` varchar(45) NOT NULL default '0', + `na_name` varchar(45) NOT NULL default '', + `na_content` text NOT NULL, + `na_approval` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`na_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Table structure for table `npc_shop` */ + +DROP TABLE IF EXISTS `npc_shop`; + +CREATE TABLE `npc_shop` ( + `c_npc_id` int(11) default NULL COMMENT 'The NPC WorldID', + `c_zoneid` int(11) default NULL COMMENT 'The ZoneID in which the NPC is', + `c_itemid` int(11) default NULL COMMENT 'ItemID for sale', + `c_itemprice` int(11) default NULL COMMENT 'Price for this item' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `npc_spawns` */ + +DROP TABLE IF EXISTS `npc_spawns`; + +CREATE TABLE `npc_spawns` ( + `npc_id` int(10) unsigned NOT NULL auto_increment, + `npc_worldid` int(10) unsigned NOT NULL default '0', + `npc_nameid` int(10) unsigned NOT NULL default '0', + `npc_typeid` int(10) unsigned NOT NULL default '0', + `npc_name` varchar(45) NOT NULL default '', + `npc_location` int(10) unsigned NOT NULL default '0', + `npc_x` int(10) unsigned NOT NULL default '0', + `npc_y` int(10) unsigned NOT NULL default '0', + `npc_z` int(10) unsigned NOT NULL default '0', + `npc_angle` int(11) NOT NULL default '0', + `npc_clothing` int(10) unsigned NOT NULL default '0', + `npc_loot` int(10) unsigned NOT NULL default '0', + `npc_unknown` int(10) unsigned NOT NULL default '0', + `npc_trader` int(10) unsigned NOT NULL default '0', + `npc_customname` varchar(80) default NULL, + `npc_customscript` varchar(100) default NULL, + `npc_shop_quality` int(3) default '50' COMMENT 'The quality of items if this npc has items to sell', + `npc_scripting` int(1) default '1' COMMENT '1: Scripts enabled 0: Scripts disabled', + PRIMARY KEY (`npc_id`) +) ENGINE=InnoDB AUTO_INCREMENT=9968 DEFAULT CHARSET=latin1; + +/*Table structure for table `outposts` */ + +DROP TABLE IF EXISTS `outposts`; + +CREATE TABLE `outposts` ( + `o_id` int(10) unsigned NOT NULL auto_increment, + `o_outnum` int(10) unsigned NOT NULL default '0', + `o_security` int(10) unsigned NOT NULL default '0', + `o_clan` int(10) unsigned NOT NULL default '0', + `o_gr` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`o_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2213 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `stockx` */ + +DROP TABLE IF EXISTS `stockx`; + +CREATE TABLE `stockx` ( + `st_id` int(10) unsigned NOT NULL auto_increment, + `st_factid` int(10) unsigned NOT NULL default '0', + `st_curval` float NOT NULL default '0', + `st_oldval` float NOT NULL default '0', + PRIMARY KEY (`st_id`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; + +/*Table structure for table `stockx_depots` */ + +DROP TABLE IF EXISTS `stockx_depots`; + +CREATE TABLE `stockx_depots` ( + `sxd_id` int(10) NOT NULL auto_increment, + `sxd_playerid` int(10) default '0', + `sxd_st_id` int(10) default '0', + `sxd_amount` int(10) default '0', + `sxd_paid` int(10) default '0', + PRIMARY KEY (`sxd_id`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `support` */ + +DROP TABLE IF EXISTS `support`; + +CREATE TABLE `support` ( + `su_id` int(10) NOT NULL auto_increment, + `su_player` int(10) default '0', + `su_datetime` varchar(45) collate latin1_general_ci default '', + `su_supporterid` int(10) default '0', + `su_desc` char(255) collate latin1_general_ci default '', + `su_type` int(1) default '0', + `su_worldid` int(10) default '0', + `su_inwork` int(1) default '0', + `su_finished` int(1) default '0', + PRIMARY KEY (`su_id`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +/*Table structure for table `vehicles` */ + +DROP TABLE IF EXISTS `vehicles`; + +CREATE TABLE `vehicles` ( + `v_id` int(10) unsigned NOT NULL auto_increment, + `v_owner` int(10) unsigned NOT NULL default '0', + `v_type` int(10) unsigned NOT NULL default '0', + `v_condition` int(10) unsigned NOT NULL default '0', + `v_status` int(10) unsigned NOT NULL default '0', + `v_world` int(10) default '0', + PRIMARY KEY (`v_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; + +/*Table structure for table `world_actors` */ + +DROP TABLE IF EXISTS `world_actors`; + +CREATE TABLE `world_actors` ( + `wa_id` int(10) unsigned NOT NULL auto_increment COMMENT 'Unique ID', + `wa_actor_id` int(10) unsigned default NULL COMMENT 'u32 ID for the worldactor', + `wa_actor_map` int(10) unsigned default NULL COMMENT 'World/Zone ID', + `wa_actor_model` int(10) unsigned default NULL COMMENT 'ID of worldactor (pak_models.ini)', + `wa_actor_type` int(10) unsigned default NULL COMMENT 'Function type of the actor', + `wa_posX` int(10) unsigned default NULL, + `wa_posY` int(10) unsigned default NULL, + `wa_posZ` int(10) unsigned default NULL, + `wa_rotX` int(10) unsigned default NULL, + `wa_rotY` int(10) unsigned default NULL, + `wa_rotZ` int(10) unsigned default NULL, + `wa_option1` int(10) unsigned default NULL, + `wa_option2` int(10) unsigned default NULL, + `wa_option3` int(10) unsigned default NULL, + PRIMARY KEY (`wa_id`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; + +/*Table structure for table `worlds` */ + +DROP TABLE IF EXISTS `worlds`; + +CREATE TABLE `worlds` ( + `wr_id` int(10) NOT NULL default '0', + `wr_group` int(10) default '0', + PRIMARY KEY (`wr_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + + diff --git a/server/database/DB_v8/unified_infoDB_rev8.sql b/server/database/DB_v8/unified_infoDB_rev8.sql index 114ddc0..09e9d48 100644 --- a/server/database/DB_v8/unified_infoDB_rev8.sql +++ b/server/database/DB_v8/unified_infoDB_rev8.sql @@ -1,51 +1,51 @@ -/* -SQLyog Enterprise - MySQL GUI v7.1 -MySQL - 5.0.51a-24+lenny2 : Database - infoserver -********************************************************************* -*/ - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - -CREATE DATABASE /*!32312 IF NOT EXISTS*/`infoserver` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci */; - -USE `infoserver`; - -/*Table structure for table `accounts` */ - -DROP TABLE IF EXISTS `accounts`; - -CREATE TABLE `accounts` ( - `a_id` int(10) unsigned NOT NULL auto_increment, - `a_username` varchar(45) NOT NULL default '', - `a_password` varchar(45) NOT NULL default '', - `a_priv` int(10) unsigned default '0', - `a_status` int(10) unsigned default '0', - `a_bandate` int(11) unsigned NOT NULL default '0', - `a_emailaddress` varchar(255) NOT NULL, - `a_creationdate` datetime NOT NULL default '0000-00-00 00:00:00', - `a_lastused` datetime NOT NULL default '0000-00-00 00:00:00', - PRIMARY KEY (`a_id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - -/*Table structure for table `server_list` */ - -DROP TABLE IF EXISTS `server_list`; - -CREATE TABLE `server_list` ( - `s_id` int(10) unsigned NOT NULL auto_increment, - `s_name` varchar(15) NOT NULL default 'NC server', - `s_wanaddr` varchar(15) NOT NULL default '127.0.0.1', - `s_port` int(10) unsigned NOT NULL default '12000', - `s_players` int(10) unsigned NOT NULL default '0', - `s_lastupdate` datetime NOT NULL default '0000-00-00 00:00:00', - `s_lanaddr` varchar(15) NOT NULL default '127.0.0.1', - PRIMARY KEY (`s_id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/* +SQLyog Enterprise - MySQL GUI v7.1 +MySQL - 5.0.51a-24+lenny2 : Database - infoserver +********************************************************************* +*/+ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`infoserver` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci */; + +USE `infoserver`; + +/*Table structure for table `accounts` */ + +DROP TABLE IF EXISTS `accounts`; + +CREATE TABLE `accounts` ( + `a_id` int(10) unsigned NOT NULL auto_increment, + `a_username` varchar(45) NOT NULL default '', + `a_password` varchar(45) NOT NULL default '', + `a_priv` int(10) unsigned default '0', + `a_status` int(10) unsigned default '0', + `a_bandate` int(11) unsigned NOT NULL default '0', + `a_emailaddress` varchar(255) NOT NULL, + `a_creationdate` datetime NOT NULL default '0000-00-00 00:00:00', + `a_lastused` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`a_id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Table structure for table `server_list` */ + +DROP TABLE IF EXISTS `server_list`; + +CREATE TABLE `server_list` ( + `s_id` int(10) unsigned NOT NULL auto_increment, + `s_name` varchar(15) NOT NULL default 'NC server', + `s_wanaddr` varchar(15) NOT NULL default '127.0.0.1', + `s_port` int(10) unsigned NOT NULL default '12000', + `s_players` int(10) unsigned NOT NULL default '0', + `s_lastupdate` datetime NOT NULL default '0000-00-00 00:00:00', + `s_lanaddr` varchar(15) NOT NULL default '127.0.0.1', + PRIMARY KEY (`s_id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/server/database/GameDB_patch_rev133-rev134.sql b/server/database/GameDB_patch_rev133-rev134.sql index be6b56f..8aacff0 100644 --- a/server/database/GameDB_patch_rev133-rev134.sql +++ b/server/database/GameDB_patch_rev133-rev134.sql @@ -1,78 +1,78 @@ --- Database: `gameserver` --- --- New stuff for NPC Subsystem --- -USE `gameserver`; - --- -------------------------------------------------------- - --- --- Table structure for table `npc_spawns` --- - -DROP TABLE IF EXISTS `npc_spawns`; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -CREATE TABLE `npc_spawns` ( - `npc_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `npc_worldid` int(10) unsigned NOT NULL DEFAULT '0', - `npc_nameid` int(10) unsigned NOT NULL DEFAULT '0', - `npc_typeid` int(10) unsigned NOT NULL DEFAULT '0', - `npc_name` varchar(45) NOT NULL DEFAULT '', - `npc_location` int(10) unsigned NOT NULL DEFAULT '0', - `npc_x` int(10) unsigned NOT NULL DEFAULT '0', - `npc_y` int(10) unsigned NOT NULL DEFAULT '0', - `npc_z` int(10) unsigned NOT NULL DEFAULT '0', - `npc_angle` int(11) NOT NULL DEFAULT '0', - `npc_clothing` int(10) unsigned NOT NULL DEFAULT '0', - `npc_loot` int(10) unsigned NOT NULL DEFAULT '0', - `npc_unknown` int(10) unsigned NOT NULL DEFAULT '0', - `npc_trader` int(10) unsigned NOT NULL DEFAULT '0', - `npc_customname` varchar(80) DEFAULT NULL, - `npc_customscript` varchar(100) DEFAULT NULL, - `npc_shop_quality` int(3) DEFAULT '50' NULL COMMENT 'The quality of items if this npc has items to sell', - PRIMARY KEY (`npc_id`) -) ENGINE=InnoDB AUTO_INCREMENT=9916 DEFAULT CHARSET=latin1; -SET character_set_client = @saved_cs_client; - --- --- Dumping data for table `npc_spawns` --- - -LOCK TABLES `npc_spawns` WRITE; -/*!40000 ALTER TABLE `npc_spawns` DISABLE KEYS */; -INSERT INTO `npc_spawns` (npc_worldid, npc_nameid, npc_typeid, npc_name, npc_location, npc_x, npc_y, npc_z, npc_angle, npc_clothing, npc_unknown, npc_trader, npc_customname) -VALUES -(1020,385,61093,'WSK',1,33808,31332,32512,30,6612,8814,0,'Event Info'), -(1020,388,17634,'WSK',3,30063,34111,33136,90,6616,14035,0,'Event Info'), -(1018,387,32772,'WSK',101,31938,32165,32512,130,6616,16675,0,'Event Info'), -(1019,215,50585,'WSK',101,34209,33864,32512,359,197,19499,195,NULL), -(1020,385,13542,'WSK',101,33261,33113,32672,2,4342,17892,0,'VotR Paperboy'), -(1019,389,10890,'WSK',401,31105,32463,31936,92,6613,14572,0,'Event Info'), -(1020,1629,26858,'WSK',401,31265,30718,31952,177,2827,12567,0,NULL), -(976,2818,15528,'WSK',2071,23436,21380,35220,185,7214,9785,0,NULL), -(971,386,5040,'WSK',2181,38000,24127,33854,264,6622,2590,0,NULL), -(1020,836,43282,'MBOTFLY',2181,43068,26020,34020,0,31788,405,0,NULL), -(988,836,41913,'MBOTFLY',2181,41537,28260,33860,0,50146,380,0,NULL), -(1006,800,15709,'MBOT',2181,42047,28256,33786,0,14348,220,0,NULL), -(1005,800,28598,'MBOT',2181,44419,23412,33445,0,8332,585,0,NULL), -(1014,672,28153,'DOGBOT',2181,38041,29414,34088,0,21948,221,0,NULL), -(984,677,32746,'WBADGUY',2181,37985,31043,33939,0,21616,222,0,NULL), -(973,606,26878,'MUTANTB',2181,26220,27158,34106,0,20679,490,0,NULL), -(975,800,11783,'MBOT',2181,31285,23969,33970,0,722,38,0,NULL), -(981,640,61001,'FLYMUT',2181,26672,26657,34281,0,20684,1510,0,NULL), -(985,610,1100,'MGMUT',2181,28040,26301,34083,0,21559,628,0,NULL), -(986,640,1159,'FLYMUT',2181,27424,27264,34328,0,21560,1503,0,NULL), -(987,626,53397,'MUTANTB',2181,26386,27672,34135,0,20680,407,0,NULL), -(999,602,19865,'MUTANTB',2181,26771,26119,34228,0,21559,271,0,NULL), -(1003,730,39449,'BROBOT',2181,25425,32173,34055,0,20939,4285,0,NULL); -/*!40000 ALTER TABLE `npc_spawns` -ENABLE KEYS */; -UNLOCK TABLES; - -DROP TABLE IF EXISTS `npc_shop`; -CREATE TABLE `npc_shop`( - `c_npc_id` int COMMENT 'The NPC WorldID', - `c_zoneid` int COMMENT 'The ZoneID in which the NPC is', - `c_itemid` int COMMENT 'ItemID for sale', - `c_itemprice` int COMMENT 'Price for this item'); \ No newline at end of file +-- Database: `gameserver` +-- +-- New stuff for NPC Subsystem +-- +USE `gameserver`; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `npc_spawns` +-- + +DROP TABLE IF EXISTS `npc_spawns`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `npc_spawns` ( + `npc_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `npc_worldid` int(10) unsigned NOT NULL DEFAULT '0', + `npc_nameid` int(10) unsigned NOT NULL DEFAULT '0', + `npc_typeid` int(10) unsigned NOT NULL DEFAULT '0', + `npc_name` varchar(45) NOT NULL DEFAULT '', + `npc_location` int(10) unsigned NOT NULL DEFAULT '0', + `npc_x` int(10) unsigned NOT NULL DEFAULT '0', + `npc_y` int(10) unsigned NOT NULL DEFAULT '0', + `npc_z` int(10) unsigned NOT NULL DEFAULT '0', + `npc_angle` int(11) NOT NULL DEFAULT '0', + `npc_clothing` int(10) unsigned NOT NULL DEFAULT '0', + `npc_loot` int(10) unsigned NOT NULL DEFAULT '0', + `npc_unknown` int(10) unsigned NOT NULL DEFAULT '0', + `npc_trader` int(10) unsigned NOT NULL DEFAULT '0', + `npc_customname` varchar(80) DEFAULT NULL, + `npc_customscript` varchar(100) DEFAULT NULL, + `npc_shop_quality` int(3) DEFAULT '50' NULL COMMENT 'The quality of items if this npc has items to sell', + PRIMARY KEY (`npc_id`) +) ENGINE=InnoDB AUTO_INCREMENT=9916 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping data for table `npc_spawns` +-- + +LOCK TABLES `npc_spawns` WRITE; +/*!40000 ALTER TABLE `npc_spawns` DISABLE KEYS */; +INSERT INTO `npc_spawns` (npc_worldid, npc_nameid, npc_typeid, npc_name, npc_location, npc_x, npc_y, npc_z, npc_angle, npc_clothing, npc_unknown, npc_trader, npc_customname) +VALUES +(1020,385,61093,'WSK',1,33808,31332,32512,30,6612,8814,0,'Event Info'), +(1020,388,17634,'WSK',3,30063,34111,33136,90,6616,14035,0,'Event Info'), +(1018,387,32772,'WSK',101,31938,32165,32512,130,6616,16675,0,'Event Info'), +(1019,215,50585,'WSK',101,34209,33864,32512,359,197,19499,195,NULL), +(1020,385,13542,'WSK',101,33261,33113,32672,2,4342,17892,0,'VotR Paperboy'), +(1019,389,10890,'WSK',401,31105,32463,31936,92,6613,14572,0,'Event Info'), +(1020,1629,26858,'WSK',401,31265,30718,31952,177,2827,12567,0,NULL), +(976,2818,15528,'WSK',2071,23436,21380,35220,185,7214,9785,0,NULL), +(971,386,5040,'WSK',2181,38000,24127,33854,264,6622,2590,0,NULL), +(1020,836,43282,'MBOTFLY',2181,43068,26020,34020,0,31788,405,0,NULL), +(988,836,41913,'MBOTFLY',2181,41537,28260,33860,0,50146,380,0,NULL), +(1006,800,15709,'MBOT',2181,42047,28256,33786,0,14348,220,0,NULL), +(1005,800,28598,'MBOT',2181,44419,23412,33445,0,8332,585,0,NULL), +(1014,672,28153,'DOGBOT',2181,38041,29414,34088,0,21948,221,0,NULL), +(984,677,32746,'WBADGUY',2181,37985,31043,33939,0,21616,222,0,NULL), +(973,606,26878,'MUTANTB',2181,26220,27158,34106,0,20679,490,0,NULL), +(975,800,11783,'MBOT',2181,31285,23969,33970,0,722,38,0,NULL), +(981,640,61001,'FLYMUT',2181,26672,26657,34281,0,20684,1510,0,NULL), +(985,610,1100,'MGMUT',2181,28040,26301,34083,0,21559,628,0,NULL), +(986,640,1159,'FLYMUT',2181,27424,27264,34328,0,21560,1503,0,NULL), +(987,626,53397,'MUTANTB',2181,26386,27672,34135,0,20680,407,0,NULL), +(999,602,19865,'MUTANTB',2181,26771,26119,34228,0,21559,271,0,NULL), +(1003,730,39449,'BROBOT',2181,25425,32173,34055,0,20939,4285,0,NULL); +/*!40000 ALTER TABLE `npc_spawns` +ENABLE KEYS */; +UNLOCK TABLES; + +DROP TABLE IF EXISTS `npc_shop`; +CREATE TABLE `npc_shop`( + `c_npc_id` int COMMENT 'The NPC WorldID', + `c_zoneid` int COMMENT 'The ZoneID in which the NPC is', + `c_itemid` int COMMENT 'ItemID for sale', + `c_itemprice` int COMMENT 'Price for this item'); diff --git a/server/database/GameDB_patch_rev134-rev140.sql b/server/database/GameDB_patch_rev134-rev140.sql index 1d5bc2a..d3a5983 100644 --- a/server/database/GameDB_patch_rev134-rev140.sql +++ b/server/database/GameDB_patch_rev134-rev140.sql @@ -1,49 +1,49 @@ -/* -SQLyog Community Edition- MySQL GUI v7.02 -MySQL - 5.0.51a-24+lenny2 : Database - gameserver -********************************************************************* -*/ - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - -CREATE DATABASE /*!32312 IF NOT EXISTS*/`gameserver` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci */; - -USE `gameserver`; - -/*Table structure for table `npc_spawns` */ - -DROP TABLE IF EXISTS `npc_spawns`; - -CREATE TABLE `npc_spawns` ( - `npc_id` int(10) unsigned NOT NULL auto_increment, - `npc_worldid` int(10) unsigned NOT NULL default '0', - `npc_nameid` int(10) unsigned NOT NULL default '0', - `npc_typeid` int(10) unsigned NOT NULL default '0', - `npc_name` varchar(45) NOT NULL default '', - `npc_location` int(10) unsigned NOT NULL default '0', - `npc_x` int(10) unsigned NOT NULL default '0', - `npc_y` int(10) unsigned NOT NULL default '0', - `npc_z` int(10) unsigned NOT NULL default '0', - `npc_angle` int(11) NOT NULL default '0', - `npc_clothing` int(10) unsigned NOT NULL default '0', - `npc_loot` int(10) unsigned NOT NULL default '0', - `npc_unknown` int(10) unsigned NOT NULL default '0', - `npc_trader` int(10) unsigned NOT NULL default '0', - `npc_customname` varchar(80) default NULL, - `npc_customscript` varchar(100) default NULL, - `npc_shop_quality` int(3) default '50' COMMENT 'The quality of items if this npc has items to sell', - `npc_scripting` int(1) default '1' COMMENT '1: Scripts enabled 0: Scripts disabled', - PRIMARY KEY (`npc_id`) -) ENGINE=InnoDB AUTO_INCREMENT=9942 DEFAULT CHARSET=latin1; - -/*Data for the table `npc_spawns` */ - -insert into `npc_spawns`(`npc_id`,`npc_worldid`,`npc_nameid`,`npc_typeid`,`npc_name`,`npc_location`,`npc_x`,`npc_y`,`npc_z`,`npc_angle`,`npc_clothing`,`npc_loot`,`npc_unknown`,`npc_trader`,`npc_customname`,`npc_customscript`,`npc_shop_quality`,`npc_scripting`) values (9916,1020,385,61093,'WSK',1,33808,31332,32512,30,6612,0,8814,0,'Zippy the Trader','scripts/lua/zippy.lua',50,1),(9917,1018,387,32772,'WSK',101,31938,32165,32512,130,6616,0,16675,0,'Event Info',NULL,50,1),(9918,1019,215,50585,'WSK',101,34209,33864,32512,359,197,0,19499,195,'VotR Paperboy',NULL,50,1),(9919,1020,385,13542,'WSK',101,33261,33113,32672,2,4342,0,17892,0,NULL,NULL,50,1),(9920,976,2818,15528,'WSK',2071,23436,21380,35220,185,7214,0,9785,0,NULL,NULL,50,1),(9921,971,386,5040,'WSK',2181,38000,24127,33854,264,6622,0,2590,0,NULL,NULL,50,1),(9922,1020,836,43282,'MBOTFLY',2181,43068,26020,34020,0,31788,0,405,0,NULL,NULL,50,1),(9923,988,836,41913,'MBOTFLY',2181,41537,28260,33860,0,50146,0,380,0,NULL,NULL,50,1),(9924,1006,800,15709,'MBOT',2181,42047,28256,33786,0,14348,0,220,0,NULL,NULL,50,1),(9925,1005,800,28598,'MBOT',2181,44419,23412,33445,0,8332,0,585,0,NULL,NULL,50,1),(9926,1014,672,28153,'DOGBOT',2181,38041,29414,34088,0,21948,0,221,0,NULL,NULL,50,1),(9927,984,677,32746,'WBADGUY',2181,37985,31043,33939,0,21616,0,222,0,NULL,NULL,50,1),(9928,973,606,26878,'MUTANTB',2181,26220,27158,34106,0,20679,0,490,0,NULL,NULL,50,1),(9929,975,800,11783,'MBOT',2181,31285,23969,33970,0,722,0,38,0,NULL,NULL,50,1),(9930,981,640,61001,'FLYMUT',2181,26672,26657,34281,0,20684,0,1510,0,NULL,NULL,50,1),(9931,985,610,1100,'MGMUT',2181,28040,26301,34083,0,21559,0,628,0,NULL,NULL,50,1),(9932,986,640,1159,'FLYMUT',2181,27424,27264,34328,0,21560,0,1503,0,NULL,NULL,50,1),(9933,987,626,53397,'MUTANTB',2181,26386,27672,34135,0,20680,0,407,0,NULL,NULL,50,1),(9934,999,602,19865,'MUTANTB',2181,26771,26119,34228,0,21559,0,271,0,NULL,NULL,50,1),(9935,1003,730,39449,'BROBOT',2181,25425,32173,34055,0,20939,0,4285,0,NULL,NULL,50,1); - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/* +SQLyog Community Edition- MySQL GUI v7.02 +MySQL - 5.0.51a-24+lenny2 : Database - gameserver +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`gameserver` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci */; + +USE `gameserver`; + +/*Table structure for table `npc_spawns` */ + +DROP TABLE IF EXISTS `npc_spawns`; + +CREATE TABLE `npc_spawns` ( + `npc_id` int(10) unsigned NOT NULL auto_increment, + `npc_worldid` int(10) unsigned NOT NULL default '0', + `npc_nameid` int(10) unsigned NOT NULL default '0', + `npc_typeid` int(10) unsigned NOT NULL default '0', + `npc_name` varchar(45) NOT NULL default '', + `npc_location` int(10) unsigned NOT NULL default '0', + `npc_x` int(10) unsigned NOT NULL default '0', + `npc_y` int(10) unsigned NOT NULL default '0', + `npc_z` int(10) unsigned NOT NULL default '0', + `npc_angle` int(11) NOT NULL default '0', + `npc_clothing` int(10) unsigned NOT NULL default '0', + `npc_loot` int(10) unsigned NOT NULL default '0', + `npc_unknown` int(10) unsigned NOT NULL default '0', + `npc_trader` int(10) unsigned NOT NULL default '0', + `npc_customname` varchar(80) default NULL, + `npc_customscript` varchar(100) default NULL, + `npc_shop_quality` int(3) default '50' COMMENT 'The quality of items if this npc has items to sell', + `npc_scripting` int(1) default '1' COMMENT '1: Scripts enabled 0: Scripts disabled', + PRIMARY KEY (`npc_id`) +) ENGINE=InnoDB AUTO_INCREMENT=9942 DEFAULT CHARSET=latin1; + +/*Data for the table `npc_spawns` */ + +insert into `npc_spawns`(`npc_id`,`npc_worldid`,`npc_nameid`,`npc_typeid`,`npc_name`,`npc_location`,`npc_x`,`npc_y`,`npc_z`,`npc_angle`,`npc_clothing`,`npc_loot`,`npc_unknown`,`npc_trader`,`npc_customname`,`npc_customscript`,`npc_shop_quality`,`npc_scripting`) values (9916,1020,385,61093,'WSK',1,33808,31332,32512,30,6612,0,8814,0,'Zippy the Trader','scripts/lua/zippy.lua',50,1),(9917,1018,387,32772,'WSK',101,31938,32165,32512,130,6616,0,16675,0,'Event Info',NULL,50,1),(9918,1019,215,50585,'WSK',101,34209,33864,32512,359,197,0,19499,195,'VotR Paperboy',NULL,50,1),(9919,1020,385,13542,'WSK',101,33261,33113,32672,2,4342,0,17892,0,NULL,NULL,50,1),(9920,976,2818,15528,'WSK',2071,23436,21380,35220,185,7214,0,9785,0,NULL,NULL,50,1),(9921,971,386,5040,'WSK',2181,38000,24127,33854,264,6622,0,2590,0,NULL,NULL,50,1),(9922,1020,836,43282,'MBOTFLY',2181,43068,26020,34020,0,31788,0,405,0,NULL,NULL,50,1),(9923,988,836,41913,'MBOTFLY',2181,41537,28260,33860,0,50146,0,380,0,NULL,NULL,50,1),(9924,1006,800,15709,'MBOT',2181,42047,28256,33786,0,14348,0,220,0,NULL,NULL,50,1),(9925,1005,800,28598,'MBOT',2181,44419,23412,33445,0,8332,0,585,0,NULL,NULL,50,1),(9926,1014,672,28153,'DOGBOT',2181,38041,29414,34088,0,21948,0,221,0,NULL,NULL,50,1),(9927,984,677,32746,'WBADGUY',2181,37985,31043,33939,0,21616,0,222,0,NULL,NULL,50,1),(9928,973,606,26878,'MUTANTB',2181,26220,27158,34106,0,20679,0,490,0,NULL,NULL,50,1),(9929,975,800,11783,'MBOT',2181,31285,23969,33970,0,722,0,38,0,NULL,NULL,50,1),(9930,981,640,61001,'FLYMUT',2181,26672,26657,34281,0,20684,0,1510,0,NULL,NULL,50,1),(9931,985,610,1100,'MGMUT',2181,28040,26301,34083,0,21559,0,628,0,NULL,NULL,50,1),(9932,986,640,1159,'FLYMUT',2181,27424,27264,34328,0,21560,0,1503,0,NULL,NULL,50,1),(9933,987,626,53397,'MUTANTB',2181,26386,27672,34135,0,20680,0,407,0,NULL,NULL,50,1),(9934,999,602,19865,'MUTANTB',2181,26771,26119,34228,0,21559,0,271,0,NULL,NULL,50,1),(9935,1003,730,39449,'BROBOT',2181,25425,32173,34055,0,20939,0,4285,0,NULL,NULL,50,1); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/server/database/infoDB.s3db b/server/database/infoDB.s3db new file mode 100644 index 0000000..467953c Binary files /dev/null and b/server/database/infoDB.s3db differ diff --git a/server/tinns b/server/init.d/tinns similarity index 100% rename from server/tinns rename to server/init.d/tinns diff --git a/server/src/CMakeLists.txt b/server/src/CMakeLists.txt new file mode 100644 index 0000000..e7d2c02 --- /dev/null +++ b/server/src/CMakeLists.txt @@ -0,0 +1,8 @@ +# move base dir to src +include_directories (${TINNS_SOURCE_DIR}/server/src) + +add_subdirectory (common) +add_subdirectory (dev-tools) +add_subdirectory (game) +add_subdirectory (info) +add_subdirectory (patch) diff --git a/server/src/Makefile b/server/src/Makefile deleted file mode 100644 index 5741089..0000000 --- a/server/src/Makefile +++ /dev/null @@ -1,198 +0,0 @@ -# -# TinNS main Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# - -# NOTA: Be carefull no to put extra spaces at EOL when specifing dir path ! - -# Config options -export CONFIG_GAMEMONKEY := n - -# Debug mode compilation option -# Uncommenting the following line will activate degub symbols generation -# and inhibit binries stripping -#DO_DEBUG = y - -# Do not change TOPDIR definiton -TOPDIR := $(shell /bin/pwd) - -# Source code subdirs (libraries directories excluded) -SUBDIRS = patch info game - -# Shortcut targets (when you dont want to make all) -# generic form is as follows, with tinnslibs rule in first if needed -#SHORTCUT_TARGETn :=[name] : tinnslibs _dir_[sub_dir] -# Implemented for n=0..9 atm. See at the end of the file if more needed - -SHORTCUT_TARGET0 :=libs : min_needed -SHORTCUT_TARGET1 :=gameserver : min_needed _dir_game -SHORTCUT_TARGET2 :=infoserver : min_needed _dir_info -SHORTCUT_TARGET3 :=patchserver : min_needed _dir_patch - -# Directory where we want to build executables in -BINDEST = $(TOPDIR)/.. - -# Commun include files stuff -HPATH = $(TOPDIR)/include -FINDHPATH = $(HPATH) -#FINDHPATH = $(HPATH) $(HPATH)/netcode $(HPATH)/console $(HPATH)/config -#FINDHPATH = $(HPATH) $(TOPDIR)/game/include $(TOPDIR)/game/decoder - -# TinNS libaries stuff -LIBS = $(TOPDIR)/lib -LIBSSRC = common - -# Common CFLAGS for all source tree -CPPFLAGS := -I$(HPATH) -CXXFLAGS := $(CPPFLAGS) -pedantic -W -Wall -Wno-long-long -O3 \ - -D_GNU_SOURCE -D_THREAD_SAFE -D_REENTRANT -#CXXFLAGS += -march=$(shell arch) -#CXXFLAGS += -Werror - -# Common Linker Flags for all source tree (partial linking with LD (ld)) -LDFLAGS := -r - -# Common Linker Flags for all source tree (final linking with CXX (g++)) -LINKFLAGS := -L$(LIBS) - -# specific files to be removed with 'make clean' -CLEAN_FILES = $(BINDEST)/gameserver $(BINDEST)/infoserver \ - $(BINDEST)/patchserver - -# defines where Source tarball and Binaries tarball will be put (for dev use) -# Use ABSOLUTE path -TARBALLS_DEST = ~ - -# Include local Makefile options/override if needed (for dev use only) --include options.local - -# -# Install stuf not done yet -# -# INSTALL_PATH := $TOP_DIR/.. -# export INSTALL_PATH - - -##################################################### -#***************************************************# -# No further config should be needed after this line -# for usual operations -#***************************************************# -ifdef DO_DEBUG - CXXFLAGS += -O0 -ggdb -endif - -CFLAGS := CXXFLAGS - -HOSTCC = gcc -HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer - -# -# Include the make variables (CC, etc...) -# -CROSS_COMPILE = - -CC = $(CROSS_COMPILE)gcc -CXX = $(CROSS_COMPILE)g++ -LD = $(CROSS_COMPILE)ld -AR = $(CROSS_COMPILE)ar -STRIP = $(CROSS_COMPILE)strip -PERL = perl -DEPDIR = .dep -TOOLS = $(TOPDIR)/dev-tools -export TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE LD CC \ - CXX AR STRIP MAKE CPPFLAGS CXXFLAGS CFLAGS LDFLAGS LINKFLAGS -export BINDEST LIBS DEPDIR TOOLS DO_DEBUG -# -# -# -ALLSUBDIRS = $(LIBSSRC) $(SUBDIRS) - -# directories removed with 'make clean' -#CLEAN_DIRS = - -# files removed with 'make cleaner' -CLEANER_FILES= \ - scripts/lxdialog/*.o scripts/lxdialog/lxdialog \ - .hdepend dev-tools/cleandepfile \ - -# directories removed with 'make cleaner' -#CLEANER_DIRS = \ - include/config - - -############################################ -# Rules Start -# -all: do-it-all - -do-it-all: min_needed tinnssubdirs - -min_needed: dev_tools svnrev tinnslibs - -# -# -# -dev_tools: dummy - $(MAKE) -C $(TOOLS) - -tinnslibs : $(patsubst %, _ldir_%, $(LIBSSRC)) -$(patsubst %, _ldir_%, $(LIBSSRC)) : dummy - $(MAKE) -C $(patsubst _ldir_%, %, $@) - -tinnssubdirs: $(patsubst %, _dir_%, $(SUBDIRS)) tinnslibs -$(patsubst %, _dir_%, $(SUBDIRS)) : dummy - $(MAKE) -C $(patsubst _dir_%, %, $@) - -svnrev: - @$(TOOLS)/setsvnrev $(TOPDIR) $(HPATH)/svnrevision.h - -clean: - find . \( -name '*.[oas]' -o -name core -o -name '.*.flags' \) -type f -print \ - | grep -v lxdialog/ | xargs rm -f - rm -f $(CLEAN_FILES) $(BINDEST)/.*.flags - rm -rf $(CLEAN_DIRS) - -cleaner: clean - find . \( -size 0 -o -name .depend -o -name .no_msg_stop \) -type f -print | xargs rm -f - find . -name .dep -type d -print | xargs rm -Rf - rm -f $(CLEANER_FILES) - rm -rf $(CLEANER_DIRS) - -distclean: cleaner - rm -f core `find . \( -not -type d \) -and \ - \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ - -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ - -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` - -backup: cleaner - cd .. && tar cf - src/ | gzip -9 > tinns-svnrev-`svnversion .`-backup.gz - sync - -sourcetar: - @$(TOOLS)/make-src-tarball $(TARBALLS_DEST) $(HPATH)/svnrevision.h - -bintar: do-it-all dummy - @$(TOOLS)/make-bin-tarball $(TARBALLS_DEST) $(HPATH)/svnrevision.h $(BINDEST) - -sums: - find . -type f -print | sort | xargs sum > .SUMS - -depend dep: - @echo This rule is not used anymore. Just do make - - -include Rules.make - -$(SHORTCUT_TARGET0) -$(SHORTCUT_TARGET1) -$(SHORTCUT_TARGET2) -$(SHORTCUT_TARGET3) -$(SHORTCUT_TARGET4) -$(SHORTCUT_TARGET5) -$(SHORTCUT_TARGET6) -$(SHORTCUT_TARGET7) -$(SHORTCUT_TARGET8) -$(SHORTCUT_TARGET9) - diff --git a/server/src/Rules.make b/server/src/Rules.make deleted file mode 100644 index 1d8d1e4..0000000 --- a/server/src/Rules.make +++ /dev/null @@ -1,226 +0,0 @@ -# -# This file contains rules which are shared between multiple Makefiles. -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -##################################################### -#***************************************************# -# This file is not intended to be modified -#***************************************************# - -# -# False targets. -# -.PHONY: dummy - -# -# Special variables which should not be exported -# -unexport EXTRA_CXXFLAGS -unexport EXTRA_LINKFLAGS -unexport EXTRA_LDFLAGS -unexport EXTRA_ARFLAGS -unexport SUBDIRS -unexport SUB_DIRS -unexport ALL_SUB_DIRS -unexport B_TARGET -unexport B_REALTARGET -unexport O_TARGET -unexport L_TARGET -unexport L_REALTARGET - -unexport obj-y -unexport obj-n -unexport obj- -unexport subdir-y -unexport subdir-n -unexport subdir- - -comma := , - - -SUB_DIRS := $(subdir-y) -#ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-n) $(subdir-)) -ALL_SUB_DIRS := $(sort $(subdir-y)) -ifdef B_TARGET - ifdef BINDEST - B_REALTARGET := $(strip $(BINDEST))/$(B_TARGET) - else - B_REALTARGET := $(B_TARGET) - endif -endif -L_REALTARGET := $(patsubst %,$(LIBS)/lib%.a,$(L_TARGET)) -ALL_TARGETS := $(B_REALTARGET) $(O_TARGET) $(L_REALTARGET) - -# -# Get things started. -# -first_rule: sub_dirs - $(if $(strip $(ALL_TARGETS)),@$(MAKE) --no-print-directory all_targets,) - -# -# Common rules -# -%.o: %.cpp - @if [ ! -d .dep ]; then mkdir .dep ; fi - $(CXX) -MD -MP $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CXXFLAGS_$@) -c $< -o $@ - @ ( \ - $(TOOLS)/cleandepfile < $(@:.o=.d) > $(DEPDIR)/$(@:.o=.dep); \ - rm -f $(@:.o=.d); \ - ) - @ ( \ - echo 'ifeq ($(strip $(subst $(comma),:,$(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CXXFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CXXFLAGS) $$(EXTRA_CXXFLAGS) $$(CXXFLAGS_$@))))' ; \ - echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ - echo 'endif' \ - ) > $(dir $@)/.$(notdir $@).flags - -# -# -# -all_targets: $(ALL_TARGETS) - -# -# Rule to compile a set of .o files into one executable file -# -ifdef B_REALTARGET - -FULLEXT_LINKFLAGS := $(patsubst %,-l%,$(LINK_TINNSLIBS)) $(EXTRA_LINKFLAGS) -LIBDEP := $(patsubst %,$(LIBS)/lib%.a,$(LINK_TINNSLIBS)) - -$(B_REALTARGET): $(obj-y) $(LIBDEP) - @rm -f $@ - ifneq "$(strip $(obj-y))" "" - $(CXX) -o $@ $(filter $(obj-y), $^) $(LINKFLAGS) $(FULLEXT_LINKFLAGS) - ifndef DO_DEBUG - @$(STRIP) $@ - endif - else - @echo No object files to build $@ !!! - endif - @ ( \ - echo 'ifeq ($(strip $(subst $(comma),:,$(LINKFLAGS) $(FULLEXT_LINKFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(LINKFLAGS) $$(FULLEXT_LINKFLAGS) $$(obj-y))))' ; \ - echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ - echo 'endif' \ - ) > $(dir $@)/.$(notdir $@).flags -endif # B_REALTARGET - -# -# Rule to compile a set of .o files into one .o file -# -ifdef O_TARGET -$(O_TARGET): $(obj-y) - rm -f $@ - ifneq "$(strip $(obj-y))" "" - $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $(filter $(obj-y), $^) - else - @echo No object files to build $@ !!! -# $(AR) rcs $@ - endif - @ ( \ - echo 'ifeq ($(strip $(subst $(comma),:,$(LDFLAGS) $(EXTRA_LDFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(LDFLAGS) $$(EXTRA_LDFLAGS) $$(obj-y))))' ; \ - echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ - echo 'endif' \ - ) > $(dir $@)/.$(notdir $@).flags -endif # O_TARGET - -# -# Rule to compile a set of .o files into one .a file, creating, -# adding or updating it -# -ifdef L_REALTARGET -$(L_REALTARGET): $(obj-y) -# rm -f $@ - @ if [ ! -d $(LIBS) ]; then mkdir $(LIBS); fi - $(if $(filter $(obj-y),$?),$(AR) $(EXTRA_ARFLAGS) rcs $@ $(filter $(obj-y),$?),) - @ ( \ - echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_ARFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_ARFLAGS) $$(obj-y))))' ; \ - echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ - echo 'endif' \ - ) > $(dir $@)/.$(notdir $@).flags -endif #L_REALTARGET - -# -# This make dependencies quickly -# -fastdep: dummy - @$(TOPDIR)/scripts/mkdep $(CXXFLAGS) $(EXTRA_CXXFLAGS) -- $(wildcard *.h) $(wildcard *.cpp) > .depend -ifdef ALL_SUB_DIRS - @$(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)" -endif - -ifdef _FASTDEP_ALL_SUB_DIRS -$(patsubst %,_sfdep_%,$(_FASTDEP_ALL_SUB_DIRS)): - @$(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep -endif - - -# -# A rule to make subdirectories -# -subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS))) -sub_dirs: dummy $(subdir-list) - -ifdef SUB_DIRS -$(subdir-list) : dummy - $(MAKE) -C $(patsubst _subdir_%,%,$@) -endif - -# -# A rule to do nothing -# -dummy: -# -# This is useful for testing -# -script: - $(SCRIPT) - -dep: fastdep - -# -# include dependency files if they exist -# -ifneq ($(wildcard $(DEPDIR)),) - ifneq ($(wildcard $(obj-y)),) - -include $(patsubst %.o,$(DEPDIR)/%.dep,$(obj-y)) - endif -endif - -ifneq ($(wildcard $(TOPDIR)/.hdepend),) -include $(TOPDIR)/.hdepend -endif - -# -# Find files whose flags have changed and force recompilation. -# For safety, this works in the converse direction: -# every file is forced, except those whose flags are positively up-to-date. -# -FILES_FLAGS_UP_TO_DATE := - -# For use in expunging commas from flags, which mung our checking. -comma = , - -FILES_FLAGS_EXIST := $(wildcard .*.flags) -ifdef B_TARGET - ifneq ($(B_REALTARGET),$(B_TARGET)) - FILES_FLAGS_EXIST += $(wildcard $(dir $(B_REALTARGET))/.$(notdir $(B_REALTARGET)).flags) - FILESTEST := $(dir $(B_REALTARGET))/.$(notdir $(B_REALTARGET)).flags - endif -endif -ifdef L_REALTARGET - FILES_FLAGS_EXIST += $(wildcard $(dir $(L_REALTARGET))/.$(notdir $(L_REALTARGET)).flags) -endif - -ifneq ($(FILES_FLAGS_EXIST),) -include $(FILES_FLAGS_EXIST) -endif - -FILES_FLAGS_CHANGED := $(strip \ - $(filter-out $(FILES_FLAGS_UP_TO_DATE), \ - $(obj-y) $(ALL_TARGETS) \ - )) - -ifneq ($(FILES_FLAGS_CHANGED),) -$(FILES_FLAGS_CHANGED): dummy -endif - diff --git a/server/src/common/CMakeLists.txt b/server/src/common/CMakeLists.txt new file mode 100644 index 0000000..9ee2e65 --- /dev/null +++ b/server/src/common/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library (common config.cpp console.cpp filesystem.cpp misc.cpp message.cpp netcode.cpp + regex++.cpp) diff --git a/server/src/common/Makefile b/server/src/common/Makefile deleted file mode 100644 index f9ed1c9..0000000 --- a/server/src/common/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := testor2 - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -#L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -#LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -subdir-y := config console filesystem misc netcode regex -subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/common/config/config.cpp b/server/src/common/config.cpp similarity index 69% rename from server/src/common/config/config.cpp rename to server/src/common/config.cpp index 6f22658..2e04bdd 100644 --- a/server/src/common/config/config.cpp +++ b/server/src/common/config.cpp @@ -1,59 +1,8 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - config.cpp - - Authors: - - Akiko - - Namikon - - someone else? - - MODIFIED: Unknown date / Unknown author - REASON: - initial release by unknown - MODIFIED: 23 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 07 Jan 2006 Namikon - REASON: - Started to replace XML with CFG files - MODIFIED: 05 Aug 2006 Hammag - REASON: - changed LoadOptions() implementation. - This should make addition of new options really easier, as well as config syntax error tracking - See config.h for info - MODIFIED: 27 Aug 2006 Hammag - REASON: - Modified LoadOption() methode to make it generic, - with an options template and the config file as arguments - - Removed the ConfigTemplate that was used for gameserver only. - - Removed old unused code - MODIFIED: 25 Jun 2007 Hammag - REASON: - Added include support - - Now use PCRE RegEx instead of "strtok", enabling rentrance and removing - potential issues. - - Added GetOption & GetOptionInt with const std::string parameter - - Fixed a bug in EOF detection in the main file reading loop -*/ - -#include "main.h" +#include "common/config.h" +#include +#include "common/console.h" +#include "common/misc.h" PConfig::PConfig() { diff --git a/server/src/common/config.h b/server/src/common/config.h new file mode 100644 index 0000000..6019055 --- /dev/null +++ b/server/src/common/config.h @@ -0,0 +1,55 @@ +#pragma once + +#include +#include +#include "common/regex++.h" + +class PConfig +{ + private : + typedef std::map OptionsMap; + OptionsMap mOptions; + RegEx* mOptValRegEx; + RegEx* mIncludeRegEx; + + bool LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile, int nDepth); + + public : + PConfig(); + ~PConfig(); + + inline bool LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile) + { return LoadOptions(nConfigTemplate, nConfigFile, 0); } + inline const std::string &GetOption(const char *Name) const { return GetOption((std::string) Name); } + const std::string &GetOption(const std::string Name) const; + int GetOptionInt(const char *Name) const { return GetOptionInt((std::string) Name); } + int GetOptionInt(const std::string Name) const; +}; + +// Max nested includes +#define CONFIG_MAXDEPTH 4 + +/* + The list of valid config options is now set in the array ConfigTemplate + A default value can be set for each option, whiches makes the option optionnal in config file + If no default value is set, the option is mandatory. + Duplicate option entries in config file are also checked, and only the first value is kept + Unkown options are rejected + Duplicates, unkown and default use generate a warning in logs but don't break options loading + Missing mandatory option generate an error in log and break option loading (imediate return false) + + The ConfigTemplate parameter must have the structure shown in the following exemple: + +const char* ConfigTemplate[][2] = { + // {option_name, default_value} if default_value is empty string, it means option is mandatory + // List ends with empty string for option_name + {"info_sql_host", "127.0.0.1"}, + {"info_sql_port", "3306"}, + {"info_sql_username", ""}, + {"info_sql_password", ""}, + {"", ""} // do not change this line (end mark) +}; + +*/ + +extern class PConfig* Config; diff --git a/server/src/common/config/Makefile b/server/src/common/config/Makefile deleted file mode 100644 index 5fb25e9..0000000 --- a/server/src/common/config/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := testor2 - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -#LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/common/config/main.h b/server/src/common/config/main.h deleted file mode 100644 index e00f8be..0000000 --- a/server/src/common/config/main.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - main.h - main include file, contains all needed includes and important definitions - - MODIFIED: 27 Aug 2006 Hammag - REASON: - created - -*/ - -#ifndef MAIN_H -#define MAIN_H - -//#include "version.h" - -//basic includes -#include "external.h" - -//tinns includes -#include "types.h" -#include "config.h" - -#include "console.h" -#include "misc.h" - -using namespace std; - -// Better change that to a static members -extern class PConsole* Console; - -#endif - diff --git a/server/src/common/console/console.cpp b/server/src/common/console.cpp similarity index 66% rename from server/src/common/console/console.cpp rename to server/src/common/console.cpp index 3c9d407..c8d70f1 100644 --- a/server/src/common/console/console.cpp +++ b/server/src/common/console.cpp @@ -1,50 +1,8 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - console.cpp - - Authors: - - Akiko - - Namikon - - someone else? - - MODIFIED: Unknown date / Unknown author - REASON: - initial release by unknown - - MODIFIED: 25 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 06 Jan 2006 Namikon - REASON: - Added Print() function for colored console output - - Added ColorText() to give selectable parts of an output another color - - Added LPrint() to print like eAthena does - Dont forget to use LClose() after using LPrint :) - MODIFIED: 26 Aug 2006 Hammag - REASON: - Added nLogFile as a constructor parameter, to make the class generic - - Removed Console-> in Console->ColorText(...) in PConsole::~PConsole() -*/ - -#include "main.h" +#include "common/console.h" + +#include +#include +#include PConsole::PConsole(const char *nLogFile) { diff --git a/server/src/common/console.h b/server/src/common/console.h new file mode 100644 index 0000000..9a0b428 --- /dev/null +++ b/server/src/common/console.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include + +enum COLORS +{ + BLACK, + RED, + GREEN, + YELLOW, + BLUE, + MAGENTA, + CYAN, + WHITE +}; + +class PConsole { +private: + std::ofstream mLogFile; + time_t mLastLogTime; + +public: + PConsole(const char *nLogFile); + ~PConsole(); + void Print(const char *Fmt_, ...); + void Print(COLORS foreground, COLORS background, const char *Fmt_, ...); + char *ColorText(COLORS foreground, COLORS background, const char *Fmt, ...); + + void LPrint(const char *Fmt_, ...); + void LPrint(COLORS foreground, COLORS background, const char *Fmt_, ...); + void LClose(); + void Update(); +}; + +extern class PConsole *Console; diff --git a/server/src/common/console/Makefile b/server/src/common/console/Makefile deleted file mode 100644 index 5fb25e9..0000000 --- a/server/src/common/console/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := testor2 - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -#LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/common/console/main.h b/server/src/common/console/main.h deleted file mode 100644 index 5d87dc8..0000000 --- a/server/src/common/console/main.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - main.h - main include file, contains all needed includes and important definitions - - MODIFIED: 26 Aug 2006 Hammag - REASON: - created from gameserver main.h and modified as needed - -*/ - -#ifndef MAIN_H -#define MAIN_H - -//#include "version.h" - -//basic includes -#include "external.h" - -//tinns includes -#include "types.h" -#include "console.h" - -using namespace std; - -#endif - diff --git a/server/src/common/filesystem/filesystem.cpp b/server/src/common/filesystem.cpp similarity index 68% rename from server/src/common/filesystem/filesystem.cpp rename to server/src/common/filesystem.cpp index 78454b7..2391f01 100644 --- a/server/src/common/filesystem/filesystem.cpp +++ b/server/src/common/filesystem.cpp @@ -1,68 +1,11 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko +#include "common/filesystem.h" - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. +#include +#include +#include +#include "common/console.h" - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - filesystem.cpp - - Authors: - - Akiko - - Namikon - - someone else? - - MODIFIED: Unknown date / Unknown author - REASON: - initial release by unknown - MODIFIED: 25 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 31 August 2005 Akiko - REASON: - modified the path handling of the open function - MODIFIED: 29 Sep 2006 Hammag - REASON: - added a safety check on read size in PFile::Read - MODIFIED: 07 Oct 2006 Hammag - REASON: - Fixed package reading to enable access to "subdirectories" in archive, - as well as translation from unix to dos path separator for in-archive search - - Removed the "file not found" message the PFileSystem::Open() was issuing in the corresponding case. - A NULL returned for PFile* is sufficient for the calling proc to manage the situation. - - Changed file search in archives to case-insensitive - - MODIFIED: 08 Oct 2006 Hammag - REASON: - added ClearCache() methode to clear pak cache when .pak access is not used anymore - -*/ - -#include "main.h" - -/* - implements file access semantics for Neocron .pak files - supports both single packed files and file archives - - how neocron files are accessed: - - if path/filename.ext exists, the file is opened - - (else) if path/pak_filename.ext exists, the file is opened - - (else) if an archive named path_head.pak exists, path_tail\filename.ext is opened from the archive - here path is split in path_head\path_tail - -*/ -const s8 DELIM = '/'; +const int8_t DELIM = '/'; PFile::PFile() { @@ -74,7 +17,7 @@ PFile::~PFile() { } -bool PFile::ReadData(std::FILE *F, u32 Size) +bool PFile::ReadData(FILE *F, uint32_t Size) { mBuffer.reserve(Size); std::fread(&mBuffer[0], 1, Size, F); @@ -82,9 +25,9 @@ bool PFile::ReadData(std::FILE *F, u32 Size) return true; } -bool PFile::ReadUnpakData(std::FILE *F, u32 Size, u32 UncSize) +bool PFile::ReadUnpakData(FILE *F, uint32_t Size, uint32_t UncSize) { - std::vector temp; + std::vector temp; temp.reserve(Size); mBuffer.reserve(UncSize); @@ -92,14 +35,14 @@ bool PFile::ReadUnpakData(std::FILE *F, u32 Size, u32 UncSize) unsigned long us=UncSize; unsigned long s=Size; - uncompress(&mBuffer[0], &us, &temp[0], s); + uncompress(reinterpret_cast(&mBuffer[0]), &us, reinterpret_cast(&temp[0]), s); mDataSize=us; return true; } -int PFile::Read(void *Dest, u32 DestSize) +int PFile::Read(void *Dest, uint32_t DestSize) { - int m = min(mDataSize-mDataOffs, DestSize); + int m = std::min(mDataSize-mDataOffs, DestSize); if (m <= 0) return 0; memcpy(Dest, &mBuffer[mDataOffs], m); @@ -107,9 +50,9 @@ int PFile::Read(void *Dest, u32 DestSize) return m; } -void PFile::Seek(u32 Offset) +void PFile::Seek(uint32_t Offset) { - mDataOffs = min(mDataSize-1, Offset); + mDataOffs = std::min(mDataSize-1, Offset); } std::string PFile::ReadString() @@ -149,7 +92,7 @@ PFileSystem::~PFileSystem() } } -PFileSystem::PPakFileList* PFileSystem::CachePak(const std::string &Pak, std::FILE *F) +PFileSystem::PPakFileList* PFileSystem::CachePak(const std::string &Pak, FILE *F) { PPakFiles::iterator n = mPaks.find(Pak); if(n != mPaks.end()) @@ -207,11 +150,11 @@ void PFileSystem::ClearCache() } } -void splitpath(const string &file, string &path, string &name, string &ext) +void splitpath(const std::string& file, std::string& path, std::string& name, std::string& ext) { unsigned long pos = file.rfind(DELIM); - if (pos == string::npos) + if (pos == std::string::npos) { path = ""; name = file; @@ -223,7 +166,7 @@ void splitpath(const string &file, string &path, string &name, string &ext) } pos = name.rfind('.'); - if (pos == string::npos) + if (pos == std::string::npos) { ext = ""; } @@ -234,7 +177,7 @@ void splitpath(const string &file, string &path, string &name, string &ext) } } -PFile *PFileSystem::Open(const std::string &Package, const char *File, std::string BasePath) +PFile *PFileSystem::Open(const std::string& Package, const char *File, std::string BasePath) { std::string name = ""; std::string ext = ""; @@ -270,7 +213,7 @@ PFile *PFileSystem::Open(const std::string &Package, const char *File, std::stri path = path.substr(2, path.length() -2); } unsigned long pos = path.find(DELIM); - if (pos == string::npos) + if (pos == std::string::npos) { pak2 = path; name2 = name; @@ -280,7 +223,7 @@ PFile *PFileSystem::Open(const std::string &Package, const char *File, std::stri pak2 = path.substr(0, pos); name2 = path.substr(pos + 1) + '\\' + name; pos = name2.find(DELIM); - while (pos != string::npos) + while (pos != std::string::npos) { name2[pos] = '\\'; pos = name2.find(DELIM); diff --git a/server/src/common/filesystem.h b/server/src/common/filesystem.h new file mode 100644 index 0000000..45b31c8 --- /dev/null +++ b/server/src/common/filesystem.h @@ -0,0 +1,57 @@ +#pragma once + +#include +#include +#include +#include + +class PFile { + friend class PFileSystem; +private: + std::vector mBuffer; + uint32_t mDataSize; + uint32_t mDataOffs; + bool ReadData(FILE *F, uint32_t Size); + bool ReadUnpakData(FILE *F, uint32_t Size, uint32_t UncSize); + +public: + PFile(); + ~PFile(); + inline bool Eof() { return mDataOffs>=mDataSize; } + int Read(void *Dest, uint32_t DestSize); + void Seek(uint32_t Offset); + std::string ReadString(); + inline uint32_t GetSize() const { return mDataSize; } +}; + +#pragma pack(push, 1) +//#pragma pack(1) +struct PPakHeader { + int mID; + int mNumFiles; +}; + +struct PPakFileHeader { + int mUnknown0; + int mOffset; + int mCompressedSize; + int mUncompressedSize; + int mNameLen; // including 0 + char *mFilename; +}; +#pragma pack(pop) + +class PFileSystem { +private: + typedef std::map PPakFileList; + typedef std::map PPakFiles; + PPakFiles mPaks; + PPakFileList *CachePak(const std::string &Pak, FILE *F); + +public: + PFileSystem(); + ~PFileSystem(); + PFile *Open(const std::string &Package, const char *File, std::string BasePath); + bool Close(PFile *File); + void ClearCache(); +}; diff --git a/server/src/common/filesystem/Makefile b/server/src/common/filesystem/Makefile deleted file mode 100644 index 5fb25e9..0000000 --- a/server/src/common/filesystem/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := testor2 - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -#LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/common/filesystem/main.h b/server/src/common/filesystem/main.h deleted file mode 100644 index d0711ef..0000000 --- a/server/src/common/filesystem/main.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - main.h - main include file, contains all needed includes and important definitions - - MODIFIED: 27 Aug 2006 Hammag - REASON: - created - -*/ - -#ifndef MAIN_H -#define MAIN_H - -//#include "version.h" - -//basic includes -#include "external.h" - -//tinns includes -#include "types.h" -#include "config.h" - -#include "console.h" -#include "misc.h" - -#include "filesystem.h" - -using namespace std; - -// Better change that to a static members -extern class PConsole* Console; -//extern class PConfig* Config; - -#endif - diff --git a/server/src/common/netcode/message.cpp b/server/src/common/message.cpp similarity index 70% rename from server/src/common/netcode/message.cpp rename to server/src/common/message.cpp index 6a6abe8..7abddba 100644 --- a/server/src/common/netcode/message.cpp +++ b/server/src/common/message.cpp @@ -1,45 +1,9 @@ +#include "common/message.h" -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko +#include +#include "common/console.h" - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - message.cpp - a data message & message pool class for tcp and udp connections (and maybe more later) - - - Authors: - - Hammag - - MODIFIED: 15 jul 2006 Hammag - REASON: - Creation -*/ - -/* -#include "../game/main.h" -#include "message.h" -*/ -#include "main.h" - -const u16 PMessage::smMsgSizes[] = {MESSAGE_SIZES_LIST}; +const uint16_t PMessage::smMsgSizes[] = {MESSAGE_SIZES_LIST}; PMsgData* PMessage::smMsgPoolHead[] = {MESSAGE_POOL_INIT}; int PMessage::smMsgPoolCount[] = {MESSAGE_POOL_COUNT_INIT}; int PMessage::smMsgCount = 0; @@ -55,7 +19,7 @@ void PMessage::CheckMsgCount() } } -PMessage::PMessage(u16 nRequestedSize) +PMessage::PMessage(uint16_t nRequestedSize) { GetMsgBuffer(nRequestedSize); mUsedSize = 0; @@ -73,7 +37,7 @@ PMessage::PMessage(PMessage& nMessage) ++smMsgCount; } -void PMessage::GetMsgBuffer(u16 nRequestedSize) //no optimisation to try to used larger unused buffer +void PMessage::GetMsgBuffer(uint16_t nRequestedSize) //no optimisation to try to used larger unused buffer { //Console->Print("Allocating buffer for size %d", nRequestedSize); for (mPoolId = 0; mPoolId < MESSAGE_SIZES_NB; mPoolId++) @@ -94,7 +58,7 @@ void PMessage::GetMsgBuffer(u16 nRequestedSize) //no optimisation to try to used //Console->Print("Pool Empty, creating new buffers"); mData = new PMsgData[MESSAGE_ALLOC_NB]; for (int i = 0; i < MESSAGE_ALLOC_NB; i++) - mData[i].mBuffer = new u8[mMaxSize]; + mData[i].mBuffer = new uint8_t[mMaxSize]; if (MESSAGE_ALLOC_NB > 1) { @@ -121,7 +85,7 @@ void PMessage::ReleaseMsgBuffer() //Console->Print("Buffer %08xd back in pool %d.", mData, mPoolId); } -void PMessage::CheckAndExtend(u16 nRequestedSize) // This is SIZE checked, not max OFFSET +void PMessage::CheckAndExtend(uint16_t nRequestedSize) // This is SIZE checked, not max OFFSET { //Console->Print("Checking size: max %d, req %d", mMaxSize, nRequestedSize); if (nRequestedSize > mMaxSize) @@ -135,14 +99,14 @@ void PMessage::CheckAndExtend(u16 nRequestedSize) // This is SIZE checked, not m } } -void PMessage::SetNextByteOffset(u16 nPos) +void PMessage::SetNextByteOffset(uint16_t nPos) { if (nPos >= mMaxSize) CheckAndExtend(nPos+1); mNextByteOffset = nPos; } -void PMessage::ForceSize(u16 nUsedSize) +void PMessage::ForceSize(uint16_t nUsedSize) { if (nUsedSize > mMaxSize) CheckAndExtend(nUsedSize); @@ -150,16 +114,16 @@ void PMessage::ForceSize(u16 nUsedSize) } // Writing methods -u8* PMessage::GetMessageDataPointer(u16 nUsedSize) +uint8_t* PMessage::GetMessageDataPointer(uint16_t nUsedSize) { if (nUsedSize > mMaxSize) CheckAndExtend(nUsedSize); if (nUsedSize > mUsedSize) mUsedSize = nUsedSize; - return (u8*) (mData->mBuffer); + return (uint8_t*) (mData->mBuffer); } -PMessage& PMessage::Fill(u8 Value, u16 StartOffset, u16 FillSize) +PMessage& PMessage::Fill(uint8_t Value, uint16_t StartOffset, uint16_t FillSize) { if (FillSize == 0) FillSize = mMaxSize; @@ -171,9 +135,9 @@ PMessage& PMessage::Fill(u8 Value, u16 StartOffset, u16 FillSize) return *this; } -PMessage& PMessage::Write(const void* nData, u16 nLength) +PMessage& PMessage::Write(const void* nData, uint16_t nLength) { - u16 tmpOffset = mNextByteOffset + nLength; + uint16_t tmpOffset = mNextByteOffset + nLength; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); memcpy((void*)(mData->mBuffer + mNextByteOffset), (void*)nData, (size_t)nLength); @@ -184,7 +148,7 @@ PMessage& PMessage::Write(const void* nData, u16 nLength) PMessage& PMessage::operator << (PMessage& nMessage) { - u16 tmpOffset = mNextByteOffset + nMessage.mUsedSize; + uint16_t tmpOffset = mNextByteOffset + nMessage.mUsedSize; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); memcpy((void*)(mData->mBuffer + mNextByteOffset), (void*)(nMessage.mData->mBuffer), (size_t)(nMessage.mUsedSize)); @@ -196,7 +160,7 @@ PMessage& PMessage::operator << (PMessage& nMessage) PMessage& PMessage::operator << (const char* nString) //for null terminated string ! Copies includes ending \0 { int StringL = strlen(nString)+1; - u16 tmpOffset = mNextByteOffset + StringL; + uint16_t tmpOffset = mNextByteOffset + StringL; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); memcpy((void*)(mData->mBuffer + mNextByteOffset), (void*)nString, (size_t)StringL); @@ -205,9 +169,9 @@ PMessage& PMessage::operator << (const char* nString) //for null terminated stri return *this; } -PMessage& PMessage::operator << (u8 nU8) +PMessage& PMessage::operator << (uint8_t nU8) { - u16 tmpOffset = mNextByteOffset+1; + uint16_t tmpOffset = mNextByteOffset+1; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); mData->mBuffer[mNextByteOffset] = nU8; @@ -216,43 +180,43 @@ PMessage& PMessage::operator << (u8 nU8) return *this; } -PMessage& PMessage::operator << (u16 nU16) +PMessage& PMessage::operator << (uint16_t nU16) { - u16 tmpOffset = mNextByteOffset+2; + uint16_t tmpOffset = mNextByteOffset+2; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); - *(u16*)(mData->mBuffer + mNextByteOffset) = nU16; + *(uint16_t*)(mData->mBuffer + mNextByteOffset) = nU16; mNextByteOffset = tmpOffset; UpdateUsedSize(); return *this; } -PMessage& PMessage::operator << (u32 nU32) +PMessage& PMessage::operator << (uint32_t nU32) { - u16 tmpOffset = mNextByteOffset+4; + uint16_t tmpOffset = mNextByteOffset+4; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); - *(u32*)(mData->mBuffer + mNextByteOffset) = nU32; + *(uint32_t*)(mData->mBuffer + mNextByteOffset) = nU32; mNextByteOffset = tmpOffset; UpdateUsedSize(); return *this; } -PMessage& PMessage::operator << (f32 nF32) +PMessage& PMessage::operator << (float nF32) { - u16 tmpOffset = mNextByteOffset+4; + uint16_t tmpOffset = mNextByteOffset+4; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); - *(f32*)(mData->mBuffer + mNextByteOffset) = nF32; + *(float*)(mData->mBuffer + mNextByteOffset) = nF32; mNextByteOffset = tmpOffset; UpdateUsedSize(); return *this; } // Mixt methods -u8& PMessage::U8Data(u16 nOffset) +uint8_t& PMessage::U8Data(uint16_t nOffset) { - u16 tmpOffset = nOffset+1; + uint16_t tmpOffset = nOffset+1; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); if (tmpOffset > mUsedSize) @@ -261,37 +225,37 @@ u8& PMessage::U8Data(u16 nOffset) return mData->mBuffer[nOffset]; } -u16& PMessage::U16Data(u16 nOffset) +uint16_t& PMessage::U16Data(uint16_t nOffset) { - u16 tmpOffset = nOffset+2; + uint16_t tmpOffset = nOffset+2; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); if (tmpOffset > mUsedSize) mUsedSize = tmpOffset; - return *(u16*)(mData->mBuffer + nOffset); + return *(uint16_t*)(mData->mBuffer + nOffset); } -u32& PMessage::U32Data(u16 nOffset) +uint32_t& PMessage::U32Data(uint16_t nOffset) { - u16 tmpOffset = nOffset+4; + uint16_t tmpOffset = nOffset+4; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); if (tmpOffset > mUsedSize) mUsedSize = tmpOffset; - return *(u32*)(mData->mBuffer + nOffset); + return *(uint32_t*)(mData->mBuffer + nOffset); } -f32& PMessage::F32Data(u16 nOffset) +float& PMessage::F32Data(uint16_t nOffset) { - u16 tmpOffset = nOffset+4; + uint16_t tmpOffset = nOffset+4; if (tmpOffset > mMaxSize) CheckAndExtend(tmpOffset); if (tmpOffset > mUsedSize) mUsedSize = tmpOffset; - return *(f32*)(mData->mBuffer + nOffset); + return *(float*)(mData->mBuffer + nOffset); } PMessage& PMessage::operator = (PMessage& nMessage) @@ -313,12 +277,12 @@ PMessage& PMessage::operator = (PMessage& nMessage) } // Reading methods -PMessage* PMessage::GetChunk(u16 StartOffset, u16 ChunkSize, u16 ChunkNumber) +PMessage* PMessage::GetChunk(uint16_t StartOffset, uint16_t ChunkSize, uint16_t ChunkNumber) { - u16 ReqStartOffset = StartOffset + ChunkNumber * ChunkSize; + uint16_t ReqStartOffset = StartOffset + ChunkNumber * ChunkSize; if (ReqStartOffset >= mUsedSize) return NULL; - u16 RealChunkSize = (ChunkSize < mUsedSize - ReqStartOffset) ? ChunkSize : mUsedSize - ReqStartOffset; + uint16_t RealChunkSize = (ChunkSize < mUsedSize - ReqStartOffset) ? ChunkSize : mUsedSize - ReqStartOffset; PMessage* MsgChunk = new PMessage(RealChunkSize); memcpy((void*)(MsgChunk->mData->mBuffer), (void*)(mData->mBuffer + ReqStartOffset), (size_t)RealChunkSize); @@ -330,7 +294,7 @@ PMessage* PMessage::GetChunk(u16 StartOffset, u16 ChunkSize, u16 ChunkNumber) PMessage& PMessage::operator >> (std::string& nString) //read up to null or EOM { int i; - u8* StringStart = mData->mBuffer + mNextByteOffset; + uint8_t* StringStart = mData->mBuffer + mNextByteOffset; char* FinalStringStart; for (i = 0; mNextByteOffset + i < mUsedSize; i++) { @@ -355,34 +319,34 @@ PMessage& PMessage::operator >> (std::string& nString) //read up to null or EOM return *this; } -PMessage& PMessage::operator >> (u8& nU8) +PMessage& PMessage::operator >> (uint8_t& nU8) { - u16 tmpOffset = mNextByteOffset+1; + uint16_t tmpOffset = mNextByteOffset+1; nU8 = (tmpOffset > mUsedSize) ? 0 : mData->mBuffer[mNextByteOffset]; mNextByteOffset = tmpOffset; return *this; } -PMessage& PMessage::operator >> (u16& nU16) +PMessage& PMessage::operator >> (uint16_t& nU16) { - u16 tmpOffset = mNextByteOffset+2; - nU16 = (tmpOffset > mUsedSize) ? 0 : *(u16*)(mData->mBuffer + mNextByteOffset); + uint16_t tmpOffset = mNextByteOffset+2; + nU16 = (tmpOffset > mUsedSize) ? 0 : *(uint16_t*)(mData->mBuffer + mNextByteOffset); mNextByteOffset = tmpOffset; return *this; } -PMessage& PMessage::operator >> (u32& nU32) +PMessage& PMessage::operator >> (uint32_t& nU32) { - u16 tmpOffset = mNextByteOffset+4; - nU32 = (tmpOffset > mUsedSize) ? 0 : *(u32*)(mData->mBuffer + mNextByteOffset); + uint16_t tmpOffset = mNextByteOffset+4; + nU32 = (tmpOffset > mUsedSize) ? 0 : *(uint32_t*)(mData->mBuffer + mNextByteOffset); mNextByteOffset = tmpOffset; return *this; } -PMessage& PMessage::operator >> (f32& nF32) +PMessage& PMessage::operator >> (float& nF32) { - u16 tmpOffset = mNextByteOffset+4; - nF32 = (tmpOffset > mUsedSize) ? 0 : *(f32*)(mData->mBuffer + mNextByteOffset); + uint16_t tmpOffset = mNextByteOffset+4; + nF32 = (tmpOffset > mUsedSize) ? 0 : *(float*)(mData->mBuffer + mNextByteOffset); mNextByteOffset = tmpOffset; return *this; } @@ -453,7 +417,7 @@ void PMessage::Dump() sAsciiDump = ""; for (j = 0; (j < 16) && ((i+j) < mUsedSize); j++) { - snprintf(tmpStr, 64, " %02hx",(u8)tmpBuff[i+j]); + snprintf(tmpStr, 64, " %02hx",(uint8_t)tmpBuff[i+j]); sDump += tmpStr; sAsciiDump += ((tmpBuff[i+j]>'\x19') && (tmpBuff[i+j]<'\x7F')) ? tmpBuff[i+j] : '.'; } @@ -470,6 +434,6 @@ void PMessage::DumpHead(char* nComment) char* tmpBuff = (char*) GetMessageData(); Console->Print("%s T:%02hx UID:%04hx UHID:%04hx Fnct:%02hx Seq:%04hx Cmd:%02hx Cmd2:%02hx Cmd3:%02hx", - nComment, (u8)tmpBuff[0], *(u16*)&tmpBuff[1], *(u16*)&tmpBuff[3], (u8)tmpBuff[6], *(u16*)&tmpBuff[7], (u8)tmpBuff[9], (u8)tmpBuff[10], (u8)tmpBuff[12] ); + nComment, (uint8_t)tmpBuff[0], *(uint16_t*)&tmpBuff[1], *(uint16_t*)&tmpBuff[3], (uint8_t)tmpBuff[6], *(uint16_t*)&tmpBuff[7], (uint8_t)tmpBuff[9], (uint8_t)tmpBuff[10], (uint8_t)tmpBuff[12] ); } diff --git a/server/src/common/message.h b/server/src/common/message.h new file mode 100644 index 0000000..f38f4df --- /dev/null +++ b/server/src/common/message.h @@ -0,0 +1,103 @@ +#pragma once + +#include + +#define MESSAGE_SIZES_LIST 32, 64, 128, 256, 512, 1024, 4096 +#define MESSAGE_POOL_INIT NULL, NULL, NULL, NULL, NULL, NULL, NULL +#define MESSAGE_POOL_COUNT_INIT 0, 0, 0, 0, 0, 0, 0 +#define MESSAGE_SIZES_NB 7 +#define MESSAGE_ALLOC_NB 4 + +struct PMsgData { + PMsgData* mNextMsgData; + uint8_t* mBuffer; // NB: no need to manage buffer deletion atm, as they will stay until server end +}; +//NB: putting mPoolId & mMaxSize in PMsgData rather than PMessage would be cleaner, but would put more mem overhead on each buffer +// Doesn't matter much as PMsgData management is done only through PMessage + +class PMessage { + private: + static const uint16_t smMsgSizes[MESSAGE_SIZES_NB]; + static PMsgData* smMsgPoolHead[MESSAGE_SIZES_NB]; + static int smMsgPoolCount[MESSAGE_SIZES_NB]; + static int smMsgCount; //Used to trace unreleased messages with CheckMsgCount() + + uint8_t mPoolId; + uint16_t mMaxSize; + PMsgData* mData; + uint16_t mUsedSize; + uint16_t mNextByteOffset; + + void GetMsgBuffer(uint16_t nRequestedSize = 0); // the requested size is just a hint to avoid internal reaffectation of buffer + void ReleaseMsgBuffer(); + void CheckAndExtend(uint16_t nRequestedSize); // This is SIZE checked, not max OFFSET + inline void UpdateUsedSize() { if (mNextByteOffset > mUsedSize) mUsedSize = mNextByteOffset; } + + public: + static void CheckMsgCount(); //To be used in a place where no new message should remain between calls + + PMessage(uint16_t nRequestedSize = 0); // max size will be extended as needed in later write accesses (up to max configured size) + PMessage(PMessage& nMessage); // creates a (size optimized, offset reset) copy of nMessage + inline ~PMessage() { ReleaseMsgBuffer(); --smMsgCount; } + + void SetNextByteOffset(uint16_t nPos); + inline void IncreaseNextByteOffset(uint16_t nIncrement) { SetNextByteOffset(mNextByteOffset + nIncrement); } + inline void SetNextByteAtEnd() { mNextByteOffset = mUsedSize; } + inline uint16_t GetNextByteOffset() { return mNextByteOffset; } + void ForceSize(uint16_t nUsedSize); + inline uint16_t GetSize() { return mUsedSize; } + inline uint16_t GetMaxSize() { return mMaxSize; } + inline bool EOM() {return (mNextByteOffset >= mUsedSize);} // End Of Message + + // Writing methods + uint8_t* GetMessageDataPointer(uint16_t nUsedSize); // extends buffer as needed by nUsedSize, and sets UsedSize at min nUsedSize + PMessage& Fill(uint8_t Value = 0, uint16_t StartOffset = 0, uint16_t FillSize = 0); // !!! Does NOT update UsedSize, fills only up to current maxSize + inline PMessage& Reset() { mNextByteOffset = mUsedSize = 0; return *this; } + inline PMessage& Clear() { return this->Fill(0).Reset(); } + PMessage& Write(const void* nData, uint16_t nLength); + PMessage& operator << (PMessage& nMessage); + PMessage& operator << (const char* nString); //for null terminated string ! Copies includes ending \0 + inline PMessage& operator << (std::string& nString) { return (*this << nString.c_str()); } + PMessage& operator << (uint8_t nU8); + inline PMessage& operator << (char nChar) { return (*this << (uint8_t) nChar);} + PMessage& operator << (uint16_t nU16); + PMessage& operator << (uint32_t nU32); + PMessage& operator << (float nF32); + + // Mixt methods + + //The next 3 methods do NOT update NextByteOffset, but DO increase message size (UsedSize ans MaxSize) as needed by nOffset. + uint8_t& U8Data(uint16_t nOffset); + uint16_t& U16Data(uint16_t nOffset); + uint32_t& U32Data(uint16_t nOffset); + float& F32Data(uint16_t nOffset); + + // *** didn't managed to overload [] operator :-/ + inline uint8_t& operator [] (uint16_t nOffset) { return U8Data(nOffset); } + //inline u16& operator [] (u16 nOffset) { return U16Data(nOffset); } + //u32& operator [] (u16 nOffset); + + // Really makes a different message instance, with all data copied (no data shared) + PMessage& operator = (PMessage& nMessage); + + // Reading methods + // ChunkNumber count from 0, return NULL for empty chunk (ie StartOffset is over UsedSize). NextByteOffset NOT updated + PMessage* GetChunk(uint16_t StartOffset, uint16_t ChunkSize, uint16_t ChunkNumber = 0); + + // Return pointer to the START of message data. + inline uint8_t const* GetMessageData() { return mData->mBuffer; } + + //Following methods do NOT extend message or Used, and return 0/empty string if over UsedSize + PMessage& operator >> (std::string& nString); //read up to null or EOM + PMessage& operator >> (uint8_t& nU8); + inline PMessage& operator >> (char& nChar) { return (*this >> (uint8_t&) nChar);} + PMessage& operator >> (uint16_t& nU16); + PMessage& operator >> (uint32_t& nU32); + PMessage& operator >> (float& nF32); + + // info/debug methods + static void ListPools(); + static void DumpPools(); + void Dump(); + void DumpHead(char* nComment = ""); +}; diff --git a/server/src/common/misc/misc.cpp b/server/src/common/misc.cpp similarity index 63% rename from server/src/common/misc/misc.cpp rename to server/src/common/misc.cpp index c27eeea..7ed900f 100644 --- a/server/src/common/misc/misc.cpp +++ b/server/src/common/misc.cpp @@ -1,68 +1,24 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - misc.cpp - - Authors: - - Akiko - - Namikon - - someone else? - - MODIFIED: Unknown date / Unknown author - REASON: - initial release by unknown - - MODIFIED: 25 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 07 Jan 2006 Namikon - REASON: - Added function to trim a string/char - MODIFIED: 01 Jul 2006 hammag - REASON: - add IPlongToString() - MODIFIED: 27 Aug 2006 Hammag - REASON: - Merged misc function from all 3 servers - MODIFIED: 11 Dec 2006 Hammag - REASON: - Commented out GetSVNRev() that is not used anymore - - TODO: - - Put Network Utility function in a netutility.cpp in netcode - - Put GetAccessString() as a static member of Accounts class -*/ - -#include "main.h" - -u32 IPStringToDWord( const char *IP ) +#include "common/misc.h" + +#include +#include +#include +#include +#include "common/console.h" + +uint32_t IPStringToDWord( const char *IP ) { if ( !IP ) return 0; - u32 a, b, c, d; + uint32_t a, b, c, d; if ( std::sscanf( IP, "%u.%u.%u.%u", &a, &b, &c, &d ) != 4 ) return 0; return ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a; } -char *IPlongToString( const u32 IP ) +char *IPlongToString( const uint32_t IP ) { struct in_addr in_IP; @@ -73,7 +29,7 @@ char *IPlongToString( const u32 IP ) //NEW //this function allow to print a packet //just for tracking values -void PrintPacket( u8 *Packet, int PacketSize ) +void PrintPacket( uint8_t *Packet, int PacketSize ) { Console->Print( "inside : PrintPacket" ); @@ -82,10 +38,10 @@ void PrintPacket( u8 *Packet, int PacketSize ) { Console->Print( "PacketSize is : %d", PacketSize ); - u8 value = 0; + uint8_t value = 0; for ( int i = 0;i < PacketSize;i++ ) { - value = *( u8* ) & Packet[i]; + value = *( uint8_t* ) & Packet[i]; Console->Print( "value[%d] is : %x", i, value ); } } @@ -101,10 +57,10 @@ void CleanUpString(std::string *nString) if(nString->length() > 3) { size_t tfound; - string t_replacechr ("\""); + std::string t_replacechr ("\""); tfound = nString->find(t_replacechr); - while(tfound != string::npos) + while(tfound != std::string::npos) { nString->replace(tfound, 1, " "); tfound = nString->find( t_replacechr, tfound +1 ); @@ -127,6 +83,7 @@ void CleanUpString(std::string *nString) } } + void Trim( char *t ) { RTrim( t ); @@ -190,7 +147,7 @@ void LTrim( char *t ) void LTrim( std::string *stString ) { unsigned int i; //Count VAR - string buf; //Temp String VAR + std::string buf; //Temp String VAR if ( !stString->length() ) return; //If The Length Is 0 @@ -244,10 +201,10 @@ std::string &Ssprintf( const char *fmt, ... ) return tmpstring; } -u16 DistanceApprox( const u16 x1, const u16 y1, const u16 z1, const u16 x2, const u16 y2, const u16 z2 ) +uint16_t DistanceApprox( const uint16_t x1, const uint16_t y1, const uint16_t z1, const uint16_t x2, const uint16_t y2, const uint16_t z2 ) { - u16 DX, DY, DZ, DMax; - u32 DMinSum, DApprox; + uint16_t DX, DY, DZ, DMax; + uint32_t DMinSum, DApprox; DMax = DX = ( x1 >= x2 ) ? x1 - x2 : x2 - x1; DMinSum = DY = ( y1 >= y2 ) ? y1 - y2 : y2 - y1; @@ -267,7 +224,7 @@ u16 DistanceApprox( const u16 x1, const u16 y1, const u16 z1, const u16 x2, cons DMinSum += DZ; } - DApprox = DMax + ( u32 )( 0.33 * DMinSum ); + DApprox = DMax + ( uint32_t )( 0.33 * DMinSum ); if ( DApprox > 65535 ) { DApprox = 65535; @@ -286,27 +243,27 @@ u16 DistanceApprox( const u16 x1, const u16 y1, const u16 z1, const u16 x2, cons if (fDist != 0) Console->Print("Dist: %f\tApprox: %d\tError: %d (%d%)", fDist, DApprox, (int)(DApprox-fDist), (int)(100*(DApprox-fDist)/fDist)); */ - return ( u16 )DApprox; + return ( uint16_t )DApprox; } /*** Portable pseudo-random number generator ***/ // until native standardized C++ lib support -u32 mInternalRand = 1; +uint32_t mInternalRand = 1; -void InitRandom( u32 nInitialisationValue ) +void InitRandom( uint32_t nInitialisationValue ) { mInternalRand = nInitialisationValue; } -u16 GetRandom( u16 MaxVal, u16 MinVal ) +uint16_t GetRandom( uint16_t MaxVal, uint16_t MinVal ) { mInternalRand = mInternalRand * 1103515245 + 12345; //from rand() manpage - return ( u16 )( MinVal + (( mInternalRand >> 16 ) % 32768 % ( MaxVal - MinVal + 1 ) ) ); + return ( uint16_t )( MinVal + (( mInternalRand >> 16 ) % 32768 % ( MaxVal - MinVal + 1 ) ) ); } -f32 GetRandomFloat() +float GetRandomFloat() { mInternalRand = mInternalRand * 1103515245 + 12345; //from rand() manpage - return (( f32 )(( mInternalRand >> 16 ) % 32768 ) / ( f32 )32768 ); + return (( float )(( mInternalRand >> 16 ) % 32768 ) / ( float )32768 ); } diff --git a/server/src/common/misc.h b/server/src/common/misc.h new file mode 100644 index 0000000..dae6fb9 --- /dev/null +++ b/server/src/common/misc.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include + +uint32_t IPStringToDWord(const char *IP); +char *IPlongToString(const uint32_t IP); +std::string GetAccessString(int level); +//void GetSVNRev(char *version); + +void PrintPacket(uint8_t *Packet, int PacketSize); + +// Cleanup for strings read from .def +void CleanUpString(std::string *nString); +void Trim(char *t); +void Trim(std::string *stString); +void RTrim(char *t); +void RTrim(std::string *stString); +void LTrim(char *t); +void LTrim(std::string *stString); +std::string &Ssprintf(const char *fmt, ...); + +uint16_t DistanceApprox(const uint16_t x1, const uint16_t y1, const uint16_t z1, const uint16_t x2, const uint16_t y2, const uint16_t z2); +float Distance(const float x1, const float y1, const float z1, const float x2, const float y2, const float z2); +float Distance(const float x1, const float y1, const float x2, const float y2); // 2D only version + +void InitRandom(uint32_t nInitialisationValue); +uint16_t GetRandom(uint16_t MaxVal, uint16_t MinVal = 0); // u16 value between MinVal and MaxVal (inclusive) with max range 32768 +float GetRandomFloat(); // f32 value between 0 and 1 diff --git a/server/src/common/misc/Makefile b/server/src/common/misc/Makefile deleted file mode 100644 index 5fb25e9..0000000 --- a/server/src/common/misc/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := testor2 - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -#LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/common/misc/main.h b/server/src/common/misc/main.h deleted file mode 100644 index 8159c2d..0000000 --- a/server/src/common/misc/main.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - main.h - main include file, contains all needed includes and important definitions - - MODIFIED: 27 Aug 2006 Hammag - REASON: - created - -*/ - -#ifndef MAIN_H -#define MAIN_H - -//#include "version.h" - -//basic includes -#include "external.h" -#include // needed fo inet_ntoa() in IPlongToString() - -//tinns includes -#include "types.h" -#include "misc.h" - -#include "console.h" - -using namespace std; - -// Better change that to a static members if needed (PrintPacket could be outdated, or put in netcode) -extern class PConsole* Console; - -#endif diff --git a/server/src/common/netcode.cpp b/server/src/common/netcode.cpp new file mode 100644 index 0000000..85c8676 --- /dev/null +++ b/server/src/common/netcode.cpp @@ -0,0 +1,1131 @@ +#include "common/netcode.h" + +#include +#include +#include +#include +#include "common/console.h" +#include "common/config.h" + +ConnectionTCP::ConnectionTCP(int sockfd, struct sockaddr_in addr, ServerSocket* server) +{ + mSockfd = sockfd; + mRemoteAddr = addr; + + if(server) + { + mServerSocket = server; + } + + // set new socket to non-blocking + fcntl(mSockfd, F_SETFL, O_NONBLOCK); + + mbConnected = true; // client obviously is connected at creation... + + mTimeOutValue = DEFAULT_TCP_TIMEOUT; + mLastActive = std::time(NULL); + + mReceiveBufferMsg = NULL; + mSendBufferMsg = NULL; +} + +ConnectionTCP::~ConnectionTCP() +{ + if (mServerSocket) + { + mServerSocket->delSocketFromSet(mSockfd); + } + close(mSockfd); + + if (mReceiveBufferMsg) + { + delete mReceiveBufferMsg; + } + + while (!mQueueIn.empty()) + { + delete mQueueIn.front(); + mQueueIn.pop(); + } + + if (mSendBufferMsg) + { + delete mSendBufferMsg; + } +} + +char* ConnectionTCP::getRemoteAddress() +{ + return inet_ntoa(mRemoteAddr.sin_addr); +} + +bool ConnectionTCP::timeOut() const +{ + time_t now = std::time(NULL); + if((now-mLastActive) >= mTimeOutValue) + return true; + + return false; +} + +PMessage* ConnectionTCP::GetMessage() +{ + PMessage* RetVal; + + if (mQueueIn.empty()) + RetVal = NULL; + else + { + RetVal = mQueueIn.front(); + mQueueIn.pop(); + } + return RetVal; +} + +void ConnectionTCP::DeleteOutgoingMessages() +{ + while (! mQueueOut.empty()) + { + delete mQueueOut.front(); + mQueueOut.pop(); + } +} + +bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p +{ + PMessage* tmpMsg; + int numBytes; + uint8_t const* DataStart; + uint16_t DataSize; + uint8_t* MsgStart; + uint16_t MsgOffset; + uint16_t MsgLen; + + //check if data is available for this socket and if yes, read into a new PMessage and put it on incoming queue + if(mServerSocket->isDataAvailable(mSockfd)) + { +//Console->Print("ConnectionTCP::update() - IN Data avail"); + if (mReceiveBufferMsg == NULL) + { + mReceiveBufferMsg = new PMessage(RECVBUFFERSIZE); + } + + DataSize = mReceiveBufferMsg->GetSize(); + numBytes = recv(mSockfd, (char*) mReceiveBufferMsg->GetMessageDataPointer(RECVBUFFERSIZE - DataSize) + DataSize, RECVBUFFERSIZE - DataSize, 0); // get the data + + if(numBytes > 0) + { +//Console->Print(GREEN, BLACK, "ConnectionTCP::update() - Data received"); + mbConnected = true; + mReceiveBufferMsg->ForceSize(DataSize + numBytes); + mLastActive = std::time(NULL); + + while(mReceiveBufferMsg && mReceiveBufferMsg->GetSize()) + { + DataStart = mReceiveBufferMsg->GetMessageData(); + DataSize = mReceiveBufferMsg->GetSize(); + MsgStart = (uint8_t*)memchr(DataStart, 0xfe, DataSize); + + if (MsgStart) + { + MsgOffset = MsgStart - DataStart; + if (MsgOffset) + { + Console->Print(YELLOW, BLACK, "ConnectionTCP::update() Message head found 0x%04hx bytes after packet start. Inbetween data will be discarded.", MsgOffset); + } + if (MsgOffset + 3 <= DataSize) + { + MsgLen = *(uint16_t*)(DataStart + MsgOffset + 1); +//Console->Print(GREEN, BLACK, "ConnectionTCP::update() TCP Message body length 0x%04hx (buffer 0x%04hx)", MsgLen, mReceiveBufferMsg->GetSize()); + if (MsgOffset + 3 + MsgLen <= DataSize) + { + tmpMsg = mReceiveBufferMsg->GetChunk(MsgOffset, MsgLen + 3); // Change (MsgOffset, MsgLen + 3) to (MsgOffset + 3, MsgLen) to REMOVE head & length from message head + mQueueIn.push(tmpMsg); + + if (MsgOffset + 3 + MsgLen < DataSize) + { + tmpMsg = mReceiveBufferMsg->GetChunk(MsgOffset + 3 + MsgLen, DataSize - (MsgOffset + 3 + MsgLen)); + } + else + { + tmpMsg = NULL; + } + + delete mReceiveBufferMsg; + mReceiveBufferMsg = tmpMsg; + } + } + } + else + { + break; + } + } + } + else if(numBytes == 0) // disconnected !! + { + mbConnected = false; // set to not-connected and close the socket + if (mServerSocket) + { + mServerSocket->delSocketFromSet(mSockfd); + } + close(mSockfd); + return false; + } + else + { + if(errno != EAGAIN) + { // an error has occured -> output it to the console + perror("tcp-receive"); + Console->Print(RED, BLACK, "mSockfd:%d MaxRead:%d ", mSockfd, RECVBUFFERSIZE); + } + } + } + + // send data from outgoing queue + flushSendBuffer(); // manage old write compatibility + while(! mQueueOut.empty()) + { +//Console->Print("ConnectionUDP::update() - OUT Data avail"); + tmpMsg = mQueueOut.front(); + int numBytes = send(mSockfd, (char*) tmpMsg->GetMessageData(), tmpMsg->GetSize(), 0); + if(numBytes == -1) // error while sending data -> output error-msg to console + { + if (errno == EAGAIN) + { + break; + } + else + { + perror("tcp-send"); + //close(mSockfd); + return false; + } + } + else if(numBytes > 0) + { +//Console->Print(GREEN, BLACK, "ConnectionTCP::update() - Data sent"); + mLastActive = std::time(NULL); + mQueueOut.pop(); // message written, we can remove it from queue + delete tmpMsg; // and delete the message + } + } + + return true; +} + +/**** Old I/F compatibility functions ****/ + +int ConnectionTCP::getRecvBufferSize() +{ + PMessage* tmpMsg; + + if (mQueueIn.empty()) + return 0; + + tmpMsg = mQueueIn.front(); + uint16_t _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); + if (_size <= 0) + { + mQueueIn.pop(); + delete tmpMsg; + if (mQueueIn.empty()) + return 0; + tmpMsg = mQueueIn.front(); + tmpMsg->SetNextByteOffset(0); + _size = tmpMsg->GetSize(); + } + return _size; +} + +int ConnectionTCP::getSendBufferSize() +{ + if(mSendBufferMsg == NULL) + return 0; + else + return mSendBufferMsg->GetSize(); +} + +void ConnectionTCP::flushSendBuffer() +{ +//Console->Print("ConnectionTCP::flushSendBuffer()"); + if((mSendBufferMsg != NULL) && (mSendBufferMsg->GetSize() > 0)) + { + SendMessage(mSendBufferMsg); + mSendBufferMsg = NULL; +//Console->Print(YELLOW, BLACK, "ConnectionTCP::flushSendBuffer() - Data flushed"); + } +} + +const uint8_t* ConnectionTCP::read(int* size) +{ + PMessage* tmpMsg; +//Console->Print("ConnectionTCP::read() - trying to read up to %d bytes", *size); + if (mQueueIn.empty() || !size) + { +//Console->Print("ConnectionTCP::read() - no more packet"); + return NULL; + } + + tmpMsg = mQueueIn.front(); + uint16_t _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); +//Console->Print("ConnectionTCP::read() - %d bytes remaining in current packet", _size); + if (_size <= 0) + { +//Console->Print("ConnectionTCP::read() - trying next packet"); + mQueueIn.pop(); + delete tmpMsg; + if (mQueueIn.empty()) + { +//Console->Print("ConnectionUDP::read() - no more packet"); + return NULL; + } + tmpMsg = mQueueIn.front(); + _size = tmpMsg->GetSize(); + tmpMsg->SetNextByteOffset(0); + } + + if(*size==0) + { + *size=_size; + } + else + { + *size = std::min(*size, (int32_t)_size); + } + + uint8_t const* ptr = tmpMsg->GetMessageData() + tmpMsg->GetNextByteOffset(); + tmpMsg->SetNextByteOffset(tmpMsg->GetNextByteOffset()+ *size); +//Console->Print(GREEN, BLACK, "ConnectionTCP::read() - %d bytes read", *size); + return ptr; +} + +int ConnectionTCP::write(const void* data, int size) +{ + // data is stored in mSendBufferMsg. Gets queued in next flushSendBuffer() or update() + if (mSendBufferMsg == NULL) + { +//Console->Print("ConnectionTCP::write() creating new mSendBufferMsg"); + mSendBufferMsg = new PMessage(SENDBUFFERSIZE); + } + + mSendBufferMsg->Write(data, (uint16_t)size); +//Console->Print(GREEN, BLACK, "ConnectionUDP::write() %d bytes written to mSendBufferMsg (total size %d)", size, mSendBufferMsg->GetSize()); + return size; +} + +int ConnectionTCP::write(const char *String) +{ + if(!String) + return 0; + + return write(String, strlen(String)); +} + +int ConnectionTCP::write(uint8_t Data) +{ + return write(&Data, sizeof(uint8_t)); +} + +int ConnectionTCP::write(uint16_t Data) +{ + return write(&Data, sizeof(uint16_t)); +} + +int ConnectionTCP::write(uint32_t Data) +{ + return write(&Data, sizeof(uint32_t)); +} + +int ConnectionTCP::write(float Data) +{ + return write(&Data, sizeof(float)); +} + +int ConnectionTCP::write(double Data) +{ + return write(&Data, sizeof(double)); +} + +ConnectionUDP::ConnectionUDP(int sockfd, int port, int remoteadress, int remoteport, ServerSocket* server) +{ + mSockfd = sockfd; + mPort = port; + //Console->Print("local UDP port: %d", port); + if(server) + { + mServerSocket = server; + } + + mTimeOutValue = DEFAULT_UDP_TIMEOUT; + mLastActive = std::time(NULL); + + mRemoteAddr.sin_family = AF_INET; // host byte order + mRemoteAddr.sin_port = htons(remoteport); // short, network byte order + mRemoteAddr.sin_addr.s_addr = remoteadress; // TODO: Get IP of client + + //Bind client to server in a udp pseudo-connection + /*if(connect(sockfd, (struct sockaddr *)&mRemoteAddr, sizeof(struct sockaddr ))) + { + Console->Print("Error on pseudo-connecting udp socket to %s:%d", inet_ntoa(mRemoteAddr.sin_addr),ntohs(mRemoteAddr.sin_port)); + perror("udp connect"); //exception should be thrown here + } + else */ + { + Console->Print("Client UDP %s:%d", inet_ntoa(mRemoteAddr.sin_addr), ntohs(mRemoteAddr.sin_port)); + } + // set UDP-socket to non-blocking + fcntl(sockfd, F_SETFL, O_NONBLOCK); + + // mRemoteAddr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP + // memset(&(mRemoteAddr.sin_zero), '\0', 8); // zero the rest of the struct + mSendBufferMsg = NULL; + + mUDP_ID = 0; + mSessionID = SESSION_UDP_OFFSET; + mLastUDPID = 0; + mTransactionID = 0; +} + + +ConnectionUDP::~ConnectionUDP() +{ + if (mServerSocket) + { + mServerSocket->delSocketFromSet(mSockfd); + } + close(mSockfd); + + if (mSendBufferMsg) + { + delete mSendBufferMsg; + } + + while (!mQueueIn.empty()) + { + delete mQueueIn.front(); + mQueueIn.pop(); + } + + while (!mQueueOut.empty()) + { + delete mQueueOut.front(); + mQueueOut.pop(); + } + while (!mVIPQueueOut.empty()) + { + delete mVIPQueueOut.front(); + mVIPQueueOut.pop(); + } + for(PMessageMap::iterator it=UDPMessages.begin(); it!=UDPMessages.end(); it++) + { + delete it->second; + UDPMessages.erase(it); + } +} + +void ConnectionUDP::InsertUDPMessage(PMessage* nMsg) +{ + if (!nMsg) + return; + + if(nMsg->U8Data(0) != 0x13) return; // Only add real UDP messages here +// 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 +// 13 07 00 F2 00 05 03 02 00 11 11 05 03 03 00 11 11 05 03 04 00 11 11 05 03 05 00 11 11 05 03 06 00 11 11 05 03 07 00 11 11 + + // Grab submessages from packet, check if message is 0x03 commandset. If not, dont add message + PMessage* tWorkMsg = NULL; + + uint16_t tCurPos = 5; + uint8_t tSubMsgLen = 0; + uint16_t tmpUDPID = 0; + //nMsg->Dump(); + while(tCurPos < (nMsg->GetSize() - 1)) // Loop while we still have more frames. (-1: GetSize starts at 1, pos pointer at 0) + { + //Console->Print("tCurPos = %d nMsg->GetSize = %d", tCurPos, nMsg->GetSize()); + tSubMsgLen = nMsg->U8Data(tCurPos) + 1; // Get the lenght of the frame, and add the lenght byte + if(nMsg->U8Data(tCurPos+1) != 0x03) + { + //Console->Print("Ignoring UDP message, no 0x03 commandset"); + tCurPos += tSubMsgLen; // Set pointer to the end of this frame + continue; // Skip if frame is not an 0x03 commandset + } + //Console->Print("MsgLen: %d", tSubMsgLen); + tWorkMsg = nMsg->GetChunk(tCurPos, tSubMsgLen); // get the frame. + //Console->Print("Msg:"); + //tWorkMsg->Dump(); + tmpUDPID = nMsg->U16Data(tCurPos + 2); // Get the UDP ID of this frame + //Console->Print("UDP ID: %d", tmpUDPID); + PMessageMap::const_iterator it = UDPMessages.find(tmpUDPID); // Try to find the UDP ID in the queue + if(it->second) // If we already have this UDP msg, print error + { + Console->Print("%s Packet *NOT* added to history buffer, UdpID %d already sent! (This may cause an OOO)", Console->ColorText(RED, BLACK, "[WARNING]"), tmpUDPID); + nMsg->Dump(); + } + else // We dont have this msg? Add it! + { + //Console->Print("Added UDP ID %d to messagebuffer", tmpUDPID); + UDPMessages.insert(std::make_pair(tmpUDPID, tWorkMsg)); + mLastUDPID++; + } + tCurPos += tSubMsgLen; // Set pointer to the end of this frame + } +} + +void ConnectionUDP::UpdateMessageBuffer() +{ + int erasednum = 0; + // Delete all old messages + for(PMessageMap::iterator it=UDPMessages.begin(); it!=UDPMessages.end(); it++) + { + if((int)it->first < (int)(mLastUDPID - MAX_RETENTION)) + { + erasednum++; + delete it->second; + UDPMessages.erase(it); + } + } + /* // Debug output + if(erasednum > 0) + Console->Print("[UpdateMessageBuffer] Done updating messagequeue, %d entries deleted", erasednum); + */ +} + +void ConnectionUDP::ResetMessageBuffer() +{ + if(mUDP_ID != 0) + { + Console->Print("%s MessageQueue got erased but UDP_ID is still >0", Console->ColorText(RED, BLACK, "[WARNING]")); + } + for(PMessageMap::iterator it=UDPMessages.begin(); it!=UDPMessages.end(); it++) + { + delete it->second; + UDPMessages.erase(it); + } + mLastUDPID = 0; +// Console->Print("[udpmanager] Erased messagebuffer"); +} + +void ConnectionUDP::ReSendUDPMessage(uint16_t nUDP_ID) +{ + // ReSend packet with given UDP_ID + if(nUDP_ID > mLastUDPID) + { + Console->Print("%s Cannot resend packet with UDP_ID %d, msgnumber is higher than last known udpID", Console->ColorText(RED, BLACK, "[PANIC]"), nUDP_ID); + } + else + { + // UDP_ID seems to be valid, now search for it + PMessageMap::const_iterator it = UDPMessages.find(nUDP_ID); + if(it == UDPMessages.end()) + { + int dynRetention = (int)mLastUDPID - nUDP_ID; + if(dynRetention > MAX_RETENTION) + { + Console->Print("%s Packet with UDP_ID %d not found. Increase #define MAX_RETENTION to at least %d", Console->ColorText(RED, BLACK, "[WARNING]"), nUDP_ID, dynRetention); + } + else + { + Console->Print("%s Packet with UDP_ID %d is missing in the packet queue!", Console->ColorText(RED, BLACK, "[PANIC]"), nUDP_ID); + } + Console->Print("Trying to cancel OOO notice by sending dummy packet"); + PMessage* tmpMsg = new PMessage(14); + //u16 tmpSessionID = mLastUDPID + SESSION_UDP_OFFSET; + *tmpMsg << (uint8_t)0x13; + *tmpMsg << nUDP_ID; + *tmpMsg << (uint16_t)(nUDP_ID + SESSION_UDP_OFFSET); + *tmpMsg << (uint8_t)0x08; + *tmpMsg << (uint8_t)0x03; + *tmpMsg << nUDP_ID; + *tmpMsg << (uint8_t)0x1F; + *tmpMsg << (uint16_t)0xFFFF; // Should do nothing, CharID 65535 should never exist + *tmpMsg << (uint16_t)0x3C01; // This value IS wrong way, so that nothing can happen at all + SendMessage(tmpMsg, true); + } + else if(it->second) + { + Console->Print("[OOO-Buster] ReSending UDP packet with ID %d", nUDP_ID); + // Build new message, including the missing UDP packets as content + uint16_t MsgSize = it->second->GetSize(); + PMessage* tmpMsg = new PMessage(MsgSize + 5); // Create new message + *tmpMsg << (uint8_t)0x13; + *tmpMsg << nUDP_ID; + *tmpMsg << (uint16_t)(nUDP_ID + SESSION_UDP_OFFSET); +// *tmpMsg << mUDP_ID; +// *tmpMsg << mSessionID; +// *tmpMsg << *it->second; // This should work, but it doesnt! Causes segfault after sending a few packets + for(int x = 0; x < MsgSize; x++) + { + *tmpMsg << it->second->U8Data(x); + } + SendMessage(tmpMsg, true); // Add message to outgoing VIP queue + } + } +} + +bool ConnectionUDP::timeOut() const +{ + time_t now = std::time(NULL); + if((now-mLastActive) >= mTimeOutValue) + return true; + + return false; +} + +char* ConnectionUDP::getRemoteAddress() +{ + return inet_ntoa(mRemoteAddr.sin_addr); +} + +PMessage* ConnectionUDP::GetMessage() +{ + PMessage* RetVal; + + if (mQueueIn.empty()) + RetVal = NULL; + else + { + RetVal = mQueueIn.front(); + mQueueIn.pop(); + } + return RetVal; +} + +void ConnectionUDP::DeleteOutgoingMessages() +{ + while (! mQueueOut.empty()) + { + PMessage* tmpMsg; + tmpMsg = mQueueOut.front(); + mQueueOut.pop(); + delete tmpMsg; + } + while (! mVIPQueueOut.empty()) + { + PMessage* tmpMsg2; + tmpMsg2 = mVIPQueueOut.front(); + mVIPQueueOut.pop(); + delete tmpMsg2; + } +} + +bool ConnectionUDP::update() +{ + PMessage* tmpMsg; + int numBytes; + bool gotVIPmsg; + + // send data from outgoing queue + flushSendBuffer(); // manage old write compatibility + + // Update messagebuffer; Erase all messages older than MAX_RETENTION + UpdateMessageBuffer(); + + if (! mQueueOut.empty() || ! mVIPQueueOut.empty()) + { + //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Sending messages -----------------"); + // Console->Print("ConnectionUDP::update() - %d messages waiting in Output Queue", mQueueOut.size()); + while(! mQueueOut.empty() || ! mVIPQueueOut.empty()) + { + //Console->Print("ConnectionUDP::update() - OUT Data avail"); + + // First, take a look at the VIP Query. If not empty, send these packets first + gotVIPmsg = false; + if(! mVIPQueueOut.empty()) + { + tmpMsg = mVIPQueueOut.front(); + gotVIPmsg = true; + Console->Print("ConnectionUDP::update() - Got VIP (Very important packet) that is waiting to be sent"); + } + else + { + tmpMsg = mQueueOut.front(); + + // We ignore VIP packets for now. They are only meant to OOO packets + InsertUDPMessage(tmpMsg); + } + //int numBytes = send(mSockfd, tmpMsg->GetMessageData(), tmpMsg->GetSize(), 0); + int numBytes = sendto(mSockfd, (char*) tmpMsg->GetMessageData(), tmpMsg->GetSize(), 0, (struct sockaddr *)&mRemoteAddr, sizeof(struct sockaddr)); + if(numBytes > 0) + { + //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Data sent"); + mLastActive = std::time(NULL); + if(gotVIPmsg == true) + { + mVIPQueueOut.pop(); + } + else + { + mQueueOut.pop(); // message written, we can remove it from queue + } + //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Message sent:"); + //tmpMsg->DumpHead("OUT Msg:"); // ==== + //tmpMsg->Dump(); + delete tmpMsg; // and delete the message + } + else + { + if (errno == EAGAIN) + { + break; + } + else // error while sending data -> output error-msg to console + { + perror("udp-send2"); + //close(mSockfd); + return false; + } + } + } + //if (! mQueueOut.empty()) + // Console->Print(YELLOW, BLACK, "ConnectionUDP::update() - %d messages remaining in Output Queue", mQueueOut.size()); + } + + //check if data is available from this socket and if yes, read into a new PMessage and put it on incoming queue + if(mServerSocket->isDataAvailable(mSockfd)) + { + //Console->Print("ConnectionUDP::update() - IN Data avail"); + while (1) + { + tmpMsg = new PMessage(RECVBUFFERSIZE); + socklen_t addrlen; + addrlen = sizeof(mRemoteAddr); + //struct sockaddr_in tempAddr; // need to built in check, + // if the incoming data is coming from the client or someone else! + //numBytes = recv(mSockfd, tmpMsg->GetMessageDataPointer(RECVBUFFERSIZE), RECVBUFFERSIZE, 0); // get the data + numBytes = recvfrom(mSockfd, (char*) tmpMsg->GetMessageDataPointer(RECVBUFFERSIZE), RECVBUFFERSIZE, 0, (struct sockaddr *)&mRemoteAddr, &addrlen); + if(numBytes > 0) + { + //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Data received"); + mLastActive = std::time(NULL); + tmpMsg->ForceSize(numBytes); + mQueueIn.push(tmpMsg); + //tmpMsg->DumpHead("IN Msg :"); // ==== + } + else + { + delete tmpMsg; + if(errno != EAGAIN) + { // an error has occured -> output it to the console + perror("udp-receive"); + Console->Print(RED, BLACK, "mSockfd:%d MaxRead:%d ", mSockfd, RECVBUFFERSIZE); + } + break; + } + } + //Console->Print("ConnectionUDP::update() - %d messages ready in Input Queue", mQueueIn.size()); + } + return true; +} + +void ConnectionUDP::SendMessage(PMessage* nMessage, bool nVIP) +{ + if (nMessage) + { + if(nVIP == true) + mVIPQueueOut.push(nMessage); + else + mQueueOut.push(nMessage); + } +} + +/**************** Old I/F compatibility stuff ******************/ + +int ConnectionUDP::getRecvBufferSize() +{ + PMessage* tmpMsg; + + if (mQueueIn.empty()) + return 0; + + tmpMsg = mQueueIn.front(); + uint16_t _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); + if (_size <= 0) + { + mQueueIn.pop(); + delete tmpMsg; + if (mQueueIn.empty()) + return 0; + tmpMsg = mQueueIn.front(); + tmpMsg->SetNextByteOffset(0); + _size = tmpMsg->GetSize(); + } + return _size; +} + +int ConnectionUDP::getSendBufferSize() +{ + if(mSendBufferMsg == NULL) + return 0; + else + return mSendBufferMsg->GetSize(); +} + +void ConnectionUDP::flushSendBuffer() +{ + //Console->Print("ConnectionUDP::flushSendBuffer()"); + if((mSendBufferMsg != NULL) && (mSendBufferMsg->GetSize() > 0)) + { + SendMessage(mSendBufferMsg); + mSendBufferMsg = NULL; + //Console->Print(YELLOW, BLACK, "ConnectionUDP::flushSendBuffer() - Data flushed"); + } +} + +const uint8_t *ConnectionUDP::read(int *size) +{ + PMessage* tmpMsg; + //Console->Print("ConnectionUDP::read() - trying to read up to %d bytes", *size); + if (mQueueIn.empty() || !size) + { + //Console->Print("ConnectionUDP::read() - no more packet"); + return NULL; + } + + tmpMsg = mQueueIn.front(); + uint16_t _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); + //Console->Print("ConnectionUDP::read() - %d bytes remaining in current packet", _size); + if (_size <= 0) + { + //Console->Print("ConnectionUDP::read() - trying next packet"); + mQueueIn.pop(); + delete tmpMsg; + if (mQueueIn.empty()) + { + //Console->Print("ConnectionUDP::read() - no more packet"); + return NULL; + } + tmpMsg = mQueueIn.front(); + _size = tmpMsg->GetSize(); + tmpMsg->SetNextByteOffset(0); + } + + if(*size==0) + { + *size=_size; + } + else + { + *size = std::min(*size, (int32_t)_size); + } + + uint8_t const *ptr = tmpMsg->GetMessageData() + tmpMsg->GetNextByteOffset(); + tmpMsg->SetNextByteOffset(tmpMsg->GetNextByteOffset()+ *size); + //Console->Print(GREEN, BLACK, "ConnectionUDP::read() - %d bytes read", *size); + return ptr; +} + +int ConnectionUDP::write(const void* data, int size) +{ + // data is stored in mSendBufferMsg. Gets queued in next flushSendBuffer() or update() + if (mSendBufferMsg == NULL) + { + //Console->Print("ConnectionUDP::write() creating new mSendBufferMsg"); + mSendBufferMsg = new PMessage(SENDBUFFERSIZE); + } + mSendBufferMsg->Write(data, (uint16_t)size); + //Console->Print(GREEN, BLACK, "ConnectionUDP::write() %d bytes written to mSendBufferMsg (total size %d)", size, mSendBufferMsg->GetSize()); + return size; +} + +int ConnectionUDP::write(const char *String) +{ + if(!String) + return 0; + + return write(String, strlen(String)); +} + +int ConnectionUDP::write(uint8_t Data) +{ + return write(&Data, sizeof(uint8_t)); +} + +int ConnectionUDP::write(uint16_t Data) +{ + return write(&Data, sizeof(uint16_t)); +} + +int ConnectionUDP::write(uint32_t Data) +{ + return write(&Data, sizeof(uint32_t)); +} + +int ConnectionUDP::write(float Data) +{ + return write(&Data, sizeof(float)); +} + +int ConnectionUDP::write(double Data) +{ + return write(&Data, sizeof(double)); +} + +/// *********************************************** + +void ConnectionUDP::SetUDP_ID(uint16_t id) +{ + if (mUDP_ID == 0xffff) + { + mUDP_ID = 0; + } + else + { + mUDP_ID = id; + } + if(mUDP_ID == 0) // If UDPID is set to zero, erase message buffer too + ResetMessageBuffer(); +} + +ServerSocket::ServerSocket() +{ + FD_ZERO(&m_MainSetTCP); // clear the master and temp sets + FD_ZERO(&m_ReadSetTCP); + FD_ZERO(&m_MainSetUDP); + FD_ZERO(&m_MainSetGlobal); + + m_FdMaxUDP=0; + + m_TimeOut.tv_sec = 0; + m_TimeOut.tv_usec = 30; + + //m_LastUDPPort = 5000; +} + +ServerSocket::~ServerSocket() +{ + close(m_ListenerTCP); +} + +void ServerSocket::settimeout(int32_t timeout_sec, int32_t timeout_usec) +{ + if ((timeout_sec >= 0) && (timeout_usec >= 0)) + { + m_TimeOut.tv_sec = timeout_sec; + m_TimeOut.tv_usec = timeout_usec; + } + +} + +bool ServerSocket::open(int port) +{ + // get the tcp listener + if ((m_ListenerTCP = socket(PF_INET, SOCK_STREAM, 0)) == -1) + { + perror("tcp-socket"); + return false; + } + + int yes=1; + + // lose the pesky "address already in use" error message + if (setsockopt(m_ListenerTCP, SOL_SOCKET, SO_REUSEADDR, &yes, + sizeof(int)) == -1) { + perror("tcp-setsockopt"); + return false; + } + + // bind + memset(&m_ServerAddr,0,sizeof(struct sockaddr_in)); + m_ServerAddr.sin_family = AF_INET; + m_ServerAddr.sin_addr.s_addr = INADDR_ANY; + m_ServerAddr.sin_port = htons(port); + + // bind with tcp sockfd + if (bind(m_ListenerTCP, (struct sockaddr *)&m_ServerAddr, sizeof(struct sockaddr)) == -1) + { + perror("tcp-bind"); + return false; + } + + // set listening-socket to non-blocking + fcntl(m_ListenerTCP, F_SETFL, O_NONBLOCK); + + // listen + if (listen(m_ListenerTCP, 10) == -1) + { + perror("tcp-listen"); + return false; + } + + FD_ZERO(&m_MainSetTCP); + FD_ZERO(&m_ReadSetTCP); + FD_ZERO(&m_MainSetUDP); + FD_ZERO(&m_MainSetGlobal); + + m_FdMaxUDP=0; + + // add the listener to the master sets + FD_SET(m_ListenerTCP, &m_MainSetTCP); + FD_SET(m_ListenerTCP, &m_MainSetGlobal); + + // keep track of the biggest file descriptor + m_FdMaxTCP = m_ListenerTCP; // so far, it's this one + + //Console->Print("Server running on port %d", port); + + return true; +} + +void ServerSocket::update() +{ + struct timeval tmp_TimeOut; + int fdMax; + + // copy fd_sets from main-set to temp. read-set + m_ReadSetTCP = m_MainSetGlobal; + + fdMax = std::max(m_FdMaxTCP, m_FdMaxUDP); + + //FD_ZERO(&m_ReadSetTCP); + //FD_SET (m_ListenerTCP, &m_ReadSetTCP); + + // select incoming data for tcp & udp + tmp_TimeOut = m_TimeOut; //save m_TimeOut... will be modified by select + if (select(fdMax+1, &m_ReadSetTCP, NULL, NULL, &tmp_TimeOut) == -1) + { + perror("select"); + } + + //Select exit condition logging + /* + if ((tmp_TimeOut.tv_sec == 0) && (tmp_TimeOut.tv_usec == 0)) + { + Console->LPrint(GREEN, BLACK, "[Idle]"); + Console->LPrint(" Exiting select on timeout (remains %d sec and %d usec)", tmp_TimeOut.tv_sec, tmp_TimeOut.tv_usec); + Console->LClose(); + } + else + { + Console->LPrint(YELLOW, BLACK, "[Active]"); + Console->LPrint(" Exiting select with remaining time %d sec and %d usec", tmp_TimeOut.tv_sec, tmp_TimeOut.tv_usec); + Console->LClose(); + } + */ + + // check for new tcp connections + if (FD_ISSET(m_ListenerTCP, &m_ReadSetTCP)) // we got one!! + { + m_bNewTCPConnection = true; + } + else + { + m_bNewTCPConnection = false; + } + +} + +bool ServerSocket::newConnection() +{ + return (m_bNewTCPConnection); +} + +ConnectionTCP* ServerSocket::getTCPConnection() +{ + if(m_bNewTCPConnection) + { + struct sockaddr_in RemoteAddr; // new incoming client address + socklen_t addrlen = sizeof(RemoteAddr); + int NewSockfd; // newly accept()ed socket descriptor + + // handle new connections + if ((NewSockfd = accept(m_ListenerTCP, (struct sockaddr *)&RemoteAddr, &addrlen)) == -1) + { + m_bNewTCPConnection = false; // set back to normal + perror("tcp-accept"); + return 0; + } + else + { + FD_SET(NewSockfd, &m_MainSetTCP); // add to master TCP set + FD_SET(NewSockfd, &m_MainSetGlobal); // add to master global set + if (NewSockfd > m_FdMaxTCP) // keep track of the maximum + { + m_FdMaxTCP = NewSockfd; + } + + ConnectionTCP* tcpConn = new ConnectionTCP(NewSockfd, RemoteAddr, this); + + m_bNewTCPConnection = false; // set back to normal + + return tcpConn; + } + } + + return 0; +} + +ConnectionUDP* ServerSocket::getUDPConnection(uint32_t remoteadress, int32_t remoteport) +{ + int udpSockfd; + + if ((udpSockfd = socket(PF_INET, SOCK_DGRAM, 0)) == -1) + { + perror("udp-socket"); + return NULL; + } + + struct sockaddr_in my_addr; + + uint16_t Port = Config->GetOptionInt("gameserver_udpport_min"); + uint16_t maxPort = Config->GetOptionInt("gameserver_udpport_max"); + + my_addr.sin_family = AF_INET; // host byte order + my_addr.sin_port = htons(Port); // short, network byte order + my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP + memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct + + //Search a free udp port to use (could be optimised for faster port allocation) + while (bind(udpSockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) + { + if (errno == EADDRINUSE) + { + my_addr.sin_port = htons(++Port); + if (Port > maxPort) + { + Console->Print(RED, BLACK,"No more free UDP port in configured range"); + return NULL; + } + } + else + { + perror("udp-bind"); + return NULL; + } + } + + FD_SET(udpSockfd, &m_MainSetUDP); // add to master UDP set + FD_SET(udpSockfd, &m_MainSetGlobal); // add to master global set + if (udpSockfd > m_FdMaxUDP) // keep track of the maximum + { + m_FdMaxUDP = udpSockfd; + } + + ConnectionUDP* udpConn = new ConnectionUDP(udpSockfd, Port, remoteadress, remoteport, this); + + //m_LastUDPPort++; + + return udpConn; +} + +bool ServerSocket::isDataAvailable(int sockfd) +{ + if(FD_ISSET(sockfd, &m_ReadSetTCP)) + { + return true; + } + + return false; +} + +void ServerSocket::delSocketFromSet(int sockfd) +{ + FD_CLR(sockfd, &m_MainSetTCP); + FD_CLR(sockfd, &m_MainSetUDP); + FD_CLR(sockfd, &m_MainSetGlobal); +} + +void ServerSocket::closeServer() +{ + close(m_ListenerTCP); +} diff --git a/server/src/common/netcode.h b/server/src/common/netcode.h new file mode 100644 index 0000000..b0db933 --- /dev/null +++ b/server/src/common/netcode.h @@ -0,0 +1,219 @@ +#pragma once + +#include +#include +#include +#include +#include +#include "common/message.h" + +#define RECVBUFFERSIZE 4096 +#define SENDBUFFERSIZE 4096 +#define DEFAULT_TCP_TIMEOUT 600 +#define DEFAULT_UDP_TIMEOUT 60 +#define SESSION_UDP_OFFSET 37917 +#define MAX_RETENTION 20 + +class ConnectionTCP; +class ConnectionUDP; +class ServerSocket; + +class ConnectionTCP { +private: + int32_t mSockfd; + struct sockaddr_in mRemoteAddr; + time_t mLastActive; + time_t mTimeOutValue; + bool mbConnected; + ServerSocket *mServerSocket; // pointer to ServerSocket + std::queue mQueueIn; + std::queue mQueueOut; + PMessage *mReceiveBufferMsg; + // old stuff + PMessage *mSendBufferMsg; + +public: + ConnectionTCP(int32_t sockfd, struct sockaddr_in addr, ServerSocket *server); + ~ConnectionTCP(); + + struct sockaddr_in getAddr() + { + return mRemoteAddr; + } + int32_t getSockfd() + { + return mSockfd; + } + char *getRemoteAddress(); + void setServer(ServerSocket *server) + { + if (server) + mServerSocket = server; + } + bool timeOut() const; + inline time_t GetTimeOutValue() const + { + return mTimeOutValue; + } + inline void SetTimeOutValue(time_t Value) + { + mTimeOutValue = Value; + } + bool update(); + bool isConnected() + { + return mbConnected; + } + inline void SendMessage(PMessage *nMessage) + { + mQueueOut.push(nMessage); + } + PMessage *GetMessage(); + void DeleteOutgoingMessages(); + // old stuff + void flushSendBuffer(); + int32_t getRecvBufferSize(); + int32_t getSendBufferSize(); + const uint8_t *read(int32_t *size); + int32_t write(const void *data, int32_t size); + int32_t write(uint8_t data); + int32_t write(uint16_t data); + int32_t write(uint32_t data); + int32_t write(float data); + int32_t write(double data); + int32_t write(const char *string); +}; + +class ConnectionUDP { + typedef std::map PMessageMap; +private: + int32_t mSockfd; + struct sockaddr_in mRemoteAddr; + time_t mLastActive; + time_t mTimeOutValue; + int32_t mPort; + ServerSocket *mServerSocket; + std::queue mQueueIn; + std::queue mQueueOut; + std::queue mVIPQueueOut; + // UDP MessageBuffer + uint16_t mUDP_ID; + uint16_t mLastUDPID; + uint16_t mSessionID; + uint16_t mTransactionID; + PMessageMap UDPMessages; + PMessageMap::iterator GetMsgListBegin() + { + return UDPMessages.begin(); + } + PMessageMap::iterator GetMsgListEnd() + { + return UDPMessages.end(); + } + void InsertUDPMessage(PMessage *nMsg); // save message for later OOO handling + void UpdateMessageBuffer(); // delete old packets, depending on define "MAX_RETENTION" + void ResetMessageBuffer(); // done whe UDP_ID gets set to zero + // old stuff + PMessage *mSendBufferMsg; + +public: + ConnectionUDP(int32_t sockfd, int32_t port, int32_t remoteaddress, int32_t remoteport, ServerSocket *server); + ~ConnectionUDP(); + + bool update(); + int32_t getPort() + { + return mPort; + } + struct sockaddr_in getAddr() + { + return mRemoteAddr; + } + int32_t getSockfd() + { + return mSockfd; + } + char *getRemoteAddress(); + bool timeOut() const; + inline time_t getTimeOutValue() const + { + return mTimeOutValue; + } + inline void setTimeOutValue(time_t Value) + { + mTimeOutValue = Value; + } + void SendMessage(PMessage *nMessage, bool nVIP = false); + inline int32_t GetReadyMessageNumber() + { + return mQueueIn.size(); + } + PMessage *GetMessage(); + void DeleteOutgoingMessages(); + // MessageBuffer + void ReSendUDPMessage(uint16_t nUDP_ID); // OOO + inline uint16_t GetUDP_ID() const + { + return mUDP_ID; + } + inline uint16_t GetSessionID() const + { + return SESSION_UDP_OFFSET + mUDP_ID; + } + inline uint16_t GetTransactionID() + { + return mTransactionID; + } + void SetUDP_ID(uint16_t id); + inline void IncreaseUDP_ID() + { + SetUDP_ID(mUDP_ID + 1); + } + inline void ResetTransactionID() + { + mTransactionID = 10170; + } + inline void IncreaseTransactionID(uint8_t nInc = 1) + { + mTransactionID += nInc; + } + // old stuff + int32_t getRecvBufferSize(); + int32_t getSendBufferSize(); + void flushSendBuffer(); + const uint8_t *read(int32_t *size); + int32_t write(const void *data, int32_t size); + int32_t write(uint8_t data); + int32_t write(uint16_t data); + int32_t write(uint32_t data); + int32_t write(float data); + int32_t write(double data); + int32_t write(const char *string); +}; + +class ServerSocket { +private: + fd_set m_MainSetTCP; // master file descriptor list for tcp-connections + fd_set m_ReadSetTCP; // temp file descriptor list for select() for tcp-connections + fd_set m_MainSetUDP; // master file descriptor list for udp-connections + fd_set m_MainSetGlobal; // master file descriptor list for udp+tcp connections + struct sockaddr_in m_ServerAddr; + int32_t m_ListenerTCP; // listen socket + int32_t m_FdMaxTCP; // highest current file-descriptor (tcp) + int32_t m_FdMaxUDP; // highest current file-descriptor (udp) + bool m_bNewTCPConnection; + struct timeval m_TimeOut; + +public: + ServerSocket(); + ~ServerSocket(); + void settimeout(int32_t timeout_sec, int32_t timeout_usec); + bool open(int32_t port); + void update(); + bool newConnection(); + ConnectionTCP *getTCPConnection(); + ConnectionUDP *getUDPConnection(uint32_t remoteaddress, int32_t remoteport); + bool isDataAvailable(int32_t sockfd); + void delSocketFromSet(int32_t sockfd); + void closeServer(); +}; diff --git a/server/src/common/netcode/Makefile b/server/src/common/netcode/Makefile deleted file mode 100644 index 5fb25e9..0000000 --- a/server/src/common/netcode/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := testor2 - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -#LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/common/netcode/connection-tcp.cpp b/server/src/common/netcode/connection-tcp.cpp deleted file mode 100644 index a43385c..0000000 --- a/server/src/common/netcode/connection-tcp.cpp +++ /dev/null @@ -1,410 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - connection-tcp.cpp - a connection class for tcp - - Authors: - - bakkdoor - - MODIFIED: 09 Feb 2006 bakkdoor - REASON: - introduced - - MODIFIED: 27 Jun 2006 hammag - REASON: - added m_ServerSocket check in ~ConnectionTCP() - - added m_ServerSocket check in update() in disconnection case - - corrected recv *buf and len parameters in update() - to avoid unread in-buffer data smashing - - MODIFIED: 01 Jul 2006 hammag - REASON: - update() : modified to deal correctly with would-block socket writes. - - ConnectionTCP() : moved-in non-blocking setting from - ServerSocket::getTCPConnection() for better class coherency - - MODIFIED: 24 Jul 2006 hammag - REASON: - ConnectionTCP() : added m_SendSize, m_RecvRewind and m_RecvSize missing initialisation - which caused nice segfaults on unlucky days :p - - MODIFIED: 24 Jul 2006 hammag - REASON: - changed member data prefix from "m_" to "m" in for homogeneity with the reste of TinNS code - - added private members data mQueueIn and mQueueOut - - added public members methods SendMessage(), GetMessage(), DeleteOutgoingMessages() and modified code accordingly - - changed old read/write methods implementation to message queues usage - NOTA: - as previously, ConnectionTCP class takes care of separating messages in the TCP stream according - to NC TCP packet lentgh field. Additionnaly, it does look for the 0xFE signature byte in front of the packet lentgh field. - - MODIFIED: 26 Jul 2006 hammag - REASON: - enabled multiple network send in on single update() call - - MODIFIED: 05 Aug 2006 hammag - REASON: - renamed "getLocalAddress()" to "getRemoteAddress()" as it is ... what it does ! - - TODO: - add real priority management when needed. atm all outgoing messages are put in the same queue - - add pending outgoing message management in case of EAGAIN (request temp add to writeset & mngt by the "scheduler") - - set TCP socket option SO_KEEPALIVE to be firewall-users friendly (else connexion may be lost when no zoning occurs for a long time, like in real NC ;-) ) - - don't access Config object from netcode's objects. Use parameter members - set by object owner. - -*/ - -#include "main.h" - -ConnectionTCP::ConnectionTCP(int sockfd, struct sockaddr_in addr, ServerSocket* server) -{ - mSockfd = sockfd; - mRemoteAddr = addr; - - if(server) - { - mServerSocket = server; - } - - // set new socket to non-blocking - fcntl(mSockfd, F_SETFL, O_NONBLOCK); - - mbConnected = true; // client obviously is connected at creation... - - mTimeOutValue = DEFAULT_TCP_TIMEOUT; - mLastActive = std::time(NULL); - - mReceiveBufferMsg = NULL; - mSendBufferMsg = NULL; -} - -ConnectionTCP::~ConnectionTCP() -{ - if (mServerSocket) - { - mServerSocket->delSocketFromSet(mSockfd); - } - close(mSockfd); - - if (mReceiveBufferMsg) - { - delete mReceiveBufferMsg; - } - - while (!mQueueIn.empty()) - { - delete mQueueIn.front(); - mQueueIn.pop(); - } - - if (mSendBufferMsg) - { - delete mSendBufferMsg; - } -} - -char* ConnectionTCP::getRemoteAddress() -{ - return inet_ntoa(mRemoteAddr.sin_addr); -} - -bool ConnectionTCP::timeOut() const -{ - time_t now = std::time(NULL); - if((now-mLastActive) >= mTimeOutValue) - return true; - - return false; -} - -PMessage* ConnectionTCP::GetMessage() -{ - PMessage* RetVal; - - if (mQueueIn.empty()) - RetVal = NULL; - else - { - RetVal = mQueueIn.front(); - mQueueIn.pop(); - } - return RetVal; -} - -void ConnectionTCP::DeleteOutgoingMessages() -{ - while (! mQueueOut.empty()) - { - delete mQueueOut.front(); - mQueueOut.pop(); - } -} - -bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p -{ - PMessage* tmpMsg; - int numBytes; - u8 const* DataStart; - u16 DataSize; - u8* MsgStart; - u16 MsgOffset; - u16 MsgLen; - - //check if data is available for this socket and if yes, read into a new PMessage and put it on incoming queue - if(mServerSocket->isDataAvailable(mSockfd)) - { -//Console->Print("ConnectionTCP::update() - IN Data avail"); - if (mReceiveBufferMsg == NULL) - { - mReceiveBufferMsg = new PMessage(RECVBUFFERSIZE); - } - - DataSize = mReceiveBufferMsg->GetSize(); - numBytes = recv(mSockfd, (char*) mReceiveBufferMsg->GetMessageDataPointer(RECVBUFFERSIZE - DataSize) + DataSize, RECVBUFFERSIZE - DataSize, 0); // get the data - - if(numBytes > 0) - { -//Console->Print(GREEN, BLACK, "ConnectionTCP::update() - Data received"); - mbConnected = true; - mReceiveBufferMsg->ForceSize(DataSize + numBytes); - mLastActive = std::time(NULL); - - while(mReceiveBufferMsg && mReceiveBufferMsg->GetSize()) - { - DataStart = mReceiveBufferMsg->GetMessageData(); - DataSize = mReceiveBufferMsg->GetSize(); - MsgStart = (u8*)memchr(DataStart, 0xfe, DataSize); - - if (MsgStart) - { - MsgOffset = MsgStart - DataStart; - if (MsgOffset) - { - Console->Print(YELLOW, BLACK, "ConnectionTCP::update() Message head found 0x%04hx bytes after packet start. Inbetween data will be discarded.", MsgOffset); - } - if (MsgOffset + 3 <= DataSize) - { - MsgLen = *(u16*)(DataStart + MsgOffset + 1); -//Console->Print(GREEN, BLACK, "ConnectionTCP::update() TCP Message body length 0x%04hx (buffer 0x%04hx)", MsgLen, mReceiveBufferMsg->GetSize()); - if (MsgOffset + 3 + MsgLen <= DataSize) - { - tmpMsg = mReceiveBufferMsg->GetChunk(MsgOffset, MsgLen + 3); // Change (MsgOffset, MsgLen + 3) to (MsgOffset + 3, MsgLen) to REMOVE head & length from message head - mQueueIn.push(tmpMsg); - - if (MsgOffset + 3 + MsgLen < DataSize) - { - tmpMsg = mReceiveBufferMsg->GetChunk(MsgOffset + 3 + MsgLen, DataSize - (MsgOffset + 3 + MsgLen)); - } - else - { - tmpMsg = NULL; - } - - delete mReceiveBufferMsg; - mReceiveBufferMsg = tmpMsg; - } - } - } - else - { - break; - } - } - } - else if(numBytes == 0) // disconnected !! - { - mbConnected = false; // set to not-connected and close the socket - if (mServerSocket) - { - mServerSocket->delSocketFromSet(mSockfd); - } - close(mSockfd); - return false; - } - else - { - if(errno != EAGAIN) - { // an error has occured -> output it to the console - perror("tcp-receive"); - Console->Print(RED, BLACK, "mSockfd:%d MaxRead:%d ", mSockfd, RECVBUFFERSIZE); - } - } - } - - // send data from outgoing queue - flushSendBuffer(); // manage old write compatibility - while(! mQueueOut.empty()) - { -//Console->Print("ConnectionUDP::update() - OUT Data avail"); - tmpMsg = mQueueOut.front(); - int numBytes = send(mSockfd, (char*) tmpMsg->GetMessageData(), tmpMsg->GetSize(), 0); - if(numBytes == -1) // error while sending data -> output error-msg to console - { - if (errno == EAGAIN) - { - break; - } - else - { - perror("tcp-send"); - //close(mSockfd); - return false; - } - } - else if(numBytes > 0) - { -//Console->Print(GREEN, BLACK, "ConnectionTCP::update() - Data sent"); - mLastActive = std::time(NULL); - mQueueOut.pop(); // message written, we can remove it from queue - delete tmpMsg; // and delete the message - } - } - - return true; -} - -/**** Old I/F compatibility functions ****/ - -int ConnectionTCP::getRecvBufferSize() -{ - PMessage* tmpMsg; - - if (mQueueIn.empty()) - return 0; - - tmpMsg = mQueueIn.front(); - u16 _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); - if (_size <= 0) - { - mQueueIn.pop(); - delete tmpMsg; - if (mQueueIn.empty()) - return 0; - tmpMsg = mQueueIn.front(); - tmpMsg->SetNextByteOffset(0); - _size = tmpMsg->GetSize(); - } - return _size; -} - -int ConnectionTCP::getSendBufferSize() -{ - if(mSendBufferMsg == NULL) - return 0; - else - return mSendBufferMsg->GetSize(); -} - -void ConnectionTCP::flushSendBuffer() -{ -//Console->Print("ConnectionTCP::flushSendBuffer()"); - if((mSendBufferMsg != NULL) && (mSendBufferMsg->GetSize() > 0)) - { - SendMessage(mSendBufferMsg); - mSendBufferMsg = NULL; -//Console->Print(YELLOW, BLACK, "ConnectionTCP::flushSendBuffer() - Data flushed"); - } -} - -const u8* ConnectionTCP::read(int* size) -{ - PMessage* tmpMsg; -//Console->Print("ConnectionTCP::read() - trying to read up to %d bytes", *size); - if (mQueueIn.empty() || !size) - { -//Console->Print("ConnectionTCP::read() - no more packet"); - return NULL; - } - - tmpMsg = mQueueIn.front(); - u16 _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); -//Console->Print("ConnectionTCP::read() - %d bytes remaining in current packet", _size); - if (_size <= 0) - { -//Console->Print("ConnectionTCP::read() - trying next packet"); - mQueueIn.pop(); - delete tmpMsg; - if (mQueueIn.empty()) - { -//Console->Print("ConnectionUDP::read() - no more packet"); - return NULL; - } - tmpMsg = mQueueIn.front(); - _size = tmpMsg->GetSize(); - tmpMsg->SetNextByteOffset(0); - } - - if(*size==0) - { - *size=_size; - } - else - { - *size=min(*size, (s32)_size); - } - - u8 const* ptr = tmpMsg->GetMessageData() + tmpMsg->GetNextByteOffset(); - tmpMsg->SetNextByteOffset(tmpMsg->GetNextByteOffset()+ *size); -//Console->Print(GREEN, BLACK, "ConnectionTCP::read() - %d bytes read", *size); - return ptr; -} - -int ConnectionTCP::write(const void* data, int size) -{ - // data is stored in mSendBufferMsg. Gets queued in next flushSendBuffer() or update() - if (mSendBufferMsg == NULL) - { -//Console->Print("ConnectionTCP::write() creating new mSendBufferMsg"); - mSendBufferMsg = new PMessage(SENDBUFFERSIZE); - } - - mSendBufferMsg->Write(data, (u16)size); -//Console->Print(GREEN, BLACK, "ConnectionUDP::write() %d bytes written to mSendBufferMsg (total size %d)", size, mSendBufferMsg->GetSize()); - return size; -} - -int ConnectionTCP::write(const char *String) -{ - if(!String) - return 0; - - return write(String, strlen(String)); -} - -int ConnectionTCP::write(u8 Data) -{ - return write(&Data, sizeof(u8)); -} - -int ConnectionTCP::write(u16 Data) -{ - return write(&Data, sizeof(u16)); -} - -int ConnectionTCP::write(u32 Data) -{ - return write(&Data, sizeof(u32)); -} - -int ConnectionTCP::write(float Data) -{ - return write(&Data, sizeof(float)); -} - -int ConnectionTCP::write(double Data) -{ - return write(&Data, sizeof(double)); -} diff --git a/server/src/common/netcode/connection-udp.cpp b/server/src/common/netcode/connection-udp.cpp deleted file mode 100644 index 02220e2..0000000 --- a/server/src/common/netcode/connection-udp.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - connection-udp.cpp - a connection class for udp - - Authors: - - bakkdoor - - MODIFIED: 09 Feb 2006 bakkdoor - REASON: - introduced - - MODIFIED: 27 Jun 2006 hammag - REASON: - put UDP socket in non-blocking mode in ConnectionUDP to avoid blocking - in update() as it can be called without data available. - - modified update() accordingly. - - modified flushSendBuffer() accordingly; >> !!! leads to data loss if packet could not be sent - and connection closed just after that. Is it a problem before UDP connection closure (ie logout) ??? - - corrected recv *buf and len parameters in update() to avoid - unread in-buffer data smashing. - - added initialisation of addrlen in update(). - - MODIFIED: 01 Jul 2006 hammag - REASON: - ConnectionUDP(): modified to set m_ServerSocket - - update(): modified to check m_ServerSocket->isDataAvailable() - before trying to read from socket - - ~ConnectionUDP(): added socket removal from fd set - - MODIFIED: 24 Jul 2006 hammag - REASON: - changed member data prefix from "m_" to "m" in for homogeneity with the reste of TinNS code - - added private members data mQueueIn and mQueueOut - - added public members methods SendMessage(), GetMessage(), DeleteOutgoingMessages() and modified code accordingly - - changed old read/write methods implementation to message queues usage - - MODIFIED: 26 Jul 2006 hammag - REASON: - enabled multiple network receive & send in on single update() call - - MODIFIED: 29 Jul 2006 hammag - REASON: - changed order of network read/write in update(): now first write, then read - - MODIFIED: 05 Aug 2006 hammag - REASON: - a pseudo-connection is now established on the udp socket, so that we don't need to care - for client IP/port in later processing - REASON: - renamed "getLocalAddress()" to "getRemoteAddress()" as it is ... what it does ! - - - TODO: - split update so the main loop is : read - process - write - wait for something to read - - add try vector read & write with recvmsg/sendmsg - - add real priority management when needed. atm all outgoing messages are put in the same queue - - add pending outgoing message management in case of EAGAIN (request temp add to writeset & mngt by the "scheduler") - - best sizing of receive message could be done with ioctl: - "int value; - error = ioctl(tcp_socket, ioctl_type, &value); - SIOCINQ - Gets a pointer to an integer as argument. Returns the size of - the next pending datagram in the integer in bytes, or 0 when no - datagram is pending." - - check incoming packets Source IP for matching with registered client IP, to avoid DOS & other things - - maybe dont allow source port change (eg. because of NAT) more than once (at the begining only) for same reasons - - check incoming messages UDP_ID to reject old messages and -if possible- request OOO granted messages (to be done at higher message decoding level thought) - - manage an ageing queue of sent granted messages for resent if OOO notified by client - - don't access Config object from netcode's objects. Use parameter members - set by object owner. -*/ - -#include "main.h" - -ConnectionUDP::ConnectionUDP(int sockfd, int port, int remoteadress, int remoteport, ServerSocket* server) -{ - mSockfd = sockfd; - mPort = port; - //Console->Print("local UDP port: %d", port); - if(server) - { - mServerSocket = server; - } - - mTimeOutValue = DEFAULT_UDP_TIMEOUT; - mLastActive = std::time(NULL); - - mRemoteAddr.sin_family = AF_INET; // host byte order - mRemoteAddr.sin_port = htons(remoteport); // short, network byte order - mRemoteAddr.sin_addr.s_addr = remoteadress; // TODO: Get IP of client - - //Bind client to server in a udp pseudo-connection - /*if(connect(sockfd, (struct sockaddr *)&mRemoteAddr, sizeof(struct sockaddr ))) - { - Console->Print("Error on pseudo-connecting udp socket to %s:%d", inet_ntoa(mRemoteAddr.sin_addr),ntohs(mRemoteAddr.sin_port)); - perror("udp connect"); //exception should be thrown here - } - else */ - { - Console->Print("Client UDP %s:%d", inet_ntoa(mRemoteAddr.sin_addr), ntohs(mRemoteAddr.sin_port)); - } - // set UDP-socket to non-blocking - fcntl(sockfd, F_SETFL, O_NONBLOCK); - - // mRemoteAddr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP - // memset(&(mRemoteAddr.sin_zero), '\0', 8); // zero the rest of the struct - mSendBufferMsg = NULL; - - mUDP_ID = 0; - mSessionID = SESSION_UDP_OFFSET; - mLastUDPID = 0; - mTransactionID = 0; -} - - -ConnectionUDP::~ConnectionUDP() -{ - if (mServerSocket) - { - mServerSocket->delSocketFromSet(mSockfd); - } - close(mSockfd); - - if (mSendBufferMsg) - { - delete mSendBufferMsg; - } - - while (!mQueueIn.empty()) - { - delete mQueueIn.front(); - mQueueIn.pop(); - } - - while (!mQueueOut.empty()) - { - delete mQueueOut.front(); - mQueueOut.pop(); - } - while (!mVIPQueueOut.empty()) - { - delete mVIPQueueOut.front(); - mVIPQueueOut.pop(); - } - for(PMessageMap::iterator it=UDPMessages.begin(); it!=UDPMessages.end(); it++) - { - delete it->second; - UDPMessages.erase(it); - } -} - - -bool ConnectionUDP::timeOut() const -{ - time_t now = std::time(NULL); - if((now-mLastActive) >= mTimeOutValue) - return true; - - return false; -} - -char* ConnectionUDP::getRemoteAddress() -{ - return inet_ntoa(mRemoteAddr.sin_addr); -} - -PMessage* ConnectionUDP::GetMessage() -{ - PMessage* RetVal; - - if (mQueueIn.empty()) - RetVal = NULL; - else - { - RetVal = mQueueIn.front(); - mQueueIn.pop(); - } - return RetVal; -} - -void ConnectionUDP::DeleteOutgoingMessages() -{ - while (! mQueueOut.empty()) - { - PMessage* tmpMsg; - tmpMsg = mQueueOut.front(); - mQueueOut.pop(); - delete tmpMsg; - } - while (! mVIPQueueOut.empty()) - { - PMessage* tmpMsg2; - tmpMsg2 = mVIPQueueOut.front(); - mVIPQueueOut.pop(); - delete tmpMsg2; - } -} - -bool ConnectionUDP::update() -{ - PMessage* tmpMsg; - int numBytes; - bool gotVIPmsg; - - // send data from outgoing queue - flushSendBuffer(); // manage old write compatibility - - // Update messagebuffer; Erase all messages older than MAX_RETENTION - UpdateMessageBuffer(); - - if (! mQueueOut.empty() || ! mVIPQueueOut.empty()) - { - //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Sending messages -----------------"); - // Console->Print("ConnectionUDP::update() - %d messages waiting in Output Queue", mQueueOut.size()); - while(! mQueueOut.empty() || ! mVIPQueueOut.empty()) - { - //Console->Print("ConnectionUDP::update() - OUT Data avail"); - - // First, take a look at the VIP Query. If not empty, send these packets first - gotVIPmsg = false; - if(! mVIPQueueOut.empty()) - { - tmpMsg = mVIPQueueOut.front(); - gotVIPmsg = true; - Console->Print("ConnectionUDP::update() - Got VIP (Very important packet) that is waiting to be sent"); - } - else - { - tmpMsg = mQueueOut.front(); - - // We ignore VIP packets for now. They are only meant to OOO packets - InsertUDPMessage(tmpMsg); - } - //int numBytes = send(mSockfd, tmpMsg->GetMessageData(), tmpMsg->GetSize(), 0); - int numBytes = sendto(mSockfd, (char*) tmpMsg->GetMessageData(), tmpMsg->GetSize(), 0, (struct sockaddr *)&mRemoteAddr, sizeof(struct sockaddr)); - if(numBytes > 0) - { - //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Data sent"); - mLastActive = std::time(NULL); - if(gotVIPmsg == true) - { - mVIPQueueOut.pop(); - } - else - { - mQueueOut.pop(); // message written, we can remove it from queue - } - //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Message sent:"); - //tmpMsg->DumpHead("OUT Msg:"); // ==== - //tmpMsg->Dump(); - delete tmpMsg; // and delete the message - } - else - { - if (errno == EAGAIN) - { - break; - } - else // error while sending data -> output error-msg to console - { - perror("udp-send2"); - //close(mSockfd); - return false; - } - } - } - //if (! mQueueOut.empty()) - // Console->Print(YELLOW, BLACK, "ConnectionUDP::update() - %d messages remaining in Output Queue", mQueueOut.size()); - } - - //check if data is available from this socket and if yes, read into a new PMessage and put it on incoming queue - if(mServerSocket->isDataAvailable(mSockfd)) - { - //Console->Print("ConnectionUDP::update() - IN Data avail"); - while (1) - { - tmpMsg = new PMessage(RECVBUFFERSIZE); - socklen_t addrlen; - addrlen = sizeof(mRemoteAddr); - //struct sockaddr_in tempAddr; // need to built in check, - // if the incoming data is coming from the client or someone else! - //numBytes = recv(mSockfd, tmpMsg->GetMessageDataPointer(RECVBUFFERSIZE), RECVBUFFERSIZE, 0); // get the data - numBytes = recvfrom(mSockfd, (char*) tmpMsg->GetMessageDataPointer(RECVBUFFERSIZE), RECVBUFFERSIZE, 0, (struct sockaddr *)&mRemoteAddr, &addrlen); - if(numBytes > 0) - { - //Console->Print(GREEN, BLACK, "ConnectionUDP::update() - Data received"); - mLastActive = std::time(NULL); - tmpMsg->ForceSize(numBytes); - mQueueIn.push(tmpMsg); - //tmpMsg->DumpHead("IN Msg :"); // ==== - } - else - { - delete tmpMsg; - if(errno != EAGAIN) - { // an error has occured -> output it to the console - perror("udp-receive"); - Console->Print(RED, BLACK, "mSockfd:%d MaxRead:%d ", mSockfd, RECVBUFFERSIZE); - } - break; - } - } - //Console->Print("ConnectionUDP::update() - %d messages ready in Input Queue", mQueueIn.size()); - } - - return true; -} - -void ConnectionUDP::SendMessage(PMessage* nMessage, bool nVIP) -{ - if (nMessage) - { - if(nVIP == true) - mVIPQueueOut.push(nMessage); - else - mQueueOut.push(nMessage); - } -} - -/**************** Old I/F compatibility stuff ******************/ - -int ConnectionUDP::getRecvBufferSize() -{ - PMessage* tmpMsg; - - if (mQueueIn.empty()) - return 0; - - tmpMsg = mQueueIn.front(); - u16 _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); - if (_size <= 0) - { - mQueueIn.pop(); - delete tmpMsg; - if (mQueueIn.empty()) - return 0; - tmpMsg = mQueueIn.front(); - tmpMsg->SetNextByteOffset(0); - _size = tmpMsg->GetSize(); - } - return _size; -} - -int ConnectionUDP::getSendBufferSize() -{ - if(mSendBufferMsg == NULL) - return 0; - else - return mSendBufferMsg->GetSize(); -} - -void ConnectionUDP::flushSendBuffer() -{ - //Console->Print("ConnectionUDP::flushSendBuffer()"); - if((mSendBufferMsg != NULL) && (mSendBufferMsg->GetSize() > 0)) - { - SendMessage(mSendBufferMsg); - mSendBufferMsg = NULL; - //Console->Print(YELLOW, BLACK, "ConnectionUDP::flushSendBuffer() - Data flushed"); - } -} - -const u8* ConnectionUDP::read(int* size) -{ - PMessage* tmpMsg; - //Console->Print("ConnectionUDP::read() - trying to read up to %d bytes", *size); - if (mQueueIn.empty() || !size) - { - //Console->Print("ConnectionUDP::read() - no more packet"); - return NULL; - } - - tmpMsg = mQueueIn.front(); - u16 _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset(); - //Console->Print("ConnectionUDP::read() - %d bytes remaining in current packet", _size); - if (_size <= 0) - { - //Console->Print("ConnectionUDP::read() - trying next packet"); - mQueueIn.pop(); - delete tmpMsg; - if (mQueueIn.empty()) - { - //Console->Print("ConnectionUDP::read() - no more packet"); - return NULL; - } - tmpMsg = mQueueIn.front(); - _size = tmpMsg->GetSize(); - tmpMsg->SetNextByteOffset(0); - } - - if(*size==0) - { - *size=_size; - } - else - { - *size=min(*size, (s32)_size); - } - - u8 const* ptr = tmpMsg->GetMessageData() + tmpMsg->GetNextByteOffset(); - tmpMsg->SetNextByteOffset(tmpMsg->GetNextByteOffset()+ *size); - //Console->Print(GREEN, BLACK, "ConnectionUDP::read() - %d bytes read", *size); - return ptr; -} - -int ConnectionUDP::write(const void* data, int size) -{ - // data is stored in mSendBufferMsg. Gets queued in next flushSendBuffer() or update() - if (mSendBufferMsg == NULL) - { - //Console->Print("ConnectionUDP::write() creating new mSendBufferMsg"); - mSendBufferMsg = new PMessage(SENDBUFFERSIZE); - } - mSendBufferMsg->Write(data, (u16)size); - //Console->Print(GREEN, BLACK, "ConnectionUDP::write() %d bytes written to mSendBufferMsg (total size %d)", size, mSendBufferMsg->GetSize()); - return size; -} - -int ConnectionUDP::write(const char *String) -{ - if(!String) - return 0; - - return write(String, strlen(String)); -} - -int ConnectionUDP::write(u8 Data) -{ - return write(&Data, sizeof(u8)); -} - -int ConnectionUDP::write(u16 Data) -{ - return write(&Data, sizeof(u16)); -} - -int ConnectionUDP::write(u32 Data) -{ - return write(&Data, sizeof(u32)); -} - -int ConnectionUDP::write(float Data) -{ - return write(&Data, sizeof(float)); -} - -int ConnectionUDP::write(double Data) -{ - return write(&Data, sizeof(double)); -} - -/// *********************************************** - -void ConnectionUDP::SetUDP_ID(u16 id) -{ - if (mUDP_ID == 0xffff) - { - mUDP_ID = 0; - } - else - { - mUDP_ID = id; - } - if(mUDP_ID == 0) // If UDPID is set to zero, erase message buffer too - ResetMessageBuffer(); -} - diff --git a/server/src/common/netcode/main.h b/server/src/common/netcode/main.h deleted file mode 100644 index b4c8fa0..0000000 --- a/server/src/common/netcode/main.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - main.h - main include file, contains all needed includes and important definitions - - MODIFIED: 26 Aug 2006 Hammag - REASON: - created from gameserver main.h and modified as needed - - TODO: - move RECVBUFFERSIZE, SENDBUFFERSIZE, DEFAULT_TIMEOUT to config file - - change Console & Config from external to static members if possible - -*/ - -#ifndef MAIN_H -#define MAIN_H - -//#include "version.h" - -//basic includes -#include "external.h" - -//tinns includes -#include "types.h" -#include "netcode.h" - -#include "console.h" -#include "config.h" - -using namespace std; - -/* -static const int RECVBUFFERSIZE = 4096; -static const int SENDBUFFERSIZE = 4096; - -static const time_t DEFAULT_TIMEOUT = 60; -*/ - -// To be put in config file -#define RECVBUFFERSIZE 4096 -#define SENDBUFFERSIZE 4096 -#define DEFAULT_TCP_TIMEOUT 600 -#define DEFAULT_UDP_TIMEOUT 60 - -// Better change that to a static members of each netcode class -extern class PConsole* Console; -extern class PConfig* Config; - -#endif - diff --git a/server/src/common/netcode/serversocket.cpp b/server/src/common/netcode/serversocket.cpp deleted file mode 100644 index d604749..0000000 --- a/server/src/common/netcode/serversocket.cpp +++ /dev/null @@ -1,313 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - serversocket.h - a serversocket class managing all connections (udp/tcp) - - Authors: - - bakkdoor - - MODIFIED: 09 Feb 2006 bakkdoor - REASON: - introduced - - MODIFIED: 27 Jun 2006 hammag - REASON: - added modif to keep m_TimeOut value in update() as select (may) modifie this - parameter in Linux - - MODIFIED: 01 Jul 2006 hammag - REASON: - ServerSocket() : moved m_TimeOut initialization in constructor - - added settimeout() method to permit various behaviors - - ServerSocket(), open() : added m_MainSetUDP and m_MainSetGlobal init - - open() : add m_ListenerTCP to m_MainSetGlobal too - - update() : now m_MainSetGlobal is copied to m_ReadSetTCP set, - and added a local fdMax for select - - getUDPConnection(): add new UDP socket to m_MainSetUDP and m_MainSetGlobal, - and keep track in m_FdMaxUDP - - getTCPConnection(): add new TCP socket to m_MainSetGlobal too - - delSocketFromSet() : added removal of sockfd from m_MainSetUDP and m_MainSetGlobal too - - getTCPConnection() : moved non-blocking setting to ConnectionTCP::ConnectionTCP() for better class coherency - - getUDPConnection(): added this to new ConnectionUDP creation parameters - - MODIFIED: 05 Aug 2006 hammag - REASON: - now use UDP port in selected range for client connection (see .h) - - TODO: - delSocketFromSet() : Could now be improved with two separte methodes for TCP and UDP removal - - in all 3 servers: put select timeout setting in config file. - - don't access Config object from netcode's objects. Use parameter members - set by object owner. -*/ - -#include "main.h" - -ServerSocket::ServerSocket() -{ - FD_ZERO(&m_MainSetTCP); // clear the master and temp sets - FD_ZERO(&m_ReadSetTCP); - FD_ZERO(&m_MainSetUDP); - FD_ZERO(&m_MainSetGlobal); - - m_FdMaxUDP=0; - - m_TimeOut.tv_sec = 0; - m_TimeOut.tv_usec = 30; - - //m_LastUDPPort = 5000; -} - -ServerSocket::~ServerSocket() -{ - close(m_ListenerTCP); -} - -void ServerSocket::settimeout(long timeout_sec, long timeout_usec) -{ - if ((timeout_sec >= 0) && (timeout_usec >= 0)) - { - m_TimeOut.tv_sec = timeout_sec; - m_TimeOut.tv_usec = timeout_usec; - } - -} - -bool ServerSocket::open(int port) -{ - // get the tcp listener - if ((m_ListenerTCP = socket(PF_INET, SOCK_STREAM, 0)) == -1) - { - perror("tcp-socket"); - return false; - } - - int yes=1; - - // lose the pesky "address already in use" error message - if (setsockopt(m_ListenerTCP, SOL_SOCKET, SO_REUSEADDR, &yes, - sizeof(int)) == -1) { - perror("tcp-setsockopt"); - return false; - } - - // bind - memset(&m_ServerAddr,0,sizeof(struct sockaddr_in)); - m_ServerAddr.sin_family = AF_INET; - m_ServerAddr.sin_addr.s_addr = INADDR_ANY; - m_ServerAddr.sin_port = htons(port); - - // bind with tcp sockfd - if (bind(m_ListenerTCP, (struct sockaddr *)&m_ServerAddr, sizeof(struct sockaddr)) == -1) - { - perror("tcp-bind"); - return false; - } - - // set listening-socket to non-blocking - fcntl(m_ListenerTCP, F_SETFL, O_NONBLOCK); - - // listen - if (listen(m_ListenerTCP, 10) == -1) - { - perror("tcp-listen"); - return false; - } - - FD_ZERO(&m_MainSetTCP); - FD_ZERO(&m_ReadSetTCP); - FD_ZERO(&m_MainSetUDP); - FD_ZERO(&m_MainSetGlobal); - - m_FdMaxUDP=0; - - // add the listener to the master sets - FD_SET(m_ListenerTCP, &m_MainSetTCP); - FD_SET(m_ListenerTCP, &m_MainSetGlobal); - - // keep track of the biggest file descriptor - m_FdMaxTCP = m_ListenerTCP; // so far, it's this one - - //Console->Print("Server running on port %d", port); - - return true; -} - -void ServerSocket::update() -{ - struct timeval tmp_TimeOut; - int fdMax; - - // copy fd_sets from main-set to temp. read-set - m_ReadSetTCP = m_MainSetGlobal; - - fdMax = max(m_FdMaxTCP, m_FdMaxUDP); - - //FD_ZERO(&m_ReadSetTCP); - //FD_SET (m_ListenerTCP, &m_ReadSetTCP); - - // select incoming data for tcp & udp - tmp_TimeOut = m_TimeOut; //save m_TimeOut... will be modified by select - if (select(fdMax+1, &m_ReadSetTCP, NULL, NULL, &tmp_TimeOut) == -1) - { - perror("select"); - } - - //Select exit condition logging - /* - if ((tmp_TimeOut.tv_sec == 0) && (tmp_TimeOut.tv_usec == 0)) - { - Console->LPrint(GREEN, BLACK, "[Idle]"); - Console->LPrint(" Exiting select on timeout (remains %d sec and %d usec)", tmp_TimeOut.tv_sec, tmp_TimeOut.tv_usec); - Console->LClose(); - } - else - { - Console->LPrint(YELLOW, BLACK, "[Active]"); - Console->LPrint(" Exiting select with remaining time %d sec and %d usec", tmp_TimeOut.tv_sec, tmp_TimeOut.tv_usec); - Console->LClose(); - } - */ - - // check for new tcp connections - if (FD_ISSET(m_ListenerTCP, &m_ReadSetTCP)) // we got one!! - { - m_bNewTCPConnection = true; - } - else - { - m_bNewTCPConnection = false; - } - -} - -bool ServerSocket::newConnection() -{ - return (m_bNewTCPConnection); -} - -ConnectionTCP* ServerSocket::getTCPConnection() -{ - if(m_bNewTCPConnection) - { - struct sockaddr_in RemoteAddr; // new incoming client address - socklen_t addrlen = sizeof(RemoteAddr); - int NewSockfd; // newly accept()ed socket descriptor - - // handle new connections - if ((NewSockfd = accept(m_ListenerTCP, (struct sockaddr *)&RemoteAddr, &addrlen)) == -1) - { - m_bNewTCPConnection = false; // set back to normal - perror("tcp-accept"); - return 0; - } - else - { - FD_SET(NewSockfd, &m_MainSetTCP); // add to master TCP set - FD_SET(NewSockfd, &m_MainSetGlobal); // add to master global set - if (NewSockfd > m_FdMaxTCP) // keep track of the maximum - { - m_FdMaxTCP = NewSockfd; - } - - ConnectionTCP* tcpConn = new ConnectionTCP(NewSockfd, RemoteAddr, this); - - m_bNewTCPConnection = false; // set back to normal - - return tcpConn; - } - } - - return 0; -} - -ConnectionUDP* ServerSocket::getUDPConnection(long remoteadress, int remoteport) -{ - int udpSockfd; - - if ((udpSockfd = socket(PF_INET, SOCK_DGRAM, 0)) == -1) - { - perror("udp-socket"); - return NULL; - } - - struct sockaddr_in my_addr; - - u16 Port = Config->GetOptionInt("gameserver_udpport_min"); - u16 maxPort = Config->GetOptionInt("gameserver_udpport_max"); - - my_addr.sin_family = AF_INET; // host byte order - my_addr.sin_port = htons(Port); // short, network byte order - my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP - memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct - - //Search a free udp port to use (could be optimised for faster port allocation) - while (bind(udpSockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) - { - if (errno == EADDRINUSE) - { - my_addr.sin_port = htons(++Port); - if (Port > maxPort) - { - Console->Print(RED, BLACK,"No more free UDP port in configured range"); - return NULL; - } - } - else - { - perror("udp-bind"); - return NULL; - } - } - - FD_SET(udpSockfd, &m_MainSetUDP); // add to master UDP set - FD_SET(udpSockfd, &m_MainSetGlobal); // add to master global set - if (udpSockfd > m_FdMaxUDP) // keep track of the maximum - { - m_FdMaxUDP = udpSockfd; - } - - ConnectionUDP* udpConn = new ConnectionUDP(udpSockfd, Port, remoteadress, remoteport, this); - - //m_LastUDPPort++; - - return udpConn; -} - -bool ServerSocket::isDataAvailable(int sockfd) -{ - if(FD_ISSET(sockfd, &m_ReadSetTCP)) - { - return true; - } - - return false; -} - -void ServerSocket::delSocketFromSet(int sockfd) -{ - FD_CLR(sockfd, &m_MainSetTCP); - FD_CLR(sockfd, &m_MainSetUDP); - FD_CLR(sockfd, &m_MainSetGlobal); -} - -void ServerSocket::closeServer() -{ - close(m_ListenerTCP); -} diff --git a/server/src/common/netcode/udpmanager.cpp b/server/src/common/netcode/udpmanager.cpp deleted file mode 100644 index 5bed273..0000000 --- a/server/src/common/netcode/udpmanager.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -/* - udpmanager.cpp - Manager for UDP Messages. Watches UDP_ID's and keeps - message history for possible OutOfOrder requests -*/ - -#include "main.h" - -void ConnectionUDP::UpdateMessageBuffer() -{ - int erasednum = 0; - // Delete all old messages - for(PMessageMap::iterator it=UDPMessages.begin(); it!=UDPMessages.end(); it++) - { - if((int)it->first < (int)(mLastUDPID - MAX_RETENTION)) - { - erasednum++; - delete it->second; - UDPMessages.erase(it); - } - } - /* // Debug output - if(erasednum > 0) - Console->Print("[UpdateMessageBuffer] Done updating messagequeue, %d entries deleted", erasednum); - */ -} - -void ConnectionUDP::ResetMessageBuffer() -{ - if(mUDP_ID != 0) - { - Console->Print("%s MessageQueue got erased but UDP_ID is still >0", Console->ColorText(RED, BLACK, "[WARNING]")); - } - for(PMessageMap::iterator it=UDPMessages.begin(); it!=UDPMessages.end(); it++) - { - delete it->second; - UDPMessages.erase(it); - } - mLastUDPID = 0; -// Console->Print("[udpmanager] Erased messagebuffer"); -} - -void ConnectionUDP::ReSendUDPMessage(u16 nUDP_ID) -{ - // ReSend packet with given UDP_ID - if(nUDP_ID > mLastUDPID) - { - Console->Print("%s Cannot resend packet with UDP_ID %d, msgnumber is higher than last known udpID", Console->ColorText(RED, BLACK, "[PANIC]"), nUDP_ID); - } - else - { - // UDP_ID seems to be valid, now search for it - PMessageMap::const_iterator it = UDPMessages.find(nUDP_ID); - if(it == UDPMessages.end()) - { - int dynRetention = (int)mLastUDPID - nUDP_ID; - if(dynRetention > MAX_RETENTION) - { - Console->Print("%s Packet with UDP_ID %d not found. Increase #define MAX_RETENTION to at least %d", Console->ColorText(RED, BLACK, "[WARNING]"), nUDP_ID, dynRetention); - } - else - { - Console->Print("%s Packet with UDP_ID %d is missing in the packet queue!", Console->ColorText(RED, BLACK, "[PANIC]"), nUDP_ID); - } - Console->Print("Trying to cancel OOO notice by sending dummy packet"); - PMessage* tmpMsg = new PMessage(14); - //u16 tmpSessionID = mLastUDPID + SESSION_UDP_OFFSET; - *tmpMsg << (u8)0x13; - *tmpMsg << nUDP_ID; - *tmpMsg << (u16)(nUDP_ID + SESSION_UDP_OFFSET); - *tmpMsg << (u8)0x08; - *tmpMsg << (u8)0x03; - *tmpMsg << nUDP_ID; - *tmpMsg << (u8)0x1F; - *tmpMsg << (u16)0xFFFF; // Should do nothing, CharID 65535 should never exist - *tmpMsg << (u16)0x3C01; // This value IS wrong way, so that nothing can happen at all - SendMessage(tmpMsg, true); - } - else if(it->second) - { - Console->Print("[OOO-Buster] ReSending UDP packet with ID %d", nUDP_ID); - // Build new message, including the missing UDP packets as content - u16 MsgSize = it->second->GetSize(); - PMessage* tmpMsg = new PMessage(MsgSize + 5); // Create new message - *tmpMsg << (u8)0x13; - *tmpMsg << nUDP_ID; - *tmpMsg << (u16)(nUDP_ID + SESSION_UDP_OFFSET); -// *tmpMsg << mUDP_ID; -// *tmpMsg << mSessionID; -// *tmpMsg << *it->second; // This should work, but it doesnt! Causes segfault after sending a few packets - for(int x = 0; x < MsgSize; x++) - { - *tmpMsg << it->second->U8Data(x); - } - SendMessage(tmpMsg, true); // Add message to outgoing VIP queue - } - } -} - -void ConnectionUDP::InsertUDPMessage(PMessage* nMsg) -{ - if (!nMsg) - return; - - if(nMsg->U8Data(0) != 0x13) return; // Only add real UDP messages here -// 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 -// 13 07 00 F2 00 05 03 02 00 11 11 05 03 03 00 11 11 05 03 04 00 11 11 05 03 05 00 11 11 05 03 06 00 11 11 05 03 07 00 11 11 - - // Grab submessages from packet, check if message is 0x03 commandset. If not, dont add message - PMessage* tWorkMsg = NULL; - - u16 tCurPos = 5; - u8 tSubMsgLen = 0; - u16 tmpUDPID = 0; - //nMsg->Dump(); - while(tCurPos < (nMsg->GetSize() - 1)) // Loop while we still have more frames. (-1: GetSize starts at 1, pos pointer at 0) - { - //Console->Print("tCurPos = %d nMsg->GetSize = %d", tCurPos, nMsg->GetSize()); - tSubMsgLen = nMsg->U8Data(tCurPos) + 1; // Get the lenght of the frame, and add the lenght byte - if(nMsg->U8Data(tCurPos+1) != 0x03) - { - //Console->Print("Ignoring UDP message, no 0x03 commandset"); - tCurPos += tSubMsgLen; // Set pointer to the end of this frame - continue; // Skip if frame is not an 0x03 commandset - } - //Console->Print("MsgLen: %d", tSubMsgLen); - tWorkMsg = nMsg->GetChunk(tCurPos, tSubMsgLen); // get the frame. - //Console->Print("Msg:"); - //tWorkMsg->Dump(); - tmpUDPID = nMsg->U16Data(tCurPos + 2); // Get the UDP ID of this frame - //Console->Print("UDP ID: %d", tmpUDPID); - PMessageMap::const_iterator it = UDPMessages.find(tmpUDPID); // Try to find the UDP ID in the queue - if(it->second) // If we already have this UDP msg, print error - { - Console->Print("%s Packet *NOT* added to history buffer, UdpID %d already sent! (This may cause an OOO)", Console->ColorText(RED, BLACK, "[WARNING]"), tmpUDPID); - nMsg->Dump(); - } - else // We dont have this msg? Add it! - { - //Console->Print("Added UDP ID %d to messagebuffer", tmpUDPID); - UDPMessages.insert(std::make_pair(tmpUDPID, tWorkMsg)); - mLastUDPID++; - } - tCurPos += tSubMsgLen; // Set pointer to the end of this frame - } -} diff --git a/server/src/common/regex/regex++.cpp b/server/src/common/regex++.cpp old mode 100755 new mode 100644 similarity index 75% rename from server/src/common/regex/regex++.cpp rename to server/src/common/regex++.cpp index d3a2a88..b2417d7 --- a/server/src/common/regex/regex++.cpp +++ b/server/src/common/regex++.cpp @@ -1,13 +1,6 @@ -// -// regex.hpp 1.0 Copyright (c) 2003 Peter Petersen (pp@on-time.de) -// Simple C++ wrapper for PCRE -// -// This source file is freeware. You may use it for any purpose without -// restriction except that the copyright notice as the top of this file as -// well as this paragraph may not be removed or altered. -// -#include -#include "regex++.h" +#include "common/regex++.h" + +#include RegEx::RegEx(const char * regex, int options) { diff --git a/server/src/common/regex++.h b/server/src/common/regex++.h new file mode 100644 index 0000000..edbff07 --- /dev/null +++ b/server/src/common/regex++.h @@ -0,0 +1,35 @@ +#pragma once + +#include + +#ifndef _PCRE_H +#include "pcre.h" +#endif + +class RegEx { +private: + pcre * re; + pcre_extra * pe; + int substrcount; + int * ovector; + const char * lastsubject; + int slen; + const char * * matchlist; + + inline void ClearMatchList(void) + { + if (matchlist) + { + pcre_free_substring_list(matchlist); + matchlist = NULL; + } + } + +public: + RegEx(const char * regex, int options = 0); + ~RegEx(); + inline int SubStrings(void) const { return substrcount; } + bool Search(const char * subject, int len = -1, int options = 0); + bool SearchAgain(int options = 0); + const char * Match(int i = 1); +}; diff --git a/server/src/common/regex/Makefile b/server/src/common/regex/Makefile deleted file mode 100644 index 5fb25e9..0000000 --- a/server/src/common/regex/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := testor2 - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -#LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/dev-tools/CMakeLists.txt b/server/src/dev-tools/CMakeLists.txt new file mode 100644 index 0000000..7be89d7 --- /dev/null +++ b/server/src/dev-tools/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable (getsvnrev getsvnrev.cpp) +add_executable (cleandepfile cleandepfile.c) diff --git a/server/src/dev-tools/Makefile b/server/src/dev-tools/Makefile deleted file mode 100644 index 5ca43b1..0000000 --- a/server/src/dev-tools/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -all: cleandepfile -#all: cleandepfile svnrev - -cleandepfile: cleandepfile.c - $(HOSTCC) $(HOSTCFLAGS) -o $@ $< - -#svnrev: getsvnrev.cpp -# g++ -pedantic -Wall -c getsvnrev.cpp -o getsvnrev.o -# g++ -o getsvnrev getsvnrev.o -lstdc++ -lz - diff --git a/server/src/dev-tools/cleandepfile.c b/server/src/dev-tools/cleandepfile.c old mode 100755 new mode 100644 index 2ff870b..4a05328 --- a/server/src/dev-tools/cleandepfile.c +++ b/server/src/dev-tools/cleandepfile.c @@ -30,7 +30,9 @@ /* cleandepfile.c - CREATED: 11 Dec 2006 Hammag + CREATED: 11 Dec 2006 Hammag + MODIFIED: 09 Jun 2009 Akiko + REASON: - corrected warning (args) */ #include @@ -70,7 +72,7 @@ int check_filter(char* buffer) return 1; } -int main(int argc, char **argv) +int main(void) { int ret; int len; diff --git a/server/src/dev-tools/getsvnrev.cpp b/server/src/dev-tools/getsvnrev.cpp index 6dcd144..dc88289 100644 --- a/server/src/dev-tools/getsvnrev.cpp +++ b/server/src/dev-tools/getsvnrev.cpp @@ -1,7 +1,7 @@ /* TinNS (TinNS is not a Neocron Server) - pak_decompress - pak file decompression tool - Copyright (C) 2005 Akiko + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -38,20 +38,23 @@ MODIFIED: 22 Dec 2006 Namikon REASON: - started this tool + MODIFIED: 09 Jun 2009 Akiko + REASON: - more C++ stylish + - missing libs (cstring, cstdlib) TODO: - Better way to get SVN rev than this (2nd number in file) */ -#include +#include +#include +#include #include -using namespace std; - int main(int argc, char **argv) { - string targetdir; + std::string targetdir; FILE *f; if(argc == 2) @@ -91,11 +94,11 @@ int main(int argc, char **argv) fclose(f); - cout << rev << endl; + std::cout << rev << std::endl; } else { - cout << "0" << endl; + std::cout << "0" << std::endl; } return(0); } diff --git a/server/src/dev-tools/setsvnrev b/server/src/dev-tools/setsvnrev deleted file mode 100755 index 33ccb14..0000000 --- a/server/src/dev-tools/setsvnrev +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# -########################################################### -# setsvnrev script for TinNS. Original written by Hammag, # -# improved by Namikon. # -# See bottom of file for GPL license. # -########################################################### -# # -# Last edited: 08.01.2076 18:02 GMT +1 by Hammag # -# # -########################################################### -# How this works: # -# Everytime you do "make", this script is called. # -# It will check the current svn headerfile if its # -# a new revision or just a recompile. # -# IF it is a new revision, the script tries to get # -# the actual version from the official SVN # -# tool "svnversion". If your server has no SVN # -# installed (which is not good if you want to # -# participate in TinNS dev), or it is outdated for # -# some reason, you must manually update svnrev.h # -# This number is then written to svnrev.h, compiled # -# into Patch, Info and Gameserver, and can be viewed # -# ingame by typing @version # -########################################################### - -if [[ $# -ne 2 ]]; then - echo "Error - usage:" `basename $0` " " >&2 - exit -1 -fi - -#We exit silently if no SVN system seem to be used locally -if [[ ! -d $1/.svn ]]; then exit 0; fi - -v=`svnversion $1` -if [[ $? -ne 0 ]]; then - echo "###### WARNING : can't get SVN revision number ######" - echo " You must manually update rev number in include/version.h before any public release !" - if [[ ! -f .no_msg_stop ]]; then - echo - echo ---- Press a key to continue ---- - read -s -n 1 - touch .no_msg_stop - fi - exit 0 -fi -#if expr "$v" : '[0-9]\+$' > /dev/null; then - current=`echo $v | sed 's/^\([0-9]*:\)\?\([0-9]\+\)[^0-9]*/\2/'` - modif=`echo $v | sed 's/^\([0-9]*:\)\?[0-9]\+[^0-9]*\(M\)/\2/'` - #echo svnver: $v - #echo current: $current - #echo modif: $modif - - if [[ $modif == M ]]; then - current=$[$current + 1]; - fi -#else -# v=`$1/dev-tools/getsvnrev $1` -# if [ "$v" = "0" ]; then -# exit 0; -# fi -# if ! expr "$v" : '[0-9]\+$' > /dev/null; then -# echo "Error: Unable to get SVN Revision!"; -# exit 0; -# fi -# if [ -z "$v" ]; then -# echo "Error: Unable to get SVN Revision!"; -# exit 0; -# fi -# current="$v" -#fi - -filever=`grep TINNS_SVN_REVISION $2 | sed 's/^.*"\([0-9]\+\)".*$/\1/'` -#echo svnver in file: $filever - -if [[ $filever -ge $current ]]; then - echo No SVN Revision number change needed - exit 0; -fi - -echo Updating SVN Revision number to $current - -cat >$2 < - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -/* - THIS FILE IS GENERATED BY THE MAKE COMMAND make svnrev - It is to be updated by this command before each revision commit operation - PLEASE DON'T MODIFY BY HAND -*/ - -#ifndef SVN_REV_DEF -#define SVN_REV_DEF - -#define TINNS_SVN_REVISION "$current" - -#endif - -ENDOFDOC - diff --git a/server/src/game/CMakeLists.txt b/server/src/game/CMakeLists.txt new file mode 100644 index 0000000..b303855 --- /dev/null +++ b/server/src/game/CMakeLists.txt @@ -0,0 +1,47 @@ +include_directories (${TINNS_SOURCE_DIR}/server/src/game ${LUA_INCLUDE_DIR}) + +add_executable (gameserver + # decoder stuff + decoder/msgdecoder.cpp decoder/udp_0x13.cpp decoder/udp_0x1f.cpp decoder/udp_0x22.cpp + decoder/udp_0x2b.cpp decoder/udpanalyser.cpp decoder/udp_appartment.cpp decoder/udp_charmove.cpp + decoder/udp_chat.cpp decoder/udp_deathrespawn.cpp decoder/udp_entityposreq.cpp + decoder/udp_hack.cpp decoder/udp_helditemaction.cpp decoder/udp_0x08.cpp decoder/udp_OOO.cpp + decoder/udp_itemmanualreload.cpp decoder/udp_itemmove.cpp decoder/udp_itemuse.cpp + decoder/udp_killself.cpp decoder/udp_outfitter.cpp decoder/udp_packet0.cpp decoder/udp_ping.cpp + decoder/udp_popupresponse.cpp decoder/udp_quickaccessbelt.cpp decoder/udp_reqinfo.cpp + decoder/udp_subskill.cpp decoder/udp_sync.cpp decoder/udp_terminal.cpp decoder/udp_useobject.cpp + decoder/udp_vhc.cpp decoder/udp_zoning.cpp decoder/udp_worldIDinfo.cpp decoder/udp_multipart.cpp + decoder/udp_pvptrade.cpp decoder/udp_npcdialog.cpp + # def file stuff + def/def_actionmod.cpp def/def_ammo.cpp def/def_appartements.cpp def/def_appplaces.cpp + def/def_blueprintpieces.cpp def/def_characters.cpp def/def_charaction.cpp def/def_charkinds.cpp + def/def_damage.cpp def/def_drugs.cpp def/def_factions.cpp def/def_hack.cpp def/def_implants.cpp + def/def_itemcontainer.cpp def/def_itemmod.cpp def/def_itemres.cpp def/def_items.cpp + def/def_mission.cpp def/def_npcarmor.cpp def/def_npc.cpp def/def_npcgroupspawn.cpp + def/def_outposts.cpp def/defparser.cpp def/def_recycles.cpp def/def_respawn.cpp + def/def_shots.cpp def/def_skills.cpp def/def_subskills.cpp def/def_trader.cpp + def/def_vehicles.cpp def/def_vehiclesits.cpp def/def_weapons.cpp def/def_weather.cpp + def/def_worldfile.cpp def/def_worldmodels.cpp def/def_worlds.cpp def/gamedefs.cpp + def/world_datparser.cpp def/def_scripts.cpp + # gamecommands stuff + gamecommands/ban.cpp gamecommands/brightness.cpp gamecommands/broadcast.cpp gamecommands/color.cpp + gamecommands/debug.cpp gamecommands/effect.cpp gamecommands/givemoney.cpp gamecommands/h.cpp + gamecommands/info.cpp gamecommands/npc_shop.cpp gamecommands/jail.cpp gamecommands/kick.cpp + gamecommands/listbans.cpp gamecommands/online.cpp gamecommands/rawf.cpp gamecommands/recall.cpp + gamecommands/remove.cpp gamecommands/setlevel.cpp gamecommands/settime.cpp + gamecommands/setsubskill.cpp gamecommands/shun.cpp gamecommands/setmainskill.cpp + gamecommands/skin.cpp gamecommands/spawnactor.cpp gamecommands/speed.cpp gamecommands/takemoney.cpp + gamecommands/t.cpp gamecommands/teleport.cpp gamecommands/test.cpp gamecommands/unban.cpp + gamecommands/unjail.cpp gamecommands/unshun.cpp gamecommands/uptime.cpp gamecommands/v.cpp + gamecommands/version.cpp gamecommands/warp.cpp gamecommands/warpto.cpp gamecommands/weather.cpp + gamecommands/npc.cpp + # gameserver stuff + globals.cpp terminal_querydb.cpp multipart.cpp accounts.cpp appartements.cpp buddylist.cpp + chars.cpp chat.cpp client.cpp clientmanager.cpp commands.cpp container.cpp doortemplate.cpp + furnituretemplate.cpp gameserver.cpp genreplist.cpp inventory.cpp isc.cpp item.cpp main.cpp + lua_engine.cpp msgbuilder.cpp npc.cpp server.cpp skill.cpp sql.cpp subway.cpp terminal.cpp + terminal_receivedb.cpp terminal_tryaccess.cpp npc_conversation.cpp terminal_updatedb.cpp + vehicle.cpp vhcaccessrequest.cpp worldactors.cpp worlddatatemplate.cpp worlds.cpp zoning.cpp + outpost.cpp npc_ai.cpp npctemplate.cpp) + +target_link_libraries (gameserver common ${MYSQL_LIBRARY} ${PCRE_LIBRARY} ${ZLIB_LIBRARY} ${RT_LIBRARY} ${LUA_LIBRARY}) diff --git a/server/src/game/Makefile b/server/src/game/Makefile deleted file mode 100644 index bf15587..0000000 --- a/server/src/game/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -B_TARGET := gameserver - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -#L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -EXTRA_CXXFLAGS := -I/usr/include/mysql -Iinclude - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lpthread -lm -lcrypt -lrt -L"/usr/lib/mysql" -lmysqlclient -lz -EXTRA_LINKFLAGS := -lrt -L"/usr/lib/mysql" -lmysqlclient -lz -lpcre -llua - - -##################################################### -# Subdirectories -##################################################### -subdir-y := decoder def gamecommands -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/game/accounts.cpp b/server/src/game/accounts.cpp index cb110fa..a1f0bbd 100644 --- a/server/src/game/accounts.cpp +++ b/server/src/game/accounts.cpp @@ -32,12 +32,15 @@ REASON: - Changed FmtTxt() to sprintf(). It does... uhm, the same :D MODIFIED: 06 Jan 2006 Namikon REASON: - Removed the old XML loading functions, and changed the SQL ones to work with the Global Neopolis/TinNS Database - - Added SetBannedStatus() to ban/unban an account (use SetBannedStatus(0) to unban a player) + - Added SetBannedStatus() to ban/unban an account (use SetBannedStatus(0) to unban a player) MODIFIED: 03 Oct 2006 Hammag REASON: - Fixed an issue in PAccount::SetBannedStatus() that was causing the "can't update banned status" error message. MODIFIED: 27 May 2007 Hammag REASON: - Full changes for on-demand account access (no more memory-resident account data) + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new build system + - clean ups */ @@ -56,7 +59,7 @@ a_status: 2 = Banned */ #include "main.h" -#include "accounts.h" +#include "include/accounts.h" /** Static members **/ RegEx* PAccount::mUsernameRegexFilter = NULL; diff --git a/server/src/game/appartements.cpp b/server/src/game/appartements.cpp index 12d0269..0da9610 100644 --- a/server/src/game/appartements.cpp +++ b/server/src/game/appartements.cpp @@ -21,19 +21,20 @@ /* - appartements.cpp - appartements class + appartements.cpp - appartements class MODIFIED: 20 Nov 2006 Hammag REASON: - creation - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #include "main.h" -#include "appartements.h" -#include "gamedefs.h" -#include "def_appartements.h" -#include "worlds.h" +#include "include/appartements.h" +#include "include/gamedefs.h" +#include "include/def_appartements.h" +#include "include/worlds.h" PAppartements::PAppartements() { diff --git a/server/src/game/buddylist.cpp b/server/src/game/buddylist.cpp old mode 100755 new mode 100644 index 90ea3c8..558b6db --- a/server/src/game/buddylist.cpp +++ b/server/src/game/buddylist.cpp @@ -1,36 +1,39 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - buddylist.cpp - classe for chat buddylist + buddylist.cpp - class for chat buddylist - MODIFIED: 19 Sep 2006 Hammag - REASON: - creation + MODIFIED: 19 Sep 2006 Hammag + REASON: - creation + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - clean ups - TODO: - link with a online char list, updated when needed (chars in/out, or list modified) + TODO: - link with a online char list, updated when needed (chars in/out, or list modified) */ #include "main.h" -#include "buddylist.h" +#include "include/buddylist.h" PBuddyList::PBuddyList(u32 nOwnerCharID) { diff --git a/server/src/game/chars.cpp b/server/src/game/chars.cpp index 348ee45..99eb049 100644 --- a/server/src/game/chars.cpp +++ b/server/src/game/chars.cpp @@ -1,57 +1,60 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - chars.cpp - - MODIFIED: 22 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 01 Jan 2006 Namikon - REASON: - Added SQLLoad() function to PChar and PChars - - Changed FmtTxt() to sprintf(). It does... uhm, the same :D - - Added IsOnline var and function - MODIFIED: 06 Jan 2005 Namikon - REASON: - Added colored console ouputs - - Removed XM Load() and Save() functions - - Rewrote parts of SQLLoad to work with the global NeoPolis / TinNS database - - Added FillinCharDetails to fill the baseline up with the char details - MODIFIED: 03 Oct 2006 Hammag - REASON: - PChar::CreateNewChar() and moved effective char creation from PChars to PChar - - added PChar::SQLDelete() - This method is put here because we want the char to be loaded when deleted from DB to avoid - any player to use it at the same time. - - added use of auto_save_period config option in PChars::update() - - removed old XML-storage related code - - TODO: - implement PChar::SQLDelete() + chars.cpp + + MODIFIED: 22 Dec 2005 Namikon + REASON: - Added GPL + MODIFIED: 01 Jan 2006 Namikon + REASON: - Added SQLLoad() function to PChar and PChars + - Changed FmtTxt() to sprintf(). It does... uhm, the same :D + - Added IsOnline var and function + MODIFIED: 06 Jan 2005 Namikon + REASON: - Added colored console ouputs + - Removed XM Load() and Save() functions + - Rewrote parts of SQLLoad to work with the global NeoPolis / TinNS database + - Added FillinCharDetails to fill the baseline up with the char details + MODIFIED: 03 Oct 2006 Hammag + REASON: - PChar::CreateNewChar() and moved effective char creation from PChars to PChar + - added PChar::SQLDelete() + This method is put here because we want the char to be loaded when deleted from DB to avoid + any player to use it at the same time. + - added use of auto_save_period config option in PChars::update() + - removed old XML-storage related code + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for ne buildsystem + - clean ups + + TODO: - implement PChar::SQLDelete() */ #include "main.h" -#include "worlds.h" -#include "appartements.h" -#include "container.h" -#include "inventory.h" -#include "vhcaccessrequest.h" +#include "include/worlds.h" +#include "include/appartements.h" +#include "include/container.h" +#include "include/inventory.h" +#include "include/vhcaccessrequest.h" // PCharCoordinates void PCharCoordinates::SetInterpolate( PCharCoordinates& Pos1, PCharCoordinates& Pos2, f32 nCoef ) @@ -105,74 +108,74 @@ void PCharCoordinates::SetPosition( u16 nY, u16 nZ, u16 nX, u8 nUD, u8 nLR ) // SQL Layout enum { - c_id, - c_name, - c_str_lvl, - c_str_pts, - c_int_lvl, - c_int_pts, - c_dex_lvl, - c_dex_pts, - c_con_lvl, - c_con_pts, - c_psi_lvl, - c_psi_pts, - a_id, - c_class, - c_profession, - c_sex, - c_location, - c_mc, - c_hc, - c_tra, - c_pc, - c_rc, - c_tc, - c_vhc, - c_agl, - c_rep, - c_rec, - c_rcl, - c_atl, - c_end, - c_for, - c_fir, - c_enr, - c_xrr, - c_por, - c_hlt, - c_hck, - c_brt, - c_psu, - c_wep, - c_cst, - c_res, - c_imp, - c_ppu, - c_apu, - c_mst, - c_ppw, - c_psr, - c_wpw, - c_apt, - c_cash, - c_head, - c_torso, - c_legs, - c_str_xp, - c_int_xp, - c_dex_xp, - c_psi_xp, - c_con_xp, - c_pos_x, - c_pos_y, - c_pos_z, - c_angle_ud, - c_angle_lr, - c_faction, - c_slot, - c_online, - c_clan, + c_id, + c_name, + c_str_lvl, + c_str_pts, + c_int_lvl, + c_int_pts, + c_dex_lvl, + c_dex_pts, + c_con_lvl, + c_con_pts, + c_psi_lvl, + c_psi_pts, + a_id, + c_class, + c_profession, + c_sex, + c_location, + c_mc, + c_hc, + c_tra, + c_pc, + c_rc, + c_tc, + c_vhc, + c_agl, + c_rep, + c_rec, + c_rcl, + c_atl, + c_end, + c_for, + c_fir, + c_enr, + c_xrr, + c_por, + c_hlt, + c_hck, + c_brt, + c_psu, + c_wep, + c_cst, + c_res, + c_imp, + c_ppu, + c_apu, + c_mst, + c_ppw, + c_psr, + c_wpw, + c_apt, + c_cash, + c_head, + c_torso, + c_legs, + c_str_xp, + c_int_xp, + c_dex_xp, + c_psi_xp, + c_con_xp, + c_pos_x, + c_pos_y, + c_pos_z, + c_angle_ud, + c_angle_lr, + c_faction, + c_slot, + c_online, + c_clan, c_soullight }; @@ -218,7 +221,7 @@ PChar::PChar() mSeatInUseObjectId = 0; mSeatInUseSeatId = 0; mVhcAccessRequestList = NULL; - + mContainerInExclusiveUse = NULL; mIsOnline = false; @@ -236,18 +239,17 @@ PChar::PChar() // Required for initial OOC Broadcast welcome message. //Gets overwritten as soon as the first PingPacket arrives - mActiveChatChannels = 262144; - - mClanLevel = 0; + mActiveChatChannels = 262144; + mClanLevel = 0; mClanID = 0; } PChar::~PChar() -{ - // Addition; Set char's online status to OFFLINE - char sqlqry[50]; - snprintf(sqlqry, 50, "UPDATE characters SET c_online = 0 WHERE c_id = %d", mID); - MySQL->GameQuery(sqlqry); +{ + // Addition; Set char's online status to OFFLINE + char sqlqry[50]; + snprintf(sqlqry, 50, "UPDATE characters SET c_online = 0 WHERE c_id = %d", mID); + MySQL->GameQuery(sqlqry); delete Skill; delete mBuddyList; @@ -497,32 +499,32 @@ void PChar::SetBaseInventory() } } } - -void PChar::LoadClanLevel() -{ - MYSQL_RES *result; - char query[200]; - - snprintf(query, 200, "SELECT cll_level FROM clanlevels WHERE cll_charid = %d AND cll_clanid = %d", mID, mClanID); - result = MySQL->GameResQuery( query ); - if ( result == NULL ) - { - mClanID = 0; - Console->Print( RED, BLACK, "PChar::GetClanLevel could not load ClanLevel from the database" ); - Console->Print( "Query was:" ); - Console->Print( "%s", query ); - MySQL->ShowGameSQLError(); - return; - } - else if(mysql_num_rows(result) == 0) - { - mClanID = 0; - Console->Print( RED, BLACK, "PChar::GetClanLevel No level entry found for clan!" ); - return; - } - mClanLevel = atoi(mysql_fetch_row(result)[0]); - if (gDevDebug) Console->Print("Loaded ClanLevel %d for char %d, clan %d", mClanLevel, mID, mClanID); -} + +void PChar::LoadClanLevel() +{ + MYSQL_RES *result; + char query[200]; + + snprintf(query, 200, "SELECT cll_level FROM clanlevels WHERE cll_charid = %d AND cll_clanid = %d", mID, mClanID); + result = MySQL->GameResQuery( query ); + if ( result == NULL ) + { + mClanID = 0; + Console->Print( RED, BLACK, "PChar::GetClanLevel could not load ClanLevel from the database" ); + Console->Print( "Query was:" ); + Console->Print( "%s", query ); + MySQL->ShowGameSQLError(); + return; + } + else if(mysql_num_rows(result) == 0) + { + mClanID = 0; + Console->Print( RED, BLACK, "PChar::GetClanLevel No level entry found for clan!" ); + return; + } + mClanLevel = atoi(mysql_fetch_row(result)[0]); + if (gDevDebug) Console->Print("Loaded ClanLevel %d for char %d, clan %d", mClanLevel, mID, mClanID); +} bool PChar::SQLLoad( int CharID ) { @@ -614,11 +616,11 @@ bool PChar::SQLLoad( int CharID ) int primapt = atoi( row[c_apt] ); mPrimaryApt = static_cast( primapt ); mStartApt = mPrimaryApt; - - mSoullight = atoi( row[c_soullight] ); - mClanID = atoi( row[c_clan] ); - if(mClanID > 0) - LoadClanLevel(); + + mSoullight = atoi( row[c_soullight] ); + mClanID = atoi( row[c_clan] ); + if(mClanID > 0) + LoadClanLevel(); // Cash f32 cashvalue = atof( row[c_cash] ); @@ -705,11 +707,11 @@ bool PChar::SQLLoad( int CharID ) } } - MySQL->FreeGameSQLResult( result ); - - // Addition; Set char's online status to ONLINE - char sqlqry[50]; - snprintf(sqlqry, 50, "UPDATE characters SET c_online = 1 WHERE c_id = %d", mID); + MySQL->FreeGameSQLResult( result ); + + // Addition; Set char's online status to ONLINE + char sqlqry[50]; + snprintf(sqlqry, 50, "UPDATE characters SET c_online = 1 WHERE c_id = %d", mID); MySQL->GameQuery(sqlqry); return true; @@ -988,6 +990,7 @@ u8 PChar::GetCombatRank() return mCombatRank; } + u8 PChar::GetMainRank() { // Override for Special Account Levels @@ -1172,7 +1175,7 @@ bool PChars::AddChar( PChar* nChar ) if ( !nChar ) return false; - mLastID = max( mLastID, nChar->GetID() ); + mLastID = std::max( mLastID, nChar->GetID() ); if ( mChars.insert( std::make_pair( nChar->GetID(), nChar ) ).second ) { if ( gDevDebug ) diff --git a/server/src/game/chat.cpp b/server/src/game/chat.cpp index 082f1cf..257b6c1 100644 --- a/server/src/game/chat.cpp +++ b/server/src/game/chat.cpp @@ -27,6 +27,7 @@ Authors: - Namikon - bakkdoor + - Akiko MODIFIED: 30 Nov 2005 Namikon/Akiko REASON: - initial release by Namikon @@ -40,8 +41,11 @@ MODIFIED: 17 Dec 2005 bakkdoor REASON: - introduced new structure for chatsystem - -> PChat class + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - clean ups - ToDo: + TODO: - Add "hooks" to process chatevents everywhere in the source <-- kind of done. you can use the global PChat Instance. Check: Chat->send(PClient* receiver, const u8* Channel, const char* AuthorNickName, char* text, bool debugOut=false); @@ -50,7 +54,7 @@ */ #include "main.h" -#include "msgbuilder.h" +#include "include/msgbuilder.h" PChat::PChat() { diff --git a/server/src/game/client.cpp b/server/src/game/client.cpp index 36ebd8c..124ca42 100644 --- a/server/src/game/client.cpp +++ b/server/src/game/client.cpp @@ -1,44 +1,46 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - client.cpp - - Authors: - - v00d00 - - Akiko - - Namikon - - MODIFIED: 30 Nov 2005 Akiko - REASON: - added GPL - - added modifications by Namikon + client.cpp + + Authors: + - v00d00 + - Akiko + - Namikon + + MODIFIED: 30 Nov 2005 Akiko + REASON: - added GPL + - added modifications by Namikon + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #include "main.h" -#include "worlds.h" -#include "msgbuilder.h" -#include "subway.h" +#include "include/worlds.h" +#include "include/msgbuilder.h" +#include "include/subway.h" #include "decoder/udp_charmove.h" PClient::PClient( int Index ) diff --git a/server/src/game/clientmanager.cpp b/server/src/game/clientmanager.cpp index 364c1c7..9f3cf73 100644 --- a/server/src/game/clientmanager.cpp +++ b/server/src/game/clientmanager.cpp @@ -1,55 +1,59 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - client.cpp - - Authors: - - bakkdoor - - MODIFIED: 13 Dec 2005 bakkdoor - REASON: - introduced - MODIFIED: 29 Jul 2006 Hammag - REASON: - Added UDP broadcast fonction - - Added "zone players say Hello" fonction - - Modified the ID used as would should avoid muliplying the IDs for the same client. - Now using Client.GetLocalID() as the key (=Client.mIndex + 1) which is used in NC protocol - - Modified getClientByID() - - Removed getClientID(). Simply do Client->GetLocalID() - - Modified deleteClientFromListByID() and renamed to deleteClientFromList() - - Modified destructor as to not destroy stored clients, which is already done in PServer - (even if it could well be done here in near futur) - - MODIFIED: 12 Aug 2006 Hammag - REASON: - implemented range filtering in UDPBroadcast() - - implemented the two versions of UDPBroadcast() - - TODO: - these are just begining of modif, as the Client Manager is bound to be a major component for multiplayer management + client.cpp + + Authors: + - bakkdoor + - Akiko + + MODIFIED: 13 Dec 2005 bakkdoor + REASON: - introduced + MODIFIED: 29 Jul 2006 Hammag + REASON: - Added UDP broadcast fonction + - Added "zone players say Hello" fonction + - Modified the ID used as would should avoid muliplying the IDs for the same client. + Now using Client.GetLocalID() as the key (=Client.mIndex + 1) which is used in NC protocol + - Modified getClientByID() + - Removed getClientID(). Simply do Client->GetLocalID() + - Modified deleteClientFromListByID() and renamed to deleteClientFromList() + - Modified destructor as to not destroy stored clients, which is already done in PServer + (even if it could well be done here in near futur) + + MODIFIED: 12 Aug 2006 Hammag + REASON: - implemented range filtering in UDPBroadcast() + - implemented the two versions of UDPBroadcast() + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - clean ups + + TODO: - these are just begining of modif, as the Client Manager is bound to be a major component for multiplayer management */ #include "main.h" -#include "msgbuilder.h" +#include "include/msgbuilder.h" PClientManager::PClientManager() { diff --git a/server/src/game/commands.cpp b/server/src/game/commands.cpp index 02b5f52..7dc907d 100644 --- a/server/src/game/commands.cpp +++ b/server/src/game/commands.cpp @@ -37,10 +37,10 @@ */ #include "main.h" -#include "client.h" -#include "msgbuilder.h" -#include "worlds.h" -#include "worldactors.h" +#include "include/client.h" +#include "include/msgbuilder.h" +#include "include/worlds.h" +#include "include/worldactors.h" PCommands::PCommands() { @@ -103,17 +103,17 @@ void PCommands::HandleGameCommand(char *packet, PClient *Client) } // ok, we have the command, now read the args - // Loop till entire chatpacket is parsed or MAXARGS is reached + // Loop till entire chatpacket is parsed or MAXARGS is reached bool tEncapsedString = false; while (packet[posPacket] != '\0' && ArgC <= MAXARGS) { // First set tmpPos for next Arg to 0 tmpPos = 0; - + // Now loop until next space ' ' or end '\0' is reached // Added extraction of encapsulated strings "test 123 123" while (packet[posPacket] != ' ' || tEncapsedString == true) - { + { // Watch out for >"< if(packet[posPacket] == '"') tEncapsedString = !tEncapsedString; @@ -124,7 +124,7 @@ void PCommands::HandleGameCommand(char *packet, PClient *Client) tmpPos++; } // Increment tmpPos and posPacket - posPacket++; + posPacket++; if(packet[posPacket] == '\0') break; } @@ -133,8 +133,8 @@ void PCommands::HandleGameCommand(char *packet, PClient *Client) // Terminate current ArgV ArgV[ArgC][tmpPos] = '\0'; - // Heh, we got one! Now more to next arg - ArgC++; + // Heh, we got one! Now more to next arg + ArgC++; // Search next arg (Maybe someone typed more than one whitespace) while (packet[posPacket] == ' ' && packet[posPacket] != '\0') @@ -318,15 +318,15 @@ void PCommands::HandleGameCommand(char *packet, PClient *Client) else if (strcmp(Command, "setsubskill") == 0) { doCmdSetSubSkill(); - } + } else if (strcmp(Command, "npc") == 0) - { + { doNPC(); - } + } else if (strcmp(Command, "npcshop") == 0) - { + { doNPC_Shop(); - } + } // Else: unknown command. Ignore } diff --git a/server/src/game/configtemplate.h b/server/src/game/configtemplate.h index a94b61e..00772a0 100644 --- a/server/src/game/configtemplate.h +++ b/server/src/game/configtemplate.h @@ -79,7 +79,7 @@ const char* GameConfigTemplate[][2] = { {"password_filter", "^[[:graph:]]{3,15}$"}, {"charname_filter", "^[a-z]+([\\-\\ ]?[a-z]+){0,2}$"}, {"clanname_filter", "^[a-z][\\w\\-\\ ]{2,14}$"}, - + // For futur use: // {"max_chars_per_account", "4"}, // {"multiple_logins_per_account", "0"}, // 0=nobody, 1=gm+ only, 2=everybody @@ -132,6 +132,5 @@ const char* CommandsTemplate[][2] = { {"setsubskill", "50"}, // Set subskill (BRT,HCK,PPU,...) of own char or someone else {"npc", "50"}, // do actions with NPCs - {"", ""} // do not change this line (end mark) }; diff --git a/server/src/game/container.cpp b/server/src/game/container.cpp index fe0cf33..00f03fe 100644 --- a/server/src/game/container.cpp +++ b/server/src/game/container.cpp @@ -1,38 +1,39 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - container.cpp - base classe for containers - - - MODIFIED: 28 Jul 2008 Hammag - REASON: - creation + container.cpp - base classe for containers + MODIFIED: 28 Jul 2008 Hammag + REASON: - creation + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - clean ups */ #include "main.h" -#include "item.h" -#include "container.h" +#include "include/item.h" +#include "include/container.h" /* --- PContainerEntry class --- */ @@ -182,7 +183,7 @@ bool PContainer::AddEntry( PContainerEntry* NewEntry, u8 nSlotId ) if ( IsSlotAllowed( nSlotId ) ) { for ( u8 i = mContContent->size(); i <= nSlotId; ++i ) // Extend as needed - mContContent->push_back( NULL ); + mContContent->push_back( static_cast(NULL) ); if ( mContContent->at( nSlotId ) ) { Console->Print( RED, BLACK, "[Warning] PContainer::AddEntry: Target entry already %d in use !!!", nSlotId ); @@ -684,7 +685,7 @@ bool PContainer2DWorkaround::AddEntry( PContainerEntry* tEntry, u8 nSlotId ) if ( FindValid2DPos( tEntry ) ) { for ( u8 i = mContContent->size(); i <= nSlotId; ++i ) // Extend as needed - mContContent->push_back( NULL ); + mContContent->push_back( static_cast(NULL) ); if ( mContContent->at( nSlotId ) ) { Console->Print( RED, BLACK, "[Warning] PContainer2DWorkaround::AddEntry: Target entry already %d in use !!!", nSlotId ); diff --git a/server/src/game/decoder/Makefile b/server/src/game/decoder/Makefile deleted file mode 100644 index 78618d5..0000000 --- a/server/src/game/decoder/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := gameserver - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -#L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -EXTRA_CXXFLAGS := -I/usr/include/mysql -I$(TOPDIR)/game/include - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/game/decoder/main.h b/server/src/game/decoder/main.h index 41af742..0e6dd6b 100644 --- a/server/src/game/decoder/main.h +++ b/server/src/game/decoder/main.h @@ -26,66 +26,70 @@ MODIFIED: 30 Aug 2006 Hammag REASON: - created - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #ifndef MAIN_H #define MAIN_H //#include "version.h" //basic includes -#include "external.h" +#include "include/external.h" //tinns includes -#include "types.h" -#include "config.h" +#include "include/types.h" +#include "common/config.h" -#include "console.h" -#include "misc.h" +#include "common/console.h" +#include "common/misc.h" -#include "netcode.h" +#include "common/netcode.h" -#include "globals.h" - -#include "msgdecoder.h" +#include "include/msgdecoder.h" #include "udpanalyser.h" + /* #include "../gamemonkey/gmMachine.h" #include "../gamemonkey/gmCall.h" */ -#include "filesystem.h" + +#include "common/filesystem.h" // MySQL Support // shouldn't be needed as DB-objects access class should do that -#include "mysql.h" -#include "sql.h" - -#include "skill.h" - -#include "chars.h" -#include "accounts.h" -#include "defs.h" -#include "client.h" -#include "server.h" -#include "misc.h" -#include "gameserver.h" -#include "globals.h" -#include "zoning.h" -#include "item.h" -#include "inventory.h" - -#include "chat.h" -#include "commands.h" -#include "clientmanager.h" -#include "msgbuilder.h" -#include "worldactors.h" -#include "npc.h" -#include "outpost.h" -#include "multipart.h" -#include "terminal.h" - -using namespace std; +#ifdef MYSQL_INC_DIR +#include +#else +#include +#endif + +#include "include/sql.h" + +#include "include/skill.h" + +#include "include/chars.h" +#include "include/accounts.h" +#include "include/defs.h" +#include "include/client.h" +#include "include/server.h" +#include "include/gameserver.h" +#include "include/globals.h" +#include "include/zoning.h" +#include "include/item.h" +#include "include/inventory.h" + +#include "include/chat.h" +#include "include/commands.h" +#include "include/clientmanager.h" +#include "include/msgbuilder.h" +#include "include/worldactors.h" +#include "include/npc.h" +#include "include/outpost.h" +#include "include/multipart.h" +#include "include/terminal.h" #endif diff --git a/server/src/game/decoder/msgdecoder.cpp b/server/src/game/decoder/msgdecoder.cpp index 755a55c..b684bd5 100644 --- a/server/src/game/decoder/msgdecoder.cpp +++ b/server/src/game/decoder/msgdecoder.cpp @@ -19,20 +19,22 @@ 02110-1301, USA. */ + + /* msgdecoder.cpp - top class for NC messages decoding CREATION: 23 Aug 2006 Hammag - MODIFIED: - REASON: - - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "msgdecoder.h" +#include "include/msgdecoder.h" #include "udp_0x13.h" diff --git a/server/src/game/decoder/udp_0x13.cpp b/server/src/game/decoder/udp_0x13.cpp index 400ca54..3a89ad4 100644 --- a/server/src/game/decoder/udp_0x13.cpp +++ b/server/src/game/decoder/udp_0x13.cpp @@ -59,23 +59,23 @@ PUdpMsgAnalyser* PUdp0x13::Analyse() if ( ! mDecodeData->mHandling0x13Sub ) // First decoding pass { -//Console->Print(" --- New 0x13 msg"); -//TmpMsg->Dump(); + //Console->Print(" --- New 0x13 msg"); + //TmpMsg->Dump(); ( *TmpMsg ) >> ( mDecodeData->mClientState->UDP.mSequence ); // "LastPacket" ( *TmpMsg ) >> ( mDecodeData->mClientState->UDP.mServerPacketNum ); //PID mDecodeData->Sub0x13StartNext = 0; - } + } if ( TmpMsg->EOM() ) - { + { Console->Print( RED, BLACK, "PUdp0x13::Analyse(): Emptied 0x13 msg handling !!!" ); mDecodeData->mState = DECODE_FINISHED; mDecodeData->mHandling0x13Sub = false; nextAnalyser = this; mDecodeData->Sub0x13Start = mDecodeData->Sub0x13StartNext = 0; - } - else - { + } + else + { if ( mDecodeData->mHandling0x13Sub && mDecodeData->Sub0x13StartNext ) { TmpMsg->SetNextByteOffset( mDecodeData->Sub0x13StartNext ); @@ -111,7 +111,7 @@ PUdpMsgAnalyser* PUdp0x13::Analyse() PSeq = *(u16*)&Buf[Offset+2];*/ //Console->Print("0x13 Type: %d", MsgType); switch ( MsgType ) - { + { case 0x03: { mDecodeData->mName << "/0x03"; @@ -161,19 +161,19 @@ PUdpMsgAnalyser* PUdp0x13::Analyse() break; } } - break; + break; } case 0x0b: // Ping { nextAnalyser = new PUdpPing( mDecodeData ); - break; + break; } case 0x0c: // Baseline { nextAnalyser = new PUdpSync2( mDecodeData ); - break; + break; } case 0x1f: @@ -189,20 +189,20 @@ PUdpMsgAnalyser* PUdp0x13::Analyse() mDecodeData->mUnknownType = MsgType; mDecodeData->mTraceUnknownMsg = true; } - break; + break; } case 0x20: // Char move { nextAnalyser = new PUdpCharPosUpdate( mDecodeData ); - break; + break; } case 0x27: // Sitting object info request { nextAnalyser = new PUdpRequestVhcInfo( mDecodeData ); - break; - } + break; + } case 0x2a: // "Packet0" { @@ -211,13 +211,13 @@ PUdpMsgAnalyser* PUdp0x13::Analyse() } case 0x2d: // sent when targeting another char - { + { nextAnalyser = new PUdpCharTargeting( mDecodeData ); break; - } + } case 0x32: // Vhc move - { + { mDecodeData->mName << "/0x32"; u8 MsgSubType = TmpMsg->U8Data( TmpMsg->GetNextByteOffset() + 4 ); switch ( MsgSubType ) @@ -239,13 +239,13 @@ PUdpMsgAnalyser* PUdp0x13::Analyse() } } break; - } + } default: - { + { mDecodeData->mUnknownType = MsgType; - break; - } + break; + } } if ( ! nextAnalyser ) @@ -253,6 +253,6 @@ PUdpMsgAnalyser* PUdp0x13::Analyse() nextAnalyser = new PUdpMsgUnknown( mDecodeData ); } - } + } return nextAnalyser; } diff --git a/server/src/game/decoder/udp_0x1f.cpp b/server/src/game/decoder/udp_0x1f.cpp index 1005f0c..e143971 100644 --- a/server/src/game/decoder/udp_0x1f.cpp +++ b/server/src/game/decoder/udp_0x1f.cpp @@ -71,12 +71,12 @@ PUdpMsgAnalyser* PUdp0x1f::Analyse() { case 0x00: { - nextAnalyser = new PUdpHeldItemBasicAction( mDecodeData ); + nextAnalyser = new PUdpHeldItemBasicAction( mDecodeData ); break; } case 0x01: { - nextAnalyser = new PUdpHeldItemAimedAction( mDecodeData ); + nextAnalyser = new PUdpHeldItemAimedAction( mDecodeData ); break; } case 0x02: @@ -114,9 +114,9 @@ PUdpMsgAnalyser* PUdp0x1f::Analyse() nextAnalyser = new PUdpItemSlotUse( mDecodeData ); break; } - case 0x20: // Use item for hacking, launcher, "launcher" spell + case 0x20: // Use item for hacking, launcher, "launcher" spell { - nextAnalyser = new PUdpHeldItemLaunchingAction( mDecodeData ); + nextAnalyser = new PUdpHeldItemLaunchingAction( mDecodeData ); break; } case 0x22: @@ -160,7 +160,7 @@ PUdpMsgAnalyser* PUdp0x1f::Analyse() mDecodeData->mName << "/0x18"; switch ( mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 9 ) ) { - case 0x01: // Use backpack item + case 0x01: // Use inventory item { nextAnalyser = new PUdpItemUse( mDecodeData ); break; diff --git a/server/src/game/decoder/udp_charmove.cpp b/server/src/game/decoder/udp_charmove.cpp index 381b26b..7f6d585 100644 --- a/server/src/game/decoder/udp_charmove.cpp +++ b/server/src/game/decoder/udp_charmove.cpp @@ -1,41 +1,41 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* + udp_charmove.cpp - decoder classes for UDP char movement messages - udp_charmove.cpp - decoder classes for UDP char movement messages - - CREATION: 5 Sep 2006 Hammag - - MODIFIED: - REASON: - + CREATION: 5 Sep 2006 Hammag + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #include "main.h" + #include "udp_charmove.h" -#include "worlds.h" -#include "vehicle.h" -#include "subway.h" +#include "include/worlds.h" +#include "include/vehicle.h" +#include "include/subway.h" + #define JUMPHEIGHT 160 diff --git a/server/src/game/decoder/udp_charmove.h b/server/src/game/decoder/udp_charmove.h index c66e058..9736fd8 100644 --- a/server/src/game/decoder/udp_charmove.h +++ b/server/src/game/decoder/udp_charmove.h @@ -25,15 +25,14 @@ CREATION: 5 Sep 2006 Hammag - MODIFIED: - REASON: - - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #ifndef UDPCHARMOVE_H #define UDPCHARMOVE_H -#include "msgdecoder.h" +#include "include/msgdecoder.h" #include "udpanalyser.h" class PUdpCharPosUpdate : public PUdpMsgAnalyser diff --git a/server/src/game/decoder/udp_entityposreq.cpp b/server/src/game/decoder/udp_entityposreq.cpp index db80a66..9e314f9 100644 --- a/server/src/game/decoder/udp_entityposreq.cpp +++ b/server/src/game/decoder/udp_entityposreq.cpp @@ -19,21 +19,24 @@ 02110-1301, USA. */ -/* + +/* udp_entityposreq.cpp - decoder classes for UDP entity position request messages CREATION: 8 jun 2007 Hammag - MODIFIED: - REASON: - - + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" + #include "udp_entityposreq.h" -#include "worlds.h" +#include "include/worlds.h" + PUdpEntityPosRequest::PUdpEntityPosRequest(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData) { diff --git a/server/src/game/decoder/udp_hack.cpp b/server/src/game/decoder/udp_hack.cpp index 1108214..e28f92f 100644 --- a/server/src/game/decoder/udp_hack.cpp +++ b/server/src/game/decoder/udp_hack.cpp @@ -1,40 +1,43 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_hack.cpp - decoder classes for UDP hacking related messages - CREATION: 30 Dec 2006 Namikon +/* + udp_hack.cpp - decoder classes for UDP hacking related messages - MODIFIED: - REASON: - + CREATION: 30 Dec 2006 Namikon + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" + #include "udp_hack.h" -#include "worlds.h" -#include "furnituretemplate.h" -#include "doortemplate.h" + +#include "include/worlds.h" +#include "include/furnituretemplate.h" +#include "include/doortemplate.h" /**** PUdpHackSuccess ****/ diff --git a/server/src/game/decoder/udp_helditemaction.cpp b/server/src/game/decoder/udp_helditemaction.cpp index 515ce99..d5436dd 100644 --- a/server/src/game/decoder/udp_helditemaction.cpp +++ b/server/src/game/decoder/udp_helditemaction.cpp @@ -32,8 +32,8 @@ #include "main.h" #include "udp_helditemaction.h" -#include "worlds.h" -#include "furnituretemplate.h" +#include "include/worlds.h" +#include "include/furnituretemplate.h" /**** PUdpHeldItemBasicAction ****/ @@ -233,9 +233,9 @@ bool PUdpItemAddonActivation::DoAction() { PClient* nClient = mDecodeData->mClient; //PChar* tChar = nClient->GetChar(); - nClient->testval8 ^= ( 1 << mAddonIdx ); // Toggle state // Using testval8 for testing only!!! + nClient->testval8 ^= (1 << mAddonIdx); // Toggle state // Using testval8 for testing only!!! - PMessage* tmpMsg = MsgBuilder->BuildHeldItemAddonActivationMsg( nClient, nClient->testval8 ); // For testing only!!! + PMessage* tmpMsg = MsgBuilder->BuildHeldItemAddonActivationMsg( nClient, nClient->testval8); // For testing only!!! ClientManager->UDPBroadcast( tmpMsg, nClient ); if ( gDevDebug ) diff --git a/server/src/game/decoder/udp_helditemaction.h b/server/src/game/decoder/udp_helditemaction.h index a1fd84a..9645821 100644 --- a/server/src/game/decoder/udp_helditemaction.h +++ b/server/src/game/decoder/udp_helditemaction.h @@ -33,7 +33,6 @@ #ifndef HELDITEMACTION_H #define HELDITEMACTION_H - class PUdpHeldItemBasicAction : public PUdpMsgAnalyser { public: @@ -45,6 +44,7 @@ class PUdpHeldItemBasicAction : public PUdpMsgAnalyser class PUdpHeldItemAimedAction : public PUdpMsgAnalyser { + private: u16 mWeaponId; u32 mTargetRawItemID; @@ -79,6 +79,7 @@ class PUdpHeldItemLaunchingAction : public PUdpMsgAnalyser bool DoAction(); }; + class PUdpItemAddonActivation : public PUdpMsgAnalyser { private: diff --git a/server/src/game/decoder/udp_itemmanualreload.cpp b/server/src/game/decoder/udp_itemmanualreload.cpp index d80ec66..f507d0e 100644 --- a/server/src/game/decoder/udp_itemmanualreload.cpp +++ b/server/src/game/decoder/udp_itemmanualreload.cpp @@ -1,38 +1,42 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_itemmanualreload.cpp - decoder classes for UDP item manual reload messages - CREATION: 9 May 2009 Hammag +/* + udp_itemmanualreload.cpp - decoder classes for UDP item manual reload messages - MODIFIED: - REASON: - + CREATION: 9 May 2009 Hammag + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" + #include "udp_itemmanualreload.h" -#include "container.h" + +#include "include/container.h" + /**** PUdpItemManualReload ****/ diff --git a/server/src/game/decoder/udp_itemmove.cpp b/server/src/game/decoder/udp_itemmove.cpp index 1720743..5a1f56a 100644 --- a/server/src/game/decoder/udp_itemmove.cpp +++ b/server/src/game/decoder/udp_itemmove.cpp @@ -1,40 +1,46 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_itemmove.cpp - decoder classes for UDP item move related messages - CREATION: 30 Dec 2006 Namikon +/* + udp_itemmove.cpp - decoder classes for UDP item move related messages - MODIFIED: 28 Aug 2007 Hammag - REASON: Moved decoding part from DoAction() to Analyse(), use natural decode methods + CREATION: 30 Dec 2006 Namikon + MODIFIED: 28 Aug 2007 Hammag + REASON: - Moved decoding part from DoAction() to Analyse(), use natural decode methods + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" + #include "udp_itemmove.h" -#include "chars.h" -#include "inventory.h" -#include "container.h" + +#include "include/chars.h" +#include "include/inventory.h" +#include "include/container.h" + /**** PUdpItemMove ****/ diff --git a/server/src/game/decoder/udp_npcdialog.cpp b/server/src/game/decoder/udp_npcdialog.cpp index c76c655..0855db8 100644 --- a/server/src/game/decoder/udp_npcdialog.cpp +++ b/server/src/game/decoder/udp_npcdialog.cpp @@ -1,138 +1,137 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -/* - - udp_npcdialog.cpp - decoder classes for UDP NPC Dialog-Messages - - CREATION: 13 Oct 2009 Namikon - - MODIFIED: - REASON: - - -*/ - -#include "main.h" -#include "udp_npcdialog.h" - -/**** PUdpNPCDialogClose ****/ - -PUdpNPCDialogClose::PUdpNPCDialogClose( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData ) -{ - nDecodeData->mName << "/0x19"; -} - -PUdpMsgAnalyser* PUdpNPCDialogClose::Analyse() -{ - mDecodeData->mName << "=NPC Dialog closed"; - - mPlayerID = mDecodeData->mMessage->U16Data( mDecodeData->Sub0x13Start + 5 ); - mNPCID = mDecodeData->mMessage->U32Data( mDecodeData->Sub0x13Start + 8 ); - - mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED; - return this; -} - -bool PUdpNPCDialogClose::DoAction() -{ - if ( mDecodeData->mState & DECODE_ACTION_READY ) - { - if (gDevDebug) - Console->Print( "%s PUdpNPCDialogClose: Client %d closed dialog with NPC %d", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mPlayerID, mNPCID ); - - // Set DialogNPC for player to 0 - mDecodeData->mClient->GetChar()->SetDialogNPC(0); - if (gDevDebug) Console->Print("[DEBUG PUdpNPCDialogClose::DoAction] New DialogPartner for Client %d is now %u", mPlayerID, mDecodeData->mClient->GetChar()->GetDialogNPC()); - - mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED; - return true; - } - else - return false; -} -/**** PUdpNPCDialogAction ****/ - -PUdpNPCDialogAction::PUdpNPCDialogAction( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData ) -{ - nDecodeData->mName << "/0x1a"; -} - -PUdpMsgAnalyser* PUdpNPCDialogAction::Analyse() -{ - mDecodeData->mName << "=NPC Dialog action"; - - mPlayerID = mDecodeData->mMessage->U16Data( mDecodeData->Sub0x13Start + 5 ); - mAnswerNr = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 8 ); - - mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED; - return this; -} - -bool PUdpNPCDialogAction::DoAction() -{ - if ( mDecodeData->mState & DECODE_ACTION_READY ) - { - if (gDevDebug) - Console->Print( "%s PUdpNPCDialogAction: Client %d selected dialog answer %d", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mPlayerID, mAnswerNr ); - - PClient* nClient = mDecodeData->mClient; - PChar* tChar = nClient->GetChar(); - bool tSuccess = false; - - // First check if client has an NPC to talk to set (just to be sure) - if (tChar->GetDialogNPC() != 0) - { - // Player has an NPC to talk to. Next, get the NPC instance - PNPC* targetNPC = 0; - PNPCWorld* currentNPCWorld = NPCManager->GetWorld( tChar->GetLocation() ); - if ( currentNPCWorld ) - { - //Console->Print(">>> Searching NPC"); - targetNPC = currentNPCWorld->GetNPC( tChar->GetDialogNPC() ); - if ( targetNPC ) - { - Console->Print( "%s Player talks to NPC %u, answer %d", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), tChar->GetDialogNPC(), mAnswerNr ); - // Continue conversation with given answer. Current node is stored in tChar* class, and NPC handles next steps - // also sends out the required packet - targetNPC->DoConversation(nClient, mAnswerNr); - tSuccess = true; - } - } - } - else - { - Console->Print( "%s Dialog request received, but player has no active NPC dialog set, dropping", Console->ColorText( RED, BLACK, "[ERROR]" )); - tSuccess = true; - } - if(tSuccess == false) - { - Console->Print( "%s Player talks to NPC %u, but npc isnt active anymore. Resetting dialog state for client", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), tChar->GetDialogNPC() ); - tChar->SetDialogNode(0); - tChar->SetDialogNPC(0); - } - - mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED; - return true; - } - else - return false; -} - +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +/* + + udp_npcdialog.cpp - decoder classes for UDP NPC Dialog-Messages + + CREATION: 13 Oct 2009 Namikon + + MODIFIED: + REASON: - + +*/ + +#include "main.h" +#include "udp_npcdialog.h" + +/**** PUdpNPCDialogClose ****/ + +PUdpNPCDialogClose::PUdpNPCDialogClose( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData ) +{ + nDecodeData->mName << "/0x19"; +} + +PUdpMsgAnalyser* PUdpNPCDialogClose::Analyse() +{ + mDecodeData->mName << "=NPC Dialog closed"; + + mPlayerID = mDecodeData->mMessage->U16Data( mDecodeData->Sub0x13Start + 5 ); + mNPCID = mDecodeData->mMessage->U32Data( mDecodeData->Sub0x13Start + 8 ); + + mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED; + return this; +} + +bool PUdpNPCDialogClose::DoAction() +{ + if ( mDecodeData->mState & DECODE_ACTION_READY ) + { + if (gDevDebug) + Console->Print( "%s PUdpNPCDialogClose: Client %d closed dialog with NPC %d", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mPlayerID, mNPCID ); + + // Set DialogNPC for player to 0 + mDecodeData->mClient->GetChar()->SetDialogNPC(0); + if (gDevDebug) Console->Print("[DEBUG PUdpNPCDialogClose::DoAction] New DialogPartner for Client %d is now %u", mPlayerID, mDecodeData->mClient->GetChar()->GetDialogNPC()); + + mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED; + return true; + } + else + return false; +} +/**** PUdpNPCDialogAction ****/ + +PUdpNPCDialogAction::PUdpNPCDialogAction( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData ) +{ + nDecodeData->mName << "/0x1a"; +} + +PUdpMsgAnalyser* PUdpNPCDialogAction::Analyse() +{ + mDecodeData->mName << "=NPC Dialog action"; + + mPlayerID = mDecodeData->mMessage->U16Data( mDecodeData->Sub0x13Start + 5 ); + mAnswerNr = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 8 ); + + mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED; + return this; +} + +bool PUdpNPCDialogAction::DoAction() +{ + if ( mDecodeData->mState & DECODE_ACTION_READY ) + { + if (gDevDebug) + Console->Print( "%s PUdpNPCDialogAction: Client %d selected dialog answer %d", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mPlayerID, mAnswerNr ); + + PClient* nClient = mDecodeData->mClient; + PChar* tChar = nClient->GetChar(); + bool tSuccess = false; + + // First check if client has an NPC to talk to set (just to be sure) + if (tChar->GetDialogNPC() != 0) + { + // Player has an NPC to talk to. Next, get the NPC instance + PNPC* targetNPC = 0; + PNPCWorld* currentNPCWorld = NPCManager->GetWorld( tChar->GetLocation() ); + if ( currentNPCWorld ) + { + //Console->Print(">>> Searching NPC"); + targetNPC = currentNPCWorld->GetNPC( tChar->GetDialogNPC() ); + if ( targetNPC ) + { + Console->Print( "%s Player talks to NPC %u, answer %d", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), tChar->GetDialogNPC(), mAnswerNr ); + // Continue conversation with given answer. Current node is stored in tChar* class, and NPC handles next steps + // also sends out the required packet + targetNPC->DoConversation(nClient, mAnswerNr); + tSuccess = true; + } + } + } + else + { + Console->Print( "%s Dialog request received, but player has no active NPC dialog set, dropping", Console->ColorText( RED, BLACK, "[ERROR]" )); + tSuccess = true; + } + if(tSuccess == false) + { + Console->Print( "%s Player talks to NPC %u, but npc isnt active anymore. Resetting dialog state for client", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), tChar->GetDialogNPC() ); + tChar->SetDialogNode(0); + tChar->SetDialogNPC(0); + } + + mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED; + return true; + } + else + return false; +} diff --git a/server/src/game/decoder/udp_npcdialog.h b/server/src/game/decoder/udp_npcdialog.h index 40e68db..5638b84 100644 --- a/server/src/game/decoder/udp_npcdialog.h +++ b/server/src/game/decoder/udp_npcdialog.h @@ -1,62 +1,62 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -/* - - udp_npcdialog.h - decoder classes for UDP NPC Dialog-Messages - - CREATION: 13 Oct 2009 Namikon - - MODIFIED: - REASON: - - -*/ - -#ifndef UDPNPCDIALOG_H -#define UDPNPCDIALOG_H - -class PUdpNPCDialogClose : public PUdpMsgAnalyser -{ - private: - u16 mPlayerID; - u32 mNPCID; - - public: - PUdpNPCDialogClose( PMsgDecodeData* nDecodeData ); - //~PUdpNPCDialogClose(); - PUdpMsgAnalyser* Analyse(); - bool DoAction(); -}; - -class PUdpNPCDialogAction : public PUdpMsgAnalyser -{ - private: - u16 mPlayerID; - u8 mAnswerNr; - - public: - PUdpNPCDialogAction( PMsgDecodeData* nDecodeData ); - //~PUdpNPCDialogAction(); - PUdpMsgAnalyser* Analyse(); - bool DoAction(); -}; - -#endif +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +/* + + udp_npcdialog.h - decoder classes for UDP NPC Dialog-Messages + + CREATION: 13 Oct 2009 Namikon + + MODIFIED: + REASON: - + +*/ + +#ifndef UDPNPCDIALOG_H +#define UDPNPCDIALOG_H + +class PUdpNPCDialogClose : public PUdpMsgAnalyser +{ + private: + u16 mPlayerID; + u32 mNPCID; + + public: + PUdpNPCDialogClose( PMsgDecodeData* nDecodeData ); + //~PUdpNPCDialogClose(); + PUdpMsgAnalyser* Analyse(); + bool DoAction(); +}; + +class PUdpNPCDialogAction : public PUdpMsgAnalyser +{ + private: + u16 mPlayerID; + u8 mAnswerNr; + + public: + PUdpNPCDialogAction( PMsgDecodeData* nDecodeData ); + //~PUdpNPCDialogAction(); + PUdpMsgAnalyser* Analyse(); + bool DoAction(); +}; + +#endif diff --git a/server/src/game/decoder/udp_ping.cpp b/server/src/game/decoder/udp_ping.cpp index 0cbd470..7258bf0 100644 --- a/server/src/game/decoder/udp_ping.cpp +++ b/server/src/game/decoder/udp_ping.cpp @@ -54,7 +54,7 @@ bool PUdpPing::DoAction() { if ( mDecodeData->mState & DECODE_ACTION_READY ) { - // if(gDevDebug) + // if(gDevDebug) // Console->Print( "%s PUdpPing: Client timestamp %d (0x%08x)", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mClientTime, mClientTime ); PMessage* tmpMsg = MsgBuilder->BuildPingMsg( mDecodeData->mClient, mClientTime ); diff --git a/server/src/game/decoder/udp_ping.h b/server/src/game/decoder/udp_ping.h index b8d6dca..88299b2 100644 --- a/server/src/game/decoder/udp_ping.h +++ b/server/src/game/decoder/udp_ping.h @@ -40,7 +40,6 @@ class PUdpPing : public PUdpMsgAnalyser public: PUdpPing( PMsgDecodeData* nDecodeData ); - PUdpMsgAnalyser* Analyse(); bool DoAction(); }; diff --git a/server/src/game/decoder/udp_popupresponse.cpp b/server/src/game/decoder/udp_popupresponse.cpp old mode 100755 new mode 100644 index b4b6c8a..3798b23 --- a/server/src/game/decoder/udp_popupresponse.cpp +++ b/server/src/game/decoder/udp_popupresponse.cpp @@ -1,37 +1,44 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* + udp_popupresponse.cpp - decoder classes for some UDP Popup response messages - udp_popupresponse.cpp - decoder classes for some UDP Popup response messages + CREATION: 14 Apr 2009 Hammag - CREATION: 14 Apr 2009 Hammag + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" + #include "udp_popupresponse.h" -#include "vhcaccessrequest.h" -#include "worlds.h" #include "udp_vhc.h" +#include "include/vhcaccessrequest.h" +#include "include/worlds.h" + /**** PUdp0x1f ****/ diff --git a/server/src/game/decoder/udp_popupresponse.h b/server/src/game/decoder/udp_popupresponse.h old mode 100755 new mode 100644 diff --git a/server/src/game/decoder/udp_quickaccessbelt.cpp b/server/src/game/decoder/udp_quickaccessbelt.cpp index 5dda2a5..b108a07 100644 --- a/server/src/game/decoder/udp_quickaccessbelt.cpp +++ b/server/src/game/decoder/udp_quickaccessbelt.cpp @@ -1,39 +1,45 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_quickaccessbelt.cpp - decoder classes for UDP Quickaccessbelt related messages - CREATION: 30 Dec 2006 Namikon +/* + udp_quickaccessbelt.cpp - decoder classes for UDP Quickaccessbelt related messages - MODIFIED: 1 Sept 2007 Hammage - REASON: Put analysis code in Analyse() and change to use new item management methods + CREATION: 30 Dec 2006 Namikon + MODIFIED: 01 Sep 2007 Hammag + REASON: - Put analysis code in Analyse() and change to use new item management methods + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" + #include "udp_quickaccessbelt.h" -#include "container.h" -#include "inventory.h" + +#include "include/container.h" +#include "include/inventory.h" + /**** PUdpItemSlotUse ****/ diff --git a/server/src/game/decoder/udp_reqinfo.cpp b/server/src/game/decoder/udp_reqinfo.cpp index d3cff4f..116c015 100644 --- a/server/src/game/decoder/udp_reqinfo.cpp +++ b/server/src/game/decoder/udp_reqinfo.cpp @@ -62,11 +62,11 @@ PUdpMsgAnalyser* PUdpReqInfo::Analyse() { mDecodeData->mName << "/0x01=Clan Long Name"; break; - } - case 3: - { - mDecodeData->mName << "/0x03=NPC Script"; - break; + } + case 3: + { + mDecodeData->mName << "/0x03=NPC Script"; + break; } case 4: { @@ -114,10 +114,10 @@ bool PUdpReqInfo::DoAction() case 1: //Clan Long Name Console->Print("Client %d : Clan Long Name Request for ClanID %i", mDecodeData->mClient->GetID(), mInfoId); snprintf (query, 255, "SELECT cl_name FROM clans WHERE cl_id = %i", mInfoId); - break; - case 3: // NPC Script - Console->Print("Client %d:: Requested LUA script for NPC %i", mDecodeData->mClient->GetID(), mInfoId); - snprintf (query, 255, "SELECT npc_customscript FROM npc_spawns WHERE npc_id = %i", mInfoId); + break; + case 3: // NPC Script + Console->Print("Client %d:: Requested LUA script for NPC %i", mDecodeData->mClient->GetID(), mInfoId); + snprintf (query, 255, "SELECT npc_customscript FROM npc_spawns WHERE npc_id = %i", mInfoId); break; case 4: //Clan Short name Console->Print("Client %d : Clan Short Name Request for ClanID %i", mDecodeData->mClient->GetID(), mInfoId); @@ -189,42 +189,39 @@ bool PUdpReqInfo::DoAction() { MySQL->FreeGameSQLResult(result); } - - // Special case for NPC Scripts. We have only the NAME of the script in "Answer" - // We need to load the filecontents first; Also, the reply msg is different - // from normal reqinfo messages - if(mRequestType == 3) - { - u32 tFileLen = 0; - PFile* fLua = NULL; - fLua = Filesystem->Open( "", (char*)Answer, Config->GetOption( "nc_data_path" ) ); - std::string tLUAScript = ""; - if(fLua) - { - tFileLen = fLua->GetSize(); - char* t_content = new char[tFileLen+1]; - memset(t_content, '\0', tFileLen+1); - - fLua->Read( t_content, tFileLen ); - fLua = NULL; - - Filesystem->Close( fLua ); - tLUAScript = t_content; // APPEND the script to our existing lua headerfile - delete t_content; - if (gDevDebug) Console->Print( "%s [PUdpReqInfo::DoAction()] Loaded LUA Script %s", Console->ColorText( GREEN, BLACK, "[SUCCESS]" ), (char*)Answer ); - } - else - { - Console->Print( "%s [PUdpReqInfo::DoAction()] Unable to load LUA Script %s", Console->ColorText( RED, BLACK, "[ERROR]" ), (char*)Answer ); - return false; - } - PMessage* tmpMsg = MsgBuilder->BuildReqNPCScriptAnswerMsg( mInfoId, &tLUAScript ); - mDecodeData->mClient->FragmentAndSendUDPMessage(tmpMsg, 0x06); - return true; - } - - PMessage* tmpMsg = MsgBuilder->BuildReqInfoAnswerMsg(mDecodeData->mClient, mRequestType, mInfoId, Answer, len); - mDecodeData->mClient->SendUDPMessage(tmpMsg); + + // Special case for NPC Scripts. We have only the NAME of the script in "Answer" + // We need to load the filecontents first; Also, the reply msg is different + // from normal reqinfo messages + if(mRequestType == 3) + { + u32 tFileLen = 0; + PFile* fLua = NULL; + fLua = Filesystem->Open( "", (char*)Answer, Config->GetOption( "nc_data_path" ) ); + std::string tLUAScript = ""; + if(fLua) + { + tFileLen = fLua->GetSize(); + char* t_content = new char[tFileLen+1]; + memset(t_content, '\0', tFileLen+1); + + fLua->Read( t_content, tFileLen ); + fLua = NULL; + + Filesystem->Close( fLua ); + tLUAScript = t_content; // APPEND the script to our existing lua headerfile + delete t_content; + if (gDevDebug) Console->Print( "%s [PUdpReqInfo::DoAction()] Loaded LUA Script %s", Console->ColorText( GREEN, BLACK, "[SUCCESS]" ), (char*)Answer ); + } + else + { + Console->Print( "%s [PUdpReqInfo::DoAction()] Unable to load LUA Script %s", Console->ColorText( RED, BLACK, "[ERROR]" ), (char*)Answer ); + return false; + } + PMessage* tmpMsg = MsgBuilder->BuildReqNPCScriptAnswerMsg( mInfoId, &tLUAScript ); + mDecodeData->mClient->FragmentAndSendUDPMessage(tmpMsg, 0x06); + return true; + } mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED; return (query[0]); diff --git a/server/src/game/decoder/udp_subskill.cpp b/server/src/game/decoder/udp_subskill.cpp index e3c0fce..c047466 100644 --- a/server/src/game/decoder/udp_subskill.cpp +++ b/server/src/game/decoder/udp_subskill.cpp @@ -22,11 +22,11 @@ /* udp_subskill.h - decoder classes for UDP subskill increasing messages - + CREATION: 15 Sep 2006 Hammag MODIFIED: - REASON: - + REASON: - */ @@ -37,17 +37,17 @@ PUdpSubskillInc::PUdpSubskillInc(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData) { - nDecodeData->mName << "/0x04"; -} + nDecodeData->mName << "/0x04"; +} PUdpMsgAnalyser* PUdpSubskillInc::Analyse() { - mDecodeData->mName << "=Subskill increase request"; - SubskillID = mDecodeData->mMessage->U16Data(mDecodeData->Sub0x13Start+9); - - mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED; + mDecodeData->mName << "=Subskill increase request"; + SubskillID = mDecodeData->mMessage->U16Data(mDecodeData->Sub0x13Start+9); - return this; + mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED; + + return this; } bool PUdpSubskillInc::DoAction() diff --git a/server/src/game/decoder/udp_sync.cpp b/server/src/game/decoder/udp_sync.cpp index 43ec275..446c283 100644 --- a/server/src/game/decoder/udp_sync.cpp +++ b/server/src/game/decoder/udp_sync.cpp @@ -1,40 +1,46 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_sync.cpp - decoder classes for UDP Sync messages - CREATION: 30 Aug 2006 Hammag +/* + udp_sync.cpp - decoder classes for UDP Sync messages + + CREATION: 30 Aug 2006 Hammag - MODIFIED: - REASON: - + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem - TODO : put chunking code from PUdpSync2::DoAction() in a SendChunkedMessqage(PClient* nClient, PMessage* nMessage, u8 nChunkSize = 220) + TODO: + - put chunking code from PUdpSync2::DoAction() in a SendChunkedMessqage(PClient* nClient, PMessage* nMessage, u8 nChunkSize = 220) */ + #include "main.h" + #include "udp_sync.h" -#include "worlds.h" -#include "vehicle.h" + +#include "include/worlds.h" +#include "include/vehicle.h" + /**** PUdpSync0 ****/ diff --git a/server/src/game/decoder/udp_terminal.cpp b/server/src/game/decoder/udp_terminal.cpp index 317fe39..d3f7453 100644 --- a/server/src/game/decoder/udp_terminal.cpp +++ b/server/src/game/decoder/udp_terminal.cpp @@ -1,43 +1,47 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_terminal.cpp - decoder classes for UDP terminal related messages - CREATION: 8 Jan 2007 Namikon +/* + udp_terminal.cpp - decoder classes for UDP terminal related messages - MODIFIED: - REASON: - + CREATION: 08 Jan 2007 Namikon + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" + #include "udp_terminal.h" -#include "terminal.h" -#include "vehicle.h" #include "udp_charmove.h" -#include "worlds.h" -#include "furnituretemplate.h" -#include + +#include "include/terminal.h" +#include "include/vehicle.h" +#include "include/worlds.h" +#include "include/furnituretemplate.h" + +#include /*******************************************************************************************/ /**** PUdpReceiveDB ****/ @@ -92,7 +96,7 @@ bool PUdpReceiveDB::DoAction() if ( gDevDebug ) { Console->Print( "%s ReceiveDB request from client", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) ); - Console->Print( "%s Open Terminal - Terminal session %04x (?) - Unknown1 %04x - DBId %04x - Unknown2 %02x", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId, mUnknown1, mDBId, mUnknown2 ); + Console->Print( "%s Open Terminal - Terminal session %04x (?) - Unknown1 %04x - DBId %04x - Unknown2 %02x", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId, mUnknown1, mDBId, mUnknown2 ); Console->Print( "%s Command: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mCommandName.c_str() ); for ( u8 i = 0; i < mOptionsCount; ++i ) Console->Print( "%s Option %d: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), i, mOptions[i].c_str() ); @@ -289,22 +293,22 @@ PUdpMsgAnalyser* PUdpUpdateDB::Analyse() bool PUdpUpdateDB::DoAction() { - if ( gDevDebug ) - { - Console->Print( "%s UpdateDB request from client", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) ); - Console->Print( "%s Open Terminal - Terminal session %04x (?)", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId ); - Console->Print( "%s Command: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mCommandName.c_str() ); - for ( u8 i = 0; i < mOptionsCount; ++i ) - Console->Print( "%s Option %d: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), i, mOptions[i].c_str() ); + if ( gDevDebug ) + { + Console->Print( "%s UpdateDB request from client", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) ); + Console->Print( "%s Open Terminal - Terminal session %04x (?)", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId ); + Console->Print( "%s Command: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mCommandName.c_str() ); + for ( u8 i = 0; i < mOptionsCount; ++i ) + Console->Print( "%s Option %d: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), i, mOptions[i].c_str() ); } bool Result = false; - Result = Terminal->HandleUpdateDB(mDecodeData->mClient, mTerminalSessionId, &mCommandName, mOptions, mOptionsCount, mDBId, mUnknown2); + Result = Terminal->HandleUpdateDB(mDecodeData->mClient, mTerminalSessionId, &mCommandName, mOptions, mOptionsCount, mDBId, mUnknown2); if ( !Result ) - { + { Console->Print( "%s PUdpUpdateDB - Error or unknown command %s", Console->ColorText( RED, BLACK, "[WARNING]" ), mCommandName.c_str() ); for ( u8 i = 0; i < mOptionsCount; ++i ) - Console->Print( "%s Option %d: '%s'", Console->ColorText( RED, BLACK, "[NOTICE]" ), i, mOptions[i].c_str() ); + Console->Print( "%s Option %d: '%s'", Console->ColorText( RED, BLACK, "[NOTICE]" ), i, mOptions[i].c_str() ); } mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED; return true; @@ -333,7 +337,6 @@ PUdpMsgAnalyser* PUdpTryAccessDB::Analyse() ( *TmpMsg ) >> Unknown3; // constant ? => Size of Options! ( *TmpMsg ) >> mCommandName; // null terminated string - while (( TmpMsg->GetNextByteOffset() < mDecodeData->Sub0x13StartNext ) && ( mOptionsCount < mMaxOptions ) ) { ( *TmpMsg ) >> OptionSize; diff --git a/server/src/game/decoder/udp_terminal.h b/server/src/game/decoder/udp_terminal.h index 24a0270..3d4870b 100644 --- a/server/src/game/decoder/udp_terminal.h +++ b/server/src/game/decoder/udp_terminal.h @@ -43,14 +43,14 @@ class PUdpReceiveDB : public PUdpMsgAnalyser std::string mCommandName; std::string mOptions[mMaxOptions]; u8 mOptionsCount; - + u16 mUnknown1; u8 mUnknown2; u16 mDBId; - + bool ActionVehicleListing(); bool ActionVehicleControl(); - + public: PUdpReceiveDB(PMsgDecodeData* nDecodeData); //~PUdpReceiveDB(); @@ -90,6 +90,7 @@ class PUdpTryAccessDB : public PUdpMsgAnalyser u16 mUnknown1; u8 mUnknown2; u16 mDBId; + public: PUdpTryAccessDB(PMsgDecodeData* nDecodeData); //~PUdpTryAccessDB(); @@ -102,7 +103,7 @@ class PUdpQueryDB : public PUdpMsgAnalyser // Also called "ServerMessage" in .ts private: static const u8 mMaxOptions = 5; // Largest: politics\transcomment.tsc(36): u16 mTerminalSessionId; - u16 mDBId; + u16 mDBId; std::string mDBCommandName; std::string mCommandName; std::string mOptions[mMaxOptions]; @@ -111,7 +112,7 @@ class PUdpQueryDB : public PUdpMsgAnalyser // Also called "ServerMessage" in .ts bool ActionSpawnVehicle(); bool ActionRepairVehicle(); bool ActionDismissVehicle(); - + public: PUdpQueryDB(PMsgDecodeData* nDecodeData); //~PUdpQueryDB(); @@ -123,7 +124,7 @@ class PUdpTeminal0x1f : public PUdpMsgAnalyser { private: u16 mTerminalSessionId; - + public: PUdpTeminal0x1f(PMsgDecodeData* nDecodeData); //~PUdpTeminal0x1f(); diff --git a/server/src/game/decoder/udp_useobject.cpp b/server/src/game/decoder/udp_useobject.cpp index 7a42e26..f556016 100644 --- a/server/src/game/decoder/udp_useobject.cpp +++ b/server/src/game/decoder/udp_useobject.cpp @@ -1,48 +1,53 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_useobject.cpp - decoder classes for object use related messages - CREATION: 17 Sep 2006 Hammag +/* + udp_useobject.cpp - decoder classes for object use related messages - MODIFIED: - REASON: - + CREATION: 17 Sep 2006 Hammag - TODO: use only RawObjectIDs to avoid complication & errors + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + TODO: + - use only RawObjectIDs to avoid complication & errors */ + #include "main.h" + #include "udp_useobject.h" -#include "worlds.h" -#include "furnituretemplate.h" -#include "doortemplate.h" -#include "appartements.h" -#include "container.h" -#include "subway.h" -#include "vhcaccessrequest.h" #include "udp_vhc.h" +#include "include/worlds.h" +#include "include/furnituretemplate.h" +#include "include/doortemplate.h" +#include "include/appartements.h" +#include "include/container.h" +#include "include/subway.h" +#include "include/vhcaccessrequest.h" + + u32 gVhcId = 0x3ff; /**** PUdpVhcMove ****/ @@ -257,29 +262,29 @@ bool PUdpUseObject::DoAction() } if ( !( mDecodeData->mState & DECODE_ACTION_DONE ) ) // not a vhc nor a pc - { - //Console->Print(">>> Searching world"); + { + //Console->Print(">>> Searching world"); // Is it a NPC ? PNPC* targetNPC = 0; PNPCWorld* currentNPCWorld = NPCManager->GetWorld( nChar->GetLocation() ); if ( currentNPCWorld ) - { + { //Console->Print(">>> Searching NPC (SQL Version)"); - targetNPC = currentNPCWorld->GetNPC( mRawItemID ); - if(!targetNPC) - { - //Console->Print(">>> Searching NPC (DEF Version)"); - // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! - targetNPC = currentNPCWorld->GetNPC( mRawItemID - 255 ); + targetNPC = currentNPCWorld->GetNPC( mRawItemID ); + if(!targetNPC) + { + //Console->Print(">>> Searching NPC (DEF Version)"); + // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! + targetNPC = currentNPCWorld->GetNPC( mRawItemID - 255 ); } } if ( targetNPC ) - { + { /*if(gDevDebug)*/ Console->Print( "%s Player talks to NPC %d", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mRawItemID ); //if(gDevDebug) tContainer->Dump(); - // Well its not "start a conversation" its more "User clicked NPC, do anything with it (Trade, script,...) + // Well its not "start a conversation" its more "User clicked NPC, do anything with it (Trade, script,...) targetNPC->StartConversation(nClient); //tmpMsg = MsgBuilder->BuildTraderItemListMsg( nClient, mRawItemID ); diff --git a/server/src/game/decoder/udp_vhc.cpp b/server/src/game/decoder/udp_vhc.cpp index ba99f97..168bdbe 100644 --- a/server/src/game/decoder/udp_vhc.cpp +++ b/server/src/game/decoder/udp_vhc.cpp @@ -1,40 +1,44 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_vhc.h - decoder classes for UDP vehicle related messages - CREATION: 5 Sep 2006 Hammag +/* + udp_vhc.h - decoder classes for UDP vehicle related messages - MODIFIED: - REASON: - + CREATION: 05 Sep 2006 Hammag + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "worlds.h" -#include "vehicle.h" + #include "udp_vhc.h" -#include "subway.h" + +#include "include/worlds.h" +#include "include/vehicle.h" +#include "include/subway.h" + /**** PUdpVhcMove ****/ diff --git a/server/src/game/decoder/udp_worldIDinfo.cpp b/server/src/game/decoder/udp_worldIDinfo.cpp index 51b0dd1..f3f1a20 100644 --- a/server/src/game/decoder/udp_worldIDinfo.cpp +++ b/server/src/game/decoder/udp_worldIDinfo.cpp @@ -41,38 +41,38 @@ PWorldIDInfoReq::PWorldIDInfoReq(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser( } PUdpMsgAnalyser* PWorldIDInfoReq::Analyse() -{ +{ PMessage* tmpMsg = mDecodeData->mMessage; - mDecodeData->mName << "=WorldID Info Req."; - - tmpMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 5); - (*tmpMsg) >> mInfoId; + mDecodeData->mName << "=WorldID Info Req."; + + tmpMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 5); + (*tmpMsg) >> mInfoId; mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED; return this; } bool PWorldIDInfoReq::DoAction() -{ - PNPC* targetNPC = NULL; - - PNPCWorld* currentNPCWorld = NPCManager->GetWorld( mDecodeData->mClient->GetChar()->GetLocation() ); - if ( currentNPCWorld ) - { - targetNPC = currentNPCWorld->GetNPC( mInfoId ); - if(!targetNPC) - { - // Search for DEF version of NPC (remember, def IDs are on 255 offset! - // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! - targetNPC = currentNPCWorld->GetNPC( mInfoId - 255 ); - } - } - if (!targetNPC) - { - // No NPC, skipping - return true; - } - +{ + PNPC* targetNPC = NULL; + + PNPCWorld* currentNPCWorld = NPCManager->GetWorld( mDecodeData->mClient->GetChar()->GetLocation() ); + if ( currentNPCWorld ) + { + targetNPC = currentNPCWorld->GetNPC( mInfoId ); + if(!targetNPC) + { + // Search for DEF version of NPC (remember, def IDs are on 255 offset! + // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! + targetNPC = currentNPCWorld->GetNPC( mInfoId - 255 ); + } + } + if (!targetNPC) + { + // No NPC, skipping + return true; + } + currentNPCWorld->SendSingleNPCInfo(mDecodeData->mClient, targetNPC); // TODO: Handle client request here! // Note: It *seems* that the client sends this "eek, giev info about ID xxx" diff --git a/server/src/game/decoder/udp_worldIDinfo.h b/server/src/game/decoder/udp_worldIDinfo.h index 9289463..8d60d3e 100644 --- a/server/src/game/decoder/udp_worldIDinfo.h +++ b/server/src/game/decoder/udp_worldIDinfo.h @@ -34,8 +34,8 @@ #define UDPWORLDIDINFO_H class PWorldIDInfoReq : public PUdpMsgAnalyser -{ - u32 mInfoId; +{ + u32 mInfoId; public: PWorldIDInfoReq(PMsgDecodeData* nDecodeData); diff --git a/server/src/game/decoder/udp_zoning.cpp b/server/src/game/decoder/udp_zoning.cpp old mode 100755 new mode 100644 index 6a8c5ec..f7fc98d --- a/server/src/game/decoder/udp_zoning.cpp +++ b/server/src/game/decoder/udp_zoning.cpp @@ -1,41 +1,46 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - udp_zoning.cpp - decoder classes for UDP Zoning messages - CREATION: 6 Sep 2006 Hammag +/* + udp_zoning.cpp - decoder classes for UDP Zoning messages - MODIFIED: 15 Dec 2006 Hammag - REASON: - added PUdpEndOfZoning management class + CREATION: 06 Sep 2006 Hammag + MODIFIED: 15 Dec 2006 Hammag + REASON: - added PUdpEndOfZoning management class + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "udp_zoning.h" +#include "udp_zoning.h" #include "udp_sync.h" -#include "worlds.h" -#include "appartements.h" + +#include "include/worlds.h" +#include "include/appartements.h" + /**** PUdpZoning1 ****/ diff --git a/server/src/game/def/Makefile b/server/src/game/def/Makefile deleted file mode 100644 index 67efa8a..0000000 --- a/server/src/game/def/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := gameserver - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -#L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -EXTRA_CXXFLAGS := -I$(TOPDIR)/game/include - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/game/def/def_actionmod.cpp b/server/src/game/def/def_actionmod.cpp index 3a59c17..44dee7c 100644 --- a/server/src/game/def/def_actionmod.cpp +++ b/server/src/game/def/def_actionmod.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_actionmod.cpp + def_actionmod.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_actionmod.h" + +#include "include/def_actionmod.h" + PDefActionMod::PDefActionMod() { diff --git a/server/src/game/def/def_ammo.cpp b/server/src/game/def/def_ammo.cpp index 8e2c2b9..218a554 100644 --- a/server/src/game/def/def_ammo.cpp +++ b/server/src/game/def/def_ammo.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_ammo.cpp + def_ammo.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_ammo.h" + +#include "include/def_ammo.h" + PDefAmmo::PDefAmmo() { diff --git a/server/src/game/def/def_appartements.cpp b/server/src/game/def/def_appartements.cpp old mode 100755 new mode 100644 diff --git a/server/src/game/def/def_blueprintpieces.cpp b/server/src/game/def/def_blueprintpieces.cpp index 54aafcf..76819ed 100644 --- a/server/src/game/def/def_blueprintpieces.cpp +++ b/server/src/game/def/def_blueprintpieces.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_blueprintpieces.cpp + def_blueprintpieces.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_blueprintpieces.h" + +#include "include/def_blueprintpieces.h" + PDefBlueprintPieces::PDefBlueprintPieces() { diff --git a/server/src/game/def/def_charaction.cpp b/server/src/game/def/def_charaction.cpp index 00d6486..2eeb0fc 100644 --- a/server/src/game/def/def_charaction.cpp +++ b/server/src/game/def/def_charaction.cpp @@ -1,34 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - def_charaction.cpp + def_charaction.cpp + + CREATED: 04 Apr 2009 Hammag - CREATED: 04 Apr 2009 Hammag + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_charaction.h" + +#include "include/def_charaction.h" + PDefCharAction::PDefCharAction() { diff --git a/server/src/game/def/def_damage.cpp b/server/src/game/def/def_damage.cpp index fefd05b..e8e852e 100644 --- a/server/src/game/def/def_damage.cpp +++ b/server/src/game/def/def_damage.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_damage.cpp + def_damage.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_damage.h" + +#include "include/def_damage.h" + PDefDamage::PDefDamage() { diff --git a/server/src/game/def/def_drugs.cpp b/server/src/game/def/def_drugs.cpp index c55ec57..4326874 100644 --- a/server/src/game/def/def_drugs.cpp +++ b/server/src/game/def/def_drugs.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_drug.cpp + def_drug.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_drugs.h" + +#include "include/def_drugs.h" + PDefDrug::PDefDrug() { diff --git a/server/src/game/def/def_factions.cpp b/server/src/game/def/def_factions.cpp index 34ca985..5daf3fd 100644 --- a/server/src/game/def/def_factions.cpp +++ b/server/src/game/def/def_factions.cpp @@ -48,7 +48,7 @@ bool PDefFaction::LoadFromDef(PTokenList *Tokens) int Idx=0; for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++) { - // setfracc 19 "Monster" -1024 0 0 -1024 -1024 -1024 -1 + // setfracc 19 "Monster" -1024 0 0 -1024 -1024 -1024 -1 switch(Idx) { case 0 : // setfrac @@ -65,10 +65,10 @@ bool PDefFaction::LoadFromDef(PTokenList *Tokens) case 3 : mStartValue = atol(i->c_str()); break; - case 4 : + case 4: mAffected = atol(i->c_str())!=0; break; - case 5 : + case 5: mSL = atol(i->c_str()); break; default : diff --git a/server/src/game/def/def_implants.cpp b/server/src/game/def/def_implants.cpp index f77024a..6c65167 100644 --- a/server/src/game/def/def_implants.cpp +++ b/server/src/game/def/def_implants.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_implants.cpp + def_implants.cpp + + CREATED: 29 Apr 2009 Hammag - CREATED: 29 Apr 2009 Hammag + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_implants.h" + +#include "include/def_implants.h" + bool PDefImplant::LoadFromDef( PTokenList *Tokens ) { diff --git a/server/src/game/def/def_itemcontainer.cpp b/server/src/game/def/def_itemcontainer.cpp index 0df8e6a..ffa480c 100644 --- a/server/src/game/def/def_itemcontainer.cpp +++ b/server/src/game/def/def_itemcontainer.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_itemcontainer.cpp + def_itemcontainer.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_itemcontainer.h" + +#include "include/def_itemcontainer.h" + PDefItemContainer::PDefItemContainer() { diff --git a/server/src/game/def/def_itemmod.cpp b/server/src/game/def/def_itemmod.cpp index ed32329..b814d63 100644 --- a/server/src/game/def/def_itemmod.cpp +++ b/server/src/game/def/def_itemmod.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_itemmod.cpp + def_itemmod.cpp - CREATED: 04 Avr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_itemmod.h" + +#include "include/def_itemmod.h" + PDefItemMod::PDefItemMod() { diff --git a/server/src/game/def/def_itemres.cpp b/server/src/game/def/def_itemres.cpp index 6e72e6b..1bd7047 100644 --- a/server/src/game/def/def_itemres.cpp +++ b/server/src/game/def/def_itemres.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_itemres.cpp + def_itemres.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_itemres.h" + +#include "include/def_itemres.h" + PDefItemRestriction::PDefItemRestriction() { diff --git a/server/src/game/def/def_mission.cpp b/server/src/game/def/def_mission.cpp index 0472335..76adb17 100644 --- a/server/src/game/def/def_mission.cpp +++ b/server/src/game/def/def_mission.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_mission.cpp + def_mission.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_mission.h" + +#include "include/def_mission.h" + PDefMission::PDefMission() { diff --git a/server/src/game/def/def_npc.cpp b/server/src/game/def/def_npc.cpp index 7467b76..36a3c64 100644 --- a/server/src/game/def/def_npc.cpp +++ b/server/src/game/def/def_npc.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_npc.cpp + def_npc.cpp + + CREATED: 04 Apr 2009 Hammag - CREATED: 04 Apr 2009 Hammag + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_npc.h" + +#include "include/def_npc.h" + PDefNpc::PDefNpc() { @@ -59,9 +67,9 @@ bool PDefNpc::LoadFromDef( PTokenList *Tokens ) case 9 : mWeaponId = atoi( i->c_str() ); break; case 10 : - mDialogScript = *i; - CleanUpString(&mDialogScript); - break; + mDialogScript = *i; + CleanUpString(&mDialogScript); + break; case 11 : mCombat = atoi( i->c_str() ); break; case 12 : @@ -77,13 +85,13 @@ bool PDefNpc::LoadFromDef( PTokenList *Tokens ) case 17 : mSkillScale = atof( i->c_str() ); break; case 18 : - mStandardScript = *i; - CleanUpString(&mStandardScript); - break; + mStandardScript = *i; + CleanUpString(&mStandardScript); + break; case 19 : - mStandardParameter = *i; - CleanUpString(&mStandardParameter); - break; + mStandardParameter = *i; + CleanUpString(&mStandardParameter); + break; case 20 : mMass = atoi( i->c_str() ); break; case 24 : @@ -97,4 +105,4 @@ bool PDefNpc::LoadFromDef( PTokenList *Tokens ) } return ((Idx >= 20)); -} +} diff --git a/server/src/game/def/def_npcarmor.cpp b/server/src/game/def/def_npcarmor.cpp index 5eeec97..dcb34ea 100644 --- a/server/src/game/def/def_npcarmor.cpp +++ b/server/src/game/def/def_npcarmor.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_npcarmor.cpp + def_npcarmor.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_npcarmor.h" + +#include "include/def_npcarmor.h" + PDefNpcArmor::PDefNpcArmor() { diff --git a/server/src/game/def/def_npcgroupspawn.cpp b/server/src/game/def/def_npcgroupspawn.cpp index 49b98a2..b18ded2 100644 --- a/server/src/game/def/def_npcgroupspawn.cpp +++ b/server/src/game/def/def_npcgroupspawn.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_npcgroupspawn.cpp + def_npcgroupspawn.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_npcgroupspawn.h" + +#include "include/def_npcgroupspawn.h" + PDefNpcGroupSpawn::PDefNpcGroupSpawn() { diff --git a/server/src/game/def/def_outposts.cpp b/server/src/game/def/def_outposts.cpp index 18fe599..3c1919a 100644 --- a/server/src/game/def/def_outposts.cpp +++ b/server/src/game/def/def_outposts.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_outposts.cpp + def_outposts.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_outposts.h" + +#include "include/def_outposts.h" + PDefOutpost::PDefOutpost() { diff --git a/server/src/game/def/def_recycles.cpp b/server/src/game/def/def_recycles.cpp index 2b1e0e2..7d12884 100644 --- a/server/src/game/def/def_recycles.cpp +++ b/server/src/game/def/def_recycles.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_recycles.cpp + def_recycles.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_recycles.h" + +#include "include/def_recycles.h" + PDefRecycle::PDefRecycle() { diff --git a/server/src/game/def/def_respawn.cpp b/server/src/game/def/def_respawn.cpp old mode 100755 new mode 100644 diff --git a/server/src/game/def/def_scripts.cpp b/server/src/game/def/def_scripts.cpp index d83115d..67b833b 100644 --- a/server/src/game/def/def_scripts.cpp +++ b/server/src/game/def/def_scripts.cpp @@ -1,132 +1,132 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - -/* - def_scripts.cpp - - CREATED: 12 Oct 2009 Namikon -*/ - -#include "main.h" - - -PDefScripts::PDefScripts() -{ - mIdentifier = ""; - mLuaFile = ""; -} - -bool PDefScripts::LoadFromDef( PTokenList *Tokens ) -{ - int Idx = 0; - for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ ) - { - switch ( Idx ) - { - case 0 : // setentry - continue; - case 1 : // index - mIndex = atoi(i->c_str()); break; - case 2 : - mIdentifier = *i; - CleanUpString(&mIdentifier); - break; - case 3 : - mLuaFile = *i; - CleanUpString(&mLuaFile); - break; - case 4 : - mScriptHeader = *i; - CleanUpString(&mScriptHeader); - break; - continue; - } - } - - return true; -} - -/* -bool PDefScriptsMap::Load(const char* nName, const char* nFilename) -{ - mName = nName; - if(mName.empty()) - { - Console->Print( "%s Defs name not defined", Console->ColorText( RED, BLACK, "[ERROR]" ) ); - return (false); - } - - if(! *nFilename) - { - Console->Print( "%s Filename not defined for %s defs", Console->ColorText( RED, BLACK, "[ERROR]" ), mName.c_str() ); - return (false); - } - - PDefParser parser; - int nDefs = 0, nErrors = 0, nDup = 0; - - if ( parser.Parse( nFilename ) ) - { - const PDefTokenList &t = parser.GetTokens(); - - for ( PDefTokenList::const_iterator i = t.begin(); i != t.end(); i++ ) - { - PDefScripts *it = new PDefScripts(); - bool loadfail = !it->LoadFromDef( *i ), insertfail = false; - - if ( !loadfail ) - insertfail = !mDefs.insert( std::make_pair( it->GetIndex(), it ) ).second; - if ( loadfail || insertfail ) - { - if ( insertfail ) - { - ++nDup; - if ( gDevDebug ) Console->Print( "%s ini error (new duplicate id %i discarded)", mName.c_str(), it->GetIndex(), it->GetName().c_str() ); - } - else - { - Console->Print( "%s ini load error @ %i", mName.c_str(), nDefs + nErrors ); - ++nErrors; - } - delete it; - } - else - ++nDefs; - } - } - else - { - Console->Print( "%s Error loading %s ini defs", Console->ColorText( RED, BLACK, "[ERROR]" ), mName.c_str() ); - return ( false ); - } - - if ( nErrors > 0 ) - Console->Print( "%s Loaded %i %s ini defs, %i error(s).", Console->ColorText( RED, BLACK, "[ERROR]" ), nDefs, mName.c_str(), nErrors ); - else - Console->Print( "%s Loaded %i %s ini defs, %i error(s).", Console->ColorText( GREEN, BLACK, "[Success]" ), nDefs, mName.c_str(), nErrors ); - - if ( nDup ) - Console->Print( "%s %d duplicate entries ignored in %s ini defs.", Console->ColorText( YELLOW, BLACK, "[Notice]" ), nDup, mName.c_str() ); - - return ( true ); -} -*/ +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + +/* + def_scripts.cpp + + CREATED: 12 Oct 2009 Namikon +*/ + +#include "main.h" + + +PDefScripts::PDefScripts() +{ + mIdentifier = ""; + mLuaFile = ""; +} + +bool PDefScripts::LoadFromDef( PTokenList *Tokens ) +{ + int Idx = 0; + for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ ) + { + switch ( Idx ) + { + case 0 : // setentry + continue; + case 1 : // index + mIndex = atoi(i->c_str()); break; + case 2 : + mIdentifier = *i; + CleanUpString(&mIdentifier); + break; + case 3 : + mLuaFile = *i; + CleanUpString(&mLuaFile); + break; + case 4 : + mScriptHeader = *i; + CleanUpString(&mScriptHeader); + break; + continue; + } + } + + return true; +} + +/* +bool PDefScriptsMap::Load(const char* nName, const char* nFilename) +{ + mName = nName; + if(mName.empty()) + { + Console->Print( "%s Defs name not defined", Console->ColorText( RED, BLACK, "[ERROR]" ) ); + return (false); + } + + if(! *nFilename) + { + Console->Print( "%s Filename not defined for %s defs", Console->ColorText( RED, BLACK, "[ERROR]" ), mName.c_str() ); + return (false); + } + + PDefParser parser; + int nDefs = 0, nErrors = 0, nDup = 0; + + if ( parser.Parse( nFilename ) ) + { + const PDefTokenList &t = parser.GetTokens(); + + for ( PDefTokenList::const_iterator i = t.begin(); i != t.end(); i++ ) + { + PDefScripts *it = new PDefScripts(); + bool loadfail = !it->LoadFromDef( *i ), insertfail = false; + + if ( !loadfail ) + insertfail = !mDefs.insert( std::make_pair( it->GetIndex(), it ) ).second; + if ( loadfail || insertfail ) + { + if ( insertfail ) + { + ++nDup; + if ( gDevDebug ) Console->Print( "%s ini error (new duplicate id %i discarded)", mName.c_str(), it->GetIndex(), it->GetName().c_str() ); + } + else + { + Console->Print( "%s ini load error @ %i", mName.c_str(), nDefs + nErrors ); + ++nErrors; + } + delete it; + } + else + ++nDefs; + } + } + else + { + Console->Print( "%s Error loading %s ini defs", Console->ColorText( RED, BLACK, "[ERROR]" ), mName.c_str() ); + return ( false ); + } + + if ( nErrors > 0 ) + Console->Print( "%s Loaded %i %s ini defs, %i error(s).", Console->ColorText( RED, BLACK, "[ERROR]" ), nDefs, mName.c_str(), nErrors ); + else + Console->Print( "%s Loaded %i %s ini defs, %i error(s).", Console->ColorText( GREEN, BLACK, "[Success]" ), nDefs, mName.c_str(), nErrors ); + + if ( nDup ) + Console->Print( "%s %d duplicate entries ignored in %s ini defs.", Console->ColorText( YELLOW, BLACK, "[Notice]" ), nDup, mName.c_str() ); + + return ( true ); +} +*/ diff --git a/server/src/game/def/def_shots.cpp b/server/src/game/def/def_shots.cpp index 29d5607..4b9ee0e 100644 --- a/server/src/game/def/def_shots.cpp +++ b/server/src/game/def/def_shots.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_shots.cpp + def_shots.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_shots.h" + +#include "include/def_shots.h" + PDefShot::PDefShot() { } diff --git a/server/src/game/def/def_trader.cpp b/server/src/game/def/def_trader.cpp index e642431..7928c99 100644 --- a/server/src/game/def/def_trader.cpp +++ b/server/src/game/def/def_trader.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_trader.cpp + def_trader.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_trader.h" + +#include "include/def_trader.h" + PDefTrader::PDefTrader() { @@ -65,7 +73,7 @@ bool PDefTrader::LoadFromDef( PTokenList *Tokens ) { if(Idx & 1) { - if(i->find_first_of('/') == string::npos) // Take care of the "1/5" format + if(i->find_first_of('/') == std::string::npos) // Take care of the "1/5" format { mItemPriceScale[int((Idx - 6) / 2)] = atof( i->c_str() ); } diff --git a/server/src/game/def/def_vehicles.cpp b/server/src/game/def/def_vehicles.cpp index 6bab124..ac21e2a 100644 --- a/server/src/game/def/def_vehicles.cpp +++ b/server/src/game/def/def_vehicles.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_vehicles.cpp + def_vehicles.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_vehicles.h" + +#include "include/def_vehicles.h" + PDefVhc::PDefVhc() { diff --git a/server/src/game/def/def_vehiclesits.cpp b/server/src/game/def/def_vehiclesits.cpp index 85b5ea4..a7484cc 100644 --- a/server/src/game/def/def_vehiclesits.cpp +++ b/server/src/game/def/def_vehiclesits.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_vehiclesits.cpp + def_vehiclesits.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_vehiclesits.h" + +#include "include/def_vehiclesits.h" + PDefVhcSeat::PDefVhcSeat() { diff --git a/server/src/game/def/def_weapons.cpp b/server/src/game/def/def_weapons.cpp index 193e125..afb3f2e 100644 --- a/server/src/game/def/def_weapons.cpp +++ b/server/src/game/def/def_weapons.cpp @@ -1,33 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + /* - def_weapons.cpp + def_weapons.cpp - CREATED: 29 Mar 2009 Hammag + CREATED: 29 Mar 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_weapons.h" + +#include "include/def_weapons.h" + PDefWeapon::PDefWeapon() { diff --git a/server/src/game/def/def_weather.cpp b/server/src/game/def/def_weather.cpp index 726fb3c..eff7858 100644 --- a/server/src/game/def/def_weather.cpp +++ b/server/src/game/def/def_weather.cpp @@ -1,32 +1,40 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + /* - def_weather.cpp + def_weather.cpp - CREATED: 04 Apr 2009 Hammag + CREATED: 04 Apr 2009 Hammag + + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "def_weather.h" + +#include "include/def_weather.h" + PDefWeather::PDefWeather() { diff --git a/server/src/game/def/def_worldfile.cpp b/server/src/game/def/def_worldfile.cpp old mode 100755 new mode 100644 diff --git a/server/src/game/def/gamedefs.cpp b/server/src/game/def/gamedefs.cpp old mode 100755 new mode 100644 index a862945..bd2292c --- a/server/src/game/def/gamedefs.cpp +++ b/server/src/game/def/gamedefs.cpp @@ -107,7 +107,6 @@ bool PGameDefs::Init() Res |= mWorldsDefs.Load ("Worldinfo", "defs/worldinfo.def"); Res |= mWorldFilesDefs.Load ("World files", "worlds/worlds.ini"); Res |= mWorldModelsDefs.Load ("World models", "defs/worldmodel.def"); - Res |= mScriptDefs.Load ("Script defs", "defs/scripts.def"); return ( Res ); diff --git a/server/src/game/def/main.h b/server/src/game/def/main.h old mode 100755 new mode 100644 index 8dfafb3..d70e4f9 --- a/server/src/game/def/main.h +++ b/server/src/game/def/main.h @@ -28,13 +28,14 @@ REASON: - created MODIFIED: 21 Sep 2006 Hammag REASON: - added def_worldmodels related stuff - MODIFIED: 22 Sep 2006 Hammag + MODIFIED: 22 Sep 2006 Hammag REASON: - added def_appartements related stuff - - added def_appplaces related stuff - - added def_respawn related stuff + - added def_appplaces related stuff + - added def_respawn related stuff MODIFIED: 28 Sep 2006 Hammag REASON: - added def_worldfile (worlds.ini) related stuff - + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #ifndef MAIN_H @@ -43,20 +44,20 @@ //#include "version.h" //basic includes -#include "external.h" +#include "include/external.h" //tinns includes -#include "types.h" -#include "config.h" +#include "include/types.h" +#include "common/config.h" -#include "console.h" -#include "misc.h" +#include "common/console.h" +#include "common/misc.h" -#include "globals.h" +#include "include/globals.h" -#include "filesystem.h" -#include "defparser.h" -#include "defs.h" +#include "common/filesystem.h" +#include "include/defparser.h" +#include "include/defs.h" // The following defines are NOT used anymore @@ -91,7 +92,5 @@ #define DEF_VEHICLESEATS "defs/vehiclesits.def" #define WRLD_WORLDFILE "worlds/worlds.ini" -using namespace std; - #endif diff --git a/server/src/game/def/world_datparser.cpp b/server/src/game/def/world_datparser.cpp old mode 100755 new mode 100644 index 07843de..38904c6 --- a/server/src/game/def/world_datparser.cpp +++ b/server/src/game/def/world_datparser.cpp @@ -1,528 +1,528 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - world_datparser.h - Class to parse .dat world files - - MODIFIED: 29 Sep 2006 Hammag - REASON: - Creation - -MODIFIED: 21 Jun 2009 Namikon -REASON: - Added NPC Template stuff - - reformatted for better reading - -*/ - -#include "main.h" - -#include "world_datparser.h" -#include "world_datstruct.h" - -#include "worlddatatemplate.h" -#include "furnituretemplate.h" -#include "doortemplate.h" -#include "npctemplate.h" - -#include - -const u16 nonDiscardUseFlags = ufTouchable | ufUsable | ufChair | ufToolTarget ; // furniture always to keep even if function type = 0 - -PWorldDatParser::PWorldDatParser() -{ - f = NULL; -} - -PWorldDatParser::~PWorldDatParser() -{ - -} - -int PWorldDatParser::LoadDatFile( const std::string& nFilename, PWorldDataTemplate* nWorld, const bool nDiscardPassiveObjects, const bool nTestAccesOnly ) -{ - PWorldFileHeader FileHeader; - PSectionHeader SectionHeader; - PSec2ElemHeader Sec2ElemHeader; - - u32 FileLen; - u32 NextSectionOffset = 0; - u32 NextElementOffset; - bool ProcessOK; - - mWorld = nWorld; - mDiscardPassiveObjects = nDiscardPassiveObjects; - - if ( mNCDataPath == "" ) - { - mNCDataPath = Config->GetOption( "nc_data_path" ); - } - - if ( gDevDebug ) - Console->Print( "Reading file %s/%s", mNCDataPath.c_str(), nFilename.c_str() ); - f = Filesystem->Open( "", nFilename.c_str(), mNCDataPath ); - - if ( nTestAccesOnly ) - { - ProcessOK = ( bool )f; - Filesystem->Close( f ); - return ( ProcessOK ? 0 : -1 ); - } - - if ( f ) - { - FileLen = f->GetSize(); - - // Section 1 - if (gDevDebug) - Console->Print( "Reading file header (section 1) ... " ); - f->Read( &FileHeader, sizeof( PWorldFileHeader ) ); - if (( FileHeader.mHeaderSize != 0x00000008 ) - || ( FileHeader.mHeaderSig != 0x000fcfcf ) - || ( FileHeader.mSection != 0x00000001 ) ) - { - if (gDevDebug) - Console->Print( "Read header: %08x / %08x / %08x", FileHeader.mHeaderSize, FileHeader.mHeaderSig, FileHeader.mSection); - Filesystem->Close( f ); - return -2; - } - NextSectionOffset += FileHeader.mHeaderSize + 4; - - // Other Sections - // Header - while ( ! f->Eof() ) - { - f->Seek( NextSectionOffset ); // Make sure we are at the computed offset - if (gDevDebug) - Console->Print( "Reading next section header ... " ); - if (( u32 )( f->Read( &SectionHeader, sizeof( PSectionHeader ) ) ) < sizeof( PSectionHeader ) ) - { - Filesystem->Close( f ); - return -3; - } - - if (( SectionHeader.mHeaderSize != 0x0000000c ) || ( SectionHeader.mHeaderSig != 0x0000ffcf ) ) - { - Filesystem->Close( f ); - return -2; - } - - if ( SectionHeader.mSection == 0 ) - { - if (gDevDebug) - Console->Print( "Ending section reached" ); - break; - } - - NextElementOffset = NextSectionOffset + SectionHeader.mHeaderSize + 4; - NextSectionOffset = NextElementOffset + SectionHeader.mDataSize; - if (gDevDebug) - Console->Print( "Processing section %d (size %d)", SectionHeader.mSection, SectionHeader.mDataSize ); - - if ( SectionHeader.mSection == 2 ) - { - //int cnt=0; - if ( gDevDebug ) - Console->Print( "Element Type 3 size: %d or %d", sizeof( PSec2ElemType3a ), sizeof( PSec2ElemType3a ) + sizeof( PSec2ElemType3b ) ); - while ( NextElementOffset < NextSectionOffset ) - { - f->Seek( NextElementOffset ); // Make sure we are at the computed offset - - //if ( gDevDebug ) - // Console->Print( "Reading next element header ... " ); - if (( u32 )( f->Read( &Sec2ElemHeader, sizeof( PSec2ElemHeader ) ) ) < sizeof( PSec2ElemHeader ) ) - { - Filesystem->Close( f ); - return -3; - } - if (( Sec2ElemHeader.mHeaderSize != 0x0000000c ) || ( Sec2ElemHeader.mHeaderSig != 0x0ffefef1 ) ) - { - Filesystem->Close( f ); - return -2; - } - NextElementOffset += ( Sec2ElemHeader.mHeaderSize + 4 + Sec2ElemHeader.mDataSize ); - //if (gDevDebug) Console->Print("Found element %d of type %d, size %d", ++cnt, Sec2ElemHeader.mElementType, Sec2ElemHeader.mDataSize); - switch ( Sec2ElemHeader.mElementType ) - { - case 1000003: - { - ProcessOK = ProcessSec2ElemType3( Sec2ElemHeader.mDataSize ); - break; - } - case 1000005: - { - ProcessOK = ProcessSec2ElemType5( Sec2ElemHeader.mDataSize ); - break; - } - case 1000006: - { - ProcessOK = ProcessSec2NPCEntry( Sec2ElemHeader.mDataSize ); - break; - } - default: - { - if (gDevDebug) Console->Print( "Ignoring SectionID %d, not supportet yet", Sec2ElemHeader.mElementType ); - ProcessOK = true; - break; - } - } - - if ( !ProcessOK ) - return -4; - } - } - else - { - if ( gDevDebug ) - Console->Print( "Section %d ignored", SectionHeader.mSection ); - continue; - } - - } - - Filesystem->Close( f ); - } - else - { - return -1; - } - - return 0; -} - -bool PWorldDatParser::ProcessSec2ElemType3( u32 nSize ) // furniture -{ - PSec2ElemType3a DataA; - PSec2ElemType3b DataB; - const PDefWorldModel* nWorldModel; - std::string nName; - const u32 sza = sizeof( PSec2ElemType3a ); - const u32 szb = sizeof( PSec2ElemType3a ) + sizeof( PSec2ElemType3b ); - - if (( nSize != szb ) && ( nSize != sza ) ) - { - Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType3 (%d read vs %d or %d needed", nSize, sza, szb ); - return false; - } - if (( u32 )( f->Read( &DataA, sza ) ) < sza ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType3a" ); - return false; - } - if ( nSize == szb ) - { - if (( u32 )( f->Read( &DataB, sizeof( PSec2ElemType3b ) ) ) < sizeof( PSec2ElemType3b ) ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType3b" ); - return false; - } - } - else - { - DataB.mBoxLowerY = DataB.mBoxLowerZ = DataB.mBoxLowerX = 0; - DataB.mBoxUpperY = DataB.mBoxUpperZ = DataB.mBoxUpperX = 0; - } - - if ( DataA.mWorldmodelID ) - { - nWorldModel = GameDefs->WorldModels()->GetDef( DataA.mWorldmodelID ); - if ( nWorldModel ) - nName = nWorldModel->GetName(); - else - nName = "UNKNOWN"; - } - else - { - nName = "PASSIVE"; - nWorldModel = NULL; - } - - /* if (gDevDebug) { - Console->Print("-------------------------------------------------------"); - Console->Print("%s (%d) : ID %d", nName.c_str(), DataA.mWorldmodelID, DataA.mObjectID); - if (!nWorldModel) Console->Print("y:%f z:%f x:%f model %d", DataA.mPosY , DataA.mPosZ, DataA.mPosX, DataA.mModelID); - Console->Print("Scale:%f Uk2:0x%08x Uk3:0x%08x", DataA.mScale, DataA.mUnknown2, DataA.mUnknown3); - Console->Print("Uk4:0x%08x Uk5:0x%04x", DataA.mUnknown4, DataA.mUnknown5); - //Console->Print("Ly:%f Lz:%f Lx:%f", DataB.mBoxLowerY, DataB.mBoxLowerZ, DataB.mBoxLowerX); - //Console->Print("Uy:%f Uz:%f Ux:%f", DataB.mBoxUpperY, DataB.mBoxUpperZ, DataB.mBoxUpperX); - }*/ - - if (( !nWorldModel || ( !nWorldModel->GetFunctionType() && !( nWorldModel->GetUseFlags() & nonDiscardUseFlags ) ) ) && mDiscardPassiveObjects ) - { - //if ( gDevDebug ) - // Console->Print( "Discarded" ); - return true; - } - - PFurnitureItemTemplate* nItem = new PFurnitureItemTemplate; - nItem->mObjectID = DataA.mObjectID; - - // The commented out values are not loaded from dat file atm because they are not used yet. - nItem->mPosY = DataA.mPosY; // float pos values are kept 0-centered - nItem->mPosZ = DataA.mPosZ; - nItem->mPosX = DataA.mPosX; -// nItem->mRotY = DataA.mRotY; - nItem->mRotZ = DataA.mRotZ; -// nItem->mRotX = DataA.mRotX; -// nItem->mScale = DataA.mScale; -// nItem->mUnknown2 = DataA.mUnknown2; - nItem->mModelID = DataA.mModelID; -// nItem->mUnknown3 = DataA.mUnknown3; -// nItem->mUnknown4 = DataA.mUnknown4; - nItem->mWorldmodelID = DataA.mWorldmodelID; -// nItem->mUnknown5 = DataA.mUnknown5; - -// nItem->mBoxLowerY = DataB.mBoxLowerY; -// nItem->mBoxLowerZ = DataB.mBoxLowerZ; -// nItem->mBoxLowerX = DataB.mBoxLowerX; -// nItem->mBoxUpperY = DataB.mBoxUpperY; -// nItem->mBoxUpperZ = DataB.mBoxUpperZ; -// nItem->mBoxUpperX = DataB.mBoxUpperX; - - nItem->mDefWorldModel = nWorldModel; - /*u16 func=nWorldModel->GetFunctionType(); - if((func==18) || (func==20) || (func==29)) - Console->Print("gate model: %d", DataA.mWorldmodelID);*/ - - float Angle = ( 180 + DataA.mRotZ ) * 3.14159 / 180; - float Radius = abs(( int )(( DataB.mBoxUpperX - DataB.mBoxLowerX ) / 2 ) ); - if ( Radius == 0 ) - { - Radius = 10; - } - Radius *= DataA.mScale; - Radius += 5; - - // int pos values are change to match char pos scale (32000 centered) - nItem->mFrontPosY = ( u16 )( 32000 + DataA.mPosY + Radius * sinf( Angle ) ); - nItem->mFrontPosZ = ( u16 )( 32000 + DataA.mPosZ ); - nItem->mFrontPosX = ( u16 )( 32000 + DataA.mPosX + Radius * cosf( Angle ) ); - nItem->mFrontLR = ( u8 )( 0.5 * ( DataA.mRotZ + ( DataA.mRotZ < 0 ? 360 : 0 ) ) ); - - mWorld->AddFurnitureItem( nItem ); - - return true; -} - -bool PWorldDatParser::ProcessSec2ElemType5( u32 nSize ) // doors -{ - PSec2ElemType5Start Data; - char StringData[64]; - - const PDefWorldModel* nWorldModel; - std::string nName; - char* ActorString; - char* ParamString; - - const u32 sza = sizeof( PSec2ElemType5Start ); - - if (( nSize < sza ) ) - { - Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType5 (%d read vs %d needed", nSize, sza ); - return false; - } - if (( u32 )( f->Read( &Data, sza ) ) < sza ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType5start" ); - return false; - } - u32 szb = Data.mActorStringSize + Data.mParamStringSize; - - if ( nSize != ( sza + szb ) ) - { - Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType5 (%d read vs %d needed", nSize, sza + szb ); - return false; - } - else - { - if ( szb > 64 ) - { - Console->Print( RED, BLACK, "[Warning] String data too long in Sec2ElemType5 End String. End will be ignored" ); - szb = 64; - } - if (( u32 )( f->Read( StringData, szb ) ) < szb ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType5 End Strings" ); - return false; - } - } - - if ( Data.mWorldmodelID ) - { - nWorldModel = GameDefs->WorldModels()->GetDef( Data.mWorldmodelID ); - if ( nWorldModel ) - nName = nWorldModel->GetName(); - else - nName = "UNKNOWN"; - } - else - { - nName = "PASSIVE"; - nWorldModel = NULL; - } - - StringData[Data.mActorStringSize - 1] = 0; - ActorString = StringData; - StringData[szb - 1] = 0; - ParamString = StringData + Data.mActorStringSize; - /* - if ( gDevDebug ) - { - Console->Print( "-------------------------------------------------------" ); - Console->Print( "Door %s (%d) : ID %d", nName.c_str(), Data.mWorldmodelID, Data.mDoorID ); - Console->Print( "y:%f z:%f x:%f", Data.mPosY , Data.mPosZ, Data.mPosX ); - Console->Print( "Uk1:0x%04x Uk1bis:0x%04x Uk5:0x%04x", Data.mUnknown1, Data.mUnknown1bis, Data.mUnknown5 ); - Console->Print( "Type=%s Param=%s", ActorString, ParamString ); - } - */ -// Let's keep knowledge of doors even without models ! - /* if ((!nWorldModel || (!nWorldModel->GetFunctionType() && !(nWorldModel->GetUseFlags() & nonDiscardUseFlags))) && mDiscardPassiveObjects) - { - if (gDevDebug) Console->Print("Discarded"); - if (gDevDebug) - { - Console->Print("Door %s (%d) : ID %d", nName.c_str(), Data.mWorldmodelID, Data.mDoorID); - Console->Print("Type=%s Param=%s", ActorString, ParamString); - } - return true; - }*/ - - PDoorTemplate* nDoor = new PDoorTemplate; - nDoor->mDoorID = Data.mDoorID; - - //nDoor->mUnknown1 = Data.mUnknown1; //18 00 - //nDoor->mUnknown1bis = Data.mUnknown1bis; //00 00 ? varies - nDoor->mPosY = Data.mPosY; - nDoor->mPosZ = Data.mPosZ; - nDoor->mPosX = Data.mPosX; - //nDoor->mUnknown5 = Data.mUnknown5; //00 00 ? second byte varies - nDoor->mWorldmodelID = Data.mWorldmodelID; //door type from worldmodel.def - nDoor->mDefWorldModel = nWorldModel; - - nDoor->SetDoorTypeName( ActorString ); - nDoor->SetDoorParameters( ParamString ); - - mWorld->AddDoor( nDoor ); - - return true; -} - -bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize ) -{ - PSec2NPC_EntryPart1 tNPCPartA; - PSec2NPC_EntryPart2 tNPCPartB; - string tActorName; - string tAngle; - char tStrBuffer[64]; - - u32 tSizeOfA = sizeof(tNPCPartA); - u32 tSizeOfB = sizeof(tNPCPartB); - - // Are we able to read enough bytes from the file? means: CAN we safely read our entire struct from the file? - if ( nSize < tSizeOfA ) - { - Console->Print( RED, BLACK, "[ERROR] Wrong size for PSec2NPC_EntryPart1 (%d read vs %d needed", nSize, tSizeOfA ); - return false; - } - // yes we can! So read it now. If we reach EOF, break - if (( u32 )( f->Read( &tNPCPartA, tSizeOfA ) ) < tSizeOfA ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry" ); - return false; - } - // Now we have the header. lets check if we have some waypoints for this NPC - // Size of entire NPC entry in file - u32 tCompleteNPCSize = tSizeOfA + tNPCPartA.mActorStringSize + tNPCPartA.mAngleStringSize; - if ( tNPCPartA.mHasAdditionalCoords > 0 ) - { - // It has additional coords, add 'em - tCompleteNPCSize += tSizeOfB*tNPCPartA.mHasAdditionalCoords; - } - - // Do a last check if we're on the correct size - if ( nSize != tCompleteNPCSize ) - { - Console->Print( RED, BLACK, "[ERROR] Wrong size for PSec2NPC_Entry (%d available vs %d expected", nSize, tCompleteNPCSize ); - Console->Print( RED, BLACK, "NPC ID was: %d", tNPCPartA.mNpcID); - return false; - } - // We are. Continue reading! - // Assign the 2 strings and watch out for EOF! - memset(tStrBuffer, 0, 64); - if (( u32 )( f->Read( tStrBuffer, tNPCPartA.mActorStringSize ) ) < tNPCPartA.mActorStringSize ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry mActorStringSize" ); - return false; - } - tActorName = tStrBuffer; - - memset(tStrBuffer, 0, 64); - if (( u32 )( f->Read( tStrBuffer, tNPCPartA.mAngleStringSize ) ) < tNPCPartA.mAngleStringSize ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry mAngleStringSize" ); - return false; - } - tAngle = tStrBuffer; - - // We're done. Now create new NPC entry - PNPCTemplate* tNPC = new PNPCTemplate; - - // and assing all that stuff - tNPC->SetUnknown1(tNPCPartA.mUnknown1); - tNPC->SetPosX(tNPCPartA.mPosX); - tNPC->SetPosY(tNPCPartA.mPosY); - tNPC->SetPosZ(tNPCPartA.mPosZ); - tNPC->SetNPCTypeID(tNPCPartA.mNPCTypeID); - tNPC->SetActorStrSize(tNPCPartA.mActorStringSize); - tNPC->SetAngleStrSize(tNPCPartA.mAngleStringSize); - tNPC->SetNpcID(tNPCPartA.mNpcID); - tNPC->SetUnknown2a(tNPCPartA.mUnknown2a); - tNPC->SetUnknown2b(tNPCPartA.mUnknown2b); - tNPC->SetUnknown2c(tNPCPartA.mUnknown2c); - tNPC->SetTradeID/*SetUnknown3*/(tNPCPartA.mTradeID/*mUnknown3*/); - tNPC->SetUnknown4(tNPCPartA.mUnknown4); - - tNPC->SetActorName(tActorName); - tNPC->SetAngle(tAngle); - - // Read additional Waypoints if available - u8 tCurrWayP = 0; - if ( tNPCPartA.mHasAdditionalCoords > 0 ) - { - while ( tCurrWayP < tNPCPartA.mHasAdditionalCoords ) - { - memset(&tNPCPartB, 0, tSizeOfB); - if (( u32 )( f->Read( &tNPCPartB, tSizeOfB ) ) < tSizeOfB ) - { - Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry while reading WayPoints" ); - return false; - } - tNPC->AddWayPoint(tNPCPartB.mPosX, tNPCPartB.mPosY, tNPCPartB.mPosZ, tCurrWayP); - tCurrWayP++; - } - } - - if (gDevDebug) Console->Print("Added NPC ID %d", tNPCPartA.mNpcID); - - mWorld->AddNPC(tNPC); - return true; -} +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + + +/* + world_datparser.h + Class to parse .dat world files + + MODIFIED: 29 Sep 2006 Hammag + REASON: - Creation + +MODIFIED: 21 Jun 2009 Namikon +REASON: - Added NPC Template stuff + - reformatted for better reading + +*/ + +#include "main.h" + +#include "include/world_datparser.h" +#include "def/world_datstruct.h" + +#include "include/worlddatatemplate.h" +#include "include/furnituretemplate.h" +#include "include/doortemplate.h" +#include "include/npctemplate.h" + +#include + +const u16 nonDiscardUseFlags = ufTouchable | ufUsable | ufChair | ufToolTarget ; // furniture always to keep even if function type = 0 + +PWorldDatParser::PWorldDatParser() +{ + f = NULL; +} + +PWorldDatParser::~PWorldDatParser() +{ + +} + +int PWorldDatParser::LoadDatFile( const std::string& nFilename, PWorldDataTemplate* nWorld, const bool nDiscardPassiveObjects, const bool nTestAccesOnly ) +{ + PWorldFileHeader FileHeader; + PSectionHeader SectionHeader; + PSec2ElemHeader Sec2ElemHeader; + + u32 FileLen; + u32 NextSectionOffset = 0; + u32 NextElementOffset; + bool ProcessOK; + + mWorld = nWorld; + mDiscardPassiveObjects = nDiscardPassiveObjects; + + if ( mNCDataPath == "" ) + { + mNCDataPath = Config->GetOption( "nc_data_path" ); + } + + if ( gDevDebug ) + Console->Print( "Reading file %s/%s", mNCDataPath.c_str(), nFilename.c_str() ); + f = Filesystem->Open( "", nFilename.c_str(), mNCDataPath ); + + if ( nTestAccesOnly ) + { + ProcessOK = ( bool )f; + Filesystem->Close( f ); + return ( ProcessOK ? 0 : -1 ); + } + + if ( f ) + { + FileLen = f->GetSize(); + + // Section 1 + if (gDevDebug) + Console->Print( "Reading file header (section 1) ... " ); + f->Read( &FileHeader, sizeof( PWorldFileHeader ) ); + if (( FileHeader.mHeaderSize != 0x00000008 ) + || ( FileHeader.mHeaderSig != 0x000fcfcf ) + || ( FileHeader.mSection != 0x00000001 ) ) + { + if (gDevDebug) + Console->Print( "Read header: %08x / %08x / %08x", FileHeader.mHeaderSize, FileHeader.mHeaderSig, FileHeader.mSection); + Filesystem->Close( f ); + return -2; + } + NextSectionOffset += FileHeader.mHeaderSize + 4; + + // Other Sections + // Header + while ( ! f->Eof() ) + { + f->Seek( NextSectionOffset ); // Make sure we are at the computed offset + if (gDevDebug) + Console->Print( "Reading next section header ... " ); + if (( u32 )( f->Read( &SectionHeader, sizeof( PSectionHeader ) ) ) < sizeof( PSectionHeader ) ) + { + Filesystem->Close( f ); + return -3; + } + + if (( SectionHeader.mHeaderSize != 0x0000000c ) || ( SectionHeader.mHeaderSig != 0x0000ffcf ) ) + { + Filesystem->Close( f ); + return -2; + } + + if ( SectionHeader.mSection == 0 ) + { + if (gDevDebug) + Console->Print( "Ending section reached" ); + break; + } + + NextElementOffset = NextSectionOffset + SectionHeader.mHeaderSize + 4; + NextSectionOffset = NextElementOffset + SectionHeader.mDataSize; + if (gDevDebug) + Console->Print( "Processing section %d (size %d)", SectionHeader.mSection, SectionHeader.mDataSize ); + + if ( SectionHeader.mSection == 2 ) + { + //int cnt=0; + if ( gDevDebug ) + Console->Print( "Element Type 3 size: %d or %d", sizeof( PSec2ElemType3a ), sizeof( PSec2ElemType3a ) + sizeof( PSec2ElemType3b ) ); + while ( NextElementOffset < NextSectionOffset ) + { + f->Seek( NextElementOffset ); // Make sure we are at the computed offset + + //if ( gDevDebug ) + // Console->Print( "Reading next element header ... " ); + if (( u32 )( f->Read( &Sec2ElemHeader, sizeof( PSec2ElemHeader ) ) ) < sizeof( PSec2ElemHeader ) ) + { + Filesystem->Close( f ); + return -3; + } + if (( Sec2ElemHeader.mHeaderSize != 0x0000000c ) || ( Sec2ElemHeader.mHeaderSig != 0x0ffefef1 ) ) + { + Filesystem->Close( f ); + return -2; + } + NextElementOffset += ( Sec2ElemHeader.mHeaderSize + 4 + Sec2ElemHeader.mDataSize ); + //if (gDevDebug) Console->Print("Found element %d of type %d, size %d", ++cnt, Sec2ElemHeader.mElementType, Sec2ElemHeader.mDataSize); + switch ( Sec2ElemHeader.mElementType ) + { + case 1000003: + { + ProcessOK = ProcessSec2ElemType3( Sec2ElemHeader.mDataSize ); + break; + } + case 1000005: + { + ProcessOK = ProcessSec2ElemType5( Sec2ElemHeader.mDataSize ); + break; + } + case 1000006: + { + ProcessOK = ProcessSec2NPCEntry( Sec2ElemHeader.mDataSize ); + break; + } + default: + { + if (gDevDebug) Console->Print( "Ignoring SectionID %d, not supportet yet", Sec2ElemHeader.mElementType ); + ProcessOK = true; + break; + } + } + + if ( !ProcessOK ) + return -4; + } + } + else + { + if ( gDevDebug ) + Console->Print( "Section %d ignored", SectionHeader.mSection ); + continue; + } + + } + + Filesystem->Close( f ); + } + else + { + return -1; + } + + return 0; +} + +bool PWorldDatParser::ProcessSec2ElemType3( u32 nSize ) // furniture +{ + PSec2ElemType3a DataA; + PSec2ElemType3b DataB; + const PDefWorldModel* nWorldModel; + std::string nName; + const u32 sza = sizeof( PSec2ElemType3a ); + const u32 szb = sizeof( PSec2ElemType3a ) + sizeof( PSec2ElemType3b ); + + if (( nSize != szb ) && ( nSize != sza ) ) + { + Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType3 (%d read vs %d or %d needed", nSize, sza, szb ); + return false; + } + if (( u32 )( f->Read( &DataA, sza ) ) < sza ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType3a" ); + return false; + } + if ( nSize == szb ) + { + if (( u32 )( f->Read( &DataB, sizeof( PSec2ElemType3b ) ) ) < sizeof( PSec2ElemType3b ) ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType3b" ); + return false; + } + } + else + { + DataB.mBoxLowerY = DataB.mBoxLowerZ = DataB.mBoxLowerX = 0; + DataB.mBoxUpperY = DataB.mBoxUpperZ = DataB.mBoxUpperX = 0; + } + + if ( DataA.mWorldmodelID ) + { + nWorldModel = GameDefs->WorldModels()->GetDef( DataA.mWorldmodelID ); + if ( nWorldModel ) + nName = nWorldModel->GetName(); + else + nName = "UNKNOWN"; + } + else + { + nName = "PASSIVE"; + nWorldModel = NULL; + } + + /* if (gDevDebug) { + Console->Print("-------------------------------------------------------"); + Console->Print("%s (%d) : ID %d", nName.c_str(), DataA.mWorldmodelID, DataA.mObjectID); + if (!nWorldModel) Console->Print("y:%f z:%f x:%f model %d", DataA.mPosY , DataA.mPosZ, DataA.mPosX, DataA.mModelID); + Console->Print("Scale:%f Uk2:0x%08x Uk3:0x%08x", DataA.mScale, DataA.mUnknown2, DataA.mUnknown3); + Console->Print("Uk4:0x%08x Uk5:0x%04x", DataA.mUnknown4, DataA.mUnknown5); + //Console->Print("Ly:%f Lz:%f Lx:%f", DataB.mBoxLowerY, DataB.mBoxLowerZ, DataB.mBoxLowerX); + //Console->Print("Uy:%f Uz:%f Ux:%f", DataB.mBoxUpperY, DataB.mBoxUpperZ, DataB.mBoxUpperX); + }*/ + + if (( !nWorldModel || ( !nWorldModel->GetFunctionType() && !( nWorldModel->GetUseFlags() & nonDiscardUseFlags ) ) ) && mDiscardPassiveObjects ) + { + //if ( gDevDebug ) + // Console->Print( "Discarded" ); + return true; + } + + PFurnitureItemTemplate* nItem = new PFurnitureItemTemplate; + nItem->mObjectID = DataA.mObjectID; + + // The commented out values are not loaded from dat file atm because they are not used yet. + nItem->mPosY = DataA.mPosY; // float pos values are kept 0-centered + nItem->mPosZ = DataA.mPosZ; + nItem->mPosX = DataA.mPosX; +// nItem->mRotY = DataA.mRotY; + nItem->mRotZ = DataA.mRotZ; +// nItem->mRotX = DataA.mRotX; +// nItem->mScale = DataA.mScale; +// nItem->mUnknown2 = DataA.mUnknown2; + nItem->mModelID = DataA.mModelID; +// nItem->mUnknown3 = DataA.mUnknown3; +// nItem->mUnknown4 = DataA.mUnknown4; + nItem->mWorldmodelID = DataA.mWorldmodelID; +// nItem->mUnknown5 = DataA.mUnknown5; + +// nItem->mBoxLowerY = DataB.mBoxLowerY; +// nItem->mBoxLowerZ = DataB.mBoxLowerZ; +// nItem->mBoxLowerX = DataB.mBoxLowerX; +// nItem->mBoxUpperY = DataB.mBoxUpperY; +// nItem->mBoxUpperZ = DataB.mBoxUpperZ; +// nItem->mBoxUpperX = DataB.mBoxUpperX; + + nItem->mDefWorldModel = nWorldModel; + /*u16 func=nWorldModel->GetFunctionType(); + if((func==18) || (func==20) || (func==29)) + Console->Print("gate model: %d", DataA.mWorldmodelID);*/ + + float Angle = ( 180 + DataA.mRotZ ) * 3.14159 / 180; + float Radius = abs(( int )(( DataB.mBoxUpperX - DataB.mBoxLowerX ) / 2 ) ); + if ( Radius == 0 ) + { + Radius = 10; + } + Radius *= DataA.mScale; + Radius += 5; + + // int pos values are change to match char pos scale (32000 centered) + nItem->mFrontPosY = ( u16 )( 32000 + DataA.mPosY + Radius * sinf( Angle ) ); + nItem->mFrontPosZ = ( u16 )( 32000 + DataA.mPosZ ); + nItem->mFrontPosX = ( u16 )( 32000 + DataA.mPosX + Radius * cosf( Angle ) ); + nItem->mFrontLR = ( u8 )( 0.5 * ( DataA.mRotZ + ( DataA.mRotZ < 0 ? 360 : 0 ) ) ); + + mWorld->AddFurnitureItem( nItem ); + + return true; +} + +bool PWorldDatParser::ProcessSec2ElemType5( u32 nSize ) // doors +{ + PSec2ElemType5Start Data; + char StringData[64]; + + const PDefWorldModel* nWorldModel; + std::string nName; + char* ActorString; + char* ParamString; + + const u32 sza = sizeof( PSec2ElemType5Start ); + + if (( nSize < sza ) ) + { + Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType5 (%d read vs %d needed", nSize, sza ); + return false; + } + if (( u32 )( f->Read( &Data, sza ) ) < sza ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType5start" ); + return false; + } + u32 szb = Data.mActorStringSize + Data.mParamStringSize; + + if ( nSize != ( sza + szb ) ) + { + Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType5 (%d read vs %d needed", nSize, sza + szb ); + return false; + } + else + { + if ( szb > 64 ) + { + Console->Print( RED, BLACK, "[Warning] String data too long in Sec2ElemType5 End String. End will be ignored" ); + szb = 64; + } + if (( u32 )( f->Read( StringData, szb ) ) < szb ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType5 End Strings" ); + return false; + } + } + + if ( Data.mWorldmodelID ) + { + nWorldModel = GameDefs->WorldModels()->GetDef( Data.mWorldmodelID ); + if ( nWorldModel ) + nName = nWorldModel->GetName(); + else + nName = "UNKNOWN"; + } + else + { + nName = "PASSIVE"; + nWorldModel = NULL; + } + + StringData[Data.mActorStringSize - 1] = 0; + ActorString = StringData; + StringData[szb - 1] = 0; + ParamString = StringData + Data.mActorStringSize; + /* + if ( gDevDebug ) + { + Console->Print( "-------------------------------------------------------" ); + Console->Print( "Door %s (%d) : ID %d", nName.c_str(), Data.mWorldmodelID, Data.mDoorID ); + Console->Print( "y:%f z:%f x:%f", Data.mPosY , Data.mPosZ, Data.mPosX ); + Console->Print( "Uk1:0x%04x Uk1bis:0x%04x Uk5:0x%04x", Data.mUnknown1, Data.mUnknown1bis, Data.mUnknown5 ); + Console->Print( "Type=%s Param=%s", ActorString, ParamString ); + } + */ +// Let's keep knowledge of doors even without models ! + /* if ((!nWorldModel || (!nWorldModel->GetFunctionType() && !(nWorldModel->GetUseFlags() & nonDiscardUseFlags))) && mDiscardPassiveObjects) + { + if (gDevDebug) Console->Print("Discarded"); + if (gDevDebug) + { + Console->Print("Door %s (%d) : ID %d", nName.c_str(), Data.mWorldmodelID, Data.mDoorID); + Console->Print("Type=%s Param=%s", ActorString, ParamString); + } + return true; + }*/ + + PDoorTemplate* nDoor = new PDoorTemplate; + nDoor->mDoorID = Data.mDoorID; + + //nDoor->mUnknown1 = Data.mUnknown1; //18 00 + //nDoor->mUnknown1bis = Data.mUnknown1bis; //00 00 ? varies + nDoor->mPosY = Data.mPosY; + nDoor->mPosZ = Data.mPosZ; + nDoor->mPosX = Data.mPosX; + //nDoor->mUnknown5 = Data.mUnknown5; //00 00 ? second byte varies + nDoor->mWorldmodelID = Data.mWorldmodelID; //door type from worldmodel.def + nDoor->mDefWorldModel = nWorldModel; + + nDoor->SetDoorTypeName( ActorString ); + nDoor->SetDoorParameters( ParamString ); + + mWorld->AddDoor( nDoor ); + + return true; +} + +bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize ) +{ + PSec2NPC_EntryPart1 tNPCPartA; + PSec2NPC_EntryPart2 tNPCPartB; + std::string tActorName; + std::string tAngle; + char tStrBuffer[64]; + + u32 tSizeOfA = sizeof(tNPCPartA); + u32 tSizeOfB = sizeof(tNPCPartB); + + // Are we able to read enough bytes from the file? means: CAN we safely read our entire struct from the file? + if ( nSize < tSizeOfA ) + { + Console->Print( RED, BLACK, "[ERROR] Wrong size for PSec2NPC_EntryPart1 (%d read vs %d needed", nSize, tSizeOfA ); + return false; + } + // yes we can! So read it now. If we reach EOF, break + if (( u32 )( f->Read( &tNPCPartA, tSizeOfA ) ) < tSizeOfA ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry" ); + return false; + } + // Now we have the header. lets check if we have some waypoints for this NPC + // Size of entire NPC entry in file + u32 tCompleteNPCSize = tSizeOfA + tNPCPartA.mActorStringSize + tNPCPartA.mAngleStringSize; + if ( tNPCPartA.mHasAdditionalCoords > 0 ) + { + // It has additional coords, add 'em + tCompleteNPCSize += tSizeOfB*tNPCPartA.mHasAdditionalCoords; + } + + // Do a last check if we're on the correct size + if ( nSize != tCompleteNPCSize ) + { + Console->Print( RED, BLACK, "[ERROR] Wrong size for PSec2NPC_Entry (%d available vs %d expected", nSize, tCompleteNPCSize ); + Console->Print( RED, BLACK, "NPC ID was: %d", tNPCPartA.mNpcID); + return false; + } + // We are. Continue reading! + // Assign the 2 strings and watch out for EOF! + memset(tStrBuffer, 0, 64); + if (( u32 )( f->Read( tStrBuffer, tNPCPartA.mActorStringSize ) ) < tNPCPartA.mActorStringSize ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry mActorStringSize" ); + return false; + } + tActorName = tStrBuffer; + + memset(tStrBuffer, 0, 64); + if (( u32 )( f->Read( tStrBuffer, tNPCPartA.mAngleStringSize ) ) < tNPCPartA.mAngleStringSize ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry mAngleStringSize" ); + return false; + } + tAngle = tStrBuffer; + + // We're done. Now create new NPC entry + PNPCTemplate* tNPC = new PNPCTemplate; + + // and assing all that stuff + tNPC->SetUnknown1(tNPCPartA.mUnknown1); + tNPC->SetPosX(tNPCPartA.mPosX); + tNPC->SetPosY(tNPCPartA.mPosY); + tNPC->SetPosZ(tNPCPartA.mPosZ); + tNPC->SetNPCTypeID(tNPCPartA.mNPCTypeID); + tNPC->SetActorStrSize(tNPCPartA.mActorStringSize); + tNPC->SetAngleStrSize(tNPCPartA.mAngleStringSize); + tNPC->SetNpcID(tNPCPartA.mNpcID); + tNPC->SetUnknown2a(tNPCPartA.mUnknown2a); + tNPC->SetUnknown2b(tNPCPartA.mUnknown2b); + tNPC->SetUnknown2c(tNPCPartA.mUnknown2c); + tNPC->SetTradeID/*SetUnknown3*/(tNPCPartA.mTradeID/*mUnknown3*/); + tNPC->SetUnknown4(tNPCPartA.mUnknown4); + + tNPC->SetActorName(tActorName); + tNPC->SetAngle(tAngle); + + // Read additional Waypoints if available + u8 tCurrWayP = 0; + if ( tNPCPartA.mHasAdditionalCoords > 0 ) + { + while ( tCurrWayP < tNPCPartA.mHasAdditionalCoords ) + { + memset(&tNPCPartB, 0, tSizeOfB); + if (( u32 )( f->Read( &tNPCPartB, tSizeOfB ) ) < tSizeOfB ) + { + Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry while reading WayPoints" ); + return false; + } + tNPC->AddWayPoint(tNPCPartB.mPosX, tNPCPartB.mPosY, tNPCPartB.mPosZ, tCurrWayP); + tCurrWayP++; + } + } + + if (gDevDebug) Console->Print("Added NPC ID %d", tNPCPartA.mNpcID); + + mWorld->AddNPC(tNPC); + return true; +} diff --git a/server/src/game/def/world_datstruct.h b/server/src/game/def/world_datstruct.h old mode 100755 new mode 100644 index d567674..d686d5d --- a/server/src/game/def/world_datstruct.h +++ b/server/src/game/def/world_datstruct.h @@ -1,169 +1,168 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - -/* - world_datstruct.h - .dat world files internal structures - - MODIFIED: 29 Sep 2006 Hammag - REASON: - Creation -*/ - -#ifndef WORLD_DATSTRUCT_H -#define WORLD_DATSTRUCT_H - -struct PWorldFileHeader -{ - u32 mHeaderSize; // must be 08 00 00 00, = header size after this field - u32 mHeaderSig; // must be CF CF 0F 00 - u32 mSection; // must be 01 00 00 00 -}; - -struct PSectionHeader -{ - u32 mHeaderSize; // must be 0C 00 00 00 - u32 mHeaderSig; // must be CF FF 00 00 - u32 mSection; // 00 00 00 00 means end - u32 mDataSize; -}; - -struct PSec2ElemHeader -{ - u32 mHeaderSize; // must be 0C 00 00 00 - u32 mHeaderSig; // must be F1 FE FE 0F - u32 mElementType; // 1000003, 1000005 or 1000014 - u32 mDataSize; -}; - -struct PSec2ElemType3a //static object ? -{ - f32 mPosY; //= u16 PosY - 32000 - f32 mPosZ; - f32 mPosX; - f32 mRotY; - f32 mRotZ; - f32 mRotX; - f32 mScale; //00 00 80 3F ? = float(1.000000) !!! => scale factor ????? - u32 mUnknown2; //01 00 00 00 ? - u16 mModelID; // points to models.ini - u32 mUnknown3; //00 00 00 00 ? - u32 mUnknown4; //00 00 00 00 ? - u16 mWorldmodelID; // points to worldmodel.def - u16 mUnknown5; //12 00 ? - u32 mObjectID; -}; -struct PSec2ElemType3b //this part is optional -{ - f32 mBoxLowerY; //Bounding box, for useflag "64 - selfconstructing colisionbox" - f32 mBoxLowerZ; // s32 or u32 ? - f32 mBoxLowerX; - f32 mBoxUpperY; - f32 mBoxUpperZ; - f32 mBoxUpperX; -}; - -struct PSec2ElemType5Start //door -{ - u16 mUnknown1; //18 00 - u16 mUnknown1bis; //00 00 ? varies - f32 mPosY; - f32 mPosZ; - f32 mPosX; - u8 mActorStringSize; //string size with ending 0 - u8 mParamStringSize; //string size with ending 0 - u16 mUnknown5; //00 00 ? second byte varies - u16 mDoorID; // but what is the link with ObjectID sent in Use message (can't find the base offset .. or 0x80 for doors ???) - u16 mWorldmodelID; //door type from worldmodel.def -}; -//Actor As String //null terminated string -//Params As String //null terminated string - for DDOOR, 2nd param is the ID of the other (half)door (*) -//param1 = 2 => simple lateral move ?, 3 => door frontal+lateral move (as at Typherra memorial) ? -//last param = 0/1 for lateral move direction ? no ... -//(*) here is the bug(?) that makes open only one half of a double door - -/* -struct PSec2ElemType6Start //npc -{ - u16 mUnknown1; //20 00 ? - u16 mUnknown2; //12 00 ? - f32 mPosY; - f32 mPosZ; - f32 mPosX; - u32 mNPCTypeID; //npc type in npc.def - u8 mActorStringSize; //string size with ending 0 - u8 mParamStringSize; //string size with ending 0 - u16 mNpcID; // kind of ? - u32 mUnknown3; //01 00 00 00 ? - u16 mUnknown4; //00 00 ? - u16 mUnknown5; //04 00 ? -}; - //Actor As String //null terminated string - //Params As String //null terminated string - Seem to be the facing angle in degres -struct PSec2ElemType6End -{ - f32 mPosY2; //second position for movement ? - f32 mPosZ2; // - f32 mPosX2; // -}; -*/ -struct PSec2NPC_EntryPart1 -{ - u32 mUnknown1; // Is always 0x20001200, in every log. maybe header for NPCs? - f32 mPosY; - f32 mPosZ; - f32 mPosX; - u32 mNPCTypeID; //npc type in npc.def - u8 mActorStringSize; //string size with ending 0 - u8 mAngleStringSize; //string size with ending 0 - u16 mNpcID; - u8 mHasAdditionalCoords; - u8 mUnknown2a; - u8 mUnknown2b; - u8 mUnknown2c; - u16 mTradeID; //mUnknown3; //00 00 ? - u16 mUnknown4; //04 00 ? -}; - -// u8 mActorName[mActorStringSize]; -// u8 mAngle[mAngleStringSize]; - -struct PSec2NPC_EntryPart2 // Waypoints! or something like that... -{ - f32 mPosY; - f32 mPosZ; - f32 mPosX; -}; - - -// u16 mStrSize; //non-zero terminated string size -// Name As String //non-zero terminated string -struct PSec2ElemType15End //area definition/sound ? -{ - f32 mUnknown1; - f32 mUnknown2; - f32 mUnknown3; - f32 mUnknown4; - f32 mUnknown5; -}; - -#endif - +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + +/* + world_datstruct.h + .dat world files internal structures + + MODIFIED: 29 Sep 2006 Hammag + REASON: - Creation +*/ + +#ifndef WORLD_DATSTRUCT_H +#define WORLD_DATSTRUCT_H + +struct PWorldFileHeader +{ + u32 mHeaderSize; // must be 08 00 00 00, = header size after this field + u32 mHeaderSig; // must be CF CF 0F 00 + u32 mSection; // must be 01 00 00 00 +}; + +struct PSectionHeader +{ + u32 mHeaderSize; // must be 0C 00 00 00 + u32 mHeaderSig; // must be CF FF 00 00 + u32 mSection; // 00 00 00 00 means end + u32 mDataSize; +}; + +struct PSec2ElemHeader +{ + u32 mHeaderSize; // must be 0C 00 00 00 + u32 mHeaderSig; // must be F1 FE FE 0F + u32 mElementType; // 1000003, 1000005 or 1000014 + u32 mDataSize; +}; + +struct PSec2ElemType3a //static object ? +{ + f32 mPosY; //= u16 PosY - 32000 + f32 mPosZ; + f32 mPosX; + f32 mRotY; + f32 mRotZ; + f32 mRotX; + f32 mScale; //00 00 80 3F ? = float(1.000000) !!! => scale factor ????? + u32 mUnknown2; //01 00 00 00 ? + u16 mModelID; // points to models.ini + u32 mUnknown3; //00 00 00 00 ? + u32 mUnknown4; //00 00 00 00 ? + u16 mWorldmodelID; // points to worldmodel.def + u16 mUnknown5; //12 00 ? + u32 mObjectID; +}; +struct PSec2ElemType3b //this part is optional +{ + f32 mBoxLowerY; //Bounding box, for useflag "64 - selfconstructing colisionbox" + f32 mBoxLowerZ; // s32 or u32 ? + f32 mBoxLowerX; + f32 mBoxUpperY; + f32 mBoxUpperZ; + f32 mBoxUpperX; +}; + +struct PSec2ElemType5Start //door +{ + u16 mUnknown1; //18 00 + u16 mUnknown1bis; //00 00 ? varies + f32 mPosY; + f32 mPosZ; + f32 mPosX; + u8 mActorStringSize; //string size with ending 0 + u8 mParamStringSize; //string size with ending 0 + u16 mUnknown5; //00 00 ? second byte varies + u16 mDoorID; // but what is the link with ObjectID sent in Use message (can't find the base offset .. or 0x80 for doors ???) + u16 mWorldmodelID; //door type from worldmodel.def +}; +//Actor As String //null terminated string +//Params As String //null terminated string - for DDOOR, 2nd param is the ID of the other (half)door (*) +//param1 = 2 => simple lateral move ?, 3 => door frontal+lateral move (as at Typherra memorial) ? +//last param = 0/1 for lateral move direction ? no ... +//(*) here is the bug(?) that makes open only one half of a double door + +/* +struct PSec2ElemType6Start //npc +{ + u16 mUnknown1; //20 00 ? + u16 mUnknown2; //12 00 ? + f32 mPosY; + f32 mPosZ; + f32 mPosX; + u32 mNPCTypeID; //npc type in npc.def + u8 mActorStringSize; //string size with ending 0 + u8 mParamStringSize; //string size with ending 0 + u16 mNpcID; // kind of ? + u32 mUnknown3; //01 00 00 00 ? + u16 mUnknown4; //00 00 ? + u16 mUnknown5; //04 00 ? +}; + //Actor As String //null terminated string + //Params As String //null terminated string - Seem to be the facing angle in degres +struct PSec2ElemType6End +{ + f32 mPosY2; //second position for movement ? + f32 mPosZ2; // + f32 mPosX2; // +}; +*/ +struct PSec2NPC_EntryPart1 +{ + u32 mUnknown1; // Is always 0x20001200, in every log. maybe header for NPCs? + f32 mPosY; + f32 mPosZ; + f32 mPosX; + u32 mNPCTypeID; //npc type in npc.def + u8 mActorStringSize; //string size with ending 0 + u8 mAngleStringSize; //string size with ending 0 + u16 mNpcID; + u8 mHasAdditionalCoords; + u8 mUnknown2a; + u8 mUnknown2b; + u8 mUnknown2c; + u16 mTradeID; //mUnknown3; //00 00 ? + u16 mUnknown4; //04 00 ? +}; + +// u8 mActorName[mActorStringSize]; +// u8 mAngle[mAngleStringSize]; + +struct PSec2NPC_EntryPart2 // Waypoints! or something like that... +{ + f32 mPosY; + f32 mPosZ; + f32 mPosX; +}; + + +// u16 mStrSize; //non-zero terminated string size +// Name As String //non-zero terminated string +struct PSec2ElemType15End //area definition/sound ? +{ + f32 mUnknown1; + f32 mUnknown2; + f32 mUnknown3; + f32 mUnknown4; + f32 mUnknown5; +}; + +#endif diff --git a/server/src/game/doortemplate.cpp b/server/src/game/doortemplate.cpp old mode 100755 new mode 100644 index 85388de..d3e5321 --- a/server/src/game/doortemplate.cpp +++ b/server/src/game/doortemplate.cpp @@ -24,6 +24,8 @@ MODIFIED: 05 Nov 2006 Hammag REASON: - creation + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem TODO: - mem corruption occurs if mDoorParameters[] is given a size of 6, and that 6 max param can be accepted This bug occurs in world 105. Reason not found yet :-x @@ -31,7 +33,8 @@ #include "main.h" -#include "doortemplate.h" + +#include "include/doortemplate.h" PDoorTemplate::PDoorTemplate() { diff --git a/server/src/game/furnituretemplate.cpp b/server/src/game/furnituretemplate.cpp old mode 100755 new mode 100644 index 9ec8a6f..4525aaa --- a/server/src/game/furnituretemplate.cpp +++ b/server/src/game/furnituretemplate.cpp @@ -20,16 +20,18 @@ /* - furnituretemplate.cpp - world furniture template class + furnituretemplate.cpp - world furniture template class MODIFIED: 04 Oct 2006 Hammag REASON: - creation - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #include "main.h" -#include "furnituretemplate.h" + +#include "include/furnituretemplate.h" PFurnitureItemTemplate::PFurnitureItemTemplate() { diff --git a/server/src/game/gamecommands/Makefile b/server/src/game/gamecommands/Makefile deleted file mode 100644 index 78618d5..0000000 --- a/server/src/game/gamecommands/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -#B_TARGET := gameserver - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -#L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -EXTRA_CXXFLAGS := -I/usr/include/mysql -I$(TOPDIR)/game/include - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/game/gamecommands/givemoney.cpp b/server/src/game/gamecommands/givemoney.cpp index 94f2679..d47af26 100644 --- a/server/src/game/gamecommands/givemoney.cpp +++ b/server/src/game/gamecommands/givemoney.cpp @@ -24,12 +24,12 @@ void PCommands::doCmdgivemoney() { u32 cashtoadd = 0; bool SyntaxError = false; - if (ArgC < 1) + if(ArgC < 1) { SyntaxError = true; } - if (IsArgNumeric(1) == false) + if(IsArgNumeric(1) == false) { SyntaxError = true; } @@ -37,20 +37,18 @@ void PCommands::doCmdgivemoney() { cashtoadd = (u32)GetArgInt(1); } - if (cashtoadd == 0) - { + if(cashtoadd == 0) SyntaxError = true; - } - if (SyntaxError == true) + if(SyntaxError == true) { Chat->send(source, CHAT_DIRECT, "Usage", "@givemoney []"); return; } - if (ArgC == 2) + if(ArgC == 2) { - if (IsArgNumeric(2) == true) + if(IsArgNumeric(2) == true) { target = GetClientByID(GetArgInt(2)); } @@ -60,12 +58,12 @@ void PCommands::doCmdgivemoney() GetArgText(2, tmp_destNick, 50); target = GetClientByNick(tmp_destNick); } - if (target == NULL) + if(target == NULL) { Chat->send(source, CHAT_DIRECT, "System", "No such player"); return; } - if (source->GetAccountLevel() <= target->GetAccountLevel()) + if(source->GetAccountLevel() <= target->GetAccountLevel()) { char tmpMsg[200]; snprintf(tmpMsg, 199, "Cant manipulate %s's credits, target level is higher or equal to yours!", Chars->GetChar(target->GetCharID())->GetName().c_str()); diff --git a/server/src/game/gamecommands/main.h b/server/src/game/gamecommands/main.h index dfdd5cd..349dce9 100644 --- a/server/src/game/gamecommands/main.h +++ b/server/src/game/gamecommands/main.h @@ -26,7 +26,8 @@ MODIFIED: 30 Aug 2006 Hammag REASON: - created - + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #ifndef MAIN_H @@ -35,18 +36,18 @@ //#include "version.h" //basic includes -#include "external.h" +#include "include/external.h" //tinns includes -#include "types.h" -#include "config.h" +#include "include/types.h" +#include "common/config.h" -#include "console.h" -#include "misc.h" +#include "common/console.h" +#include "common/misc.h" -#include "netcode.h" +#include "common/netcode.h" -#include "globals.h" +#include "include/globals.h" /* #include "../gamemonkey/gmMachine.h" @@ -54,34 +55,36 @@ */ // MySQL Support // shouldn't be needed as DB-objects access class should do that -#include "mysql.h" -#include "sql.h" - -#include "filesystem.h" -#include "defparser.h" - -#include "skill.h" - -#include "chars.h" -#include "accounts.h" -#include "defs.h" -#include "client.h" -#include "server.h" -#include "misc.h" -#include "gameserver.h" -#include "zoning.h" -#include "item.h" -#include "inventory.h" - -#include "chat.h" -#include "commands.h" -#include "clientmanager.h" -#include "msgbuilder.h" -#include "worlds.h" -#include "worldactors.h" -#include "npc.h" - -using namespace std; +#ifdef MYSQL_INC_DIR +#include +#else +#include +#endif + +#include "include/sql.h" + +#include "common/filesystem.h" +#include "include/defparser.h" + +#include "include/skill.h" + +#include "include/chars.h" +#include "include/accounts.h" +#include "include/defs.h" +#include "include/client.h" +#include "include/server.h" +#include "include/gameserver.h" +#include "include/zoning.h" +#include "include/item.h" +#include "include/inventory.h" + +#include "include/chat.h" +#include "include/commands.h" +#include "include/clientmanager.h" +#include "include/msgbuilder.h" +#include "include/worlds.h" +#include "include/worldactors.h" +#include "include/npc.h" #endif diff --git a/server/src/game/gamecommands/npc.cpp b/server/src/game/gamecommands/npc.cpp index 0efa269..847c4ca 100644 --- a/server/src/game/gamecommands/npc.cpp +++ b/server/src/game/gamecommands/npc.cpp @@ -1,284 +1,284 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ -#include "main.h" - -void PCommands::doNPC() -{ - bool SyntaxError = false; - if(ArgC < 2) - { - SyntaxError = true; - } - - if(SyntaxError == true) - { - Chat->send(source, CHAT_DIRECT, "Usage", "@npc []"); - Chat->send(source, CHAT_DIRECT, "Usage", " can be:"); - Chat->send(source, CHAT_DIRECT, "lua 1/0", "Enables/Disables scripts"); - Chat->send(source, CHAT_DIRECT, "reloadlua ", "Reloads LUA script"); - Chat->send(source, CHAT_DIRECT, "spawn []", "Spawns an NPC"); - Chat->send(source, CHAT_DIRECT, "remove ", "Removes an NPC"); - Chat->send(source, CHAT_DIRECT, "help ", "Displays detailed help for any command"); - - /* more to add here... spawn, remove, ... */ - return; - } - // Get subcommand - char tmp_npccommand[50]; - GetArgText(1, tmp_npccommand, 50); - - // Dont search for NPC ID when commands HELP and SPAWN are used - PNPC* targetNPC = NULL; - PNPCWorld* currentNPCWorld = NULL; - if(strncmp(tmp_npccommand, "spawn", 5) != 0 && strncmp(tmp_npccommand, "help", 4) != 0) - { - currentNPCWorld = NPCManager->GetWorld( source->GetChar()->GetLocation() ); - if ( currentNPCWorld ) - { - targetNPC = currentNPCWorld->GetNPC( GetArgInt(2) ); - if(!targetNPC) - { - // Search for DEF version of NPC (remember, def IDs are on 255 offset! - // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! - targetNPC = currentNPCWorld->GetNPC( GetArgInt(1) - 255 ); - } - } - if (!targetNPC) - { - Chat->send(source, CHAT_DIRECT, "System", "Invalid NPC ID"); - return; - } - } - - if(strncmp(tmp_npccommand, "help", 4) == 0) - { - char tmp_help[50]; - GetArgText(2, tmp_help, 50); - - if(strncmp(tmp_help, "reloadlua", 9) == 0) - { - Chat->send(source, CHAT_DIRECT, "reloadlua", "Forces the server to reload any LUA script attached to the NPC"); - return; - } - else if(strncmp(tmp_help, "spawn", 5) == 0) - { - Chat->send(source, CHAT_DIRECT, "spawn", "Spawns an NPC on your current location"); - Chat->send(source, CHAT_DIRECT, "Params", " - See npc.def"); - Chat->send(source, CHAT_DIRECT, "Params", "[] - Optional name for NPC"); - return; - } - else if(strncmp(tmp_help, "remove", 6) == 0) - { - Chat->send(source, CHAT_DIRECT, "remove", "Removes an NPC"); - Chat->send(source, CHAT_DIRECT, "Params", " - Use @debug it to get ID"); - Chat->send(source, CHAT_DIRECT, "Params", "[keep] - Dont delete NPC from SQL"); - return; - } - else if(strncmp(tmp_help, "help", 4) == 0) - { - Chat->send(source, CHAT_DIRECT, "help", "Yes... help..."); - return; - } - else - { - Chat->send(source, CHAT_DIRECT, "help", "No such command"); - return; - } - } - else if(strncmp(tmp_npccommand, "spawn", 5) == 0) - { -// ------------------------------ - PNPCWorld* tNPCWorld = NPCManager->GetWorld( source->GetChar()->GetLocation() ); - if (!tNPCWorld) - { - Chat->send(source, CHAT_DIRECT, "System", "Error NPC World is inactive"); - Console->Print("%s Error NPC World is inactive but players are there!", Console->ColorText(RED,BLACK, "[PANIC]")); - return; - } - // Get requested spawn ID from Input - // @npc spawn 12 - int tSpawnID = GetArgInt(2); - // Check if ID is valid - const PDefNpc* t_defNpc = GameDefs->Npcs()->GetDef(tSpawnID); - if(!t_defNpc) - { - Chat->send(source, CHAT_DIRECT, "System", "Invalid SpawnID"); - return; - } - char tCustomName[80]; - tCustomName[0] = '\0'; - if(ArgC == 3) - GetArgText(3, tCustomName, 80); - - u16 tNPCPosX = source->GetChar()->Coords.mX + 768; - u16 tNPCPosY = source->GetChar()->Coords.mY + 768; - u16 tNPCPosZ = source->GetChar()->Coords.mZ + 768; - u32 tLocation = source->GetChar()->GetLocation(); - - u8 tAngle = source->GetChar()->Coords.mLR; - string tNPCAngle = Ssprintf( "%d", tAngle ); - - string tNPCScript = t_defNpc->GetStandardScript(); - u32 tNPCHealth = t_defNpc->GetHealth() * NPC_HEALTHFACTOR; - - /*-------------------------------------------------------*/ - // Get the highest NPC Id for current zone - /*-------------------------------------------------------*/ - MYSQL_RES *result = NULL; - char tSql[100]; - snprintf(tSql, 100, "SELECT IFNULL(MAX(npc_worldid)+1,0) FROM npc_spawns WHERE npc_location = %d", tLocation); - result = MySQL->GameResQuery(tSql); - if(!result) - { - Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, NPC not added"); - MySQL->ShowGameSQLError(); - return; - } - - int tNewWorldID = atoi(mysql_fetch_row(result)[0]); - - if(tNewWorldID == 0) - tNewWorldID = NEW_NPC_ZONEID_START; - - /*-------------------------------------------------------*/ - // Insert NPC into DB - /*-------------------------------------------------------*/ - char tSql2[500]; - snprintf(tSql2, 500, "INSERT INTO npc_spawns (npc_worldid, npc_nameid, npc_typeid, npc_name, npc_location, npc_x, npc_y, npc_z, npc_angle, npc_clothing, npc_loot, npc_unknown, npc_trader, npc_customname) VALUES (%d, %d, %d, \"%s\", %d, %d, %d, %d, %d, %d, %d, %d, %d, \"%s\")", - tNewWorldID, tSpawnID, GetRandom(65000, 1000), tNPCScript.c_str(), tLocation, tNPCPosX, tNPCPosY, tNPCPosZ, atoi(tNPCAngle.c_str()), - GetRandom(65000, 1000), t_defNpc->GetLoot(), tNPCHealth, 0, tCustomName); - - if(MySQL->GameQuery(tSql2)) - { - Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, NPC not added"); - MySQL->ShowGameSQLError(); - return; - } - /*-------------------------------------------------------*/ - // Grab last insert ID to tell NPCWorld later - /*-------------------------------------------------------*/ - int tNPC_SQLID = MySQL->GetLastGameInsertId(); - if(tNPC_SQLID == 0) - { - Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, please check your DB"); - Console->Print("%s LastInsertID is 0 without SQL Error after query", Console->ColorText(RED,BLACK, "[PANIC]")); - return; - } - /*-------------------------------------------------------*/ - // Tell NPCWorld to load NPC with given SQL - /*-------------------------------------------------------*/ - tNPCWorld->AddNPC(tNPC_SQLID, tNewWorldID); - - char retMsg[100]; - snprintf(retMsg, 100, "NPC spawned. WorldID: %d", tNewWorldID); - Chat->send(source, CHAT_DIRECT, "System", retMsg); - return; -// ------------------------------ - } - else if(strncmp(tmp_npccommand, "remove", 6) == 0 && targetNPC && currentNPCWorld) - { - char tmp_option[50]; - if(ArgC == 3) - GetArgText(3, tmp_option, 50); - - if(strncmp(tmp_option, "keep", 4) != 0) - { - if(targetNPC->IsSQLNPC() == true) - { - char sql[100]; - char sql2[100]; - snprintf(sql, 100, "DELETE FROM npc_spawns WHERE npc_id = %d", targetNPC->GetNPCSQLID()); - snprintf(sql2, 100, "DELETE FROM npc_shop WHERE c_npc_id = %d and c_zoneid = %d", targetNPC->GetNPCID(), source->GetChar()->GetLocation()); - if(MySQL->GameQuery(sql)) - { - Chat->send(source, CHAT_DIRECT, "System", "Unable to remove NPC from SQL"); - Console->Print("%s Unable to remove NPC from SQL", Console->ColorText(RED, BLACK, "[Error]")); - MySQL->ShowGameSQLError(); - } - if(MySQL->GameQuery(sql2)) - { - Chat->send(source, CHAT_DIRECT, "System", "Unable to remove NPC Shop settings from SQL"); - Console->Print("%s Unable to remove NPC shop settings from SQL", Console->ColorText(RED, BLACK, "[Error]")); - MySQL->ShowGameSQLError(); - } - } - } - Chat->send(source, CHAT_DIRECT, "System", "Removing NPC..."); - currentNPCWorld->DelNPC(targetNPC->GetNPCID()); - return; - } - else if(strncmp(tmp_npccommand, "reloadlua", 9) == 0 && targetNPC) - { - if(targetNPC->ReloadLUAScript() == true) - { - Chat->send(source, CHAT_DIRECT, "System", "LUA script reload successfull"); - return; - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "LUA script reload failed"); - return; - } - } - else if(strncmp(tmp_npccommand, "lua", 3) == 0 && targetNPC) - { - if(ArgC < 3) - { - Chat->send(source, CHAT_DIRECT, "Syntax", "@npc lua 1/0"); - return; - } - if(IsArgNumeric(3) == false) - { - Chat->send(source, CHAT_DIRECT, "Syntax", "@npc lua 1/0"); - return; - } - - int tVal = GetArgInt(3); - targetNPC->SetScripting(tVal); - - - if(targetNPC->IsSQLNPC() == true) - { - char sql[100]; - snprintf(sql, 100, "UPDATE npc_spawns SET npc_scripting = %d WHERE npc_id = %d", tVal, targetNPC->GetNPCSQLID()); - if(MySQL->GameQuery(sql)) - { - Chat->send(source, CHAT_DIRECT, "System", "Unable to set scripting value in SQL"); - Console->Print("%s Unable to set scripting value in SQL", Console->ColorText(RED, BLACK, "[Error]")); - MySQL->ShowGameSQLError(); - } - } - - if(tVal == 1) - Chat->send(source, CHAT_DIRECT, "System", "LUA scripting is now enabled"); - else - Chat->send(source, CHAT_DIRECT, "Syntax", "LUA scripting is now disabled"); - - return; - } - else - { - char buff[100]; - snprintf(buff, 100, "Unknown command: '%s'", tmp_npccommand); - Chat->send(source, CHAT_DIRECT, "System", buff); - return; - } -} +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#include "main.h" + +void PCommands::doNPC() +{ + bool SyntaxError = false; + if(ArgC < 2) + { + SyntaxError = true; + } + + if(SyntaxError == true) + { + Chat->send(source, CHAT_DIRECT, "Usage", "@npc []"); + Chat->send(source, CHAT_DIRECT, "Usage", " can be:"); + Chat->send(source, CHAT_DIRECT, "lua 1/0", "Enables/Disables scripts"); + Chat->send(source, CHAT_DIRECT, "reloadlua ", "Reloads LUA script"); + Chat->send(source, CHAT_DIRECT, "spawn []", "Spawns an NPC"); + Chat->send(source, CHAT_DIRECT, "remove ", "Removes an NPC"); + Chat->send(source, CHAT_DIRECT, "help ", "Displays detailed help for any command"); + + /* more to add here... spawn, remove, ... */ + return; + } + // Get subcommand + char tmp_npccommand[50]; + GetArgText(1, tmp_npccommand, 50); + + // Dont search for NPC ID when commands HELP and SPAWN are used + PNPC* targetNPC = NULL; + PNPCWorld* currentNPCWorld = NULL; + if(strncmp(tmp_npccommand, "spawn", 5) != 0 && strncmp(tmp_npccommand, "help", 4) != 0) + { + currentNPCWorld = NPCManager->GetWorld( source->GetChar()->GetLocation() ); + if ( currentNPCWorld ) + { + targetNPC = currentNPCWorld->GetNPC( GetArgInt(2) ); + if(!targetNPC) + { + // Search for DEF version of NPC (remember, def IDs are on 255 offset! + // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! + targetNPC = currentNPCWorld->GetNPC( GetArgInt(1) - 255 ); + } + } + if (!targetNPC) + { + Chat->send(source, CHAT_DIRECT, "System", "Invalid NPC ID"); + return; + } + } + + if(strncmp(tmp_npccommand, "help", 4) == 0) + { + char tmp_help[50]; + GetArgText(2, tmp_help, 50); + + if(strncmp(tmp_help, "reloadlua", 9) == 0) + { + Chat->send(source, CHAT_DIRECT, "reloadlua", "Forces the server to reload any LUA script attached to the NPC"); + return; + } + else if(strncmp(tmp_help, "spawn", 5) == 0) + { + Chat->send(source, CHAT_DIRECT, "spawn", "Spawns an NPC on your current location"); + Chat->send(source, CHAT_DIRECT, "Params", " - See npc.def"); + Chat->send(source, CHAT_DIRECT, "Params", "[] - Optional name for NPC"); + return; + } + else if(strncmp(tmp_help, "remove", 6) == 0) + { + Chat->send(source, CHAT_DIRECT, "remove", "Removes an NPC"); + Chat->send(source, CHAT_DIRECT, "Params", " - Use @debug it to get ID"); + Chat->send(source, CHAT_DIRECT, "Params", "[keep] - Dont delete NPC from SQL"); + return; + } + else if(strncmp(tmp_help, "help", 4) == 0) + { + Chat->send(source, CHAT_DIRECT, "help", "Yes... help..."); + return; + } + else + { + Chat->send(source, CHAT_DIRECT, "help", "No such command"); + return; + } + } + else if(strncmp(tmp_npccommand, "spawn", 5) == 0) + { +// ------------------------------ + PNPCWorld* tNPCWorld = NPCManager->GetWorld( source->GetChar()->GetLocation() ); + if (!tNPCWorld) + { + Chat->send(source, CHAT_DIRECT, "System", "Error NPC World is inactive"); + Console->Print("%s Error NPC World is inactive but players are there!", Console->ColorText(RED,BLACK, "[PANIC]")); + return; + } + // Get requested spawn ID from Input + // @npc spawn 12 + int tSpawnID = GetArgInt(2); + // Check if ID is valid + const PDefNpc* t_defNpc = GameDefs->Npcs()->GetDef(tSpawnID); + if(!t_defNpc) + { + Chat->send(source, CHAT_DIRECT, "System", "Invalid SpawnID"); + return; + } + char tCustomName[80]; + tCustomName[0] = '\0'; + if(ArgC == 3) + GetArgText(3, tCustomName, 80); + + u16 tNPCPosX = source->GetChar()->Coords.mX + 768; + u16 tNPCPosY = source->GetChar()->Coords.mY + 768; + u16 tNPCPosZ = source->GetChar()->Coords.mZ + 768; + u32 tLocation = source->GetChar()->GetLocation(); + + u8 tAngle = source->GetChar()->Coords.mLR; + std::string tNPCAngle = Ssprintf( "%d", tAngle ); + + std::string tNPCScript = t_defNpc->GetStandardScript(); + u32 tNPCHealth = t_defNpc->GetHealth() * NPC_HEALTHFACTOR; + + /*-------------------------------------------------------*/ + // Get the highest NPC Id for current zone + /*-------------------------------------------------------*/ + MYSQL_RES *result = NULL; + char tSql[100]; + snprintf(tSql, 100, "SELECT IFNULL(MAX(npc_worldid)+1,0) FROM npc_spawns WHERE npc_location = %d", tLocation); + result = MySQL->GameResQuery(tSql); + if(!result) + { + Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, NPC not added"); + MySQL->ShowGameSQLError(); + return; + } + + int tNewWorldID = atoi(mysql_fetch_row(result)[0]); + + if(tNewWorldID == 0) + tNewWorldID = NEW_NPC_ZONEID_START; + + /*-------------------------------------------------------*/ + // Insert NPC into DB + /*-------------------------------------------------------*/ + char tSql2[500]; + snprintf(tSql2, 500, "INSERT INTO npc_spawns (npc_worldid, npc_nameid, npc_typeid, npc_name, npc_location, npc_x, npc_y, npc_z, npc_angle, npc_clothing, npc_loot, npc_unknown, npc_trader, npc_customname) VALUES (%d, %d, %d, \"%s\", %d, %d, %d, %d, %d, %d, %d, %d, %d, \"%s\")", + tNewWorldID, tSpawnID, GetRandom(65000, 1000), tNPCScript.c_str(), tLocation, tNPCPosX, tNPCPosY, tNPCPosZ, atoi(tNPCAngle.c_str()), + GetRandom(65000, 1000), t_defNpc->GetLoot(), tNPCHealth, 0, tCustomName); + + if(MySQL->GameQuery(tSql2)) + { + Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, NPC not added"); + MySQL->ShowGameSQLError(); + return; + } + /*-------------------------------------------------------*/ + // Grab last insert ID to tell NPCWorld later + /*-------------------------------------------------------*/ + int tNPC_SQLID = MySQL->GetLastGameInsertId(); + if(tNPC_SQLID == 0) + { + Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, please check your DB"); + Console->Print("%s LastInsertID is 0 without SQL Error after query", Console->ColorText(RED,BLACK, "[PANIC]")); + return; + } + /*-------------------------------------------------------*/ + // Tell NPCWorld to load NPC with given SQL + /*-------------------------------------------------------*/ + tNPCWorld->AddNPC(tNPC_SQLID, tNewWorldID); + + char retMsg[100]; + snprintf(retMsg, 100, "NPC spawned. WorldID: %d", tNewWorldID); + Chat->send(source, CHAT_DIRECT, "System", retMsg); + return; +// ------------------------------ + } + else if(strncmp(tmp_npccommand, "remove", 6) == 0 && targetNPC && currentNPCWorld) + { + char tmp_option[50]; + if(ArgC == 3) + GetArgText(3, tmp_option, 50); + + if(strncmp(tmp_option, "keep", 4) != 0) + { + if(targetNPC->IsSQLNPC() == true) + { + char sql[100]; + char sql2[100]; + snprintf(sql, 100, "DELETE FROM npc_spawns WHERE npc_id = %d", targetNPC->GetNPCSQLID()); + snprintf(sql2, 100, "DELETE FROM npc_shop WHERE c_npc_id = %d and c_zoneid = %d", targetNPC->GetNPCID(), source->GetChar()->GetLocation()); + if(MySQL->GameQuery(sql)) + { + Chat->send(source, CHAT_DIRECT, "System", "Unable to remove NPC from SQL"); + Console->Print("%s Unable to remove NPC from SQL", Console->ColorText(RED, BLACK, "[Error]")); + MySQL->ShowGameSQLError(); + } + if(MySQL->GameQuery(sql2)) + { + Chat->send(source, CHAT_DIRECT, "System", "Unable to remove NPC Shop settings from SQL"); + Console->Print("%s Unable to remove NPC shop settings from SQL", Console->ColorText(RED, BLACK, "[Error]")); + MySQL->ShowGameSQLError(); + } + } + } + Chat->send(source, CHAT_DIRECT, "System", "Removing NPC..."); + currentNPCWorld->DelNPC(targetNPC->GetNPCID()); + return; + } + else if(strncmp(tmp_npccommand, "reloadlua", 9) == 0 && targetNPC) + { + if(targetNPC->ReloadLUAScript() == true) + { + Chat->send(source, CHAT_DIRECT, "System", "LUA script reload successfull"); + return; + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "LUA script reload failed"); + return; + } + } + else if(strncmp(tmp_npccommand, "lua", 3) == 0 && targetNPC) + { + if(ArgC < 3) + { + Chat->send(source, CHAT_DIRECT, "Syntax", "@npc lua 1/0"); + return; + } + if(IsArgNumeric(3) == false) + { + Chat->send(source, CHAT_DIRECT, "Syntax", "@npc lua 1/0"); + return; + } + + int tVal = GetArgInt(3); + targetNPC->SetScripting(tVal); + + + if(targetNPC->IsSQLNPC() == true) + { + char sql[100]; + snprintf(sql, 100, "UPDATE npc_spawns SET npc_scripting = %d WHERE npc_id = %d", tVal, targetNPC->GetNPCSQLID()); + if(MySQL->GameQuery(sql)) + { + Chat->send(source, CHAT_DIRECT, "System", "Unable to set scripting value in SQL"); + Console->Print("%s Unable to set scripting value in SQL", Console->ColorText(RED, BLACK, "[Error]")); + MySQL->ShowGameSQLError(); + } + } + + if(tVal == 1) + Chat->send(source, CHAT_DIRECT, "System", "LUA scripting is now enabled"); + else + Chat->send(source, CHAT_DIRECT, "Syntax", "LUA scripting is now disabled"); + + return; + } + else + { + char buff[100]; + snprintf(buff, 100, "Unknown command: '%s'", tmp_npccommand); + Chat->send(source, CHAT_DIRECT, "System", buff); + return; + } +} diff --git a/server/src/game/gamecommands/npc_shop.cpp b/server/src/game/gamecommands/npc_shop.cpp index 6a26804..e7ffcf4 100644 --- a/server/src/game/gamecommands/npc_shop.cpp +++ b/server/src/game/gamecommands/npc_shop.cpp @@ -1,252 +1,252 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ -#include "main.h" - -void PCommands::doNPC_Shop() -{ - bool SyntaxError = false; - if(ArgC < 2) - { - SyntaxError = true; - } - - if(IsArgNumeric(1) == true) - { - target = GetClientByID(GetArgInt(1)); - } - else - { - SyntaxError = true; - } - - if(SyntaxError == true) - { - Chat->send(source, CHAT_DIRECT, "Usage", "@npcshop "); - Chat->send(source, CHAT_DIRECT, "Usage", " can be:"); - Chat->send(source, CHAT_DIRECT, "setquality <1-255>", "Sets itemquality in shop"); - Chat->send(source, CHAT_DIRECT, "additem ", "Adds item with "); - Chat->send(source, CHAT_DIRECT, "delitem ", "Removes item "); - Chat->send(source, CHAT_DIRECT, "setdefshop ", "ID from trader.def; Use 0 to unset"); - Chat->send(source, CHAT_DIRECT, "reload", "Reloads shop list"); - Chat->send(source, CHAT_DIRECT, "remove", "Disables the shop"); - Chat->send(source, CHAT_DIRECT, "setallbuyer", "Makes NPC an allbuyer (Yo's)"); - - /* more to add here... spawn, remove, ... */ - return; - } - - PNPC* targetNPC = NULL; - PNPCWorld* currentNPCWorld = NPCManager->GetWorld( source->GetChar()->GetLocation() ); - if ( currentNPCWorld ) - { - targetNPC = currentNPCWorld->GetNPC( GetArgInt(1) ); - if(!targetNPC) - { - // Search for DEF version of NPC (remember, def IDs are on 255 offset! - // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! - targetNPC = currentNPCWorld->GetNPC( GetArgInt(1) - 255 ); - } - } - if (!targetNPC) - { - Chat->send(source, CHAT_DIRECT, "System", "Invalid NPC ID"); - return; - } - - // Get subcommand - char tmp_npccommand[50]; - GetArgText(2, tmp_npccommand, 50); - - if(strncmp(tmp_npccommand, "setallbuyer", 11) == 0) - { - int tItemID = -1; - int tPrice = 0; - int tNPCID = targetNPC->GetNPCID(); - int tZoneID = source->GetChar()->GetLocation(); - - char sqlq[200]; - snprintf(sqlq, 200, "INSERT INTO npc_shop (`c_npc_id`, `c_zoneid`, `c_itemid`, `c_itemprice`) VALUES (%d, %d, %d, %d)", tNPCID, tZoneID, tItemID, tPrice); - if(MySQL->GameQuery(sqlq)) - { - Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, nothing changed"); - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "NPC is now an allbuyer"); - } - return; - - } - else if(strncmp(tmp_npccommand, "additem", 7) == 0) - { - int tItemID = GetArgInt(3); - int tPrice = GetArgInt(4); - int tNPCID = targetNPC->GetNPCID(); - int tZoneID = source->GetChar()->GetLocation(); - const PDefItems* t_item = GameDefs->Items()->GetDef(tItemID); - if(!t_item) - { - Chat->send(source, CHAT_DIRECT, "System", "Invalid ItemID"); - return; - } - char sqlq[200]; - snprintf(sqlq, 200, "INSERT INTO npc_shop (`c_npc_id`, `c_zoneid`, `c_itemid`, `c_itemprice`) VALUES (%d, %d, %d, %d)", tNPCID, tZoneID, tItemID, tPrice); - if(MySQL->GameQuery(sqlq)) - { - Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, item not added"); - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "Item added to shop"); - } - return; - } - else if(strncmp(tmp_npccommand, "delitem", 7) == 0) - { - int tItemID = GetArgInt(3); - int tNPCID = targetNPC->GetNPCID(); - int tZoneID = source->GetChar()->GetLocation(); - char sqlq[200]; - snprintf(sqlq, 200, "DELETE FROM npc_shop WHERE `c_npc_id` = %d and `c_zoneid` = %d and `c_itemid` = %d LIMIT 1", tNPCID, tZoneID, tItemID); - if(MySQL->GameQuery(sqlq)) - { - Chat->send(source, CHAT_DIRECT, "System", "Error on DB update, item not removed"); - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "Item removed from shop"); - } - return; - } - else if(strncmp(tmp_npccommand, "setdefshop", 10) == 0) - { - int tNewTraderDef = GetArgInt(3); - const PDefTrader* nTraderDef = GameDefs->Traders()->GetDef(tNewTraderDef); - - // Valid trader definition? - if(!nTraderDef) - { - Chat->send(source, CHAT_DIRECT, "System", "Invalid Traderdef ID"); - return; - } - - char sqlq[200]; - char sqlq2[200]; - bool success = false; - snprintf(sqlq, 200, "UPDATE npc_spawns SET `npc_trader` = %d WHERE `npc_id` = %d", tNewTraderDef, targetNPC->GetNPCSQLID()); - if(!MySQL->GameQuery(sqlq)) - { - snprintf(sqlq2, 200, "UPDATE npc_spawns SET `npc_trader` = 0 WHERE `npc_id` = %d", targetNPC->GetNPCSQLID()); - if(!MySQL->GameQuery(sqlq2)) - success = true; - } - - if(success == true) - { - // Set new trader and remove existing shoplist - targetNPC->SetTrader(tNewTraderDef); - targetNPC->ReloadShopList(); - Chat->send(source, CHAT_DIRECT, "System", "NPC acts now as defined TraderShop"); - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "Error while removing shop"); - } - - - return; - } - else if(strncmp(tmp_npccommand, "remove", 6) == 0) - { - int tZoneID = source->GetChar()->GetLocation(); - int tNPCID = targetNPC->GetNPCID(); - char sqlq[200]; - bool success = false; - snprintf(sqlq, 200, "DELETE FROM npc_shop WHERE `c_npc_id` = %d and `c_zoneid` = %d", tNPCID, tZoneID); - if(MySQL->GameQuery(sqlq)) - { - snprintf(sqlq, 200, "UPDATE npc_spawns SET `npc_trader` = 0 WHERE `npc_id` = %d", targetNPC->GetNPCSQLID()); - if(MySQL->GameQuery(sqlq)) - success = false; - else - success = true; - } - if(success == true) - { - // Remove shoplist - targetNPC->ReloadShopList(); - Chat->send(source, CHAT_DIRECT, "System", "Shop removed from NPC"); - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "Error while removing shop"); - } - - - return; - } - else if(strncmp(tmp_npccommand, "reload", 6) == 0) - { - if(targetNPC->ReloadShopList() == true) - { - Chat->send(source, CHAT_DIRECT, "System", "Shoplist reload successfull"); - return; - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "Shoplist reload failed"); - return; - } - } - else if(strncmp(tmp_npccommand, "setquality", 10) == 0) - { - u8 tNewLv = (u8)GetArgInt(3); - if(targetNPC->IsSQLNPC() == true) - { - char sqlq[200]; - snprintf(sqlq, 200, "UPDATE npc_spawns SET `npc_shop_quality` = %d WHERE `npc_id` = %d", tNewLv, targetNPC->GetNPCSQLID()); - if(MySQL->GameQuery(sqlq)) - { - Chat->send(source, CHAT_DIRECT, "System", "Error while updating SQL. New quality will be lost on reload"); - } - } - - if(targetNPC->SetShopQuality(tNewLv) == true) - { - char tBuff[100]; - snprintf(tBuff, 100, "Itemquality of this NPC is now %u", tNewLv); - Chat->send(source, CHAT_DIRECT, "System", tBuff); - return; - } - else - { - Chat->send(source, CHAT_DIRECT, "System", "Cannot set ItemQuality. (Make sure you entered 1-255 and NPC is loaded from SQL)"); - return; - } - } - else - { - char buff[100]; - snprintf(buff, 100, "Unknown command: '%s'", tmp_npccommand); - Chat->send(source, CHAT_DIRECT, "System", buff); - return; - } -} +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#include "main.h" + +void PCommands::doNPC_Shop() +{ + bool SyntaxError = false; + if(ArgC < 2) + { + SyntaxError = true; + } + + if(IsArgNumeric(1) == true) + { + target = GetClientByID(GetArgInt(1)); + } + else + { + SyntaxError = true; + } + + if(SyntaxError == true) + { + Chat->send(source, CHAT_DIRECT, "Usage", "@npcshop "); + Chat->send(source, CHAT_DIRECT, "Usage", " can be:"); + Chat->send(source, CHAT_DIRECT, "setquality <1-255>", "Sets itemquality in shop"); + Chat->send(source, CHAT_DIRECT, "additem ", "Adds item with "); + Chat->send(source, CHAT_DIRECT, "delitem ", "Removes item "); + Chat->send(source, CHAT_DIRECT, "setdefshop ", "ID from trader.def; Use 0 to unset"); + Chat->send(source, CHAT_DIRECT, "reload", "Reloads shop list"); + Chat->send(source, CHAT_DIRECT, "remove", "Disables the shop"); + Chat->send(source, CHAT_DIRECT, "setallbuyer", "Makes NPC an allbuyer (Yo's)"); + + /* more to add here... spawn, remove, ... */ + return; + } + + PNPC* targetNPC = NULL; + PNPCWorld* currentNPCWorld = NPCManager->GetWorld( source->GetChar()->GetLocation() ); + if ( currentNPCWorld ) + { + targetNPC = currentNPCWorld->GetNPC( GetArgInt(1) ); + if(!targetNPC) + { + // Search for DEF version of NPC (remember, def IDs are on 255 offset! + // Note to myself: This is UGLY!!!! and BAD!!! but it works for now. CHANGE THIS! + targetNPC = currentNPCWorld->GetNPC( GetArgInt(1) - 255 ); + } + } + if (!targetNPC) + { + Chat->send(source, CHAT_DIRECT, "System", "Invalid NPC ID"); + return; + } + + // Get subcommand + char tmp_npccommand[50]; + GetArgText(2, tmp_npccommand, 50); + + if(strncmp(tmp_npccommand, "setallbuyer", 11) == 0) + { + int tItemID = -1; + int tPrice = 0; + int tNPCID = targetNPC->GetNPCID(); + int tZoneID = source->GetChar()->GetLocation(); + + char sqlq[200]; + snprintf(sqlq, 200, "INSERT INTO npc_shop (`c_npc_id`, `c_zoneid`, `c_itemid`, `c_itemprice`) VALUES (%d, %d, %d, %d)", tNPCID, tZoneID, tItemID, tPrice); + if(MySQL->GameQuery(sqlq)) + { + Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, nothing changed"); + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "NPC is now an allbuyer"); + } + return; + + } + else if(strncmp(tmp_npccommand, "additem", 7) == 0) + { + int tItemID = GetArgInt(3); + int tPrice = GetArgInt(4); + int tNPCID = targetNPC->GetNPCID(); + int tZoneID = source->GetChar()->GetLocation(); + const PDefItems* t_item = GameDefs->Items()->GetDef(tItemID); + if(!t_item) + { + Chat->send(source, CHAT_DIRECT, "System", "Invalid ItemID"); + return; + } + char sqlq[200]; + snprintf(sqlq, 200, "INSERT INTO npc_shop (`c_npc_id`, `c_zoneid`, `c_itemid`, `c_itemprice`) VALUES (%d, %d, %d, %d)", tNPCID, tZoneID, tItemID, tPrice); + if(MySQL->GameQuery(sqlq)) + { + Chat->send(source, CHAT_DIRECT, "System", "Error on DB insert, item not added"); + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "Item added to shop"); + } + return; + } + else if(strncmp(tmp_npccommand, "delitem", 7) == 0) + { + int tItemID = GetArgInt(3); + int tNPCID = targetNPC->GetNPCID(); + int tZoneID = source->GetChar()->GetLocation(); + char sqlq[200]; + snprintf(sqlq, 200, "DELETE FROM npc_shop WHERE `c_npc_id` = %d and `c_zoneid` = %d and `c_itemid` = %d LIMIT 1", tNPCID, tZoneID, tItemID); + if(MySQL->GameQuery(sqlq)) + { + Chat->send(source, CHAT_DIRECT, "System", "Error on DB update, item not removed"); + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "Item removed from shop"); + } + return; + } + else if(strncmp(tmp_npccommand, "setdefshop", 10) == 0) + { + int tNewTraderDef = GetArgInt(3); + const PDefTrader* nTraderDef = GameDefs->Traders()->GetDef(tNewTraderDef); + + // Valid trader definition? + if(!nTraderDef) + { + Chat->send(source, CHAT_DIRECT, "System", "Invalid Traderdef ID"); + return; + } + + char sqlq[200]; + char sqlq2[200]; + bool success = false; + snprintf(sqlq, 200, "UPDATE npc_spawns SET `npc_trader` = %d WHERE `npc_id` = %d", tNewTraderDef, targetNPC->GetNPCSQLID()); + if(!MySQL->GameQuery(sqlq)) + { + snprintf(sqlq2, 200, "UPDATE npc_spawns SET `npc_trader` = 0 WHERE `npc_id` = %d", targetNPC->GetNPCSQLID()); + if(!MySQL->GameQuery(sqlq2)) + success = true; + } + + if(success == true) + { + // Set new trader and remove existing shoplist + targetNPC->SetTrader(tNewTraderDef); + targetNPC->ReloadShopList(); + Chat->send(source, CHAT_DIRECT, "System", "NPC acts now as defined TraderShop"); + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "Error while removing shop"); + } + + + return; + } + else if(strncmp(tmp_npccommand, "remove", 6) == 0) + { + int tZoneID = source->GetChar()->GetLocation(); + int tNPCID = targetNPC->GetNPCID(); + char sqlq[200]; + bool success = false; + snprintf(sqlq, 200, "DELETE FROM npc_shop WHERE `c_npc_id` = %d and `c_zoneid` = %d", tNPCID, tZoneID); + if(MySQL->GameQuery(sqlq)) + { + snprintf(sqlq, 200, "UPDATE npc_spawns SET `npc_trader` = 0 WHERE `npc_id` = %d", targetNPC->GetNPCSQLID()); + if(MySQL->GameQuery(sqlq)) + success = false; + else + success = true; + } + if(success == true) + { + // Remove shoplist + targetNPC->ReloadShopList(); + Chat->send(source, CHAT_DIRECT, "System", "Shop removed from NPC"); + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "Error while removing shop"); + } + + + return; + } + else if(strncmp(tmp_npccommand, "reload", 6) == 0) + { + if(targetNPC->ReloadShopList() == true) + { + Chat->send(source, CHAT_DIRECT, "System", "Shoplist reload successfull"); + return; + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "Shoplist reload failed"); + return; + } + } + else if(strncmp(tmp_npccommand, "setquality", 10) == 0) + { + u8 tNewLv = (u8)GetArgInt(3); + if(targetNPC->IsSQLNPC() == true) + { + char sqlq[200]; + snprintf(sqlq, 200, "UPDATE npc_spawns SET `npc_shop_quality` = %d WHERE `npc_id` = %d", tNewLv, targetNPC->GetNPCSQLID()); + if(MySQL->GameQuery(sqlq)) + { + Chat->send(source, CHAT_DIRECT, "System", "Error while updating SQL. New quality will be lost on reload"); + } + } + + if(targetNPC->SetShopQuality(tNewLv) == true) + { + char tBuff[100]; + snprintf(tBuff, 100, "Itemquality of this NPC is now %u", tNewLv); + Chat->send(source, CHAT_DIRECT, "System", tBuff); + return; + } + else + { + Chat->send(source, CHAT_DIRECT, "System", "Cannot set ItemQuality. (Make sure you entered 1-255 and NPC is loaded from SQL)"); + return; + } + } + else + { + char buff[100]; + snprintf(buff, 100, "Unknown command: '%s'", tmp_npccommand); + Chat->send(source, CHAT_DIRECT, "System", buff); + return; + } +} diff --git a/server/src/game/gamecommands/rawf.cpp b/server/src/game/gamecommands/rawf.cpp index 7796f72..917409d 100644 --- a/server/src/game/gamecommands/rawf.cpp +++ b/server/src/game/gamecommands/rawf.cpp @@ -58,17 +58,17 @@ void PCommands::doCmdrawf() return; } - ifstream::pos_type size; + std::ifstream::pos_type size; char *buffer; - ifstream hexdump (file_to_send, ios::in|ios::binary|ios::ate); + std::ifstream hexdump (file_to_send, std::ios::in | std::ios::binary | std::ios::ate); if (hexdump.is_open()) { if (gDevDebug) Console->Print("IngameCommand: Sending packet file %s", file_to_send); size = hexdump.tellg(); buffer = new char [size]; - hexdump.seekg (0, ios::beg); + hexdump.seekg (0, std::ios::beg); hexdump.read (buffer, size); hexdump.close(); diff --git a/server/src/game/gamecommands/setlevel.cpp b/server/src/game/gamecommands/setlevel.cpp index 02692d7..5e8cb42 100644 --- a/server/src/game/gamecommands/setlevel.cpp +++ b/server/src/game/gamecommands/setlevel.cpp @@ -1,86 +1,86 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ -#include "main.h" - -void PCommands::doCmdsetlevel() -{ - int destLevel = 0; - bool SyntaxError = false; - if (ArgC < 2) - { - SyntaxError = true; - } - - if (IsArgNumeric(2) == false) - { - SyntaxError = true; - } - else - { - destLevel = GetArgInt(2); - } - - if (SyntaxError == true) - { - Chat->send(source, CHAT_DIRECT, "Usage", "@setlevel "); - return; - } - - if (IsArgNumeric(1) == true) - { - target = GetClientByID(GetArgInt(1)); - } - else - { - char tmp_destNick[50]; - GetArgText(1, tmp_destNick, 50); - target = GetClientByNick(tmp_destNick); - } - - if (target == NULL) // If victim isnt found, return error - { - Chat->send(source, CHAT_DIRECT, "System", "No such player"); - return; - } - if (source->GetAccountLevel() <= target->GetAccountLevel()) - { - char tmpMsg[200]; - snprintf(tmpMsg, 199, "Cant set new level for %s, target level is higher or equal to yours!", Chars->GetChar(target->GetCharID())->GetName().c_str()); - tmpMsg[199] = '\0'; - Chat->send(source, CHAT_DIRECT, "System", tmpMsg); - return; - } - - PAccount Acc(target->GetAccountID()); - Acc.SetLevel(destLevel); - Acc.Save(); - source->RefreshAccountInfo(&Acc); - - char tmpMsg[60], tmpMsg2[60]; - snprintf(tmpMsg, 59, "Set level for player %s to %d", Chars->GetChar(target->GetCharID())->GetName().c_str(), destLevel); - snprintf(tmpMsg2, 59, "**POOF** Your new accesslevel is now %d", destLevel); - - tmpMsg[59] = '\0'; - tmpMsg2[59] = '\0'; - - Chat->send(source, CHAT_DIRECT, "System", tmpMsg); - Chat->send(target, CHAT_DIRECT, "System", tmpMsg2); -} +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#include "main.h" + +void PCommands::doCmdsetlevel() +{ + int destLevel = 0; + bool SyntaxError = false; + if (ArgC < 2) + { + SyntaxError = true; + } + + if (IsArgNumeric(2) == false) + { + SyntaxError = true; + } + else + { + destLevel = GetArgInt(2); + } + + if (SyntaxError == true) + { + Chat->send(source, CHAT_DIRECT, "Usage", "@setlevel "); + return; + } + + if (IsArgNumeric(1) == true) + { + target = GetClientByID(GetArgInt(1)); + } + else + { + char tmp_destNick[50]; + GetArgText(1, tmp_destNick, 50); + target = GetClientByNick(tmp_destNick); + } + + if (target == NULL) // If victim isnt found, return error + { + Chat->send(source, CHAT_DIRECT, "System", "No such player"); + return; + } + if (source->GetAccountLevel() <= target->GetAccountLevel()) + { + char tmpMsg[200]; + snprintf(tmpMsg, 199, "Cant set new level for %s, target level is higher or equal to yours!", Chars->GetChar(target->GetCharID())->GetName().c_str()); + tmpMsg[199] = '\0'; + Chat->send(source, CHAT_DIRECT, "System", tmpMsg); + return; + } + + PAccount Acc(target->GetAccountID()); + Acc.SetLevel(destLevel); + Acc.Save(); + source->RefreshAccountInfo(&Acc); + + char tmpMsg[60], tmpMsg2[60]; + snprintf(tmpMsg, 59, "Set level for player %s to %d", Chars->GetChar(target->GetCharID())->GetName().c_str(), destLevel); + snprintf(tmpMsg2, 59, "**POOF** Your new accesslevel is now %d", destLevel); + + tmpMsg[59] = '\0'; + tmpMsg2[59] = '\0'; + + Chat->send(source, CHAT_DIRECT, "System", tmpMsg); + Chat->send(target, CHAT_DIRECT, "System", tmpMsg2); +} diff --git a/server/src/game/gamecommands/setmainskill.cpp b/server/src/game/gamecommands/setmainskill.cpp index aa2dd4f..a059afb 100644 --- a/server/src/game/gamecommands/setmainskill.cpp +++ b/server/src/game/gamecommands/setmainskill.cpp @@ -1,22 +1,22 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "main.h" diff --git a/server/src/game/gamecommands/setsubskill.cpp b/server/src/game/gamecommands/setsubskill.cpp index 27c0f75..42dbf9a 100644 --- a/server/src/game/gamecommands/setsubskill.cpp +++ b/server/src/game/gamecommands/setsubskill.cpp @@ -1,22 +1,22 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "main.h" diff --git a/server/src/game/gameserver.cpp b/server/src/game/gameserver.cpp index a450a8d..d83c47e 100644 --- a/server/src/game/gameserver.cpp +++ b/server/src/game/gameserver.cpp @@ -1,99 +1,98 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - - gameserver.cpp - main file of the gameserver - - MODIFIED: 31 Aug 2005 Akiko - REASON: - added modifications by "Sting" to get a running gameserver again - - added this header - MODIFIED: 28 Sep 2005 Akiko - REASON: - define for game server port - MODIFIED: 29 Sep 2005 Sting (modified by Akiko) - REASON: - configurable UDP port for testing - - tidied up/corrected packet sent with most character stats (character now has monk stats for testing) - MODIFIED: 27 Nov 2005 Akiko - REASON: - added Namikons fix (IPStringToDWord) - - added bluehrs packet fix - MODIFIED: 17 Dec 2005 bakkdoor - REASON: - Due the new structure for chatsystem, changed - HandleGameChat(Client, Packet); - to - Chat->HandleGameChat(Client, Packet); - - Also added ClientManager->addClientToList and ClientManager->deleteClientFromList() - (check Update() & FinalizeClient()) - MODIFIED: 18 Dec 2005 Namikon - REASON: - Fixed several small issues in the main-packet if-clause (sizeof(), etc) - MODIFIED: 21 Dec 2005 Namikon - REASON: - Fixed zoning (for now). The basic packet is broken somehow, still working on that - MODIFIED: 25 Dec 2005 Namikon - REASON: - Basepacket 1 and 2 fixed. (Thanks to MaxxJag!) - Zoning still works, same goes for skills/factions. - Not sure about quickbelt and inventory, but it seems to be ok - MODIFIED: 26 Dec 2005 Namikon - REASON: - Added doors - - Added support for Worlditem usage (Gogo/Genrep/Appitem/...) - MODIFIED: 01 Jan 2006 Namikon - REASON: - Changed FmtTxt() to sprintf(). It does... uhm, the same :D - - Added SetOnlineStatus to do instand updates when char is logging in - MODIFIED: 02 Jan 2006 Namikon - REASON: - Added debug output function - MODIFIED: 06 Jan 2006 Namikon - REASON: - Added color to console outputs - MODIFIED: 01 Jul 2006 hammag - REASON: - added set timeout to 10 msec (for ReadSetTCP select) in Start() - to avoid useless 100% CPU use - MODIFIED: 30 Jul 2006 hammag - REASON: - Fixed 0x13 0x03 0x1F message filters to enable other char than ID 1 to play ... :P - MODIFIED: 12 Aug 2006 hammag - REASON: - Fixed BuildCharPosUpdateMsg() to send correct characters orientation to other characters - MODIFIED: 26 Aug 2006 hammag - REASON: - removed use of GAME_PORT define as this info is available in Config object with a default value - MODIFIED: 17 Sep 2006 hammag - REASON: - Moved all UDP message management code to decoder classes - - Removed corresponding code from gameserver.cpp & .h - - MODIFIED: 03 Oct 2006 hammag - REASON: - Added some more DB cleanup when a char is deleted (still incomplete and will later be done in PChar::SQLDelete() ) - MODIFIED: 10 Dec 2006 Namikon - REASON: - Added new variable "mServerStartupTime". Holds the unix timestamp uppon startup. Required for @uptime - and other time-based stuff - - TODO: - - Deny login if char is already online (More information about the login procedure is necessary to do that) - - Take main loop timeout setting from config file - - Add Regex control to new char name validation - - Add Check of Char offline (and unloaded) before deleting (from the char choosing i/f) if multiple login allowed for the same account - - Check if adding to Client to Client manager shouldn't be done only one UDP connection done ? + gameserver.cpp - main file of the gameserver + + MODIFIED: 31 Aug 2005 Akiko + REASON: - added modifications by "Sting" to get a running gameserver again + - added this header + MODIFIED: 28 Sep 2005 Akiko + REASON: - define for game server port + MODIFIED: 29 Sep 2005 Sting (modified by Akiko) + REASON: - configurable UDP port for testing + - tidied up/corrected packet sent with most character stats (character now has monk stats for testing) + MODIFIED: 27 Nov 2005 Akiko + REASON: - added Namikons fix (IPStringToDWord) + - added bluehrs packet fix + MODIFIED: 17 Dec 2005 bakkdoor + REASON: - Due the new structure for chatsystem, changed HandleGameChat(Client, Packet); + to Chat->HandleGameChat(Client, Packet); + - Also added ClientManager->addClientToList and ClientManager->deleteClientFromList() + (check Update() & FinalizeClient()) + MODIFIED: 18 Dec 2005 Namikon + REASON: - Fixed several small issues in the main-packet if-clause (sizeof(), etc) + MODIFIED: 21 Dec 2005 Namikon + REASON: - Fixed zoning (for now). The basic packet is broken somehow, still working on that + MODIFIED: 25 Dec 2005 Namikon + REASON: - Basepacket 1 and 2 fixed. (Thanks to MaxxJag!) + - Zoning still works, same goes for skills/factions. + - Not sure about quickbelt and inventory, but it seems to be ok + MODIFIED: 26 Dec 2005 Namikon + REASON: - Added doors + - Added support for Worlditem usage (Gogo/Genrep/Appitem/...) + MODIFIED: 01 Jan 2006 Namikon + REASON: - Changed FmtTxt() to sprintf(). It does... uhm, the same :D + - Added SetOnlineStatus to do instand updates when char is logging in + MODIFIED: 02 Jan 2006 Namikon + REASON: - Added debug output function + MODIFIED: 06 Jan 2006 Namikon + REASON: - Added color to console outputs + MODIFIED: 01 Jul 2006 hammag + REASON: - added set timeout to 10 msec (for ReadSetTCP select) in Start() to avoid useless 100% CPU use + MODIFIED: 30 Jul 2006 hammag + REASON: - Fixed 0x13 0x03 0x1F message filters to enable other char than ID 1 to play ... :P + MODIFIED: 12 Aug 2006 hammag + REASON: - Fixed BuildCharPosUpdateMsg() to send correct characters orientation to other characters + MODIFIED: 26 Aug 2006 hammag + REASON: - removed use of GAME_PORT define as this info is available in Config object with a default value + MODIFIED: 17 Sep 2006 hammag + REASON: - Moved all UDP message management code to decoder classes + - Removed corresponding code from gameserver.cpp & .h + MODIFIED: 03 Oct 2006 hammag + REASON: - Added some more DB cleanup when a char is deleted (still incomplete and will later be done in PChar::SQLDelete() ) + MODIFIED: 10 Dec 2006 Namikon + REASON: - Added new variable "mServerStartupTime". Holds the unix timestamp uppon startup. Required for @uptime + and other time-based stuff + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - clean ups + + TODO: + - Deny login if char is already online (More information about the login procedure is necessary to do that) + - Take main loop timeout setting from config file + - Add Regex control to new char name validation + - Add Check of Char offline (and unloaded) before deleting (from the char choosing i/f) if multiple login + allowed for the same account + - Check if adding to Client to Client manager shouldn't be done only one UDP connection done ? => Risk of sending UDP chat on non-socket ???? */ #include "main.h" -#include "msgdecoder.h" -#include "msgbuilder.h" -#include "appartements.h" +#include "include/msgdecoder.h" +#include "include/msgbuilder.h" +#include "include/appartements.h" PGameServer::PGameServer() diff --git a/server/src/game/genreplist.cpp b/server/src/game/genreplist.cpp old mode 100755 new mode 100644 index f2fae95..956bb88 --- a/server/src/game/genreplist.cpp +++ b/server/src/game/genreplist.cpp @@ -1,35 +1,38 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - genreplist.cpp - classe for character genrep list - - MODIFIED: 20 Sep 2006 Hammag - REASON: - creation + genreplist.cpp - classe for character genrep list + MODIFIED: 20 Sep 2006 Hammag + REASON: - creation + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - clean ups */ #include "main.h" -#include "genreplist.h" + +#include "include/genreplist.h" PGenrepList::PGenrepList(u32 nOwnerCharID) { diff --git a/server/src/game/globals.cpp b/server/src/game/globals.cpp index fde68e8..4e28699 100644 --- a/server/src/game/globals.cpp +++ b/server/src/game/globals.cpp @@ -1,63 +1,71 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - globals.cpp - - MODIFIED: 12 September 2005 Akiko - REASON: - exchanged Pretender strings by TinNS - MODIFIED: 16 Dec 2005 bakkdoor - REASON: - Added global ClientManager and Chat Interface - MODIFIED: 22 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 25 Dec 2005 Namikon - REASON: - Added MySQL Support - - Fixed ShutdownTinns (Wont cause segmentation fault anymore) - MODIFIED: 06 Jan 2006 Namikon - REASON: - Added color to console outputs - - Added shiny and colored copyright box :D - MODIFIED: 22 Jul 2006 Hammag - REASON: - Added Server NOT NULL check to avoid segfault when shuting down during startup - MODIFIED: 27 Aug 2006 Hammag - REASON: - Implemented shared Config class use and config template to load conf. - Added gameserver configtemplate.h include, - Added new required parameters to Config->LoadOptions() - MODIFIED: 02 Oct 2006 Hammag - REASON: - Added gDevDebug global flag to control development debug outputs (flagged messaged, dump-flagged messes, dev console->print) - - TODO: - Get logfile name from config file + globals.cpp + + MODIFIED: 12 September 2005 Akiko + REASON: - exchanged Pretender strings by TinNS + MODIFIED: 16 Dec 2005 bakkdoor + REASON: - Added global ClientManager and Chat Interface + MODIFIED: 22 Dec 2005 Namikon + REASON: - Added GPL + MODIFIED: 25 Dec 2005 Namikon + REASON: - Added MySQL Support + - Fixed ShutdownTinns (Wont cause segmentation fault anymore) + MODIFIED: 06 Jan 2006 Namikon + REASON: - Added color to console outputs + - Added shiny and colored copyright box :D + MODIFIED: 22 Jul 2006 Hammag + REASON: - Added Server NOT NULL check to avoid segfault when shuting down during startup + MODIFIED: 27 Aug 2006 Hammag + REASON: - Implemented shared Config class use and config template to load conf. + - Added gameserver configtemplate.h include, + - Added new required parameters to Config->LoadOptions() + MODIFIED: 02 Oct 2006 Hammag + REASON: - Added gDevDebug global flag to control development debug outputs (flagged messaged, + dump-flagged messes, dev console->print) + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for buildsystem + - clean ups + + TODO: - Get logfile name from config file */ + #include "main.h" + #include "configtemplate.h" -#include "isc.h" +#include "include/isc.h" + +#include "include/msgbuilder.h" +#include "include/worlds.h" +#include "include/appartements.h" +#include "include/npc.h" +#include "include/subway.h" +#include "include/terminal.h" + +#include "include/version.h" -#include "msgbuilder.h" -#include "worlds.h" -#include "appartements.h" -#include "npc.h" -#include "subway.h" -#include "terminal.h" -#include "version.h" const char ServerVersion[] = TINNS_GAME_VERSION; const char SVNRevision[] = TINNS_SVN_REVISION; @@ -79,8 +87,8 @@ PWorldActors* WorldActors = 0; PNPCManager* NPCManager = 0; PSubway* Subway = 0; PTerminal* Terminal = 0; -PLuaEngine* LuaEngine = 0; -POutpost* Outposts = 0; +PLuaEngine* LuaEngine = 0; +POutpost* Outposts = 0; PMultiPart* MultiPartHandler = 0; //multi-user chat implementation @@ -153,7 +161,7 @@ bool InitTinNS() Worlds->LoadWorlds(); WorldActors = new PWorldActors(); - LuaEngine = new PLuaEngine(); + LuaEngine = new PLuaEngine(); NPCManager = new PNPCManager(); Appartements = new PAppartements; @@ -169,14 +177,14 @@ bool InitTinNS() Console->Print("%s Could not creat password_filter PCRE '%s'", Console->ColorText(RED, BLACK, "[Error]"), Config->GetOption("password_filter").c_str()); return false; } - + if (!PChar::SetCharnameRegexFilter(Config->GetOption("charname_filter").c_str())) { Console->Print("%s Could not creat charname_filter PCRE '%s'", Console->ColorText(RED, BLACK, "[Error]"), Config->GetOption("charname_filter").c_str()); return false; } Chars = new PChars(); - + ServerSock = new ServerSocket(); Server = new PServer(); GameServer = new PGameServer(); @@ -190,19 +198,19 @@ bool InitTinNS() ISC = new PISC(); Terminal = new PTerminal(); - - Outposts = new POutpost(); - - MultiPartHandler = new PMultiPart(); + + Outposts = new POutpost(); + + MultiPartHandler = new PMultiPart(); return true; } void Shutdown() -{ - if(MultiPartHandler) - delete MultiPartHandler; - if(Outposts) +{ + if(MultiPartHandler) + delete MultiPartHandler; + if(Outposts) delete Outposts; if(LuaEngine) delete LuaEngine; diff --git a/server/src/game/include/accounts.h b/server/src/game/include/accounts.h index 1acacb0..92c3402 100644 --- a/server/src/game/include/accounts.h +++ b/server/src/game/include/accounts.h @@ -32,6 +32,8 @@ REASON: - Added bool var for ingame debug outputs for administrators MODIFIED: 06 Jan 2005 Namikon REASON: - Added SetBannedStatus() to ban/unban an account (use SetBannedStatus(0) to unban a player) + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #ifndef ACCOUNTS_H @@ -41,7 +43,7 @@ #pragma once #endif -#include "regex++.h" +#include "common/regex++.h" /* 0 = unregistered user @@ -57,8 +59,8 @@ #define PAL_UNREGPLAYER 0 #define PAL_REGPLAYER 1 #define PAL_VOLUNTEER 30 // Special Rank: 50/50 -#define PAL_GM 50 // Special Rank: 120/120 -#define PAL_ADMIN 100 // Special Rank: 127/127 +#define PAL_GM 50 // Special Rank: 120/120 +#define PAL_ADMIN 100 // Special Rank: 127/127 // Max number of char slots per account #define MAX_CHARS_PER_ACCOUNT 4 @@ -75,7 +77,7 @@ enum PAccountStatus PAS_ONLINE = 1, PAS_BANNED = 2 }; - + class PAccount { private : @@ -88,11 +90,11 @@ class PAccount a_status, a_bandate }; - + // static members static RegEx* mUsernameRegexFilter; static RegEx* mPasswordRegexFilter; - + // instance members u32 mID; std::string mName; @@ -103,17 +105,17 @@ class PAccount bool LoadFromQuery(char* query); bool DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key, char* ClearPassword); - + public : PAccount(); PAccount(const u32 AccountId); PAccount(const char *Username); - + static bool SetUsernameRegexFilter(const char* RegexStr); static bool SetPasswordRegexFilter(const char* RegexStr); static bool IsUsernameWellFormed(const char *Username); static bool IsPasswordWellFormed(const char *Password); - + inline u32 GetID() const { return mID; } bool SetName(const std::string &Pass); inline const std::string &GetName() const { return mName; } @@ -131,7 +133,7 @@ class PAccount bool Authenticate(const u8* PasswordData, int PassLen, const u8 *Key); bool Authenticate(const char *Password) const; - + bool Create(); bool Save(bool CreateMode = false); diff --git a/server/src/game/include/chars.h b/server/src/game/include/chars.h index 428591a..e3e42d5 100644 --- a/server/src/game/include/chars.h +++ b/server/src/game/include/chars.h @@ -1,49 +1,52 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - chars.h - this is the main file with the main function - - Authors: - - Namikon - - MODIFIED: 22 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 01 Jan 2006 Namikon - REASON: - Added SQLLoad() function to PChar and PChars - - Added enum for charlist SQL Database - - Added IsOnline var and inline func for Onlinestatus of char - MODIFIED: 26 Jul 2006 Namikon - REASON: - Added Health/MaxHealth, idem for Mana & Stamin - TODO: - fix real current Health vs MaxHealth, also in char load/save - - MODIFIED: 03 Oct 2006 Hammag - REASON: - PChar::CreateNewChar() and moved effective char creation from PChars to PChar - - added PChar::SQLDelete() - This method is put here because we want the char to be loaded when deleted from DB to avoid - any player to use it at the same time. - - added use of auto_save_period config option in PChars::update() - + chars.h - this is the main file with the main function + + Authors: + - Namikon + - Akiko + + MODIFIED: 22 Dec 2005 Namikon + REASON: - Added GPL + MODIFIED: 01 Jan 2006 Namikon + REASON: - Added SQLLoad() function to PChar and PChars + - Added enum for charlist SQL Database + - Added IsOnline var and inline func for Onlinestatus of char + MODIFIED: 26 Jul 2006 Namikon + REASON: - Added Health/MaxHealth, idem for Mana & Stamin + TODO: - fix real current Health vs MaxHealth, also in char load/save + + MODIFIED: 03 Oct 2006 Hammag + REASON: - PChar::CreateNewChar() and moved effective char creation from PChars to PChar + - added PChar::SQLDelete() + This method is put here because we want the char to be loaded when deleted from DB to avoid + any player to use it at the same time. + - added use of auto_save_period config option in PChars::update() + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new build system + - clean ups */ #ifndef CHARS_H @@ -58,7 +61,7 @@ #include "inventory.h" #include "buddylist.h" #include "genreplist.h" -#include "regex++.h" +#include "common/regex++.h" class PVhcAccessRequestList; enum PSeatType @@ -96,7 +99,7 @@ class PCharCoordinates //inline PCharCoordinates() { mX = mY = mZ = mUD = mLR = mAct = mUnknown = mJumpingState = 0;} void SetPosition( u16 nY, u16 nZ, u16 nX, u8 nUD = 0x80, u8 nLR = 0 ); void SetInterpolate( PCharCoordinates& Pos1, PCharCoordinates& Pos2, f32 nCoef ); - + //Temp u16 minPos[3]; u16 maxPos[3]; @@ -108,7 +111,7 @@ class PChar private : // static members static RegEx* mCharnameRegexFilter; - + // instance members u32 mID; u32 mAccount; @@ -173,9 +176,9 @@ class PChar u16 mLookingAt; // Zone charID of currently targeted player std::time_t mLookAtTimestamp; // Lifetimer of lookat var - u32 mLastUsedWorldObjectId; // Last world object clicked on - - u8 mClanLevel; // 1-15 + u32 mLastUsedWorldObjectId; // Last world object clicked on + + u8 mClanLevel; // 1-15 u16 mClanID; bool mIsOnline; @@ -261,8 +264,8 @@ class PChar inline u32 GetCash() const { return mCash; } u32 SetCash( u32 nCash ); // Does return the new cashvalue, NO udpmessage is sent out!! - u32 AddCash( u32 nAmount ); - u32 TakeCash( u32 nAmount ); + u32 AddCash( u32 nAmount ); + u32 TakeCash( u32 nAmount ); inline u32 GetBaseApartment() const { return mPrimaryApt; } @@ -277,9 +280,9 @@ class PChar inline void SetDialogNode( u16 nNode ) { mCurrentDialogNode = nNode; }; inline u16 GetDialogNode() const { return mCurrentDialogNode; }; - - inline u8 GetClanLevel() const { return mClanLevel; }; - inline u16 GetClan() const { return mClanID; }; + + inline u8 GetClanLevel() const { return mClanLevel; }; + inline u16 GetClan() const { return mClanID; }; void LoadClanLevel(); inline s8 GetSoullight() const { return mSoullight; } diff --git a/server/src/game/include/commands.h b/server/src/game/include/commands.h index c4f1b15..16b6ced 100644 --- a/server/src/game/include/commands.h +++ b/server/src/game/include/commands.h @@ -110,8 +110,8 @@ private: void doCmdeditactor(); void doCmdweather(); void doCmdSetMainSkill(); - void doCmdSetSubSkill(); - void doNPC(); + void doCmdSetSubSkill(); + void doNPC(); void doNPC_Shop(); void doCmdtest(); diff --git a/server/src/game/include/container.h b/server/src/game/include/container.h index 08cec1e..aae6f87 100644 --- a/server/src/game/include/container.h +++ b/server/src/game/include/container.h @@ -22,7 +22,7 @@ /* container.h - base classe for containers - + MODIFIED: 28 Jul 2008 Hammag REASON: - creation @@ -41,9 +41,9 @@ class PContainerEntry friend class PContainer; friend class PContainer2D; friend class PMsgBuilder; - + friend class PContainer2DWorkaround; - + private: enum { i_invid = 0, @@ -52,26 +52,26 @@ class PContainerEntry i_x, i_y, i_itemid, - //i_type, - i_flag, - i_qty, - i_sqty, + //i_type, + i_flag, + i_qty, + i_sqty, i_curdur, i_dmg, i_freq, i_hand, i_rng, - i_maxdur, - i_slots, - i_slt1, - i_slt2, - i_slt3, - i_slt4, - i_slt5, - i_atype, - i_conatin + i_maxdur, + i_slots, + i_slt1, + i_slt2, + i_slt3, + i_slt4, + i_slt5, + i_atype, + i_conatin }; - + PItem* mItem; u8 mPosX; u8 mPosY; @@ -80,22 +80,22 @@ class PContainerEntry PContainerEntry(PItem* nItem, u8 X, u8 Y, u32 nInvID = 0, bool SetDirty = true); PContainerEntry(MYSQL_ROW row); - + bool SQLSave(u32 CharID, u32 InvLoc); bool SQLDelete(); - + inline void Set2DPos(u8 nPosX, u8 nPosY) { mDirtyFlag = mDirtyFlag || (mPosX != nPosX) || (mPosY != nPosY) ; mPosX = nPosX; mPosY = nPosY; } - + public: ~PContainerEntry(); - + inline void Get2DPos(u8* oPosX, u8* oPosY) { *oPosX = mPosX; *oPosY = mPosY; } }; class PContainer // Holes allowed, no autofind free slots -{ +{ protected: u8 mMaxSlots; std::vector< PContainerEntry* >* mContContent; @@ -103,48 +103,48 @@ class PContainer // Holes allowed, no autofind free slots u32 mInvLoc; u32 mExclusiveUseCharID; bool mDirtyFlag; - + inline bool IsSlotAllowed(u8 nSlotId) { return ((nSlotId < CONTAINER_MAX_SIZE) && (!mMaxSlots || (nSlotId < mMaxSlots))); } virtual bool AddEntry(PContainerEntry* NewEntry, u8 nSlotId = 0); virtual PContainerEntry* RemoveEntry(u8 nSlotId); virtual bool GetFreeSlot(u8* nSlotId); void Compact(u8 startSlotId = 0); - + public: PContainer(u8 nMaxSlots = 0); virtual ~PContainer(); inline void SetInfo(u32 CharID, u32 InvLoc) { mCharID = CharID; mInvLoc = InvLoc; } inline u32 GetOwnerId() { return mCharID; } - + inline bool IsDirty() { return mDirtyFlag; } inline void SetDirty() { mDirtyFlag = true; } - + bool StartUse(u32 nExclusiveUseCharID = 0); virtual bool EndUse(u32 nExclusiveUseCharID = 0); bool SQLLoad(); bool SQLSave(); - + bool IsSlotFree(u8 nSlotId); virtual bool AddItem(PItem* NewItem, u32 nInvID = 0, u8 nPosX = 0, u8 nPosY = 0, bool SetDirty = true); - + virtual bool MoveItem(u8 srcSlotId, u8 nCount, u8 dstSlotId); bool MoveItem(u8 srcSlotId, u8 nCount, PContainer* dstContainer, u8 dstSlotId = 0, u8 nPosX = 0, u8 nPosY = 0); virtual void SetEntryPosXY(PContainerEntry* nEntry, u8 nSlotId, u8 nPosX = 0, u8 nPosY = 0); virtual u8 RandomFill(u8 nItemCount = 0, int nItemContainerDefIndex = -1); - + PContainerEntry* GetEntry(u8 nSlotId); std::vector< PContainerEntry* >* GetEntries(); PItem* GetItem(u8 nSlotId); - + virtual void Dump(); }; class PContainerWithHoles : public PContainer // Holes allowed, no autofind free slots -{ +{ public: PContainerWithHoles(u8 nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; } virtual ~PContainerWithHoles() {} @@ -156,17 +156,17 @@ class PContainerAutoCompact : public PContainer // No holes allowed, automatic a protected: virtual PContainerEntry* RemoveEntry(u8 nSlotId); virtual bool GetFreeSlot(u8* nSlotId); - + public: PContainerAutoCompact(u8 nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; } virtual ~PContainerAutoCompact() {} - - virtual bool MoveItem(u8 srcSlotId, u8 nCount, u8 dstSlotId); + + virtual bool MoveItem(u8 srcSlotId, u8 nCount, u8 dstSlotId); }; class PContainer2D : public PContainerAutoCompact // + slotId not used, non-significant XY used (no XY check yet) -{ +{ public: PContainer2D(u8 nMaxSlots = 0) : PContainerAutoCompact(nMaxSlots){ nMaxSlots = nMaxSlots; } virtual ~PContainer2D() {} @@ -182,28 +182,28 @@ class PContainer2DWorkaround : public PContainerWithHoles // Holes allowed, auto u8 mMaxCols; u8 mMaxRows; u8 mRows; - + void AddRow(); - + inline bool Is2DPosAllowed(u8 PosX, u8 PosY, u8 SizeX, u8 SizeY) { return ((PosX < mMaxCols-SizeX+1) && (PosY < mMaxRows-SizeY+1)); } bool Is2DFree(u8 PosX, u8 PosY, u8 SizeX, u8 SizeY); bool FindValid2DPos(PContainerEntry* nEntry); - + protected: bool AddEntry(PContainerEntry* NewEntry, u8 nSlotId = 0); PContainerEntry* RemoveEntry(u8 nSlotId); bool GetFreeSlot(u8* nSlotId); - + public: PContainer2DWorkaround(u8 nMaxSlots = 0); ~PContainer2DWorkaround(); - + bool MoveItem(u8 srcSlotId, u8 nCount, u8 dstSlotId); - + void Set2DPosMax(u8 MaxPosX, u8 MaxPosY = 254) { mMaxCols = MaxPosX; mMaxRows = MaxPosY; } void SetEntryPosXY(PContainerEntry* nEntry, u8 nSlotId, u8 nPosX = 0, u8 nPosY = 0); void SetUsed(PContainerEntry* nEntry, bool Value = true); @@ -214,19 +214,19 @@ class PContainerAutoFindFree : public PContainerWithHoles // No holes kept after { protected: virtual bool GetFreeSlot(u8* nSlotId); - + public: PContainerAutoFindFree(u8 nMaxSlots = 0) : PContainerWithHoles(nMaxSlots){ nMaxSlots = nMaxSlots; } virtual ~PContainerAutoFindFree() {} }; class PContainerAutoCompactOnClose : public PContainerAutoFindFree // No holes kept after EndUse, automatic find first free slots (no control on insertion slot) -{ +{ public: PContainerAutoCompactOnClose(u8 nMaxSlots = 0) : PContainerAutoFindFree(nMaxSlots){ nMaxSlots = nMaxSlots; } virtual ~PContainerAutoCompactOnClose() {} virtual bool EndUse(u32 nExclusiveUseCharID = 0); -}; +}; #endif diff --git a/server/src/game/include/def_appartements.h b/server/src/game/include/def_appartements.h old mode 100755 new mode 100644 diff --git a/server/src/game/include/def_drugs.h b/server/src/game/include/def_drugs.h index 25f446f..17c80c6 100644 --- a/server/src/game/include/def_drugs.h +++ b/server/src/game/include/def_drugs.h @@ -34,13 +34,13 @@ class PDefDrug : public PDef { protected : //int mIndex; - int mType; - //int mUseSound; - int mDuration; - int mChangeNum; + int mType; + //int mUseSound; + int mDuration; + int mChangeNum; int mChangeType[8]; // 1: bonus, 2:malus, ... other ? float mChangeScale[8]; - int mChangeTarget[8]; + int mChangeTarget[8]; public : PDefDrug(); @@ -49,7 +49,7 @@ class PDefDrug : public PDef bool LoadFromDef( PTokenList *Tokens ); inline int GetType() const { return mType; } - inline int GetDuration() const { return mDuration; } + inline int GetDuration() const { return mDuration; } inline int GetChangeNum() const { return mChangeNum; } inline int GetChangeType( int nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < mChangeNum ) ) ? mChangeType[nIdx] : 0 ) ; } inline float GetChangeScale( int nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < mChangeNum ) ) ? mChangeScale[nIdx] : 0 ) ; } diff --git a/server/src/game/include/def_items.h b/server/src/game/include/def_items.h index f21c735..88db9b9 100644 --- a/server/src/game/include/def_items.h +++ b/server/src/game/include/def_items.h @@ -26,7 +26,7 @@ MODIFIED: 25 Dec 2005 Namikon REASON: - Added GPL - + MODIFIED: 10 Jul Hammag REASON: - Full Item Def implementation */ @@ -50,14 +50,14 @@ class PDefItems : public PDef // int mBmNum; // used IG for inventory display // int mmBmNumIndex; // used IG for inventory display int mSizeX; - int mSizeY; + int mSizeY; // int mSmallbmnum; // used IG for inventory display float mWeight; int mStackable; float mFillWeight; int mQualifier; int mGfxMods; - int mItemGroupID; + int mItemGroupID; int mTextDescID; int mBasePrice; int mTechlevel; @@ -83,7 +83,7 @@ class PDefItems : public PDef inline float GetFillWeight() const { return mFillWeight; } inline int GetQualifier() const { return mQualifier; } inline int GetGfxMods() const { return mGfxMods; } - inline int GetItemGroupID() const { return mItemGroupID; } + inline int GetItemGroupID() const { return mItemGroupID; } inline int GetTextDescID() const { return mTextDescID; } inline int GetBasePrice() const { return mBasePrice; } inline int GetTechlevel() const { return mTechlevel; } @@ -108,8 +108,8 @@ class PDefItemsMap : public PDefMap const PDefItems* GetDefBySeqIndex( int nSeqIndex ) const; int GetRandomItemIdFromGroup( int nGroupId ) const; - inline std::map::const_iterator ConstIteratorBegin() const { return mDefs.begin(); } - inline std::map::const_iterator ConstIteratorEnd() const { return mDefs.end(); } + inline std::map::const_iterator ConstIteratorBegin() const { return mDefs.begin(); } + inline std::map::const_iterator ConstIteratorEnd() const { return mDefs.end(); } }; #endif diff --git a/server/src/game/include/def_npc.h b/server/src/game/include/def_npc.h index 7edc88d..e3b3069 100644 --- a/server/src/game/include/def_npc.h +++ b/server/src/game/include/def_npc.h @@ -50,14 +50,14 @@ class PDefNpc : public PDef float mModelScaling; // 0 - 0.9 int mMoneyLoose; // 0 - 190 float mSkillScale; // 0 - 120 - std::string mStandardScript; + std::string mStandardScript; std::string mStandardParameter; int mMass; // 1 - 10000 //int mStartHour; // not used //int mEndHour; // not used //std::string mTempScript; // not used int mFlags; // values: 513, 259, 256, 128, 64, 48, 35, 34, 33, 32, 2, 1, 0 - + public : PDefNpc(); //~PDefNpc(); diff --git a/server/src/game/include/def_respawn.h b/server/src/game/include/def_respawn.h old mode 100755 new mode 100644 diff --git a/server/src/game/include/def_scripts.h b/server/src/game/include/def_scripts.h index 5a9bf23..04bc0b5 100644 --- a/server/src/game/include/def_scripts.h +++ b/server/src/game/include/def_scripts.h @@ -1,62 +1,62 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - def_scripts.h - - CREATED: 12 Oct 2009 Namikon -*/ - -#ifndef DEF_SCRIPTS_H -#define DEF_SCRIPTS_H - -#include "def.h" - -class PDefScripts : public PDef -{ - private : - //int mIndex; - std::string mIdentifier; - std::string mLuaFile; - std::string mScriptHeader; - - public : - PDefScripts(); - //~PDefWeapon(); - - bool LoadFromDef( PTokenList *Tokens ); - - inline const std::string &GetIdentifier() const { return mIdentifier; } - inline const std::string &GetLuaFile() const { return mLuaFile; } - inline const std::string &GetScriptHeader() const { return mScriptHeader; } -}; - -class PDefScriptsMap : public PDefMap -{ - public: - //bool Load(const char* nName, const char* nFilename); - inline std::map::const_iterator ConstIteratorBegin() const { return mDefs.begin(); } - inline std::map::const_iterator ConstIteratorEnd() const { return mDefs.end(); } -}; - -#endif +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + + +/* + def_scripts.h + + CREATED: 12 Oct 2009 Namikon +*/ + +#ifndef DEF_SCRIPTS_H +#define DEF_SCRIPTS_H + +#include "def.h" + +class PDefScripts : public PDef +{ + private : + //int mIndex; + std::string mIdentifier; + std::string mLuaFile; + std::string mScriptHeader; + + public : + PDefScripts(); + //~PDefWeapon(); + + bool LoadFromDef( PTokenList *Tokens ); + + inline const std::string &GetIdentifier() const { return mIdentifier; } + inline const std::string &GetLuaFile() const { return mLuaFile; } + inline const std::string &GetScriptHeader() const { return mScriptHeader; } +}; + +class PDefScriptsMap : public PDefMap +{ + public: + //bool Load(const char* nName, const char* nFilename); + inline std::map::const_iterator ConstIteratorBegin() const { return mDefs.begin(); } + inline std::map::const_iterator ConstIteratorEnd() const { return mDefs.end(); } +}; + +#endif diff --git a/server/src/game/include/def_worldfile.h b/server/src/game/include/def_worldfile.h old mode 100755 new mode 100644 diff --git a/server/src/game/include/defs.h b/server/src/game/include/defs.h old mode 100755 new mode 100644 index 9f644c7..64bb6ed --- a/server/src/game/include/defs.h +++ b/server/src/game/include/defs.h @@ -23,10 +23,10 @@ /* defs.h - include file for all def_* files related stuff used by all modules - + MODIFIED: 21 Sep 2006 Hammag REASON: - created - + */ #ifndef DEFS_H @@ -70,12 +70,9 @@ #include "def_worlds.h" #include "def_worldfile.h" #include "def_worldmodels.h" - #include "def_scripts.h" #include "gamedefs.h" -using namespace std; - #endif diff --git a/server/src/game/include/doortemplate.h b/server/src/game/include/doortemplate.h old mode 100755 new mode 100644 diff --git a/server/src/game/include/furnituretemplate.h b/server/src/game/include/furnituretemplate.h old mode 100755 new mode 100644 diff --git a/server/src/game/include/gamedefs.h b/server/src/game/include/gamedefs.h old mode 100755 new mode 100644 index 486caee..32f221e --- a/server/src/game/include/gamedefs.h +++ b/server/src/game/include/gamedefs.h @@ -124,7 +124,6 @@ class PGameDefs PDefWorldsMap mWorldsDefs; PDefWorldFilesMap mWorldFilesDefs; PDefWorldModelsMap mWorldModelsDefs; - PDefScriptsMap mScriptDefs; // ___Add new entries here___ @@ -169,7 +168,6 @@ class PGameDefs inline const PDefWorldsMap* Worlds() const { return &mWorldsDefs; } inline const PDefWorldFilesMap* WorldFiles() const { return &mWorldFilesDefs; } inline const PDefWorldModelsMap* WorldModels() const { return &mWorldModelsDefs; } - inline const PDefScriptsMap* Scripts() const { return &mScriptDefs; } // ___Add new entries here___ diff --git a/server/src/game/include/globals.h b/server/src/game/include/globals.h index 04b730a..634f328 100644 --- a/server/src/game/include/globals.h +++ b/server/src/game/include/globals.h @@ -62,9 +62,9 @@ extern class PClientManager *ClientManager; extern class PNPCManager* NPCManager; extern class PChat *Chat; extern class PCommands *GameCommands; - -extern class POutpost *Outposts; -extern class PMultiPart *MultiPartHandler; + +extern class POutpost *Outposts; +extern class PMultiPart *MultiPartHandler; // Development debug output control extern bool gDevDebug; diff --git a/server/src/game/include/lua_engine.h b/server/src/game/include/lua_engine.h index 719019a..0d4e146 100644 --- a/server/src/game/include/lua_engine.h +++ b/server/src/game/include/lua_engine.h @@ -1,77 +1,77 @@ -/* -TinNS (TinNS is not a Neocron Server) -Copyright (C) 2005 Linux Addicted Community -maintainer Akiko - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. -*/ - -/* - -lua_engine.h - TinNS Lua engine for processing NPC scripts - -CREATION: 13 Oct 2009 Namikon - -*/ - -#ifndef PLUA_H -#define PLUA_H - -extern "C" { - #include - #include - #include -} - -#define PLUAENGINE_DEFAULT 0 -#define PLUAENGINE_GETANSWER 4096 -#define PLUAENGINE_EXECUTENODE 8192 - -class PLuaEngine -{ - private: - PClient* mTargetClient; - - bool mRunning; - lua_State *mLua; - - std::vector mReturnValues; - - - // Return Values - int mReturn_INT; -// std::string mReturn_STR; - // add more if needed... - - void CleanUp(); - bool ExecuteScript(std::string nLUAScript, int nNode, int nDialogClass = 0); - - public: - PLuaEngine(); - ~PLuaEngine(); - - // To check if LUA Script has syntax errors or whatever - bool CheckLUAFile(std::string nLUAScript); - void AddScriptResult(int nResult); - void ProcessDialogScript(PClient* nClient, std::string mLUAFile, int nAnswer); - inline PClient* GetBoundClient() { return mTargetClient; }; - - inline void SetReturnINT(int nValue) { mReturn_INT = nValue; }; - // inline void SetReturnSTR(std::string nValue) { mReturn_STR = nValue; }; -}; - - -#endif +/* +TinNS (TinNS is not a Neocron Server) +Copyright (C) 2005 Linux Addicted Community +maintainer Akiko + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. +*/ + +/* + +lua_engine.h - TinNS Lua engine for processing NPC scripts + +CREATION: 13 Oct 2009 Namikon + +*/ + +#ifndef PLUA_H +#define PLUA_H + +extern "C" { + #include + #include + #include +} + +#define PLUAENGINE_DEFAULT 0 +#define PLUAENGINE_GETANSWER 4096 +#define PLUAENGINE_EXECUTENODE 8192 + +class PLuaEngine +{ + private: + PClient* mTargetClient; + + bool mRunning; + lua_State *mLua; + + std::vector mReturnValues; + + + // Return Values + int mReturn_INT; +// std::string mReturn_STR; + // add more if needed... + + void CleanUp(); + bool ExecuteScript(std::string nLUAScript, int nNode, int nDialogClass = 0); + + public: + PLuaEngine(); + ~PLuaEngine(); + + // To check if LUA Script has syntax errors or whatever + bool CheckLUAFile(std::string nLUAScript); + void AddScriptResult(int nResult); + void ProcessDialogScript(PClient* nClient, std::string mLUAFile, int nAnswer); + inline PClient* GetBoundClient() { return mTargetClient; }; + + inline void SetReturnINT(int nValue) { mReturn_INT = nValue; }; + // inline void SetReturnSTR(std::string nValue) { mReturn_STR = nValue; }; +}; + + +#endif diff --git a/server/src/game/include/msgbuilder.h b/server/src/game/include/msgbuilder.h index d8410c0..eed5da4 100644 --- a/server/src/game/include/msgbuilder.h +++ b/server/src/game/include/msgbuilder.h @@ -79,7 +79,7 @@ public: // Temp. NPC update message for testing PMessage* BuildNpcDeathMsg( PClient* nClient, u32 nNpcId, u8 unknown1 = 0x4a, u8 npcAction = 0x1e ); - PMessage* BuildNPCMassInfoMsg( u32 nWorldID, u16 nTypeID, u16 nClothing, u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nHealth, u16 nTraderID, string* nAngleStr, string* nNpcName, string* nCustomName); + PMessage* BuildNPCMassInfoMsg( u32 nWorldID, u16 nTypeID, u16 nClothing, u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nHealth, u16 nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName); PMessage* BuildNPCMassAliveMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction ); PMessage* BuildNPCMassUpdateMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction ); // Moved here since its a zone broadcast! @@ -91,20 +91,20 @@ public: PMessage* BuildTryAccessAnswerMsg(PClient* nClient, char *nArea, bool nAllowed); PMessage* BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nResultBuffer, std::string* nCommandName, u16 nNumRows, u16 nNumFields); PMessage* BuildYouGotEmailsMsg( PClient* nClient, u8 nMailCount ); - - PMessage* BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID, string* nDialogScript ); + + PMessage* BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID, std::string *nDialogScript ); PMessage* BuildNPCDialogReplyMsg( PClient* nClient, u16 nNextNode, std::vector*nResultBuffer); - PMessage* BuildReqNPCScriptAnswerMsg( u32 nInfoId, string* nNPCScript ); + PMessage* BuildReqNPCScriptAnswerMsg( u32 nInfoId, std::string *nNPCScript ); PMessage* BuildNPCShoppingListMsg( PClient* nClient, PMessage* nContentList, int nWorldID, u8 nItemQuality); PMessage* BuildNPCBeginAllBuyerTradeMsg( PClient* nClient, int nWorldID ); - - PMessage* BuildNPCSingleInfoMsg( PClient* nClient, u32 nWorldID, u16 nTypeID, u16 nClothing, u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nHealth, u16 nTraderID, string* nAngleStr, string* nNpcName, string* nCustomName); + + PMessage* BuildNPCSingleInfoMsg( PClient* nClient, u32 nWorldID, u16 nTypeID, u16 nClothing, u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nHealth, u16 nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName); PMessage* BuildNPCSingleAliveMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction ); PMessage* BuildNPCSingleUpdateMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction ); - + // NEW for testing. Combined update message PMessage* BuildNPCUpdateMsg(u32 nWorldID, u16 nPosY, u16 nPosZ, u16 nPosX, u8 nActionBM, u16 nHealth, u8 nWeaponState, u8 nUnknown, u32 nTargetID = 0); - + PMessage* BuildReqInfoAnswerMsg( PClient* nClient, u16 nReqType, u32 nInfoId, void* nResponse, u16 nResponseLength ); PMessage* BuildPacket0Msg( PClient* nClient ); diff --git a/server/src/game/include/multipart.h b/server/src/game/include/multipart.h index 7b52e52..10f16fd 100644 --- a/server/src/game/include/multipart.h +++ b/server/src/game/include/multipart.h @@ -40,7 +40,7 @@ typedef struct // A single chunk of any multipart sequence PMessage* smChunk; } s_MessageChunk; -typedef vector vecMsgChunk; // The vector of an specific multipart sequence, containing all chunks +typedef std::vector vecMsgChunk; // The vector of an specific multipart sequence, containing all chunks typedef struct { time_t smTimeStamp; // To keep track of sequence's lifetimer @@ -49,7 +49,7 @@ typedef struct PClient *smClient; // Required to call terminal class } s_SequenceEntry; -typedef map PMultipartMap; // Map of all vectors, indexed by sequencenumber +typedef std::map PMultipartMap; // Map of all vectors, indexed by sequencenumber class PMultiPart @@ -76,4 +76,4 @@ class PMultiPart void AddMultiPartChunk(PClient *nClient, PMessage *nChunk, u16 nChunkNumber, u16 nChunkTotal, u8 nSequence); }; -#endif \ No newline at end of file +#endif diff --git a/server/src/game/include/npc.h b/server/src/game/include/npc.h index 9177ef7..1f254c3 100644 --- a/server/src/game/include/npc.h +++ b/server/src/game/include/npc.h @@ -32,17 +32,17 @@ #ifndef NPC_H #define NPC_H - + // Healthfactor for NPCs (see old npc.def) #define NPC_HEALTHFACTOR 15 - + // Minimum time in seconds that has to pass before an NPC // gets his heartbeat send #define NPC_HEARTBEAT_MIN 5 // Maximum time in seconds that is allowed to pass without // an NPC heartbeat #define NPC_HEARTBEAT_MAX 20 - + // If no custom NPC is set in this Zone, what ID to start with? #define NEW_NPC_ZONEID_START 1000 @@ -56,10 +56,10 @@ // How many seconds have to pass until we need an NPC "keepalive" packet? #define NPC_ALIVE_MSG 15 - + // How often a NPC should check if an enemy is nearby? #define NPC_ENEMYCHECK 5 - + #define NPC_ACTIONSTATE_SITGND 0x00 #define NPC_ACTIONSTATE_ATTACK 0x01 //#define NPC_ACTIONSTATE_? 0x02 @@ -69,24 +69,24 @@ #define NPC_ACTIONSTATE_PASSIVE 0x20 #define NPC_ACTIONSTATE_IDLE 0x40 #define NPC_ACTIONSTATE_DEATH 0x80 - + #define NPC_SHOOT_IDLE 15 #define NPC_SHOOT_SINGLE 16 #define NPC_SHOOT_AUTO1 17 #define NPC_SHOOT_AUTO2 18 - + class PNPC; class PNPCWorld; typedef std::map PNPCMap; typedef std::map PNPCWorldMap; - + typedef struct { u16 ItemID; u32 Price; } stShopListEntry; - + class PNPC { private: @@ -112,7 +112,7 @@ private: npc_shop_quality, npc_scripting }; - + std::time_t mNextUpdate; // Timestamp for next heartbeat std::time_t mNextEnemyCheck; // Timestamp for next enemycheck inline void PushUpdateTimer() { mNextUpdate = std::time(NULL) + GetRandom(NPC_HEARTBEAT_MAX, NPC_HEARTBEAT_MIN); }; @@ -131,14 +131,14 @@ private: u16 mTrader; u8 mItemQuality; // Used for Shopping stuff u8 mUnknown; - + std::string mDialogScript; std::string mLUAFile; // Load File; Preloaded uppon NPC creation - + std::vector mVectItemsInShop; // We need to keep track of the itemorder for shopping void AddToVectorList(u16 nItemID, u32 nPrice); inline const stShopListEntry* GetItemNum(u32 nIdx) const { if(nIdx > mVectItemsInShop.size()) { return NULL; } else { return &mVectItemsInShop[nIdx]; }}; - + bool mScripting; // Manual override to disable scripting for an NPC TRUE: Scripts will be executed FALSE: Scripts will be ignored std::string mName; @@ -159,9 +159,9 @@ private: // WorldID Fix 10.10.2009 bool mFromDEF; // to differ DEF NPCs from SQL NPCs bool mSuccess; // NPC load successfull? - + - u8 mAction; // Current action + u8 mAction; // Current action inline u8 GetActionStatus() const { return mAction; }; // 00000001 ( 1) 0x01: Attack-Mode (Depends on WeaponStatus) // 00000010 ( 2) 0x02: ? @@ -171,40 +171,40 @@ private: // 00100000 ( 32) 0x20: Passive-Mode (Depends on WeaponStatus. Difference between 0x01: NPC does NOT open fire) // 01000000 ( 64) 0x40: Idle // 10000000 (128) 0x80: Die - + u8 mWeaponStatus; inline u8 GetWeaponStatus() const { return mWeaponStatus; }; // 00001111 (15) 0x0F: Follow given target with eyes / Put weapon away if pulled // 00010000 (16) 0x10: Pull weapon if not pulled / If pulled, attack // 00010001 (17) 0x11: Pull weapon and attack - + bool SQL_Load(); bool DEF_Load(u32 nWorldID); - - PNPC( int nSQLID ); + + PNPC( int nSQLID ); PNPC( int nDEFID, u32 nWorldID ); - ~PNPC(); - + ~PNPC(); + void InitVars(); void ContentListAddItem(PMessage* nContentList, u16 nItemID, u32 nBasePrice = 0, bool nAddToList = true); void ContentListAddItemGroup(PMessage* nContentList, u32 nItemGroupID); void StartDialog( PClient* nClient/*, string &nDialogscript */); - + bool DoSQLShoppingList( PClient* nClient, PMessage* nContentList ); bool HasSQLShoppingList( PClient* nClient ); bool IsAllbuyer( PClient* nClient ); bool LoadLUAScript(); - + inline u32 GetRealWorldID() { if(mFromDEF == true) return mWorldID+255; else return mWorldID; }; public: friend class PNPCWorld; - + inline void StopAttack() { mDirty = true; mAction = NPC_ACTIONSTATE_IDLE; mWeaponStatus = NPC_SHOOT_IDLE; }; inline void Attack( PClient* nClient, u8 nType = NPC_SHOOT_SINGLE, u8 nUnknown = 90 ) { Attack(nClient->GetChar()->GetID(), nType, nUnknown); }; void Attack( u32 nWorldID, u8 nType = NPC_SHOOT_SINGLE, u8 nUnknown = 90 ); - + inline void Move( u16 nNewX, u16 nNewY, u16 nNewZ ) { mPosX = nNewX; @@ -217,7 +217,7 @@ public: void Update(); // Check respawn timer void StartConversation( PClient* nClient ); void DoConversation( PClient* nClient, u8 nAnswer ) ; - + // GameCommands bool ReloadLUAScript(); bool ReloadShopList(); @@ -265,14 +265,14 @@ private: bool LoadNPCfromSQL(); bool LoadNPCfromDEF(); - + void BroadcastNewNPC(PNPC* nNpc); void CheckForEnemies(PNPC* nNPC); public: friend class PNPCManager; - PNPC* GetNPC( u32 nNPCID ); - + PNPC* GetNPC( u32 nNPCID ); + // Functions to add/remove an NPC while server is running void SendSingleNPCInfo( PClient* nClient, PNPC* nNpc ); // Send bool AddNPC(u32 nSQL_ID, u32 nRaw_ID); // Load single SQL NPC from given SQL ID diff --git a/server/src/game/include/npctemplate.h b/server/src/game/include/npctemplate.h index 7c14a54..c90ac67 100644 --- a/server/src/game/include/npctemplate.h +++ b/server/src/game/include/npctemplate.h @@ -59,8 +59,8 @@ private: u8 mUnknown2c; u16 mTradeID; //mUnknown3; //00 00 ? u16 mUnknown4; //04 00 ? - string mActorName; - string mAngle; + std::string mActorName; + std::string mAngle; /* // Not sure about that. Commented out until someone finds out how to deal with those "extra" informations f32 mWaypoint1_Y; @@ -143,11 +143,11 @@ public: { return mUnknown4; }; - inline string GetActorName() const + inline std::string GetActorName() const { return mActorName; }; - inline string GetAngle() const + inline std::string GetAngle() const { return mAngle; }; @@ -209,11 +209,11 @@ public: { mUnknown4 = nValue; }; - inline void SetActorName( string nValue ) + inline void SetActorName( std::string nValue ) { mActorName = nValue; }; - inline void SetAngle( string nValue ) + inline void SetAngle( std::string nValue ) { mAngle = nValue; }; diff --git a/server/src/game/include/sql.h b/server/src/game/include/sql.h old mode 100755 new mode 100644 diff --git a/server/src/game/include/terminal.h b/server/src/game/include/terminal.h index 9dc6c53..d94ec97 100644 --- a/server/src/game/include/terminal.h +++ b/server/src/game/include/terminal.h @@ -41,15 +41,14 @@ class PTerminal int mResultFields; void EraseVars(); - char mConPrefix[50]; - + char mConPrefix[50]; + inline bool ChkOpt(u8 nNumOptions, u8 nReqOpt) { if(nNumOptions < nReqOpt) return false; else return true; }; - bool DoStockXCheck(PClient* nClient, int nAmountEntered, int nNewAmount); + bool DoStockXCheck(PClient* nClient, int nAmountEntered, int nNewAmount); public: PTerminal(); //~PTerminal(); - // Check accesslevel of Player for various Terminal actions bool CheckAccess(PClient* nClient, char *nArea, u16 nCmdNr, char *nOption1, char *nOption2, char *nOption3); u8 GetNewEmailCount(PClient* nClient, bool nNoticeClient = true); diff --git a/server/src/game/include/world_datparser.h b/server/src/game/include/world_datparser.h old mode 100755 new mode 100644 index 20b199b..5da7924 --- a/server/src/game/include/world_datparser.h +++ b/server/src/game/include/world_datparser.h @@ -1,60 +1,59 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - world_datparser.h - Class to parse .dat world files - - MODIFIED: 29 Sep 2006 Hammag - REASON: - Creation -*/ - -#ifndef WORLD_DATPARSER_H -#define WORLD_DATPARSER_H - -class PFile; -class PWorldDataTemplate; - -class PWorldDatParser -{ -private : - PFile* f; - std::string mNCDataPath; - - PWorldDataTemplate* mWorld; - bool mDiscardPassiveObjects; - - bool ProcessSec2ElemType3(u32 nSize); - bool ProcessSec2ElemType5(u32 nSize); - bool ProcessSec2NPCEntry(u32 nSize); - -public : - PWorldDatParser(); - ~PWorldDatParser(); - - int LoadDatFile(const std::string& nFilename, PWorldDataTemplate* nWorld, const bool nDiscardPassiveObjects = true, const bool nTestAccesOnly = false); - -}; - -#endif - +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + + +/* + world_datparser.h + Class to parse .dat world files + + MODIFIED: 29 Sep 2006 Hammag + REASON: - Creation +*/ + +#ifndef WORLD_DATPARSER_H +#define WORLD_DATPARSER_H + +class PFile; +class PWorldDataTemplate; + +class PWorldDatParser +{ +private : + PFile* f; + std::string mNCDataPath; + + PWorldDataTemplate* mWorld; + bool mDiscardPassiveObjects; + + bool ProcessSec2ElemType3(u32 nSize); + bool ProcessSec2ElemType5(u32 nSize); + bool ProcessSec2NPCEntry(u32 nSize); + +public : + PWorldDatParser(); + ~PWorldDatParser(); + + int LoadDatFile(const std::string& nFilename, PWorldDataTemplate* nWorld, const bool nDiscardPassiveObjects = true, const bool nTestAccesOnly = false); + +}; + +#endif diff --git a/server/src/game/include/worlddatatemplate.h b/server/src/game/include/worlddatatemplate.h old mode 100755 new mode 100644 index 2e1ded4..6720870 --- a/server/src/game/include/worlddatatemplate.h +++ b/server/src/game/include/worlddatatemplate.h @@ -1,107 +1,107 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - -/* - worlddatatemplate.cpp - world data template (from worlds .dat files) class - - MODIFIED: 04 Oct 2006 Hammag - REASON: - creation - - MODIFIED: 21 Jun 2009 Namikon - REASON: - Added NPC Template stuff - -*/ - - -#ifndef WORLDDATATEMPLATE_H -#define WORLDDATATEMPLATE_H - -#define WORLDDATATEMPLATE_MAXPOSITEMS 11 - -class PFurnitureItemTemplate; -typedef std::map PFurnitureItemsMap; - -class PDoorTemplate; -typedef std::map PDoorsMap; - -class PNPCTemplate; -typedef std::map PNPCsMap; - -class PWorldDataTemplate -{ -private: - std::string mName; // (datfile) relative path+filename without leading ./ or ./worlds/ nor .dat extension - std::string mBspName; // (bsp file) relative path+filename without leading ./ or ./worlds/ nor .bsp extension - PFurnitureItemsMap mFurnitureItems; - PDoorsMap mDoors; - PNPCsMap mNPCs; - PFurnitureItemTemplate* mPositionItems[WORLDDATATEMPLATE_MAXPOSITEMS]; - - int mUseCount; - - void DatFileDataCleanup(); - void SetLinkedObjects(); // This method implements some workarouds for some world objects on which we lack info. - -public: - PWorldDataTemplate(); - ~PWorldDataTemplate(); - - bool LoadDatFile(const std::string& WorldTemplateName, const std::string& nFilename, const bool nTestAccesOnly = false); - inline const std::string& GetName() - { - return mName; - } - inline const std::string& GetBspName() - { - return mBspName; - } - - inline void IncreaseUseCount() - { - ++mUseCount; - } - inline int DecreaseUseCount() - { - return (mUseCount ? --mUseCount : 0); - } - inline int GetUseCount() - { - return mUseCount; - } - - u32 AddFurnitureItem(PFurnitureItemTemplate* nItem); - const PFurnitureItemTemplate* GetFurnitureItem(u32 ItemID); - bool getPositionItemPosition(u8 PosID, f32* pX, f32* pY, f32* pZ); - - u32 AddDoor(PDoorTemplate* nDoor); - const PDoorTemplate* GetDoor(u32 DoorID); - - u32 AddNPC(PNPCTemplate* nNPC); - - // External functions for NPCManager - const PNPCTemplate* GetNPC(u32 NPCID); - inline const PNPCsMap *GetNPCMap() const - { - return &mNPCs; - }; // called by class PNPCWorld to get all NPCs for this world -}; - -#endif +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + +/* + worlddatatemplate.cpp - world data template (from worlds .dat files) class + + MODIFIED: 04 Oct 2006 Hammag + REASON: - creation + + MODIFIED: 21 Jun 2009 Namikon + REASON: - Added NPC Template stuff + +*/ + + +#ifndef WORLDDATATEMPLATE_H +#define WORLDDATATEMPLATE_H + +#define WORLDDATATEMPLATE_MAXPOSITEMS 11 + +class PFurnitureItemTemplate; +typedef std::map PFurnitureItemsMap; + +class PDoorTemplate; +typedef std::map PDoorsMap; + +class PNPCTemplate; +typedef std::map PNPCsMap; + +class PWorldDataTemplate +{ +private: + std::string mName; // (datfile) relative path+filename without leading ./ or ./worlds/ nor .dat extension + std::string mBspName; // (bsp file) relative path+filename without leading ./ or ./worlds/ nor .bsp extension + PFurnitureItemsMap mFurnitureItems; + PDoorsMap mDoors; + PNPCsMap mNPCs; + PFurnitureItemTemplate* mPositionItems[WORLDDATATEMPLATE_MAXPOSITEMS]; + + int mUseCount; + + void DatFileDataCleanup(); + void SetLinkedObjects(); // This method implements some workarouds for some world objects on which we lack info. + +public: + PWorldDataTemplate(); + ~PWorldDataTemplate(); + + bool LoadDatFile(const std::string& WorldTemplateName, const std::string& nFilename, const bool nTestAccesOnly = false); + inline const std::string& GetName() + { + return mName; + } + inline const std::string& GetBspName() + { + return mBspName; + } + + inline void IncreaseUseCount() + { + ++mUseCount; + } + inline int DecreaseUseCount() + { + return (mUseCount ? --mUseCount : 0); + } + inline int GetUseCount() + { + return mUseCount; + } + + u32 AddFurnitureItem(PFurnitureItemTemplate* nItem); + const PFurnitureItemTemplate* GetFurnitureItem(u32 ItemID); + bool getPositionItemPosition(u8 PosID, f32* pX, f32* pY, f32* pZ); + + u32 AddDoor(PDoorTemplate* nDoor); + const PDoorTemplate* GetDoor(u32 DoorID); + + u32 AddNPC(PNPCTemplate* nNPC); + + // External functions for NPCManager + const PNPCTemplate* GetNPC(u32 NPCID); + inline const PNPCsMap *GetNPCMap() const + { + return &mNPCs; + }; // called by class PNPCWorld to get all NPCs for this world +}; + +#endif diff --git a/server/src/game/include/worlds.h b/server/src/game/include/worlds.h old mode 100755 new mode 100644 diff --git a/server/src/game/inventory.cpp b/server/src/game/inventory.cpp index 8b601a9..fac330c 100644 --- a/server/src/game/inventory.cpp +++ b/server/src/game/inventory.cpp @@ -1,38 +1,41 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - inventory.cpp - classes for inventories - (inventory, belt, armor, implants, gogo, processor(?), maybe other containers(?) ) - - MODIFIED: 10 Jul 2006 Hammag - REASON: - creation : Quick and dirty main inventory (backpack) management - - + inventory.cpp - classes for inventories + (inventory, belt, armor, implants, gogo, processor(?), maybe other containers(?) ) + + MODIFIED: 10 Jul 2006 Hammag + REASON: - creation : Quick and dirty main inventory (backpack) management + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - clean ups */ + #include "main.h" -#include "inventory.h" -#include "container.h" + +#include "include/inventory.h" +#include "include/container.h" /* --- PInventory class --- */ diff --git a/server/src/game/isc.cpp b/server/src/game/isc.cpp index c5a270f..8120de1 100644 --- a/server/src/game/isc.cpp +++ b/server/src/game/isc.cpp @@ -20,20 +20,22 @@ */ /* - isc.cpp + isc.cpp - MODIFIED: Unknown date / Namikon - REASON: - initial release by Namikon + MODIFIED: Unknown date / Namikon + REASON: - initial release by Namikon MODIFIED: 13 Oct 2006 Hammag REASON: - Implemented MySQL isc method + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem - TODO: - - implement ISC protocol + TODO: + - implement ISC protocol */ #include "main.h" -#include "isc.h" +#include "include/isc.h" PISC::PISC() { diff --git a/server/src/game/item.cpp b/server/src/game/item.cpp index cdd275b..ca80477 100644 --- a/server/src/game/item.cpp +++ b/server/src/game/item.cpp @@ -21,18 +21,21 @@ /* - item.cpp - item class + item.cpp - item class MODIFIED: 11 Jul 2006 Hammag REASON: - creation - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "item.h" -#include "gamedefs.h" -#include "def_items.h" +#include "include/item.h" +#include "include/gamedefs.h" +#include "include/def_items.h" + PItem::PItem(u32 ItemID, u8 nStackSize, u8 CurDur, u8 MaxDur, u8 Dmg, u8 Freq, u8 Hand, u8 Rng) { @@ -122,7 +125,7 @@ u8 PItem::TakeFromStack(u8 ItemNb) u8 retreivedItems = 0; if (mStackable) { - retreivedItems = min(mStackSize, ItemNb); + retreivedItems = std::min(mStackSize, ItemNb); mStackSize -= retreivedItems; } return retreivedItems; diff --git a/server/src/game/lua_engine.cpp b/server/src/game/lua_engine.cpp index 01c3d45..7e2afd3 100644 --- a/server/src/game/lua_engine.cpp +++ b/server/src/game/lua_engine.cpp @@ -1,337 +1,338 @@ -/* -TinNS (TinNS is not a Neocron Server) -Copyright (C) 2005 Linux Addicted Community -maintainer Akiko - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. -*/ - -/* - -lua_engine.cpp - TinNS Lua engine for processing NPC scripts - -CREATION: 13 Oct 2009 Namikon - -*/ - -#include "main.h" -#include "msgbuilder.h" - -// ****************************************************************** -// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION -// ****************************************************************** -/* - This function is the CALLBACK function for Neocron lua scripts. - Every command inside any .lua file will result in a call to - SendScriptMsg(xx), which ends up here. - - For currently known callbacks, look in the docs/ folder, - file lua_callbacks.xls. It also contains the status and - all parameters with return values that are required to handle - script requests. If you're extending this function, - please note it in the xls file! -*/ -// ****************************************************************** -int npcscript_callback(lua_State *nLua) -{ - PClient* tClient = LuaEngine->GetBoundClient(); - if(tClient == NULL) - { - Console->Print("%s [npcscript_callback] No client is set, unable to process actions!", Console->ColorText(RED, BLACK, "[Error]")); - return 0; - } - - // Get dialogclass and ScriptMsg from LUA call - std::string tScriptMsg = lua_tostring(nLua, 1); - int tDialogClass = lua_tointeger(nLua, 2); - - // Only execute any commands (getmoney, takemoney, etc) when we're told to do so! - bool tExecCommands = false; - if((tDialogClass&PLUAENGINE_EXECUTENODE) == PLUAENGINE_EXECUTENODE) - { - tExecCommands = true; - } - - // Check which ScriptMsg we have - if(tScriptMsg == "setanswer") - { - // its an setanswer - // see if we're requested to return the node for any special answer number - if((tDialogClass&PLUAENGINE_GETANSWER) == PLUAENGINE_GETANSWER) - { - // looks like that. Get the answernumber to check for and answernumber from lua - int tAnswerNr = tDialogClass - PLUAENGINE_GETANSWER; - int tLuaAnswerNr = lua_tointeger(nLua, 3); - - // Now check answernumber, and if positive, set the returnvalue in LuaEngine - if(tAnswerNr == tLuaAnswerNr) - { - LuaEngine->SetReturnINT(lua_tointeger(nLua, 5)); - // We're done here; exit function - return 1; - } - } - } - else if(tScriptMsg == "givemoney" && tExecCommands == true) - // Give the player money - // Script syntax: GIVEMONEY(amount) - // Return Values: None - { - int tAmount = lua_tointeger(nLua, 3); - - /*int tNewMoneyValue = */tClient->GetChar()->AddCash(tAmount); - - // This issnt required, since the client adds the money already. It - // isnt added twice, but you get the message twice and thats confusing :) - //PMessage* tmpMsg = MsgBuilder->BuildCharMoneyUpdateMsg(tClient, tNewMoneyValue); - //tClient->SendUDPMessage(tmpMsg); - - if (gDevDebug) Console->Print("GIVEMONEY from script; Added %d credits", tAmount); - } - else if(tScriptMsg == "takemoney" && tExecCommands == true) - // Takes away money from player - // Script syntax: TAKEMONEY(amount) - // Return Values: 1 (Success) 0 (Failed) - { - int tAmount = lua_tointeger(nLua, 3); - if (gDevDebug) Console->Print("TAKEMONEY from script"); - - if(tClient->GetChar()->GetCash() < (u32)tAmount) - { - // Cannot take cash, player has less than amount required - LuaEngine->AddScriptResult(0); - if (gDevDebug) Console->Print("..FAILED player has not enough money (-%d)", tAmount); - } - else - { - // TakeMOney successfull. Reduce players credits and send money update - int tNewMoneyValue = tClient->GetChar()->TakeCash(tAmount); - PMessage* tmpMsg = MsgBuilder->BuildCharMoneyUpdateMsg(tClient, tNewMoneyValue); - tClient->SendUDPMessage(tmpMsg); - - // TakeMoney successfull. Return 1 - LuaEngine->AddScriptResult(1); - if (gDevDebug) Console->Print("..SUCCESS player had enough (-%d)", tAmount); - } - } - else if(tScriptMsg == "rand" && tExecCommands == true) - // Generate random number from 0 to tRange - // Script syntax: RAND(range) - // Return Values: 0 to range - { - int tRange = lua_tointeger(nLua, 3); - - int tRandomVal = GetRandom(tRange, 0); - LuaEngine->AddScriptResult(tRandomVal); - if (gDevDebug) Console->Print("RAND(%d) from script. Result: %d", tRange, tRandomVal); - } - else if(tScriptMsg == "takeitem" && tExecCommands == true) - // Takes away an item from players inventory - // Script syntax: TAKEITEM(itemID) - // Return Values: 1 (Success) 0 (Failed) - { - int tItemID = lua_tointeger(nLua, 3); - // Check if player has item ID tItemID and take it away - // No clean way to take item away yet, fake answer until then. - int tRes = GetRandom (1, 0); - LuaEngine->AddScriptResult(tRes); // TakeItem was SUCCESSFULL - - if (gDevDebug) Console->Print("TAKEITEM(%d) from script. Random result: %d", tItemID, tRes); - } - else if(tScriptMsg == "giveitem" && tExecCommands == true) - // Give an item to player, with given quality - // Script syntax: GIVEITEM(itemID) - // Return Values: None - { - int tItemID = lua_tointeger(nLua, 3); - int tQuality = lua_tointeger(nLua, 4); - // Give item tItemID in quality tQuality to player - - PItem* NewItem = new PItem( tItemID ); - if ( NewItem->GetItemID() ) - { - NewItem->MakeItemStandard( tQuality, tQuality ); // Set Quality of item to tQuality - tClient->GetChar()->GetInventory()->AddItem( NewItem ); - // TODO: Find a way to refresh inventory - if (gDevDebug) Console->Print("GIVEITEM(%d,%d) from script. Result: %d", tItemID, tQuality); - } - else - { - // Error, invalid ItemID in script..? - if (gDevDebug) Console->Print("GIVEITEM(%d,%d) from script. Fail: Unknown itemID", tItemID, tQuality); - - // Do nothing - } - } - return 1; -} -// ************************************************************* -bool PLuaEngine::CheckLUAFile(std::string nLUAScript) -{ - luaL_openlibs(mLua); - if (luaL_loadstring(mLua, nLUAScript.c_str()) || lua_pcall(mLua, 0, 0, 0)) { - Console->Print("[PLuaEngine::CheckLUAFile] Error in LUA Script: %s", lua_tostring(mLua, -1)); - return false; - } - - // Check if we have the 2 main functions present - lua_getglobal(mLua, "lSendAction"); - if(!lua_isfunction(mLua,-1)) - { - Console->Print("[PLuaEngine::CheckLUAFile] LUA Script is missing function \"lSendAction)\""); - lua_pop(mLua,1); - return false; - } - // Check if we have the 2 main functions present - lua_getglobal(mLua, "SetResult"); - if(!lua_isfunction(mLua,-1)) - { - Console->Print("[PLuaEngine::CheckLUAFile] LUA Script is missing function \"SetResult)\""); - lua_pop(mLua,1); - return false; - } - - // LUA File is ok - return true; -} - -void PLuaEngine::ProcessDialogScript(PClient* nClient, std::string nLUAFile, int nAnswer) -{ - mTargetClient = nClient; - PChar* tChar = nClient->GetChar(); - - // Get current node ID the player is on - u16 tNodeID = tChar->GetDialogNode(); - - // First, get the new node ID based on the answer the client gave us. DO NOT execute any commands from - // Script yet. Resulting node is in mReturn_INT - ExecuteScript(nLUAFile, tNodeID, nAnswer + PLUAENGINE_GETANSWER); - - //int tNextNode = LuaEngine->GetNextNodeFromAnswer(nLUAFile, tNodeID, nAnswer); - // Now execute target Node. Process all requests by Script, and tell client the results (if any) - if(LuaEngine->ExecuteScript(nLUAFile, mReturn_INT, PLUAENGINE_EXECUTENODE) == false) - { - Console->Print("ERROR while processing LUA Script, skip"); - return; - } - else - { - // Set the new node in client - tChar->SetDialogNode((u16)mReturn_INT); - // Now send the new node (together with the answer-buffer) to the client. - // After this packet hits the client, it will show the given node - PMessage* tmpMsg = MsgBuilder->BuildNPCDialogReplyMsg(nClient, tChar->GetDialogNode(), &mReturnValues); - nClient->SendUDPMessage(tmpMsg); - } - - // Cleanup everything - mTargetClient = NULL; - CleanUp(); -} - -void PLuaEngine::AddScriptResult(int nResult) -{ - if(!mRunning) - { - Console->Print("%s [PLuaEngine::AddScriptResult] Trying to set lua result while no lua script is running", Console->ColorText(YELLOW, BLACK, "[Warning]")); - return; - } - - // Insert new returnvalue to buffer - mReturnValues.push_back(nResult); - - // Push result back to LUA Script - lua_getglobal(mLua, "SetResult"); - lua_pushnumber(mLua, nResult); // newstate - - if (lua_pcall(mLua, 1, 0, 0) != 0) - { - Console->Print("%s [npcscript_callback] Unable to return result '%s'", Console->ColorText(RED, BLACK, "[Error]"), lua_tostring(mLua, -1)); - } -} - -PLuaEngine::PLuaEngine() -{ - mLua = lua_open(); - mRunning = false; -} - -void PLuaEngine::CleanUp() -{ - // CleanUp vars, empty vectors, etc - mRunning = false; - mReturnValues.erase(mReturnValues.begin(), mReturnValues.end()); -} - -PLuaEngine::~PLuaEngine() -{ - lua_close(mLua); -} - -bool PLuaEngine::ExecuteScript(std::string nLUAScript, int nNode, int nDialogClass) -{ - // Make sure we have an bound client to work with - if(mTargetClient == NULL) - { - Console->Print("%s [PLuaEngine::ExecuteScript] No Client has been bound. Cannot run lua script", Console->ColorText(RED, BLACK, "[Error]")); - return false; - } - - // Open LUA libs - luaL_openlibs(mLua); - - // Try to load script and check for syntax errors - if (luaL_loadstring(mLua, nLUAScript.c_str()) || lua_pcall(mLua, 0, 0, 0)) { - Console->Print("%s [PLuaEngine::ExecuteScript] Unable to execute lua script: '%s'", Console->ColorText(RED, BLACK, "[Error]"), lua_tostring(mLua, -1)); - return false; - } - - // Register callback function for NPC Script actions - lua_register(mLua, "SendScriptMsg", npcscript_callback); - - // Get handle for lua main() function - lua_getglobal(mLua, "lSendAction"); - - // Error if function isnt found - if(!lua_isfunction(mLua,-1)) - { - Console->Print("%s [PLuaEngine::ExecuteScript] Unable to execute lua script; Script has no entry function (lSendAction)", Console->ColorText(RED, BLACK, "[Error]")); - lua_pop(mLua,1); - return false; - } - // Push our vars to the script - // DialogClass is a loopback value for our callback function, to detect different - // script runs (with or without execution of command) - lua_pushnumber(mLua, nDialogClass); - lua_pushnumber(mLua, nNode); - - /* - run LUA Script (2 arguments, 0 result, 0 errorhandler) - Only allow callback actions while lua is running (mRunning = true) - */ - - mRunning = true; - int tLuaResult = lua_pcall(mLua, 2, 0, 0); - mRunning = false; - - if (tLuaResult != 0) - { - Console->Print("%s [PLuaEngine::ExecuteScript] Unable to execute lua script: '%s'", Console->ColorText(RED, BLACK, "[Error]"), lua_tostring(mLua, -1)); - return false; - } - - return true; -} +/* +TinNS (TinNS is not a Neocron Server) +Copyright (C) 2005 Linux Addicted Community +maintainer Akiko + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. +*/ + +/* + +lua_engine.cpp - TinNS Lua engine for processing NPC scripts + +CREATION: 13 Oct 2009 Namikon + +*/ + +#include "main.h" +#include "include/msgbuilder.h" + +// ****************************************************************** +// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION +// ****************************************************************** +/* + This function is the CALLBACK function for Neocron lua scripts. + Every command inside any .lua file will result in a call to + SendScriptMsg(xx), which ends up here. + + For currently known callbacks, look in the docs/ folder, + file lua_callbacks.xls. It also contains the status and + all parameters with return values that are required to handle + script requests. If you're extending this function, + please note it in the xls file! +*/ +// ****************************************************************** +int npcscript_callback(lua_State *nLua) +{ + PClient* tClient = LuaEngine->GetBoundClient(); + if(tClient == NULL) + { + Console->Print("%s [npcscript_callback] No client is set, unable to process actions!", Console->ColorText(RED, BLACK, "[Error]")); + return 0; + } + + // Get dialogclass and ScriptMsg from LUA call + std::string tScriptMsg = lua_tostring(nLua, 1); + int tDialogClass = lua_tointeger(nLua, 2); + + // Only execute any commands (getmoney, takemoney, etc) when we're told to do so! + bool tExecCommands = false; + if((tDialogClass&PLUAENGINE_EXECUTENODE) == PLUAENGINE_EXECUTENODE) + { + tExecCommands = true; + } + + // Check which ScriptMsg we have + if(tScriptMsg == "setanswer") + { + // its an setanswer + // see if we're requested to return the node for any special answer number + if((tDialogClass&PLUAENGINE_GETANSWER) == PLUAENGINE_GETANSWER) + { + // looks like that. Get the answernumber to check for and answernumber from lua + int tAnswerNr = tDialogClass - PLUAENGINE_GETANSWER; + int tLuaAnswerNr = lua_tointeger(nLua, 3); + + // Now check answernumber, and if positive, set the returnvalue in LuaEngine + if(tAnswerNr == tLuaAnswerNr) + { + LuaEngine->SetReturnINT(lua_tointeger(nLua, 5)); + // We're done here; exit function + return 1; + } + } + } + else if(tScriptMsg == "givemoney" && tExecCommands == true) + // Give the player money + // Script syntax: GIVEMONEY(amount) + // Return Values: None + { + int tAmount = lua_tointeger(nLua, 3); + + /*int tNewMoneyValue = */tClient->GetChar()->AddCash(tAmount); + + // This issnt required, since the client adds the money already. It + // isnt added twice, but you get the message twice and thats confusing :) + //PMessage* tmpMsg = MsgBuilder->BuildCharMoneyUpdateMsg(tClient, tNewMoneyValue); + //tClient->SendUDPMessage(tmpMsg); + + if (gDevDebug) Console->Print("GIVEMONEY from script; Added %d credits", tAmount); + } + else if(tScriptMsg == "takemoney" && tExecCommands == true) + // Takes away money from player + // Script syntax: TAKEMONEY(amount) + // Return Values: 1 (Success) 0 (Failed) + { + int tAmount = lua_tointeger(nLua, 3); + if (gDevDebug) Console->Print("TAKEMONEY from script"); + + if(tClient->GetChar()->GetCash() < (u32)tAmount) + { + // Cannot take cash, player has less than amount required + LuaEngine->AddScriptResult(0); + if (gDevDebug) Console->Print("..FAILED player has not enough money (-%d)", tAmount); + } + else + { + // TakeMOney successfull. Reduce players credits and send money update + int tNewMoneyValue = tClient->GetChar()->TakeCash(tAmount); + PMessage* tmpMsg = MsgBuilder->BuildCharMoneyUpdateMsg(tClient, tNewMoneyValue); + tClient->SendUDPMessage(tmpMsg); + + // TakeMoney successfull. Return 1 + LuaEngine->AddScriptResult(1); + if (gDevDebug) Console->Print("..SUCCESS player had enough (-%d)", tAmount); + } + } + else if(tScriptMsg == "rand" && tExecCommands == true) + // Generate random number from 0 to tRange + // Script syntax: RAND(range) + // Return Values: 0 to range + { + int tRange = lua_tointeger(nLua, 3); + + int tRandomVal = GetRandom(tRange, 0); + LuaEngine->AddScriptResult(tRandomVal); + if (gDevDebug) Console->Print("RAND(%d) from script. Result: %d", tRange, tRandomVal); + } + else if(tScriptMsg == "takeitem" && tExecCommands == true) + // Takes away an item from players inventory + // Script syntax: TAKEITEM(itemID) + // Return Values: 1 (Success) 0 (Failed) + { + int tItemID = lua_tointeger(nLua, 3); + // Check if player has item ID tItemID and take it away + // No clean way to take item away yet, fake answer until then. + int tRes = GetRandom (1, 0); + LuaEngine->AddScriptResult(tRes); // TakeItem was SUCCESSFULL + + if (gDevDebug) Console->Print("TAKEITEM(%d) from script. Random result: %d", tItemID, tRes); + } + else if(tScriptMsg == "giveitem" && tExecCommands == true) + // Give an item to player, with given quality + // Script syntax: GIVEITEM(itemID) + // Return Values: None + { + int tItemID = lua_tointeger(nLua, 3); + int tQuality = lua_tointeger(nLua, 4); + // Give item tItemID in quality tQuality to player + + PItem* NewItem = new PItem( tItemID ); + if ( NewItem->GetItemID() ) + { + NewItem->MakeItemStandard( tQuality, tQuality ); // Set Quality of item to tQuality + tClient->GetChar()->GetInventory()->AddItem( NewItem ); + // TODO: Find a way to refresh inventory + if (gDevDebug) Console->Print("GIVEITEM(%d,%d) from script. Result: %d", tItemID, tQuality); + } + else + { + // Error, invalid ItemID in script..? + if (gDevDebug) Console->Print("GIVEITEM(%d,%d) from script. Fail: Unknown itemID", tItemID, tQuality); + + // Do nothing + } + } + return 1; +} +// ************************************************************* +bool PLuaEngine::CheckLUAFile(std::string nLUAScript) +{ + luaL_openlibs(mLua); + if (luaL_loadstring(mLua, nLUAScript.c_str()) || lua_pcall(mLua, 0, 0, 0)) { + Console->Print("[PLuaEngine::CheckLUAFile] Error in LUA Script: %s", lua_tostring(mLua, -1)); + return false; + } + + // Check if we have the 2 main functions present + lua_getglobal(mLua, "lSendAction"); + if(!lua_isfunction(mLua,-1)) + { + Console->Print("[PLuaEngine::CheckLUAFile] LUA Script is missing function \"lSendAction)\""); + lua_pop(mLua,1); + return false; + } + // Check if we have the 2 main functions present + lua_getglobal(mLua, "SetResult"); + if(!lua_isfunction(mLua,-1)) + { + Console->Print("[PLuaEngine::CheckLUAFile] LUA Script is missing function \"SetResult)\""); + lua_pop(mLua,1); + return false; + } + + // LUA File is ok + return true; +} + +void PLuaEngine::ProcessDialogScript(PClient* nClient, std::string nLUAFile, int nAnswer) +{ + mTargetClient = nClient; + PChar* tChar = nClient->GetChar(); + + // Get current node ID the player is on + u16 tNodeID = tChar->GetDialogNode(); + + // First, get the new node ID based on the answer the client gave us. DO NOT execute any commands from + // Script yet. Resulting node is in mReturn_INT + ExecuteScript(nLUAFile, tNodeID, nAnswer + PLUAENGINE_GETANSWER); + + //int tNextNode = LuaEngine->GetNextNodeFromAnswer(nLUAFile, tNodeID, nAnswer); + // Now execute target Node. Process all requests by Script, and tell client the results (if any) + if(LuaEngine->ExecuteScript(nLUAFile, mReturn_INT, PLUAENGINE_EXECUTENODE) == false) + { + Console->Print("ERROR while processing LUA Script, skip"); + return; + } + else + { + // Set the new node in client + tChar->SetDialogNode((u16)mReturn_INT); + // Now send the new node (together with the answer-buffer) to the client. + // After this packet hits the client, it will show the given node + PMessage* tmpMsg = MsgBuilder->BuildNPCDialogReplyMsg(nClient, tChar->GetDialogNode(), &mReturnValues); + nClient->SendUDPMessage(tmpMsg); + } + + // Cleanup everything + mTargetClient = NULL; + CleanUp(); +} + +void PLuaEngine::AddScriptResult(int nResult) +{ + if(!mRunning) + { + Console->Print("%s [PLuaEngine::AddScriptResult] Trying to set lua result while no lua script is running", Console->ColorText(YELLOW, BLACK, "[Warning]")); + return; + } + + // Insert new returnvalue to buffer + mReturnValues.push_back(nResult); + + // Push result back to LUA Script + lua_getglobal(mLua, "SetResult"); + lua_pushnumber(mLua, nResult); // newstate + + if (lua_pcall(mLua, 1, 0, 0) != 0) + { + Console->Print("%s [npcscript_callback] Unable to return result '%s'", Console->ColorText(RED, BLACK, "[Error]"), lua_tostring(mLua, -1)); + } +} + +PLuaEngine::PLuaEngine() +{ + // New lua function + mLua = luaL_newstate(); + mRunning = false; +} + +void PLuaEngine::CleanUp() +{ + // CleanUp vars, empty vectors, etc + mRunning = false; + mReturnValues.erase(mReturnValues.begin(), mReturnValues.end()); +} + +PLuaEngine::~PLuaEngine() +{ + lua_close(mLua); +} + +bool PLuaEngine::ExecuteScript(std::string nLUAScript, int nNode, int nDialogClass) +{ + // Make sure we have an bound client to work with + if(mTargetClient == NULL) + { + Console->Print("%s [PLuaEngine::ExecuteScript] No Client has been bound. Cannot run lua script", Console->ColorText(RED, BLACK, "[Error]")); + return false; + } + + // Open LUA libs + luaL_openlibs(mLua); + + // Try to load script and check for syntax errors + if (luaL_loadstring(mLua, nLUAScript.c_str()) || lua_pcall(mLua, 0, 0, 0)) { + Console->Print("%s [PLuaEngine::ExecuteScript] Unable to execute lua script: '%s'", Console->ColorText(RED, BLACK, "[Error]"), lua_tostring(mLua, -1)); + return false; + } + + // Register callback function for NPC Script actions + lua_register(mLua, "SendScriptMsg", npcscript_callback); + + // Get handle for lua main() function + lua_getglobal(mLua, "lSendAction"); + + // Error if function isnt found + if(!lua_isfunction(mLua,-1)) + { + Console->Print("%s [PLuaEngine::ExecuteScript] Unable to execute lua script; Script has no entry function (lSendAction)", Console->ColorText(RED, BLACK, "[Error]")); + lua_pop(mLua,1); + return false; + } + // Push our vars to the script + // DialogClass is a loopback value for our callback function, to detect different + // script runs (with or without execution of command) + lua_pushnumber(mLua, nDialogClass); + lua_pushnumber(mLua, nNode); + + /* + run LUA Script (2 arguments, 0 result, 0 errorhandler) + Only allow callback actions while lua is running (mRunning = true) + */ + + mRunning = true; + int tLuaResult = lua_pcall(mLua, 2, 0, 0); + mRunning = false; + + if (tLuaResult != 0) + { + Console->Print("%s [PLuaEngine::ExecuteScript] Unable to execute lua script: '%s'", Console->ColorText(RED, BLACK, "[Error]"), lua_tostring(mLua, -1)); + return false; + } + + return true; +} diff --git a/server/src/game/main.cpp b/server/src/game/main.cpp index b4c3d4f..0fcb977 100644 --- a/server/src/game/main.cpp +++ b/server/src/game/main.cpp @@ -1,104 +1,110 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - main.cpp - this is the main file with the main function - - MODIFIED: 12 Sep 2005 Akiko - REASON: - removed some of the Windows specific code - - replaced SleepEx method by the Linux equivalent - MODIFIED: 26 Sep 2005 Akiko - REASON: - added GPL - MODIFIED: 23 Dec 2005 bakkdoor - REASON: - Added & signalHandler -> catch strg-c and shutdown nicely - MODIFIED: 25 Dec 2005 Namikon - REASON: - Fixed shutdown procedure, wont cause segfault anymore - MODIFIED: 06 Jan 2006 Namikon - REASON: - Added color to console outputs - MODIFIED: 01 Jul 2006 Hammag - REASON: - commented out sched_yield() in main loop, as it is - not needed anymore with a right timeout for ReadSetTCP select - MODIFIED: 26 Jul 2006 Hammag - REASON: - added memory leak check in the main loop for unreleased DB Ressources and messages - -*/ - -#include "main.h" - -#include "worlddatatemplate.h" // temp -#include "worlds.h" // temp - -#include "isc.h" - -// for handling strg-c signal to shutdown in correct way -void signal_handler(int signal) -{ - if (signal == SIGINT) - { - //cout << "Shutting down TinNS" << endl; - - //exit(0); - Shutdown(); - } - else - { - psignal(signal, "Unkown signal: "); - } -} - -int main() -{ - // Connect signal with handlerfunction - signal(SIGINT, signal_handler); // TODO: change for sigaction() - - - if(!InitTinNS()) - { - if(Console) - Console->Print("%s Aborting startup.", Console->ColorText(RED, BLACK, "[Fatal]")); - Shutdown(); // exits with 0 ... - } - - //RemoteConsole->Start(); - GameServer->Start(); - //GameServer->SetGameTime(0); - ISC->Start(); - - Console->Print("Gameserver is now %s. Waiting for clients...", Console->ColorText(GREEN, BLACK, "Online")); - - while(1) - { - ServerSock->update(); - NPCManager->Update(); - Server->Update(); - Chars->Update(); - GameServer->Update(); - PMessage::CheckMsgCount(); // Memory leak check - MySQL->Update(); // Memory leak check and MySQL keepalive - ISC->Update(); +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + + +/* + main.cpp - this is the main file with the main function + + MODIFIED: 12 Sep 2005 Akiko + REASON: - removed some of the Windows specific code + - replaced SleepEx method by the Linux equivalent + MODIFIED: 26 Sep 2005 Akiko + REASON: - added GPL + MODIFIED: 23 Dec 2005 bakkdoor + REASON: - Added & signalHandler -> catch strg-c and shutdown nicely + MODIFIED: 25 Dec 2005 Namikon + REASON: - Fixed shutdown procedure, wont cause segfault anymore + MODIFIED: 06 Jan 2006 Namikon + REASON: - Added color to console outputs + MODIFIED: 01 Jul 2006 Hammag + REASON: - commented out sched_yield() in main loop, as it is + not needed anymore with a right timeout for ReadSetTCP select + MODIFIED: 26 Jul 2006 Hammag + REASON: - added memory leak check in the main loop for unreleased DB Ressources and messages + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - cleanups + - dos linefeeds -> unix linefeeds +*/ + + +#include "main.h" + +#include "include/worlddatatemplate.h" // temp +#include "include/worlds.h" // temp + +#include "include/isc.h" + + +// for handling strg-c signal to shutdown in correct way +void signal_handler(int signal) +{ + if (signal == SIGINT) + { + //cout << "Shutting down TinNS" << endl; + + //exit(0); + Shutdown(); + } + else + { + psignal(signal, "Unkown signal: "); + } +} + +int main() +{ + // Connect signal with handlerfunction + signal(SIGINT, signal_handler); // TODO: change for sigaction() + + + if(!InitTinNS()) + { + if(Console) + Console->Print("%s Aborting startup.", Console->ColorText(RED, BLACK, "[Fatal]")); + Shutdown(); // exits with 0 ... + } + + //RemoteConsole->Start(); + GameServer->Start(); + //GameServer->SetGameTime(0); + ISC->Start(); + + Console->Print("Gameserver is now %s. Waiting for clients...", Console->ColorText(GREEN, BLACK, "Online")); + + + while(1) + { + ServerSock->update(); + NPCManager->Update(); + Server->Update(); + Chars->Update(); + GameServer->Update(); + PMessage::CheckMsgCount(); // Memory leak check + MySQL->Update(); // Memory leak check and MySQL keepalive + ISC->Update(); Console->Update(); - MultiPartHandler->Update(); - } - - return 0; -} + MultiPartHandler->Update(); + } + + return 0; +} diff --git a/server/src/game/main.h b/server/src/game/main.h index a77b975..8ee6e00 100644 --- a/server/src/game/main.h +++ b/server/src/game/main.h @@ -42,22 +42,24 @@ REASON: - commented out mutex.h, thread.h, semaphore.h MODIFIED: 22 Dec 2005 Namikon/bakkdoor REASON: - Added commands.h, skill.h, clientmanager.h - MODIFIED: 23 Dec 2005 bakkdoor + MODIFIED: 23 Dec 2005 bakkdoor REASON: - Added for main.cpp -> catch strg-c and shutdown nicely - MODIFIED: 25 Dec 2005 Namikon + MODIFIED: 25 Dec 2005 Namikon REASON: - Added mysql.h, sql.h for MySQL support - MODIFIED: 01 Jan 2006 Namikon + MODIFIED: 01 Jan 2006 Namikon REASON: - Moved skill.h before chars.h (char.h needs skill.h now) - MODIFIED: 30 May 2006 Namikon + MODIFIED: 30 May 2006 Namikon REASON: - Removed all useless includes to complete the server splitup; Also renamed tinns.h to main.h - MODIFIED: 6 Jul 2006 Hammag - REASON: - moved include "types.h" before include "../netcode/main.h" to permit compile - MODIFIED: 10 Jul 2006 Hammag - REASON: - added inventory.h - REASON: - added item.h - MODIFIED: 26 Jul 2006 Hammag - REASON: - removed #define GAME_PORT which is not used anymore (now in config file) - + MODIFIED: 6 Jul 2006 Hammag + REASON: - moved include "types.h" before include "../netcode/main.h" to permit compile + MODIFIED: 10 Jul 2006 Hammag + REASON: - added inventory.h + REASON: - added item.h + MODIFIED: 26 Jul 2006 Hammag + REASON: - removed #define GAME_PORT which is not used anymore (now in config file) + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + - cleaned up a bit */ #ifndef MAIN_H @@ -66,50 +68,52 @@ //#include "version.h" //basic includes -#include "external.h" +#include "include/external.h" //tinns includes -#include "types.h" -#include "netcode.h" +#include "include/types.h" +#include "common/netcode.h" /* #include "../gamemonkey/gmMachine.h" #include "../gamemonkey/gmCall.h" */ -#include "console.h" +#include "common/console.h" +#include "common/misc.h" // MySQL Support -#include "mysql.h" -#include "sql.h" - -#include "config.h" -#include "filesystem.h" -#include "defparser.h" - - -#include "skill.h" -#include "chars.h" -#include "accounts.h" -#include "client.h" -#include "server.h" -#include "misc.h" -#include "gameserver.h" -#include "globals.h" -#include "defs.h" -#include "zoning.h" -#include "item.h" -#include "inventory.h" -#include "worldactors.h" -#include "npc.h" -#include "outpost.h" -#include "multipart.h" -#include "terminal.h" - -#include "lua_engine.h" -#include "chat.h" -#include "commands.h" -#include "clientmanager.h" - -using namespace std; +#ifdef MYSQL_INC_DIR +#include +#else +#include +#endif + +#include "include/sql.h" + +#include "common/config.h" +#include "common/filesystem.h" +#include "include/defparser.h" + +#include "include/skill.h" +#include "include/chars.h" +#include "include/accounts.h" +#include "include/client.h" +#include "include/server.h" +#include "include/gameserver.h" +#include "include/globals.h" +#include "include/defs.h" +#include "include/zoning.h" +#include "include/item.h" +#include "include/inventory.h" +#include "include/worldactors.h" +#include "include/npc.h" +#include "include/outpost.h" +#include "include/multipart.h" +#include "include/terminal.h" + +#include "include/lua_engine.h" +#include "include/chat.h" +#include "include/commands.h" +#include "include/clientmanager.h" #endif diff --git a/server/src/game/msgbuilder.cpp b/server/src/game/msgbuilder.cpp index e97e421..285f64e 100644 --- a/server/src/game/msgbuilder.cpp +++ b/server/src/game/msgbuilder.cpp @@ -31,14 +31,14 @@ */ #include "main.h" -#include "msgbuilder.h" +#include "include/msgbuilder.h" -#include "worlds.h" -#include "appartements.h" -#include "vehicle.h" -#include "subway.h" -#include "item.h" -#include "container.h" +#include "include/worlds.h" +#include "include/appartements.h" +#include "include/vehicle.h" +#include "include/subway.h" +#include "include/item.h" +#include "include/container.h" PMessage* PMsgBuilder::BuildOutpostClanInfoMsg( PClient* nClient, u32 nClanID, u8 nFaction ) { @@ -192,27 +192,27 @@ PMessage* PMsgBuilder::BuildCharHelloMsg( PClient* nClient ) return tmpMsg; } -PMessage* PMsgBuilder::BuildReqNPCScriptAnswerMsg( u32 nInfoId, string* nNPCScript ) -{ +PMessage* PMsgBuilder::BuildReqNPCScriptAnswerMsg( u32 nInfoId, std::string *nNPCScript ) + { PMessage* tmpMsg; - + tmpMsg = new PMessage(); - + *tmpMsg << ( u8 )0x19; *tmpMsg << ( u16 )0x0006; // InfoQuery *tmpMsg << ( u16 )0x0003; // NPC Script *tmpMsg << ( u32 )nInfoId; *tmpMsg << nNPCScript->c_str(); - + return tmpMsg; - -} - + + } + PMessage* PMsgBuilder::BuildYouGotEmailsMsg( PClient* nClient, u8 nMailCount ) -{ + { PMessage* tmpMsg = new PMessage(); nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 )nClient->GetUDP_ID(); *tmpMsg << ( u16 )nClient->GetSessionID(); @@ -227,15 +227,15 @@ PMessage* PMsgBuilder::BuildYouGotEmailsMsg( PClient* nClient, u8 nMailCount ) *tmpMsg << ( u8 )0x00; *tmpMsg << ( u8 )0x00; *tmpMsg << ( u8 )nMailCount; - + return tmpMsg; -} - -PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nResultBuffer, std::string* nCommandName, u16 nNumRows, u16 nNumFields) -{ + } + +PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nResultBuffer, std::string *nCommandName, u16 nNumRows, u16 nNumFields) + { PMessage* tmpMsg = new PMessage(); /* nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 )0x0000; *tmpMsg << ( u16 )0x0000; @@ -248,17 +248,17 @@ PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nRes *tmpMsg << ( u8 )0x01; else *tmpMsg << ( u8 )0x00; - - *tmpMsg << ( u8 )0x00; - *tmpMsg << ( u8 )0x00; + + *tmpMsg << ( u8 )0x00; + *tmpMsg << ( u8 )0x00; *tmpMsg << *nCommandName; ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); - + // 2nd message *tmpMsg << ( u16 )(13 + nCommandName->length() + nResultBuffer->GetSize()); // ?? -*/ + */ nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 )nClient->GetUDP_ID(); *tmpMsg << ( u16 )nClient->GetSessionID(); @@ -272,10 +272,10 @@ PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nRes *tmpMsg << ( u16 )nNumFields; *tmpMsg << *nCommandName; *tmpMsg << *nResultBuffer; - + ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); - - + + return tmpMsg; //len = (unsigned int)strlen(DB); //SendBuffer[0] = 0x13; @@ -294,7 +294,7 @@ PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nRes // SendBuffer[15] = 0x00; // strcpy (SendBuffer+16, DB); // plen = 17+len; - + // SendBuffer[plen] = 13+len+slen; // SendBuffer[plen+1] = 0x03; // Network_IncrementUDP (ClientNum); @@ -309,21 +309,21 @@ PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nRes // //Fieldnum is defined in each DB below // strcpy (SendBuffer+plen+12, DB); // plen += 13+len; - + // for (i=0;iIncreaseUDP_ID(); - + *tmpMsg << (u8)0x13; *tmpMsg << (u16)nClient->GetUDP_ID(); *tmpMsg << (u16)nClient->GetSessionID(); @@ -333,19 +333,19 @@ PMessage* PMsgBuilder::BuildTryAccessAnswerMsg(PClient* nClient, char *nArea, bo *tmpMsg << (u8)0x2b; *tmpMsg << (u8)0x1a; *tmpMsg << (u16)(strlen(nArea)+1); - + if(nAllowed) *tmpMsg << (u8)0x01; else *tmpMsg << (u8)0x00; - + *tmpMsg << (u8)0x00; *tmpMsg << (u8)0x00; *tmpMsg << nArea; - + ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); return tmpMsg; -} + } PMessage* PMsgBuilder::BuildReqInfoAnswerMsg( PClient* nClient, u16 nReqType, u32 nInfoId, void* nResponse, u16 nResponseLength ) { @@ -1242,7 +1242,7 @@ PMessage* PMsgBuilder::BuildZoningTCPReadyMsg() return tmpMsg; } -PMessage* PMsgBuilder::BuildSendZoneTCPMsg( u32 nLocation, std::string* nWorldName ) +PMessage* PMsgBuilder::BuildSendZoneTCPMsg( u32 nLocation, std::string *nWorldName ) { PMessage* tmpMsg = new PMessage( 14 + nWorldName->size() ); @@ -1500,14 +1500,14 @@ PMessage* PMsgBuilder::BuildSubskillIncMsg( PClient* nClient, u8 nSubskill, u16 return tmpMsg; } -*/ + */ // NPC Dialog. Start dialog with NPC -PMessage* PMsgBuilder::BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID, string* nDialogScript ) -{ +PMessage* PMsgBuilder::BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID, std::string *nDialogScript ) + { PMessage* tmpMsg = new PMessage(); nClient->IncreaseUDP_ID(); - - + + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 ) 0x0000; // UDP Placeholder *tmpMsg << ( u16 ) 0x0000; // UDP Placeholder @@ -1518,16 +1518,16 @@ PMessage* PMsgBuilder::BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID *tmpMsg << ( u16 )nClient->GetLocalID(); *tmpMsg << ( u8 )0x18; *tmpMsg << ( u32 ) nNPCWorldID; - + // Todo: is this correct? random u32 value?? *tmpMsg << ( u16 ) GetRandom( 65535, 4369 ); *tmpMsg << ( u16 ) GetRandom( 65535, 4369 ); *tmpMsg << ( u32 ) 0x0000; *tmpMsg << nDialogScript->c_str(); ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); - + nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x0a; *tmpMsg << ( u8 )0x03; *tmpMsg << ( u16 )nClient->GetUDP_ID(); @@ -1537,24 +1537,24 @@ PMessage* PMsgBuilder::BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID *tmpMsg << ( u8 )0x00; *tmpMsg << ( u8 )0x00; *tmpMsg << ( u8 )0x00; - + tmpMsg->U16Data( 1 ) = nClient->GetUDP_ID(); tmpMsg->U16Data( 3 ) = nClient->GetSessionID(); - + return tmpMsg; -} + } // NPC Dialog. Send next node number in lua script to client PMessage* PMsgBuilder::BuildNPCDialogReplyMsg( PClient* nClient, u16 nNextNode, std::vector*nResultBuffer) -{ + { PMessage* tmpMsg = new PMessage(); - + nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 )nClient->GetUDP_ID();; *tmpMsg << ( u16 )nClient->GetSessionID();; *tmpMsg << ( u8 )0x00; // SubMessage length; - + *tmpMsg << ( u8 )0x03; *tmpMsg << ( u16 )nClient->GetUDP_ID();; *tmpMsg << ( u8 )0x1f; @@ -1563,23 +1563,24 @@ PMessage* PMsgBuilder::BuildNPCDialogReplyMsg( PClient* nClient, u16 nNextNode, *tmpMsg << ( u16 )nNextNode; //*tmpMsg << ( u8 )nNumResults; *tmpMsg << ( u8 )nResultBuffer->size(); - + std::vector::const_iterator it; - + for(it = nResultBuffer->begin(); it != nResultBuffer->end(); it++) - { + { *tmpMsg << ( f32 )*(it); - } - + } + ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); - + return tmpMsg; -} + } + PMessage* PMsgBuilder::BuildNPCBeginAllBuyerTradeMsg( PClient* nClient, int nWorldID ) -{ + { PMessage* tmpMsg = new PMessage(); nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 )nClient->GetUDP_ID(); *tmpMsg << ( u16 )nClient->GetSessionID(); @@ -1592,17 +1593,17 @@ PMessage* PMsgBuilder::BuildNPCBeginAllBuyerTradeMsg( PClient* nClient, int nWor *tmpMsg << ( u32 ) nWorldID; *tmpMsg << ( u8 )0x01; // Traders inventory *tmpMsg << ( u16 )0xFFFF; // Traders inventory - + ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); - + return tmpMsg; -} - + } + PMessage* PMsgBuilder::BuildNPCShoppingListMsg( PClient* nClient, PMessage* nContentList, int nWorldID, u8 nItemQuality) -{ + { PMessage* tmpMsg = new PMessage(); nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 )nClient->GetUDP_ID(); *tmpMsg << ( u16 )nClient->GetSessionID(); @@ -1617,31 +1618,31 @@ PMessage* PMsgBuilder::BuildNPCShoppingListMsg( PClient* nClient, PMessage* nCon *tmpMsg << ( u16 )( nContentList->GetSize() / 6 ); // List entries *tmpMsg << ( u8 )nItemQuality; // Items quality *tmpMsg << *nContentList; - + ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); - + return tmpMsg; -} - + } + // ========================== PMessage* PMsgBuilder::BuildNPCSingleInfoMsg( PClient* nClient, u32 nWorldID, u16 nTypeID, u16 nClothing, u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nUnknown, -u16 nTraderID, string* nAngleStr, string* nNpcName, string* nCustomName) +u16 nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName) // Initial NPC Packet that defines how the NPC look, etc -{ + { // u8 tMsgLen = 29 + nNpcName->size() + nAngleStr->size() + nCustomName->size(); - + PMessage* tmpMsg = new PMessage(); nClient->IncreaseUDP_ID(); - + *tmpMsg << ( u8 )0x13; // Begin UDP message *tmpMsg << ( u16 )nClient->GetUDP_ID(); *tmpMsg << ( u16 )nClient->GetSessionID(); *tmpMsg << ( u8 )0x00; - *tmpMsg << ( u8 )0x03; - *tmpMsg << ( u16 )nClient->GetUDP_ID(); - *tmpMsg << ( u8 )0x28; - *tmpMsg << ( u8 )0x00; + *tmpMsg << ( u8 )0x03; + *tmpMsg << ( u16 )nClient->GetUDP_ID(); + *tmpMsg << ( u8 )0x28; + *tmpMsg << ( u8 )0x00; *tmpMsg << ( u8 )0x01; *tmpMsg << ( u32 )nWorldID; *tmpMsg << ( u16 )nTypeID; @@ -1650,27 +1651,27 @@ u16 nTraderID, string* nAngleStr, string* nNpcName, string* nCustomName) *tmpMsg << ( u16 )nPosY; *tmpMsg << ( u16 )nPosZ; *tmpMsg << ( u16 )nPosX; - *tmpMsg << ( u8 )0x00; + *tmpMsg << ( u8 )0x00; *tmpMsg << ( u16 )nUnknown; *tmpMsg << ( u16 )nTraderID; *tmpMsg << nNpcName->c_str(); *tmpMsg << nAngleStr->c_str(); if(nCustomName->length() > 1) *tmpMsg << nCustomName->c_str(); - + (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6); return tmpMsg; -} - + } + PMessage* PMsgBuilder::BuildNPCMassInfoMsg( u32 nWorldID, u16 nTypeID, u16 nClothing, u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nHealth, -u16 nTraderID, string* nAngleStr, string* nNpcName, string* nCustomName) +u16 nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName) // Initial NPC Packet that defines how the NPC look, etc -{ + { // u8 tMsgLen = 29 + nNpcName->size() + nAngleStr->size() + nCustomName->size(); - + PMessage* tmpMsg = new PMessage(); - + *tmpMsg << ( u8 )0x13; // Begin UDP message *tmpMsg << ( u16 )0x0000; *tmpMsg << ( u16 )0x0000; @@ -1694,16 +1695,16 @@ u16 nTraderID, string* nAngleStr, string* nNpcName, string* nCustomName) *tmpMsg << nAngleStr->c_str(); if(nCustomName->length() > 1) *tmpMsg << nCustomName->c_str(); - + (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6); - return tmpMsg; -} - + return tmpMsg; + } + // ************** PMessage* PMsgBuilder::BuildNPCUpdateMsg(u32 nWorldID, u16 nPosY, u16 nPosZ, u16 nPosX, u8 nActionBM, u16 nHealth, u8 nWeaponState, u8 nUnknown, u32 nTargetID) -{ + { PMessage* tmpMsg = new PMessage(); - + *tmpMsg << ( u8 )0x13; *tmpMsg << ( u16 )0x0000; *tmpMsg << ( u16 )0x0000; @@ -1720,17 +1721,17 @@ PMessage* PMsgBuilder::BuildNPCUpdateMsg(u32 nWorldID, u16 nPosY, u16 nPosZ, u16 *tmpMsg << ( u32 )nTargetID; // WorldID of NPCs target (if any) *tmpMsg << ( u8 )nUnknown; *tmpMsg << ( u8 )nWeaponState; - + (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6); - + return tmpMsg; -} + } // ************** - + PMessage* PMsgBuilder::BuildNPCSingleAliveMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction ) -{ + { PMessage* tmpMsg = new PMessage(); - + *tmpMsg << ( u8 )0x13; // Begin UDP message *tmpMsg << ( u16 )nClient->GetUDP_ID(); *tmpMsg << ( u16 )nClient->GetSessionID(); @@ -1746,14 +1747,14 @@ PMessage* PMsgBuilder::BuildNPCSingleAliveMsg( PClient* nClient, u32 nWorldID, u *tmpMsg << ( u8 )nHealth; *tmpMsg << ( u8 )0x00; *tmpMsg << ( u8 )nAction; - + return tmpMsg; -} - + } + PMessage* PMsgBuilder::BuildNPCMassAliveMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction ) -{ + { PMessage* tmpMsg = new PMessage(); - + *tmpMsg << ( u8 )0x13; // Begin UDP message *tmpMsg << ( u16 )0x0000; *tmpMsg << ( u16 )0x0000; @@ -1769,16 +1770,16 @@ PMessage* PMsgBuilder::BuildNPCMassAliveMsg( u32 nWorldID, u16 nX, u16 nY, u16 n *tmpMsg << ( u8 )nHealth; *tmpMsg << ( u8 )0x00; *tmpMsg << ( u8 )nAction; - + return tmpMsg; -} - + } + PMessage* PMsgBuilder::BuildNPCMassUpdateMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction ) -{ + { PMessage* tmpMsg = new PMessage(); - + *tmpMsg << ( u8 )0x13; // Begin UDP message - *tmpMsg << ( u16 )0x0000; + *tmpMsg << ( u16 )0x0000; *tmpMsg << ( u16 )0x0000; *tmpMsg << ( u8 )0x15; // Message length *tmpMsg << ( u8 )0x1b; @@ -1795,16 +1796,16 @@ PMessage* PMsgBuilder::BuildNPCMassUpdateMsg( u32 nWorldID, u16 nX, u16 nY, u16 *tmpMsg << ( u8 )0x00; // ? *tmpMsg << ( u8 )0x00; // ? *tmpMsg << ( u8 )nAction; - + return tmpMsg; -} - + } + // ========================== - + PMessage* PMsgBuilder::BuildNPCSingleUpdateMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction ) -{ + { PMessage* tmpMsg = new PMessage(); - + *tmpMsg << ( u8 )0x13; // Begin UDP message *tmpMsg << ( u16 )nClient->GetUDP_ID(); *tmpMsg << ( u16 )nClient->GetSessionID(); @@ -1823,9 +1824,9 @@ PMessage* PMsgBuilder::BuildNPCSingleUpdateMsg( PClient* nClient, u32 nWorldID, *tmpMsg << ( u8 )0x00; // ? *tmpMsg << ( u8 )0x00; // ? *tmpMsg << ( u8 )nAction; - + return tmpMsg; -} + } // ========================== PMessage* PMsgBuilder::BuildSubskillIncMsg( PClient* nClient, u8 nSubskill, u16 nSkillPoints ) { @@ -2964,7 +2965,7 @@ PMessage* PMsgBuilder::BuildRemoveWorldObjectMsg( u32 nWOID ) return tmpMsg; } -PMessage* PMsgBuilder::BuildDBRequestStatusMsg( PClient* nClient, std::string* nCommandName, u8 nStatus, u16 nErrCode ) +PMessage* PMsgBuilder::BuildDBRequestStatusMsg( PClient* nClient, std::string *nCommandName, u8 nStatus, u16 nErrCode ) { PMessage* tmpMsg = new PMessage( 32 ); nClient->IncreaseUDP_ID(); @@ -2987,7 +2988,7 @@ PMessage* PMsgBuilder::BuildDBRequestStatusMsg( PClient* nClient, std::string* n return tmpMsg; } -PMessage* PMsgBuilder::BuildDBAnswerMsg( PClient* nClient, std::string* nCommandName, std::string* nAnswerData, u16 nRows, u16 nCols ) +PMessage* PMsgBuilder::BuildDBAnswerMsg( PClient* nClient, std::string *nCommandName, std::string *nAnswerData, u16 nRows, u16 nCols ) { u8 i, j, k; PMessage* tmpMsg = new PMessage( 32 ); @@ -3648,8 +3649,8 @@ PMessage* PMsgBuilder::BuildNpcCleanupMsg( u32 nNpcId, u8 nCmd ) ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 ); return tmpMsg; -} - + } + /* void Cmd_GiveItem (int ItemId, int Amount, int ClientNum) diff --git a/server/src/game/multipart.cpp b/server/src/game/multipart.cpp index f7e58b8..c5732ad 100644 --- a/server/src/game/multipart.cpp +++ b/server/src/game/multipart.cpp @@ -200,6 +200,6 @@ void PMultiPart::AddMultiPartChunk(PClient *nClient, PMessage *nChunk, u16 nChun tSeq.smClient = nClient; // Finally, push that into our map - MsgMap.insert(make_pair(nSequence, tSeq)); + MsgMap.insert(std::make_pair(nSequence, tSeq)); } } diff --git a/server/src/game/npc.cpp b/server/src/game/npc.cpp index a91137e..f78a897 100644 --- a/server/src/game/npc.cpp +++ b/server/src/game/npc.cpp @@ -1,43 +1,43 @@ -/* + /* TinNS (TinNS is not a Neocron Server) Copyright (C) 2005 Linux Addicted Community maintainer Akiko - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -/* - + */ + + /* + npc.cpp - Management class for NPC worldactors - + CREATION: 04 Jan 2007 Namikon - + MODIFIED: 28 Apr 2009 Hammag REASON: changed worlds/zones Id from u16 (wrong !!!) to u32 - -*/ + + */ #include "main.h" -#include "npc.h" -#include "worlds.h" -#include "npctemplate.h" -#include "worlddatatemplate.h" -#include "msgbuilder.h" - -///*********************************************************************** +#include "include/npc.h" +#include "include/worlds.h" +#include "include/npctemplate.h" +#include "include/worlddatatemplate.h" +#include "include/msgbuilder.h" + + ///*********************************************************************** // Reload LUA script while running, in case we modified it and dont want to restart the entire server bool PNPC::ReloadLUAScript() @@ -48,12 +48,12 @@ bool PNPC::ReloadLUAScript() // Reload it return LoadLUAScript(); } - + bool PNPC::DEF_Load(u32 nWorldID) -{ + { if ( gDevDebug ) Console->Print( "[DEBUG] Now loading NPC data for NPC id %d from DEF", mWorldID ); const PNPCTemplate* t_defNPC = Worlds->GetWorld(nWorldID)->GetNPCTemplate(mWorldID); - + mNameID = (u16)t_defNPC->GetNPCTypeID(); // 16 or 32?? const PDefNpc* t_NpcTypeDef = GameDefs->Npcs()->GetDef(mNameID); if(!t_NpcTypeDef) @@ -61,13 +61,13 @@ bool PNPC::DEF_Load(u32 nWorldID) Console->Print("%s [PNPC::DEF_Load()] Unknown NPC Type %d in .dat file found", Console->ColorText(RED,BLACK, "[Error]"), mNameID); return false; } - + // TODO: Find out what exactly these TypeID and ClothingID values do and where they are generated/read // Possible (working) solution: Random seed for name generation that happens clientside mTypeID = GetRandom(32767, 1); mClothing = GetRandom(32767, 1); // ------------- - + mPosX = t_defNPC->GetPosX()+32768; mPosY = t_defNPC->GetPosY()+32768; mPosZ = t_defNPC->GetPosZ()+32768; @@ -79,7 +79,7 @@ bool PNPC::DEF_Load(u32 nWorldID) mFaction = t_NpcTypeDef->GetFaction(); // WorldID Fix 10.10.2009 mFromDEF = true; - + mName = t_defNPC->GetActorName(); @@ -94,7 +94,7 @@ bool PNPC::DEF_Load(u32 nWorldID) if ( gDevDebug ) Console->Print( "ANG:%d HITPOINTS:%d TRADE:%d LOOT:%d NAME:%s CNAME:%s CUSTOMSCRIPT:%s", mAngle, mHealth, mTrader, mLoot, mName.c_str(), mCustomName.c_str(), mCustomLua.c_str() ); if ( gDevDebug ) Console->Print( "DIALOGSCR:%s", mDialogScript.c_str() ); return true; -} + } bool PNPC::SQL_Load() { @@ -172,11 +172,11 @@ bool PNPC::SQL_Load() if(t_npc->GetDialogScript().length() > 3) { size_t tfound; - string t_dialogscript = t_npc->GetDialogScript(); - string t_replacechr ("\""); + std::string t_dialogscript = t_npc->GetDialogScript(); + std::string t_replacechr ("\""); tfound = t_dialogscript.find(t_replacechr); - while(tfound != string::npos) + while(tfound != std::string::npos) { t_dialogscript.replace(tfound, 1, " "); tfound = t_dialogscript.find( t_replacechr, tfound +1 ); @@ -203,8 +203,8 @@ bool PNPC::LoadLUAScript() { u32 tFileLen = 0; PFile* fLua = NULL; - string tLuaFile = ""; - string tHDRFile = ""; + std::string tLuaFile = ""; + std::string tHDRFile = ""; // Load LUA script and include the correct header file // based in mDialogScript @@ -329,17 +329,17 @@ bool PNPC::LoadLUAScript() return false; } } - -void PNPC::Die() -{ + + void PNPC::Die() + { if ( gDevDebug ) Console->Print( "[DEBUG] NPC dying now" ); mHealth = 0; mAction = NPC_ACTIONSTATE_DEATH; mRespawn = std::time( NULL ) + NPC_RESPAWN_AFTER; mDirty = true; -} - -void PNPC::Update() + } + + void PNPC::Update() { // Has to be changed for mobs later if ( std::time( NULL ) >= mRespawn && (mAction&NPC_ACTIONSTATE_DEATH) ) @@ -353,7 +353,7 @@ void PNPC::Update() } void PNPC::InitVars() -{ + { mID = 0; mWorldID = 0; mNameID = 0; @@ -386,7 +386,7 @@ void PNPC::InitVars() // Note: this is for regular heartbeats only. If npc is dirty, // an update is sent anyway mNextUpdate = std::time(NULL) + GetRandom(30, 10); -} + } void PNPC::Attack( u32 nWorldID, u8 nType, u8 nUnknown ) { @@ -396,9 +396,9 @@ void PNPC::Attack( u32 nWorldID, u8 nType, u8 nUnknown ) mWeaponStatus = nType; mUnknown = nUnknown; } - -PNPC::PNPC( int nSQLID ) -{ + + PNPC::PNPC( int nSQLID ) + { InitVars(); //if(gDevDebug) Console->Print("[DEBUG] New NPC instance created. ID is %d", nSQLID); mID = nSQLID; @@ -407,7 +407,7 @@ PNPC::PNPC( int nSQLID ) else mSuccess = true; } - + PNPC::PNPC( int nDEFID, u32 nWorldID ) { InitVars(); @@ -417,15 +417,15 @@ PNPC::PNPC( int nDEFID, u32 nWorldID ) mSuccess = false; else mSuccess = true; -} - -PNPC::~PNPC() -{ + } + + PNPC::~PNPC() + { //if(gDevDebug) Console->Print("[DEBUG] NPC ID %d terminated", mID); -} + } /* -u8 PNPC::GetActionStatus() -{ + u8 PNPC::GetActionStatus() + { if ( mDeath == true ) { return 128; // 128 triggers "death" animation @@ -434,10 +434,10 @@ u8 PNPC::GetActionStatus() { return 3; // 3 is the value found in many packets. However, no idea what this does } -} + } */ -///*********************************************************************** -///*********************************************************************** + ///*********************************************************************** + ///*********************************************************************** // Broadcast a single NPC void PNPCWorld::BroadcastNewNPC(PNPC* nNpc) @@ -498,8 +498,8 @@ void PNPCWorld::SendSingleNPCInfo( PClient* nClient, PNPC* nNpc ) nClient->SendUDPMessage( tmpMsg ); return; } - -void PNPCWorld::MSG_SendNPCs( PClient* nClient ) + + void PNPCWorld::MSG_SendNPCs( PClient* nClient ) { PNPC* nNpc = NULL; for ( PNPCMap::iterator it = mNPCs.begin(); it != mNPCs.end(); it++ ) @@ -518,35 +518,35 @@ void PNPCWorld::MSG_SendNPCs( PClient* nClient ) } bool PNPCWorld::LoadNPCfromSQL() -{ + { // Load NPC defs from MySQL MYSQL_RES *result = NULL; MYSQL_ROW row; char query[100]; - + snprintf( query, 100, "SELECT * FROM `npc_spawns` WHERE `npc_location` = %d", mWorldID ); //if(gDevDebug) Console->Print("[DEBUG] Query is: %s", query); result = MySQL->GameResQuery( query ); if ( result == NULL ) - { + { Console->Print( RED, BLACK, "PNPCWorld::PNPCWorld could not load NPC definition" ); Console->Print( "Query was:" ); Console->Print( "%s", query ); MySQL->ShowGameSQLError(); return false; - } + } if ( mysql_num_rows( result ) == 0 ) // No NPCs found - { + { MySQL->FreeGameSQLResult( result ); //if(gDevDebug) Console->Print("[NPC] No NPCs for this world found"); return true; - } + } //if(gDevDebug) Console->Print("[DEBUG] Found NPCs, now adding!"); PNPC* tmpNpc = NULL; u32 tRawID = 0; int tSQLID = 0; while (( row = mysql_fetch_row( result ) ) ) - { + { tRawID = atoi( row[PNPC::npc_worldid] ); tSQLID = atoi( row[PNPC::npc_id] ); tmpNpc = new PNPC( tSQLID ); @@ -561,59 +561,59 @@ bool PNPCWorld::LoadNPCfromSQL() //if(gDevDebug) Console->Print("[DEBUG] NPC init failed, removing link"); delete tmpNpc; } - } + } if ( gDevDebug ) Console->Print( "[DEBUG] NPC Load from MySQL done" ); MySQL->FreeGameSQLResult( result ); return true; -} - + } + bool PNPCWorld::LoadNPCfromDEF() -{ + { const PNPCsMap* tNPCmap = Worlds->GetWorld(mWorldID)->GetNPCMap(); // Get the NPC Map for this world - + PNPC* tmpNpc = NULL; u32 tDEFID = 0; - + for ( PNPCsMap::const_iterator i = tNPCmap->begin(); i != tNPCmap->end(); i++ ) - { + { // call PNPC with NPC ID and WorldID tDEFID = i->first; tmpNpc = new PNPC( tDEFID, mWorldID ); if ( tmpNpc->mSuccess == true ) - { + { mNPCs.insert( std::make_pair( tDEFID, tmpNpc ) ); tmpNpc = NULL; - } - else - { + } + else + { delete tmpNpc; - } - } + } + } if ( gDevDebug ) Console->Print( "[DEBUG] NPC Load from .def done" ); return true; -} - -PNPCWorld::PNPCWorld( u32 nWorldID ) -{ + } + + PNPCWorld::PNPCWorld( u32 nWorldID ) + { //if(gDevDebug) Console->Print("[DEBUG] New world got initialized! Now starting to add NPCs. (WorldID %d)", nWorldID); - + // Assign WorldValues now mCreation = std::time( NULL ); mWorldID = nWorldID; mLastAliveMsg = 0; LoadNPCfromSQL(); LoadNPCfromDEF(); -} - -PNPCWorld::~PNPCWorld() -{ + } + + PNPCWorld::~PNPCWorld() + { if ( gDevDebug ) Console->Print( "[DEBUG] Erasing all NPCs" ); // Erase all NPCs - for ( PNPCMap::iterator it = mNPCs.begin(); it != mNPCs.end(); it++ ) - { + for ( PNPCMap::iterator it = mNPCs.begin(); it != mNPCs.end(); it++ ) + { delete it->second; mNPCs.erase( it ); - } + } } void PNPCWorld::Update() // v2; New send function @@ -653,7 +653,8 @@ void PNPCWorld::Update() // v2; New send function } return; -} + } + /* void PNPCWorld::Update() { @@ -696,50 +697,49 @@ void PNPCWorld::Update() return; } */ -PNPC* PNPCWorld::GetNPC( u32 nNPCID ) -{ + PNPC* PNPCWorld::GetNPC( u32 nNPCID ) + { if ( gDevDebug ) Console->Print( "[DEBUG] Searching for NPC %d in list", nNPCID ); PNPCMap::const_iterator it = mNPCs.find( nNPCID ); if ( it == mNPCs.end() ) // only if client not found in list return NULL; else return it->second; -} - -///*********************************************************************** -///*********************************************************************** - -PNPCManager::PNPCManager() -{ + } + + ///*********************************************************************** + + PNPCManager::PNPCManager() + { if ( gDevDebug ) Console->Print( "[DEBUG] NPCManager wakeup!" ); // Nothing yet -} - -PNPCManager::~PNPCManager() -{ + } + + PNPCManager::~PNPCManager() + { if ( gDevDebug ) Console->Print( "[DEBUG] NPCManager shutdown" ); for ( PNPCWorldMap::iterator it = mWorlds.begin(); it != mWorlds.end(); it++ ) { delete it->second; mWorlds.erase( it ); } -} - -void PNPCManager::InitPlayer( PClient* nClient ) -{ + } + + void PNPCManager::InitPlayer( PClient* nClient ) + { if ( gDevDebug ) Console->Print( "[DEBUG] Player entered zone, doing init" ); // Ok, player entered zone. First, get zone! u32 nZone = nClient->GetChar()->GetLocation(); if ( gDevDebug ) Console->Print( "[DEBUG] Now searching for zone %d in list", nZone ); // Search worldmanager for this zone PNPCWorld* tmpWorld = GetWorld( nZone ); - + if ( tmpWorld != NULL ) - { + { if ( gDevDebug ) Console->Print( "[DEBUG] World found, poking MSG_SendNPCs" ); // World found? Fine. Then poke the class to send its content to the client tmpWorld->MSG_SendNPCs( nClient ); - } + } else { if ( gDevDebug ) Console->Print( "[DEBUG] World not found, creating...." ); @@ -755,10 +755,10 @@ void PNPCManager::InitPlayer( PClient* nClient ) tmpWorld->MSG_SendNPCs( nClient ); //tmpWorld->MSG_SendAlive( nClient ); // Force instand-update of NPCs for this client } -} - -PNPCWorld* PNPCManager::InitWorld( u32 nWorldID ) -{ + } + + PNPCWorld* PNPCManager::InitWorld( u32 nWorldID ) + { if ( gDevDebug ) Console->Print( "[DEBUG] InitWorld triggered: ID %d", nWorldID ); PNPCWorld* tmpWorld = NULL; tmpWorld = new PNPCWorld( nWorldID ); @@ -774,17 +774,17 @@ PNPCWorld* PNPCManager::InitWorld( u32 nWorldID ) if ( gDevDebug ) Console->Print( "[DEBUG] Failed to init world. Returning NULL" ); return NULL; } -} - -void PNPCManager::Update() -{ + } + + void PNPCManager::Update() + { static std::time_t lastdebug = std::time( NULL ); // Loop all worlds -// if(lastdebug < std::time(NULL)) -// if(gDevDebug) Console->Print("[DEBUG] WorldLoop still running..."); - + // if(lastdebug < std::time(NULL)) + // if(gDevDebug) Console->Print("[DEBUG] WorldLoop still running..."); + for ( PNPCWorldMap::iterator it = mWorlds.begin(); it != mWorlds.end(); it++ ) - { + { // Make sure target still exists if ( it->second ) { @@ -801,7 +801,7 @@ void PNPCManager::Update() { //if(lastdebug < std::time(NULL)) // if(gDevDebug) Console->Print("[DEBUG] World not in use. Checking lifetimer..."); - + if (( tWorld->mCreation + ZONE_RESET_AFTER ) <= std::time( NULL ) ) //if(tWorld->mCreation <= std::time(NULL)) { @@ -818,17 +818,17 @@ void PNPCManager::Update() // if(gDevDebug) Console->Print("[DEBUG] World still within ZONE_RESET timeout"); } } - } - } + } + } if ( lastdebug < std::time( NULL ) ) { lastdebug = std::time( NULL ) + 3; //if(gDevDebug) Console->Print("[DEBUG] next updateloopmsg in 3 seconds"); } -} - -PNPCWorld* PNPCManager::GetWorld( u32 nWorldID ) -{ + } + + PNPCWorld* PNPCManager::GetWorld( u32 nWorldID ) + { if ( gDevDebug ) Console->Print( "[DEBUG] Trying to get instance for worldid %d", nWorldID ); PNPCWorldMap::const_iterator it = mWorlds.find( nWorldID ); if ( it == mWorlds.end() ) @@ -841,4 +841,4 @@ PNPCWorld* PNPCManager::GetWorld( u32 nWorldID ) if ( gDevDebug ) Console->Print( "[DEBUG] Found. Returning address" ); return it->second; } -} + } diff --git a/server/src/game/npc_ai.cpp b/server/src/game/npc_ai.cpp index 4de4760..501d45d 100644 --- a/server/src/game/npc_ai.cpp +++ b/server/src/game/npc_ai.cpp @@ -1,108 +1,108 @@ -#include "main.h" -#include "npc.h" - -// First try of an "AI" :P -void PNPCWorld::CheckForEnemies(PNPC* nNPC) -{ - //return; - std::time_t tNow = time(NULL); - // Is it time for next enemy check? - - // Temp: Skip that for IDs below 1000 - if(nNPC->GetRealWorldID() < 1000) - return; - // ------------- - - if(tNow > nNPC->mNextEnemyCheck) - { - //Console->Print("[NPC AI] Checking enemy status for NPC %d", nNPC->GetRealWorldID()); - nNPC->mNextEnemyCheck = time(NULL) + NPC_ENEMYCHECK; - // Loop all NPCs in my world - - // tNearestEnemy[0] = WorldID | tNearestEnemy[1] = Distance to us - u32 tNearestEnemy[2] = {0,0}; - - for ( PNPCMap::iterator it = mNPCs.begin(); it != mNPCs.end(); it++ ) - { - if(it->second) - { - PNPC* tNPC = it->second; - // Is target = me? - if(tNPC->GetRealWorldID() == nNPC->GetRealWorldID()) - continue; - - u16 tDistance = DistanceApprox(nNPC->mPosX, nNPC->mPosY, nNPC->mPosZ, tNPC->mPosX, tNPC->mPosY, tNPC->mPosZ); - - // Is NPC infight? - if(nNPC->GetActionStatus() == NPC_ACTIONSTATE_ATTACK) - { - // If not infight with current target, skip here - if(nNPC->mTarget != tNPC->GetRealWorldID()) - continue; - - // He IS with target infight. Check range - if(tDistance > 1500) - nNPC->StopAttack(); // Enemy ran away :( cancel fight - else - { - //nNPC->Attack(tNPC->GetRealWorldID()); - continue; // Enemy is still in range, good! keep attacking him - } - - } - // Ok, NPC is not infight, so lets check if current iterator target is in range - if(tDistance > 800) - continue; // No, he's not - - // He is! Look closer at him. Get Faction standing - int tFactionMe = nNPC->mFaction; - int tFactionHim = tNPC->mFaction; - //Console->Print("[NPC AI] Checking InRange NPC %d; MyFac: %d HisFac: %d", tNPC->GetRealWorldID(), tFactionMe, tFactionHim); - - // Hey, we're friends :) - if(tFactionMe == tFactionHim) - continue; - - const PDefFaction* tFaction = NULL; - int tStanding = 0; - // Always check higher faction against lower faction - if(tFactionMe > tFactionHim) - { - tFaction = GameDefs->Factions()->GetDef(tFactionMe); - if(!tFaction) - { - Console->Print("Unknown faction: %d", tFactionMe); - continue; - } - tStanding = tFaction->GetRelation(tFactionHim); - } - else - { - tFaction = GameDefs->Factions()->GetDef(tFactionHim); - if(!tFaction) - { - Console->Print("Unknown faction: %d", tFactionHim); - continue; - } - tStanding = tFaction->GetRelation(tFactionMe); - } - // Enemies? omg! Check distance! - if(tStanding < 0) - { - if(tNearestEnemy[1] > tDistance || tNearestEnemy[0] == 0) - { - // This enemy is even closer than the stored one, or we dont have any enemy yet - tNearestEnemy[0] = tNPC->GetRealWorldID(); - tNearestEnemy[1] = tDistance; - Console->Print("NPC ID %d (Distance %d) is an Faction enemy, Standing: %d. Remembering him!", tNearestEnemy[0], tNearestEnemy[1], tStanding); - } - } - } - } - if(tNearestEnemy[0] > 0) - { - Console->Print("NPC ID %d now attacking NPC ID %d", nNPC->GetRealWorldID(), tNearestEnemy[0]); - nNPC->Attack(tNearestEnemy[0]); - } - } -} +#include "main.h" +#include "include/npc.h" + +// First try of an "AI" :P +void PNPCWorld::CheckForEnemies(PNPC* nNPC) +{ + //return; + std::time_t tNow = time(NULL); + // Is it time for next enemy check? + + // Temp: Skip that for IDs below 1000 + if(nNPC->GetRealWorldID() < 1000) + return; + // ------------- + + if(tNow > nNPC->mNextEnemyCheck) + { + //Console->Print("[NPC AI] Checking enemy status for NPC %d", nNPC->GetRealWorldID()); + nNPC->mNextEnemyCheck = time(NULL) + NPC_ENEMYCHECK; + // Loop all NPCs in my world + + // tNearestEnemy[0] = WorldID | tNearestEnemy[1] = Distance to us + u32 tNearestEnemy[2] = {0,0}; + + for ( PNPCMap::iterator it = mNPCs.begin(); it != mNPCs.end(); it++ ) + { + if(it->second) + { + PNPC* tNPC = it->second; + // Is target = me? + if(tNPC->GetRealWorldID() == nNPC->GetRealWorldID()) + continue; + + u16 tDistance = DistanceApprox(nNPC->mPosX, nNPC->mPosY, nNPC->mPosZ, tNPC->mPosX, tNPC->mPosY, tNPC->mPosZ); + + // Is NPC infight? + if(nNPC->GetActionStatus() == NPC_ACTIONSTATE_ATTACK) + { + // If not infight with current target, skip here + if(nNPC->mTarget != tNPC->GetRealWorldID()) + continue; + + // He IS with target infight. Check range + if(tDistance > 1500) + nNPC->StopAttack(); // Enemy ran away :( cancel fight + else + { + //nNPC->Attack(tNPC->GetRealWorldID()); + continue; // Enemy is still in range, good! keep attacking him + } + + } + // Ok, NPC is not infight, so lets check if current iterator target is in range + if(tDistance > 800) + continue; // No, he's not + + // He is! Look closer at him. Get Faction standing + int tFactionMe = nNPC->mFaction; + int tFactionHim = tNPC->mFaction; + //Console->Print("[NPC AI] Checking InRange NPC %d; MyFac: %d HisFac: %d", tNPC->GetRealWorldID(), tFactionMe, tFactionHim); + + // Hey, we're friends :) + if(tFactionMe == tFactionHim) + continue; + + const PDefFaction* tFaction = NULL; + int tStanding = 0; + // Always check higher faction against lower faction + if(tFactionMe > tFactionHim) + { + tFaction = GameDefs->Factions()->GetDef(tFactionMe); + if(!tFaction) + { + Console->Print("Unknown faction: %d", tFactionMe); + continue; + } + tStanding = tFaction->GetRelation(tFactionHim); + } + else + { + tFaction = GameDefs->Factions()->GetDef(tFactionHim); + if(!tFaction) + { + Console->Print("Unknown faction: %d", tFactionHim); + continue; + } + tStanding = tFaction->GetRelation(tFactionMe); + } + // Enemies? omg! Check distance! + if(tStanding < 0) + { + if(tNearestEnemy[1] > tDistance || tNearestEnemy[0] == 0) + { + // This enemy is even closer than the stored one, or we dont have any enemy yet + tNearestEnemy[0] = tNPC->GetRealWorldID(); + tNearestEnemy[1] = tDistance; + Console->Print("NPC ID %d (Distance %d) is an Faction enemy, Standing: %d. Remembering him!", tNearestEnemy[0], tNearestEnemy[1], tStanding); + } + } + } + } + if(tNearestEnemy[0] > 0) + { + Console->Print("NPC ID %d now attacking NPC ID %d", nNPC->GetRealWorldID(), tNearestEnemy[0]); + nNPC->Attack(tNearestEnemy[0]); + } + } +} diff --git a/server/src/game/npc_conversation.cpp b/server/src/game/npc_conversation.cpp index 875d595..05a4c82 100644 --- a/server/src/game/npc_conversation.cpp +++ b/server/src/game/npc_conversation.cpp @@ -1,367 +1,367 @@ -/* -TinNS (TinNS is not a Neocron Server) -Copyright (C) 2005 Linux Addicted Community -maintainer Akiko - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. -*/ - -/* - -npc_conversation.cpp - Split up file for NPC conversations (Trade and QuestStuff) - -CREATION: 11 Oct 2009 Namikon - -*/ - -#include "main.h" -#include "npc.h" -#include "worlds.h" -#include "npctemplate.h" -#include "worlddatatemplate.h" -#include "msgbuilder.h" - -///*********************************************************************** - -bool PNPC::SetShopQuality(u8 nNewVal) -{ - // Ignore that setting if NPC is loaded from .def - if(mFromDEF == true) - return false; - - if(nNewVal == 0) - return false; - - mItemQuality = nNewVal; - return true; -} - -bool PNPC::ReloadShopList() -{ - // Shop list will be reloaded uppon next click - mVectItemsInShop.erase(mVectItemsInShop.begin(), mVectItemsInShop.end()); - return true; -} - -void PNPC::AddToVectorList(u16 nItemID, u32 nPrice) -{ - stShopListEntry tEntry; - tEntry.ItemID = nItemID; - tEntry.Price = nPrice; - Console->Print("New item in buffer: %d price %d", tEntry.ItemID, tEntry.Price); - mVectItemsInShop.push_back(tEntry); -} - -void PNPC::ContentListAddItem(PMessage* nContentList, u16 nItemID, u32 nBasePrice, bool nAddToList) -{ - // Items with baseprice = 0 are ignored! - if(nBasePrice == 0) - return; - - // Modify baseprice with Config value - f32 tPerCent = Config->GetOptionInt("item_price"); - tPerCent = tPerCent / 100; - u32 tPrice = nBasePrice * tPerCent; - *nContentList << ( u16 ) nItemID; - *nContentList << ( u32 )( tPrice ); - - if(nAddToList) - AddToVectorList(nItemID, tPrice); - - if (gDevDebug) Console->Print("[PNPC::ContentListAddItem] Adding item: ID: %d Price: %u", nItemID, tPrice); -} - -void PNPC::ContentListAddItemGroup(PMessage* nContentList, u32 nItemGroupID) -{ - const PDefItems* tDefItems = NULL; - std::map::const_iterator itStart = GameDefs->Items()->ConstIteratorBegin(); - std::map::const_iterator itEnd = GameDefs->Items()->ConstIteratorEnd(); - for ( std::map::const_iterator i = itStart; i != itEnd; i++ ) - { - tDefItems = i->second; - if((u32)tDefItems->GetItemGroupID() == nItemGroupID) - { - // Pricing: Use Baseprice - // If Baseprice is 0, use Quality * Techlevel * 2 - u32 tPrice = tDefItems->GetBasePrice(); - if(tPrice == 0) - { - tPrice = tDefItems->GetTechlevel() * mItemQuality * 2; - } - - ContentListAddItem(nContentList, i->first, tPrice); - } - } -} - -bool PNPC::DoSQLShoppingList( PClient* nClient, PMessage* nContentList ) -{ - MYSQL_RES *result = NULL; - MYSQL_ROW row; - char query[100]; - - snprintf( query, 100, "SELECT * FROM `npc_shop` WHERE `c_npc_id` = %d AND `c_zoneid` = %d", mWorldID, nClient->GetChar()->GetLocation()); - if (gDevDebug) Console->Print( "[PNPC::DoSQLShoppingList] Executing query %s", query ); - result = MySQL->GameResQuery( query ); - if ( result == NULL ) - { - Console->Print( YELLOW, BLACK, "[PNPC::DoSQLShoppingList] could not load shoplist from SQL" ); - Console->Print( "Query was:" ); - Console->Print( "%s", query ); - MySQL->ShowGameSQLError(); - return false; - } - if ( mysql_num_rows( result ) == 0 ) - { - if (gDevDebug) Console->Print( YELLOW, BLACK, "[PNPC::DoSQLShoppingList] No items found in SQL for NPC %d", mWorldID); - MySQL->FreeGameSQLResult( result ); - return false; - } - - f32 tPerCent = Config->GetOptionInt("item_price"); - tPerCent = tPerCent / 100; - - while((row = mysql_fetch_row(result))) - { - const PDefItems* t_item = GameDefs->Items()->GetDef(atoi( row[2] )); - if(t_item) - { - // Pricing: If no value in DB is set, use Baseprice - // If Baseprice is 0, use Quality * Techlevel * 2 - u32 tPrice = atoi(row[3]); - if(tPrice == 0) - { - tPrice = t_item->GetBasePrice(); - if(tPrice == 0) - { - tPrice = t_item->GetTechlevel() * mItemQuality * 2; - } - } - - // Modify price as told in config - tPrice = tPrice * tPerCent; - u16 tItemID = atoi(row[2]); - - *nContentList << ( u16 ) tItemID; - *nContentList << ( u32 ) tPrice; - - // Store item position in list for later trade stuff - AddToVectorList(tItemID, tPrice); - - if (gDevDebug) Console->Print("Adding item: ID: %d Price: %d", tItemID, tPrice); - } - } - MySQL->FreeGameSQLResult( result ); - return true; -} - -bool PNPC::IsAllbuyer( PClient* nClient ) -{ - MYSQL_RES *result = NULL; - char query[100]; - - snprintf( query, 100, "SELECT * FROM `npc_shop` WHERE `c_npc_id` = %d AND `c_zoneid` = %d and `c_itemid` = -1", mWorldID, nClient->GetChar()->GetLocation()); - Console->Print( "[PNPC::IsAllbuyer] Executing query %s", query ); - result = MySQL->GameResQuery( query ); - if ( result == NULL ) - { - Console->Print( YELLOW, BLACK, "[PNPC::IsAllbuyer] could not check if npc is allbuyer" ); - Console->Print( "Query was:" ); - Console->Print( "%s", query ); - MySQL->ShowGameSQLError(); - return false; - } - int count = mysql_num_rows(result); - MySQL->FreeGameSQLResult( result ); - if(count > 0) - return true; - else - return false; -} - -bool PNPC::HasSQLShoppingList( PClient* nClient ) -{ - MYSQL_RES *result = NULL; - char query[100]; - - snprintf( query, 100, "SELECT * FROM `npc_shop` WHERE `c_npc_id` = %d AND `c_zoneid` = %d", mWorldID, nClient->GetChar()->GetLocation()); - Console->Print( "[PNPC::HasSQLShoppingList] Executing query %s", query ); - result = MySQL->GameResQuery( query ); - if ( result == NULL ) - { - Console->Print( YELLOW, BLACK, "[PNPC::HasSQLShoppingList] could not load shoplist from SQL" ); - Console->Print( "Query was:" ); - Console->Print( "%s", query ); - MySQL->ShowGameSQLError(); - return false; - } - int count = mysql_num_rows(result); - MySQL->FreeGameSQLResult( result ); - if(count > 0) - return true; - else - return false; -} - -void PNPC::StartDialog( PClient* nClient/*, string &nDialogscript*/ ) -{ - std::string t_ScriptName = ""; - if(mFromDEF == false && mCustomLua.length() > 1) - { - char tmpnum[11]; - snprintf(tmpnum, 11, "%d", mID); - t_ScriptName = tmpnum; - } - else - { - t_ScriptName = mDialogScript; - } - - u32 tWorldID = GetRealWorldID(); - // Starts dialog with NPC - // First, set required values in client's char - nClient->GetChar()->SetDialogNPC(mWorldID); - nClient->GetChar()->SetDialogNode(0); - - // Second generate start-dialog message - PMessage* tmpMsg = MsgBuilder->BuildNPCStartDialogMsg(nClient, tWorldID, &t_ScriptName); - nClient->SendUDPMessage(tmpMsg); - - Console->Print("[PNPC::StartDialog] Sending NPC DialogStart for Script %s", t_ScriptName.c_str()); - return; -} - -void PNPC::StartConversation( PClient* nClient ) -{ - // Set Offset to mWorldID - // .def NPCs need this offset in order to work - u32 tRealID = GetRealWorldID(); - - // Check if NPC has script for talking - // OR - // Check if NPC is from SQL and has a custom LUA script stored in DB - if(mScripting == true) - { - if(mDialogScript.length() > 0 || (mFromDEF == false && mCustomLua.length() > 1)) - { - StartDialog(nClient); - return; - } - } - - // Check if NPC has a TradeID - Console->Print("[DEBUG] NPC WorldID %u NPC TraderDefID %u", tRealID, mTrader); - if(IsAllbuyer(nClient) == true) - { - PMessage* tmpMsg = MsgBuilder->BuildNPCBeginAllBuyerTradeMsg(nClient, tRealID); - nClient->SendUDPMessage(tmpMsg); - - return; - } - - if(mTrader > 0) - { - // NPC is a trader. Fetch trader template from def - const PDefTrader* nTraderDef = GameDefs->Traders()->GetDef(mTrader); - - // Is the NPC a trading one? (Def-defined) - if(nTraderDef) - { - // Preparing ItemList for shopping - PMessage* ContentList = new PMessage(); - - // Check if we already have our Vector filled with itemIDs - if(mVectItemsInShop.size() > 0) - { - Console->Print("Using Vector shopping list"); - vector ::iterator it; - for(it = mVectItemsInShop.begin(); it < mVectItemsInShop.end(); it++) - ContentListAddItem(ContentList, (*it).ItemID, (*it).Price, false); - } - else - { - int t_ItemGroupID = nTraderDef->GetType(); - int t_CurrItem = 0; - int t_DefItemEnt = nTraderDef->GetItemId(t_CurrItem); - while(t_DefItemEnt != 0) - { - // Loop through all item(groups) in trader.def - if(t_DefItemEnt < 0) - { - // We got a ItemGroup - ContentListAddItemGroup(ContentList, (t_DefItemEnt * -1)); - } - else - { - // We got a normal Item - ContentListAddItem(ContentList, t_DefItemEnt, 0, nTraderDef->GetQuality()); - } - - t_DefItemEnt = nTraderDef->GetItemId(++t_CurrItem); - } - if (gDevDebug) Console->Print("[PNPC::StartConversation] TraderTemplate: %d, Type: %d", mTrader, t_ItemGroupID); - } - - - // Step 2: Send Packet to start trade - PMessage* tmpMsg = MsgBuilder->BuildNPCShoppingListMsg(nClient, ContentList, tRealID, nTraderDef->GetQuality()); - nClient->FragmentAndSendUDPMessage(tmpMsg, 0xac); - - delete ContentList; - } - else - { - Console->Print( YELLOW, BLACK, "[PNPC::StartConversation] unknown/invalid traderID ignoring traderequest" ); - return; - } - } - // Not a regular trader? Check if we have some SQL Based shopping list - else if(HasSQLShoppingList(nClient) == true) - { - PMessage* ContentList = new PMessage(); - if(DoSQLShoppingList(nClient, ContentList) == true) - { - PMessage* tmpMsg = MsgBuilder->BuildNPCShoppingListMsg(nClient, ContentList, tRealID, mItemQuality); - nClient->FragmentAndSendUDPMessage(tmpMsg, 0xac); - - delete ContentList; - } - else - { - Console->Print( RED, BLACK, "[PNPC::StartConversation] Failed to generate SQL Shopping list" ); - delete ContentList; - } - return; - } - else - { - // No script found? No shopping list? Well, then this NPC looks.. inactive :) - if (gDevDebug) Console->Print("[PNPC::StartConversation] Inactive NPC"); - return; - } -} - - -// DoConversation: -// nClient : The client which startet the conversation / is doing it right now -// nAnswer: the Answer the player clicked -void PNPC::DoConversation( PClient* nClient, u8 nAnswer ) -{ - // LUA Engine v3: Let the LuaEngine handle everything! - LuaEngine->ProcessDialogScript(nClient, mLUAFile, nAnswer); - - return; -} +/* +TinNS (TinNS is not a Neocron Server) +Copyright (C) 2005 Linux Addicted Community +maintainer Akiko + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. +*/ + +/* + +npc_conversation.cpp - Split up file for NPC conversations (Trade and QuestStuff) + +CREATION: 11 Oct 2009 Namikon + +*/ + +#include "main.h" +#include "include/npc.h" +#include "include/worlds.h" +#include "include/npctemplate.h" +#include "include/worlddatatemplate.h" +#include "include/msgbuilder.h" + +///*********************************************************************** + +bool PNPC::SetShopQuality(u8 nNewVal) +{ + // Ignore that setting if NPC is loaded from .def + if(mFromDEF == true) + return false; + + if(nNewVal == 0) + return false; + + mItemQuality = nNewVal; + return true; +} + +bool PNPC::ReloadShopList() +{ + // Shop list will be reloaded uppon next click + mVectItemsInShop.erase(mVectItemsInShop.begin(), mVectItemsInShop.end()); + return true; +} + +void PNPC::AddToVectorList(u16 nItemID, u32 nPrice) +{ + stShopListEntry tEntry; + tEntry.ItemID = nItemID; + tEntry.Price = nPrice; + Console->Print("New item in buffer: %d price %d", tEntry.ItemID, tEntry.Price); + mVectItemsInShop.push_back(tEntry); +} + +void PNPC::ContentListAddItem(PMessage* nContentList, u16 nItemID, u32 nBasePrice, bool nAddToList) +{ + // Items with baseprice = 0 are ignored! + if(nBasePrice == 0) + return; + + // Modify baseprice with Config value + f32 tPerCent = Config->GetOptionInt("item_price"); + tPerCent = tPerCent / 100; + u32 tPrice = nBasePrice * tPerCent; + *nContentList << ( u16 ) nItemID; + *nContentList << ( u32 )( tPrice ); + + if(nAddToList) + AddToVectorList(nItemID, tPrice); + + if (gDevDebug) Console->Print("[PNPC::ContentListAddItem] Adding item: ID: %d Price: %u", nItemID, tPrice); +} + +void PNPC::ContentListAddItemGroup(PMessage* nContentList, u32 nItemGroupID) +{ + const PDefItems* tDefItems = NULL; + std::map::const_iterator itStart = GameDefs->Items()->ConstIteratorBegin(); + std::map::const_iterator itEnd = GameDefs->Items()->ConstIteratorEnd(); + for ( std::map::const_iterator i = itStart; i != itEnd; i++ ) + { + tDefItems = i->second; + if((u32)tDefItems->GetItemGroupID() == nItemGroupID) + { + // Pricing: Use Baseprice + // If Baseprice is 0, use Quality * Techlevel * 2 + u32 tPrice = tDefItems->GetBasePrice(); + if(tPrice == 0) + { + tPrice = tDefItems->GetTechlevel() * mItemQuality * 2; + } + + ContentListAddItem(nContentList, i->first, tPrice); + } + } +} + +bool PNPC::DoSQLShoppingList( PClient* nClient, PMessage* nContentList ) +{ + MYSQL_RES *result = NULL; + MYSQL_ROW row; + char query[100]; + + snprintf( query, 100, "SELECT * FROM `npc_shop` WHERE `c_npc_id` = %d AND `c_zoneid` = %d", mWorldID, nClient->GetChar()->GetLocation()); + if (gDevDebug) Console->Print( "[PNPC::DoSQLShoppingList] Executing query %s", query ); + result = MySQL->GameResQuery( query ); + if ( result == NULL ) + { + Console->Print( YELLOW, BLACK, "[PNPC::DoSQLShoppingList] could not load shoplist from SQL" ); + Console->Print( "Query was:" ); + Console->Print( "%s", query ); + MySQL->ShowGameSQLError(); + return false; + } + if ( mysql_num_rows( result ) == 0 ) + { + if (gDevDebug) Console->Print( YELLOW, BLACK, "[PNPC::DoSQLShoppingList] No items found in SQL for NPC %d", mWorldID); + MySQL->FreeGameSQLResult( result ); + return false; + } + + f32 tPerCent = Config->GetOptionInt("item_price"); + tPerCent = tPerCent / 100; + + while((row = mysql_fetch_row(result))) + { + const PDefItems* t_item = GameDefs->Items()->GetDef(atoi( row[2] )); + if(t_item) + { + // Pricing: If no value in DB is set, use Baseprice + // If Baseprice is 0, use Quality * Techlevel * 2 + u32 tPrice = atoi(row[3]); + if(tPrice == 0) + { + tPrice = t_item->GetBasePrice(); + if(tPrice == 0) + { + tPrice = t_item->GetTechlevel() * mItemQuality * 2; + } + } + + // Modify price as told in config + tPrice = tPrice * tPerCent; + u16 tItemID = atoi(row[2]); + + *nContentList << ( u16 ) tItemID; + *nContentList << ( u32 ) tPrice; + + // Store item position in list for later trade stuff + AddToVectorList(tItemID, tPrice); + + if (gDevDebug) Console->Print("Adding item: ID: %d Price: %d", tItemID, tPrice); + } + } + MySQL->FreeGameSQLResult( result ); + return true; +} + +bool PNPC::IsAllbuyer( PClient* nClient ) +{ + MYSQL_RES *result = NULL; + char query[100]; + + snprintf( query, 100, "SELECT * FROM `npc_shop` WHERE `c_npc_id` = %d AND `c_zoneid` = %d and `c_itemid` = -1", mWorldID, nClient->GetChar()->GetLocation()); + Console->Print( "[PNPC::IsAllbuyer] Executing query %s", query ); + result = MySQL->GameResQuery( query ); + if ( result == NULL ) + { + Console->Print( YELLOW, BLACK, "[PNPC::IsAllbuyer] could not check if npc is allbuyer" ); + Console->Print( "Query was:" ); + Console->Print( "%s", query ); + MySQL->ShowGameSQLError(); + return false; + } + int count = mysql_num_rows(result); + MySQL->FreeGameSQLResult( result ); + if(count > 0) + return true; + else + return false; +} + +bool PNPC::HasSQLShoppingList( PClient* nClient ) +{ + MYSQL_RES *result = NULL; + char query[100]; + + snprintf( query, 100, "SELECT * FROM `npc_shop` WHERE `c_npc_id` = %d AND `c_zoneid` = %d", mWorldID, nClient->GetChar()->GetLocation()); + Console->Print( "[PNPC::HasSQLShoppingList] Executing query %s", query ); + result = MySQL->GameResQuery( query ); + if ( result == NULL ) + { + Console->Print( YELLOW, BLACK, "[PNPC::HasSQLShoppingList] could not load shoplist from SQL" ); + Console->Print( "Query was:" ); + Console->Print( "%s", query ); + MySQL->ShowGameSQLError(); + return false; + } + int count = mysql_num_rows(result); + MySQL->FreeGameSQLResult( result ); + if(count > 0) + return true; + else + return false; +} + +void PNPC::StartDialog( PClient* nClient/*, string &nDialogscript*/ ) +{ + std::string t_ScriptName = ""; + if(mFromDEF == false && mCustomLua.length() > 1) + { + char tmpnum[11]; + snprintf(tmpnum, 11, "%d", mID); + t_ScriptName = tmpnum; + } + else + { + t_ScriptName = mDialogScript; + } + + u32 tWorldID = GetRealWorldID(); + // Starts dialog with NPC + // First, set required values in client's char + nClient->GetChar()->SetDialogNPC(mWorldID); + nClient->GetChar()->SetDialogNode(0); + + // Second generate start-dialog message + PMessage* tmpMsg = MsgBuilder->BuildNPCStartDialogMsg(nClient, tWorldID, &t_ScriptName); + nClient->SendUDPMessage(tmpMsg); + + Console->Print("[PNPC::StartDialog] Sending NPC DialogStart for Script %s", t_ScriptName.c_str()); + return; +} + +void PNPC::StartConversation( PClient* nClient ) +{ + // Set Offset to mWorldID + // .def NPCs need this offset in order to work + u32 tRealID = GetRealWorldID(); + + // Check if NPC has script for talking + // OR + // Check if NPC is from SQL and has a custom LUA script stored in DB + if(mScripting == true) + { + if(mDialogScript.length() > 0 || (mFromDEF == false && mCustomLua.length() > 1)) + { + StartDialog(nClient); + return; + } + } + + // Check if NPC has a TradeID + Console->Print("[DEBUG] NPC WorldID %u NPC TraderDefID %u", tRealID, mTrader); + if(IsAllbuyer(nClient) == true) + { + PMessage* tmpMsg = MsgBuilder->BuildNPCBeginAllBuyerTradeMsg(nClient, tRealID); + nClient->SendUDPMessage(tmpMsg); + + return; + } + + if(mTrader > 0) + { + // NPC is a trader. Fetch trader template from def + const PDefTrader* nTraderDef = GameDefs->Traders()->GetDef(mTrader); + + // Is the NPC a trading one? (Def-defined) + if(nTraderDef) + { + // Preparing ItemList for shopping + PMessage* ContentList = new PMessage(); + + // Check if we already have our Vector filled with itemIDs + if(mVectItemsInShop.size() > 0) + { + Console->Print("Using Vector shopping list"); + std::vector::iterator it; + for(it = mVectItemsInShop.begin(); it < mVectItemsInShop.end(); it++) + ContentListAddItem(ContentList, (*it).ItemID, (*it).Price, false); + } + else + { + int t_ItemGroupID = nTraderDef->GetType(); + int t_CurrItem = 0; + int t_DefItemEnt = nTraderDef->GetItemId(t_CurrItem); + while(t_DefItemEnt != 0) + { + // Loop through all item(groups) in trader.def + if(t_DefItemEnt < 0) + { + // We got a ItemGroup + ContentListAddItemGroup(ContentList, (t_DefItemEnt * -1)); + } + else + { + // We got a normal Item + ContentListAddItem(ContentList, t_DefItemEnt, 0, nTraderDef->GetQuality()); + } + + t_DefItemEnt = nTraderDef->GetItemId(++t_CurrItem); + } + if (gDevDebug) Console->Print("[PNPC::StartConversation] TraderTemplate: %d, Type: %d", mTrader, t_ItemGroupID); + } + + + // Step 2: Send Packet to start trade + PMessage* tmpMsg = MsgBuilder->BuildNPCShoppingListMsg(nClient, ContentList, tRealID, nTraderDef->GetQuality()); + nClient->FragmentAndSendUDPMessage(tmpMsg, 0xac); + + delete ContentList; + } + else + { + Console->Print( YELLOW, BLACK, "[PNPC::StartConversation] unknown/invalid traderID ignoring traderequest" ); + return; + } + } + // Not a regular trader? Check if we have some SQL Based shopping list + else if(HasSQLShoppingList(nClient) == true) + { + PMessage* ContentList = new PMessage(); + if(DoSQLShoppingList(nClient, ContentList) == true) + { + PMessage* tmpMsg = MsgBuilder->BuildNPCShoppingListMsg(nClient, ContentList, tRealID, mItemQuality); + nClient->FragmentAndSendUDPMessage(tmpMsg, 0xac); + + delete ContentList; + } + else + { + Console->Print( RED, BLACK, "[PNPC::StartConversation] Failed to generate SQL Shopping list" ); + delete ContentList; + } + return; + } + else + { + // No script found? No shopping list? Well, then this NPC looks.. inactive :) + if (gDevDebug) Console->Print("[PNPC::StartConversation] Inactive NPC"); + return; + } +} + + +// DoConversation: +// nClient : The client which startet the conversation / is doing it right now +// nAnswer: the Answer the player clicked +void PNPC::DoConversation( PClient* nClient, u8 nAnswer ) +{ + // LUA Engine v3: Let the LuaEngine handle everything! + LuaEngine->ProcessDialogScript(nClient, mLUAFile, nAnswer); + + return; +} diff --git a/server/src/game/npctemplate.cpp b/server/src/game/npctemplate.cpp index 6d280fc..1971819 100644 --- a/server/src/game/npctemplate.cpp +++ b/server/src/game/npctemplate.cpp @@ -1,21 +1,21 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ @@ -29,7 +29,7 @@ REASON: - creation #include "main.h" -#include "npctemplate.h" +#include "include/npctemplate.h" PNPCTemplate::PNPCTemplate() { diff --git a/server/src/game/outpost.cpp b/server/src/game/outpost.cpp index 91c3f57..ae54c8c 100644 --- a/server/src/game/outpost.cpp +++ b/server/src/game/outpost.cpp @@ -28,7 +28,7 @@ CREATION: 24 Oct 2009 Namikon */ #include "main.h" -#include "msgbuilder.h" +#include "include/msgbuilder.h" POutpost::POutpost() { diff --git a/server/src/game/sql.cpp b/server/src/game/sql.cpp index 3812bdc..9616c25 100644 --- a/server/src/game/sql.cpp +++ b/server/src/game/sql.cpp @@ -311,7 +311,7 @@ u32 PMySQL::EscapeString(const char* nText, char* dText, u32 dMaxLength) { nLength = tMax; } - + return mysql_real_escape_string(game_dbHandle, dText, nText, nLength); } diff --git a/server/src/game/subway.cpp b/server/src/game/subway.cpp index 24ac2af..8a1a298 100644 --- a/server/src/game/subway.cpp +++ b/server/src/game/subway.cpp @@ -21,11 +21,12 @@ /* - subway.h - subway class + subway.h - subway class MODIFIED: 9 Nov 2007 Hammag REASON: - creation - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ /* @@ -37,9 +38,12 @@ Offset =MOD(M86-122778+(M85*29896);328860) */ + #include "main.h" -#include "subway.h" -#include "chars.h" // for PCharCoordinates only + +#include "include/subway.h" +#include "include/chars.h" // for PCharCoordinates only + // Determines relative position of cabs, but how ??? const u16 PSubway::mSubwayInitData [] = {0x4396, 0x4387, 0x4370, 0x4352, 0x4334, 0x4316, 0x42f0, 0x42b4, 0x4270, 0x41f0, 0x0000}; diff --git a/server/src/game/terminal.cpp b/server/src/game/terminal.cpp index fab9bb0..0577627 100644 --- a/server/src/game/terminal.cpp +++ b/server/src/game/terminal.cpp @@ -26,25 +26,27 @@ MODIFIED: 08 Jan 2007 Namikon REASON: - Created - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "terminal.h" -#include "msgbuilder.h" - - -PTerminal::PTerminal() -{ - snprintf(mConPrefix, 50, "[PConsole]"); - EraseVars(); -} - -void PTerminal::EraseVars() -{ - memset(mSQLQuery, '\0', 500); - mResultFields = 0; -} +#include "include/terminal.h" +#include "include/msgbuilder.h" + + +PTerminal::PTerminal() +{ + snprintf(mConPrefix, 50, "[PConsole]"); + EraseVars(); +} + +void PTerminal::EraseVars() +{ + memset(mSQLQuery, '\0', 500); + mResultFields = 0; +} u8 PTerminal::GetNewEmailCount(PClient* nClient, bool nNoticeClient) { @@ -74,12 +76,13 @@ u8 PTerminal::GetNewEmailCount(PClient* nClient, bool nNoticeClient) row = mysql_fetch_row(result); u8 tRetVal = (u8)atoi(row[0]); MySQL->FreeGameSQLResult(result); - - if(nNoticeClient) + + if(nNoticeClient) { - PMessage* tmpMsg = MsgBuilder->BuildYouGotEmailsMsg(nClient, tRetVal); - nClient->SendUDPMessage(tmpMsg); + PMessage* tmpMsg = MsgBuilder->BuildYouGotEmailsMsg(nClient, tRetVal); + nClient->SendUDPMessage(tmpMsg); } + return tRetVal; } diff --git a/server/src/game/terminal_querydb.cpp b/server/src/game/terminal_querydb.cpp index eee384c..f01d0c7 100644 --- a/server/src/game/terminal_querydb.cpp +++ b/server/src/game/terminal_querydb.cpp @@ -1,128 +1,128 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - terminal_querydb.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...) - > Sub-File for terminal "ReceiveDB" command - - MODIFIED: 18 Oct 2009 Namikon - REASON: - Created - -*/ - -#include "main.h" -#include "terminal.h" -#include "msgbuilder.h" - - -bool PTerminal::HandleQueryDB(PClient* nClient, std::string *nDBCommandName, std::string *nCommandName, std::string *nOptions, u8 nNumOptions) -{ +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + + +/* + terminal_querydb.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...) + > Sub-File for terminal "ReceiveDB" command + + MODIFIED: 18 Oct 2009 Namikon + REASON: - Created + +*/ + +#include "main.h" +#include "include/terminal.h" +#include "include/msgbuilder.h" + + +bool PTerminal::HandleQueryDB(PClient* nClient, std::string *nDBCommandName, std::string *nCommandName, std::string *nOptions, u8 nNumOptions) +{ EraseVars(); - bool tOk = false; - - if(!strcmp(nDBCommandName->c_str(), "ACM")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "CHANGELEADER")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "CHANGERANK")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "CHECKRUNNER")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "CSM")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "DELETECLAN")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "DISMISSMEMBER")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "DISMISSVEHICLE")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "GIVEMONEY")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "JOINCLAN")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "KICKPLAYER")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "QUITCLAN")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "REPAIRVEHICLE")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "SPAWNVEHICLE")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "TAKEFACTIONMONEY")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "TAKEMONEY")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "TRADESTOCKX")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "WARPPLAYER")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else if(!strcmp(nDBCommandName->c_str(), "WARPPLAYERTOWORLD")) - { - Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); - } - else - { - // Ok this REALLY should'nt happen.. But who knows..? - Console->Print("%s [PTerminal::HandleQueryDB] Unknown ServerMessage: %s", Console->ColorText(RED,BLACK,"Error"), nDBCommandName->c_str()); - return false; - } - - return tOk; -} + bool tOk = false; + + if(!strcmp(nDBCommandName->c_str(), "ACM")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "CHANGELEADER")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "CHANGERANK")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "CHECKRUNNER")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "CSM")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "DELETECLAN")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "DISMISSMEMBER")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "DISMISSVEHICLE")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "GIVEMONEY")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "JOINCLAN")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "KICKPLAYER")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "QUITCLAN")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "REPAIRVEHICLE")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "SPAWNVEHICLE")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "TAKEFACTIONMONEY")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "TAKEMONEY")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "TRADESTOCKX")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "WARPPLAYER")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else if(!strcmp(nDBCommandName->c_str(), "WARPPLAYERTOWORLD")) + { + Console->Print("%s [PTerminal::HandleQueryDB] Nothing to do; Function not written yet: %s", Console->ColorText(YELLOW,BLACK,"Notice"), nDBCommandName->c_str()); + } + else + { + // Ok this REALLY should'nt happen.. But who knows..? + Console->Print("%s [PTerminal::HandleQueryDB] Unknown ServerMessage: %s", Console->ColorText(RED,BLACK,"Error"), nDBCommandName->c_str()); + return false; + } + + return tOk; +} diff --git a/server/src/game/terminal_receivedb.cpp b/server/src/game/terminal_receivedb.cpp index 51dcd38..d107638 100644 --- a/server/src/game/terminal_receivedb.cpp +++ b/server/src/game/terminal_receivedb.cpp @@ -23,121 +23,124 @@ /* terminal_receivedb.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...) - > Sub-File for terminal "ReceiveDB" command + Sub-File for terminal "ReceiveDB" command MODIFIED: 12 Jan 2007 Namikon REASON: - Created - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "terminal.h" -#include "msgbuilder.h" + +#include "include/terminal.h" +#include "include/msgbuilder.h" bool PTerminal::HandleReceiveDB(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown) { - EraseVars(); - int nAccessLevel = nClient->GetAccountLevel(); + EraseVars(); + int nAccessLevel = nClient->GetAccountLevel(); //Console->Print("DBID: %d", nDBID); switch (nDBID) { case 8: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 6; - if(!strncmp(nOptions[0].c_str(), "date", 4)) - //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - else - //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 6; + if(!strncmp(nOptions[0].c_str(), "date", 4)) + //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + else + //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + break; case 9: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 6; - if(!strncmp(nOptions[0].c_str(), "date", 4)) - //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - else - //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 6; + if(!strncmp(nOptions[0].c_str(), "date", 4)) + //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + else + //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 1 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; case 10: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 6; - if(!strncmp(nOptions[0].c_str(), "date", 4)) - //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - else - //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 11: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 6; + if(!strncmp(nOptions[0].c_str(), "date", 4)) + //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + else + //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_approved FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_approved FROM `neochronicle` WHERE nc_approved = 0 ORDER BY nc_datetime DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 11: if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 6; - //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_content FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_id = %d", atoi(nOptions[0].c_str())); - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_content FROM `neochronicle` WHERE nc_id = %d", atoi(nOptions[0].c_str())); - //snprintf (mSQLQuery, 500, "SELECT na_id, \'\', na_datetime, na_author, na_name, na_content FROM `neocron articles` WHERE na_approval = 1 AND na_id = %d", atoi(nOptions[0].c_str())); + mResultFields = 6; + //snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, c_name, nc_name, nc_content FROM `neochronicle` INNER JOIN characters ON (nc_author = c_id) WHERE nc_id = %d", atoi(nOptions[0].c_str())); + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_icon, nc_datetime, nc_author, nc_name, nc_content FROM `neochronicle` WHERE nc_id = %d", atoi(nOptions[0].c_str())); + //snprintf (mSQLQuery, 500, "SELECT na_id, \'\', na_datetime, na_author, na_name, na_content FROM `neocron articles` WHERE na_approval = 1 AND na_id = %d", atoi(nOptions[0].c_str())); break; - case 14: - // 0: ID 1: Short 2: Clanname 3: FactionID 4: Faction Symp - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 6; // TODO: replace 0 with average faction sympathy + case 14: + // 0: ID 1: Short 2: Clanname 3: FactionID 4: Faction Symp + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 6; // TODO: replace 0 with average faction sympathy snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_faction, \"0\", \"0\" FROM `clans` WHERE cl_name LIKE \"%%%s%%\" LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); break; - case 16: + case 16: if(!ChkOpt(nNumOptions, 3)) break; - if (!strcmp (nOptions[0].c_str(), "Neocronicle")) - { - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT na_id, \'0\', na_datetime, na_author, na_name FROM `neocron articles` WHERE na_approval = 1 LIMIT %s, %s", nOptions[1].c_str(), nOptions[2].c_str()); - } - else - { - mResultFields = 7; - snprintf (mSQLQuery, 500, "SELECT na_id, \'0\', na_datetime, na_author, na_name, na_approval, \"0\" FROM `neocron articles` LIMIT %s, %s", nOptions[1].c_str(), nOptions[2].c_str()); + if (!strcmp (nOptions[0].c_str(), "Neocronicle")) + { + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT na_id, \'0\', na_datetime, na_author, na_name FROM `neocron articles` WHERE na_approval = 1 LIMIT %s, %s", nOptions[1].c_str(), nOptions[2].c_str()); + } + else + { + mResultFields = 7; + snprintf (mSQLQuery, 500, "SELECT na_id, \'0\', na_datetime, na_author, na_name, na_approval, \"0\" FROM `neocron articles` LIMIT %s, %s", nOptions[1].c_str(), nOptions[2].c_str()); } - - break; - case 18: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT c_name FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); - - break; - case 20: - case 21: - // Select either c_"name" or c_"minsympathy". Names taken from option, saves if/else - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT `cl_%s` FROM `clans` WHERE `cl_id` = %d", nOptions[0].c_str(), atoi(nOptions[1].c_str())); - - break; + + break; + case 18: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT c_name FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); + + break; + case 20: + case 21: + // Select either c_"name" or c_"minsympathy". Names taken from option, saves if/else + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT `cl_%s` FROM `clans` WHERE `cl_id` = %d", nOptions[0].c_str(), atoi(nOptions[1].c_str())); + + break; case 25: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 6; // TODO: replace 0 with average faction sympathy - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_faction, \"0\", \"0\" FROM clans WHERE cl_name > \"%s\" AND cl_name <=\"%s\" LIMIT %d, %d", nOptions[0].c_str(), nOptions[1].c_str(), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 6; // TODO: replace 0 with average faction sympathy + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_faction, \"0\", \"0\" FROM clans WHERE cl_name > \"%s\" AND cl_name <=\"%s\" LIMIT %d, %d", nOptions[0].c_str(), nOptions[1].c_str(), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + break; case 26: - // 0: short 1: name 2: money 3: faction 4: fac symp 5: symp_to_join 6: cappid - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT cl_shortdesc, cl_name, cl_money, cl_faction, \"0\", cl_minsympathy, cl_appid FROM `clans` WHERE `cl_id` = %d", atoi(nOptions[0].c_str())); - - break; - case 27: - if(!ChkOpt(nNumOptions, 1)) break; + // 0: short 1: name 2: money 3: faction 4: fac symp 5: symp_to_join 6: cappid + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT cl_shortdesc, cl_name, cl_money, cl_faction, \"0\", cl_minsympathy, cl_appid FROM `clans` WHERE `cl_id` = %d", atoi(nOptions[0].c_str())); + + break; + case 27: + if(!ChkOpt(nNumOptions, 1)) break; mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_description, count(DISTINCT o_outnum), count(DISTINCT c_id) FROM outposts INNER JOIN clans ON (o_clan = cl_id) INNER JOIN characters ON (c_clan = clans.cl_id) WHERE (cl_id = %d) GROUP BY cl_id", atoi(nOptions[0].c_str())); - + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_description, count(DISTINCT o_outnum), count(DISTINCT c_id) FROM outposts INNER JOIN clans ON (o_clan = cl_id) INNER JOIN characters ON (c_clan = clans.cl_id) WHERE (cl_id = %d) GROUP BY cl_id", atoi(nOptions[0].c_str())); + break; - case 28: + case 28: // Faction missions? Never seen them even in NC2... Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d has not been written yet; Factionmissions..? Never seen them", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; @@ -145,900 +148,900 @@ bool PTerminal::HandleReceiveDB(PClient* nClient, u16 mTerminalSessionId, std::s Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d Ordercol was missing. Its: [%s]", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID, nOptions[0].c_str()); break; case 34: - // Name, Add. Info, Profession, Description, Overal Ranking, Soullight, Money, Runner Kills, Creature Kills - // Note: Add. Info is autogenerated clientside! - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 8; - snprintf (mSQLQuery, 500, "SELECT c_name, c_profession, \"0\", \"1\", \"127\", c_cash, \"0\", \"0\" FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); + // Name, Add. Info, Profession, Description, Overal Ranking, Soullight, Money, Runner Kills, Creature Kills + // Note: Add. Info is autogenerated clientside! + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 8; + snprintf (mSQLQuery, 500, "SELECT c_name, c_profession, \"0\", \"1\", \"127\", c_cash, \"0\", \"0\" FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); break; - case 38: + case 38: // Faction missions? Never seen them even in NC2... Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d has not been written yet; Factionmissions..? Never seen them", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 39: + case 39: // 0:id 1:name 2:clan 3:fac.symp - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_clan, \"75\" FROM characters WHERE c_name LIKE \"%s\"", nOptions[0].c_str()); - + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_clan, \"75\" FROM characters WHERE c_name LIKE \"%s\"", nOptions[0].c_str()); + break; case 41: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT o_outnum, o_outnum, \"0\", \"0\", \"0\" FROM outposts WHERE o_clan = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 46: - // charid, charname, charclanlevel, clanlevelname, charfactionsymp, char online - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, cll_level, cll_desc, \"0\", c_online FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (cll_clanid = %d) AND (cll_level >= %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 47: - if(!ChkOpt(nNumOptions, 5)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, cll_desc, 0, c_online FROM characters INNER JOIN clanlevels ON (c_id = cll_charid) WHERE cll_level >= %d AND cll_level <= %d AND c_clan = %d ORDER BY cll_level DESC LIMIT %d, %d", atoi(nOptions[2].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); - - break; + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT o_outnum, o_outnum, \"0\", \"0\", \"0\" FROM outposts WHERE o_clan = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 46: + // charid, charname, charclanlevel, clanlevelname, charfactionsymp, char online + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, cll_level, cll_desc, \"0\", c_online FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (cll_clanid = %d) AND (cll_level >= %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 47: + if(!ChkOpt(nNumOptions, 5)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, cll_desc, 0, c_online FROM characters INNER JOIN clanlevels ON (c_id = cll_charid) WHERE cll_level >= %d AND cll_level <= %d AND c_clan = %d ORDER BY cll_level DESC LIMIT %d, %d", atoi(nOptions[2].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); + + break; case 48: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT cll_desc, cll_level FROM clanlevels WHERE cll_clanid = %d AND cll_level = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT cll_desc, cll_level FROM clanlevels WHERE cll_clanid = %d AND cll_level = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; case 49: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); - - break; - case 50: if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 2; //Fieldnum - snprintf (mSQLQuery, 500, "SELECT f_showname, f_name FROM forums WHERE f_area = %d", atoi(nOptions[0].c_str())); + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); + + break; + case 50: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 2; //Fieldnum + snprintf (mSQLQuery, 500, "SELECT f_showname, f_name FROM forums WHERE f_area = %d", atoi(nOptions[0].c_str())); break; - case 51: + case 51: if(!ChkOpt(nNumOptions, 9)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND f_name = \'%s\' AND fp_replyid = 0 LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[7].c_str()), atoi(nOptions[8].c_str())); + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND f_name = \'%s\' AND fp_replyid = 0 LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[7].c_str()), atoi(nOptions[8].c_str())); break; - case 52: + case 52: if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") AND (fp_id = %d OR fp_replyid = %d)", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 54: - // id, name, rank, rankname, f.symp - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, cll_level, cll_desc, 0 FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (c_id = %d)", atoi(nOptions[0].c_str())); - - break; - case 60: // Query for OutPost state. Result is + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") AND (fp_id = %d OR fp_replyid = %d)", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 54: + // id, name, rank, rankname, f.symp + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, cll_level, cll_desc, 0 FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (c_id = %d)", atoi(nOptions[0].c_str())); + + break; + case 60: // Query for OutPost state. Result is if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT o_outnum, o_clan FROM outposts LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT o_outnum, o_clan FROM outposts LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; case 61: // It should display the clanname, but it doesnt. seems to be clientside bug - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT o_outnum, o_clan, o_clan, o_security FROM outposts WHERE o_outnum = %d", atoi(nOptions[0].c_str())); - - break; - case 75: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 2; + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT o_outnum, o_clan, o_clan, o_security FROM outposts WHERE o_outnum = %d", atoi(nOptions[0].c_str())); + + break; + case 75: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 2; snprintf (mSQLQuery, 500, "SELECT cll_desc, cll_level FROM clanlevels WHERE cll_clanid = %d ORDER BY cll_level DESC LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); break; - case 76: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT count(c_id) FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (cll_clanid = %d AND cll_desc = \"%s\")", atoi(nOptions[0].c_str()),nOptions[1].c_str()); - + case 76: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT count(c_id) FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (cll_clanid = %d AND cll_desc = \"%s\")", atoi(nOptions[0].c_str()),nOptions[1].c_str()); + break; - case 85: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 6; // No idea why this Fac.Symp is that high... 1000000 is 100 ingame. But only for this query - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, cll_level, cll_desc, 1000000, c_online FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (c_online = %d OR c_online = 1) AND c_clan = %d LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - + case 85: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 6; // No idea why this Fac.Symp is that high... 1000000 is 100 ingame. But only for this query + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, cll_level, cll_desc, 1000000, c_online FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (c_online = %d OR c_online = 1) AND c_clan = %d LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + break; case 86: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - if(!strncmp(nOptions[1].c_str(), "date", 4)) - snprintf (mSQLQuery, 500, "SELECT mt_id, mt_amount, mt_date, c_name FROM moneytransactions INNER JOIN characters ON (mt_player = c_id) WHERE mt_clanid = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - else - snprintf (mSQLQuery, 500, "SELECT mt_id, mt_amount, mt_date, c_name FROM moneytransactions INNER JOIN characters ON (mt_player = c_id) WHERE mt_clanid = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + if(!strncmp(nOptions[1].c_str(), "date", 4)) + snprintf (mSQLQuery, 500, "SELECT mt_id, mt_amount, mt_date, c_name FROM moneytransactions INNER JOIN characters ON (mt_player = c_id) WHERE mt_clanid = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + else + snprintf (mSQLQuery, 500, "SELECT mt_id, mt_amount, mt_date, c_name FROM moneytransactions INNER JOIN characters ON (mt_player = c_id) WHERE mt_clanid = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; case 87: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_name, mt_date, mt_amount, mt_comment FROM moneytransactions INNER JOIN characters ON (mt_player = c_id) WHERE mt_id = %d", atoi(nOptions[0].c_str())); - - break; - case 92: if(!ChkOpt(nNumOptions, 1)) break; - // Location of player - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT c_location FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); - + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_name, mt_date, mt_amount, mt_comment FROM moneytransactions INNER JOIN characters ON (mt_player = c_id) WHERE mt_id = %d", atoi(nOptions[0].c_str())); + + break; + case 92: + if(!ChkOpt(nNumOptions, 1)) break; + // Location of player + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT c_location FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); + break; - case 93: + case 93: if(!ChkOpt(nNumOptions, 1)) break; - // Name, Add. Info, Profession, Description - // Note: Add. Info is autogenerated clientside! - mResultFields = 3; + // Name, Add. Info, Profession, Description + // Note: Add. Info is autogenerated clientside! + mResultFields = 3; snprintf (mSQLQuery, 500, "SELECT c_name, c_profession, \"0\" FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); - + break; case 96: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT f_showname FROM forums WHERE f_name = \"%s\"", nOptions[0].c_str()); - - break; - case 98: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT f_showname FROM forums WHERE f_name = \"%s\"", nOptions[0].c_str()); + + break; + case 98: // ID, Name, Online, 0, Soullight - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_online, \"0\", c_soullight FROM characters WHERE c_online = %d AND c_soullight <= -%d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - break; - case 99: - // Terrorist info + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_online, \"0\", c_soullight FROM characters WHERE c_online = %d AND c_soullight <= -%d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + break; + case 99: + // Terrorist info // id, name, faction, clan, clanlevel, location - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_faction, c_clan, cll_level, c_location FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (c_id = %d AND c_soullight <= -%d)", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_faction, c_clan, cll_level, c_location FROM clanlevels INNER JOIN characters ON (cll_charid = c_id) WHERE (c_id = %d AND c_soullight <= -%d)", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + break; case 108: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT cl_name FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str())); - - break; + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT cl_name FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str())); + + break; case 109: - if(!ChkOpt(nNumOptions, 1)) break; - // The only case where KK used an DBId twice for completely different things... - if(nNumOptions < 3) - { - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_clan, cll_level, cll_desc FROM characters INNER JOIN clanlevels ON (cll_charid = c_id AND cll_clanid = c_clan) WHERE c_id = %d", atoi(nOptions[0].c_str())); - } - else if(nNumOptions == 3) - { - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT c_id, apt_location FROM apartments INNER JOIN characters ON (apt_owner = c_id) WHERE (c_id = %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - } - - break; + if(!ChkOpt(nNumOptions, 1)) break; + // The only case where KK used an DBId twice for completely different things... + if(nNumOptions < 3) + { + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_clan, cll_level, cll_desc FROM characters INNER JOIN clanlevels ON (cll_charid = c_id AND cll_clanid = c_clan) WHERE c_id = %d", atoi(nOptions[0].c_str())); + } + else if(nNumOptions == 3) + { + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT c_id, apt_location FROM apartments INNER JOIN characters ON (apt_owner = c_id) WHERE (c_id = %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + } + + break; case 116: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT wr_id FROM worlds WHERE wr_group = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 125: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT wr_id FROM worlds WHERE wr_group = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 125: // Return position in Helpqueue. todo yet... for now its 255, we're always busy! =) - //if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT 255"); - - break; + //if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT 255"); + + break; case 126: - // Return position in Helpqueue. todo yet... for now its 255, we're always busy! =) - // This is with Datecheck, somehow.. - //if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT 255"); - + // Return position in Helpqueue. todo yet... for now its 255, we're always busy! =) + // This is with Datecheck, somehow.. + //if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT 255"); + break; case 127: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT c_name, apt_location FROM apartments INNER JOIN characters ON (apt_owner = c_id) WHERE (c_id = %d)", atoi(nOptions[0].c_str())); + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT c_name, apt_location FROM apartments INNER JOIN characters ON (apt_owner = c_id) WHERE (c_id = %d)", atoi(nOptions[0].c_str())); break; case 128: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT su_id FROM support WHERE su_supporterid = %d AND su_finished = 0", atoi(nOptions[0].c_str())); - + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT su_id FROM support WHERE su_supporterid = %d AND su_finished = 0", atoi(nOptions[0].c_str())); + case 131: - mResultFields = 6; - //snprintf(mSQLQuery, 500, "SELECT br_id, br_type, c_online, c_name, br_location, br_datetime FROM `bug report`, characters WHERE c_id = br_fromid AND br_status = %d LIMIT %d, %d", - // atoi(nOptions[0].c_str())+atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - snprintf(mSQLQuery, 500, "SELECT su_id, su_type, 0, c_name, su_worldid, su_datetime FROM support INNER JOIN characters ON (su_player = c_id) WHERE su_inwork = %d AND su_finished = %d LIMIT %d, %d", - atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 132: - // reqid, runnerid, runnername, 0, date/time, type, 0, in work, finished, desc - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 10; - //snprintf(mSQLQuery, 500, "SELECT br_id, br_fromid, c_name, \"0\", br_datetime, br_type, \"0\", br_status, br_status, br_desc FROM `bug report` INNER JOIN characters ON (br_fromid = c_id) WHERE br_id = %d", atoi(nOptions[0].c_str())); - snprintf(mSQLQuery, 500, "SELECT su_id, su_player, c_name, 0, su_datetime, su_type, su_supporterid, su_inwork, su_finished, su_desc FROM support INNER JOIN characters ON (su_player = c_id) WHERE su_id = %d", atoi(nOptions[0].c_str())); - - break; - case 134: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; - snprintf(mSQLQuery, 500, "SELECT br_id FROM bug_report WHERE br_fromid = %d", atoi(nOptions[0].c_str())); - - break; - case 136: + mResultFields = 6; + //snprintf(mSQLQuery, 500, "SELECT br_id, br_type, c_online, c_name, br_location, br_datetime FROM `bug report`, characters WHERE c_id = br_fromid AND br_status = %d LIMIT %d, %d", + // atoi(nOptions[0].c_str())+atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + snprintf(mSQLQuery, 500, "SELECT su_id, su_type, 0, c_name, su_worldid, su_datetime FROM support INNER JOIN characters ON (su_player = c_id) WHERE su_inwork = %d AND su_finished = %d LIMIT %d, %d", + atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 132: + // reqid, runnerid, runnername, 0, date/time, type, 0, in work, finished, desc if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; + mResultFields = 10; + //snprintf(mSQLQuery, 500, "SELECT br_id, br_fromid, c_name, \"0\", br_datetime, br_type, \"0\", br_status, br_status, br_desc FROM `bug report` INNER JOIN characters ON (br_fromid = c_id) WHERE br_id = %d", atoi(nOptions[0].c_str())); + snprintf(mSQLQuery, 500, "SELECT su_id, su_player, c_name, 0, su_datetime, su_type, su_supporterid, su_inwork, su_finished, su_desc FROM support INNER JOIN characters ON (su_player = c_id) WHERE su_id = %d", atoi(nOptions[0].c_str())); + + break; + case 134: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; + snprintf(mSQLQuery, 500, "SELECT br_id FROM bug_report WHERE br_fromid = %d", atoi(nOptions[0].c_str())); + + break; + case 136: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; snprintf (mSQLQuery, 500, "SELECT c_name FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); break; - case 137: - if(!ChkOpt(nNumOptions, 1)) break; + case 137: + if(!ChkOpt(nNumOptions, 1)) break; // runnerid, runnername, location, online - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters WHERE c_name = \"%s\"", nOptions[0].c_str()); + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters WHERE c_name = \"%s\"", nOptions[0].c_str()); break; case 138: - if(!ChkOpt(nNumOptions, 1)) break; - // runnerid, runnername, location, online - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT br_type, br_location, br_datetime, br_supid, br_status, br_desc FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); - break; - case 143: - if(!ChkOpt(nNumOptions, 1)) break; - // runnerid, runnername, location, online - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT a.a_id, a.a_username, b.c_id, 0, b.c_location, b.c_online FROM `%s`.accounts AS a, `%s`.characters AS b WHERE b.c_name = \"%s\" AND a.a_id = b.a_id", - Config->GetOption("info_sql_database").c_str(), Config->GetOption("game_sql_database").c_str(), nOptions[0].c_str()); - break; + if(!ChkOpt(nNumOptions, 1)) break; + // runnerid, runnername, location, online + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT br_type, br_location, br_datetime, br_supid, br_status, br_desc FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); + break; + case 143: + if(!ChkOpt(nNumOptions, 1)) break; + // runnerid, runnername, location, online + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT a.a_id, a.a_username, b.c_id, 0, b.c_location, b.c_online FROM `%s`.accounts AS a, `%s`.characters AS b WHERE b.c_name = \"%s\" AND a.a_id = b.a_id", + Config->GetOption("info_sql_database").c_str(), Config->GetOption("game_sql_database").c_str(), nOptions[0].c_str()); + break; case 144: - mResultFields = 2; // Replace "1" with Online/Offline! - snprintf (mSQLQuery, 500, "SELECT c_location, c_online FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); + mResultFields = 2; // Replace "1" with Online/Offline! + snprintf (mSQLQuery, 500, "SELECT c_location, c_online FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); break; case 145: - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT a_email FROM `%s`.accounts WHERE a_id = %d", Config->GetOption("info_sql_database").c_str(), atoi(nOptions[0].c_str())); + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT a_email FROM `%s`.accounts WHERE a_id = %d", Config->GetOption("info_sql_database").c_str(), atoi(nOptions[0].c_str())); break; case 146: - mResultFields = 4; - // Too bad we named the row different... - char tSortRow[10]; - if(!strncmp(nOptions[1].c_str(), "world", 5)) - strcpy(tSortRow, "location"); - else - strcpy(tSortRow, "name"); - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters WHERE c_name LIKE \"%s\" ORDER BY `c_%s` LIMIT %d, %d", nOptions[0].c_str(), tSortRow, atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 147: + mResultFields = 4; + // Too bad we named the row different... + char tSortRow[10]; + if(!strncmp(nOptions[1].c_str(), "world", 5)) + strcpy(tSortRow, "location"); + else + strcpy(tSortRow, "name"); + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters WHERE c_name LIKE \"%s\" ORDER BY `c_%s` LIMIT %d, %d", nOptions[0].c_str(), tSortRow, atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 147: mResultFields = 4; snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters WHERE c_online = %d ORDER BY `c_%s` LIMIT %d, %d", atoi(nOptions[0].c_str()), nOptions[1].c_str(), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - + break; - case 148: + case 148: if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, \"0\", \"0\", c_id FROM clans INNER JOIN characters ON (cl_leader = c_id) WHERE (cl_id = %d)", atoi(nOptions[0].c_str())); - + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, \"0\", \"0\", c_id FROM clans INNER JOIN characters ON (cl_leader = c_id) WHERE (cl_id = %d)", atoi(nOptions[0].c_str())); + break; - case 150: + case 150: // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 151: + case 151: // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 153: - // Mission stuff. Will be added later! + // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 154: - // Mission stuff. Will be added later! + // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 155: - // Mission stuff. Will be added later! + // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 156: - // Mission stuff. Will be added later! + // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 157: - // Mission stuff. Will be added later! + // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 158: - // Mission stuff. Will be added later! + // Mission stuff. Will be added later! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 175: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT br_id, br_type, br_title, br_datetime FROM bug_report LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 176: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 8; - snprintf (mSQLQuery, 500, "SELECT br_type, br_status, br_title, br_desc, 0, br_datetime, br_location, br_fromid FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); - - break; + case 175: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT br_id, br_type, br_title, br_datetime FROM bug_report LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 176: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 8; + snprintf (mSQLQuery, 500, "SELECT br_type, br_status, br_title, br_desc, 0, br_datetime, br_location, br_fromid FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); + + break; case 181: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 3; - snprintf (mSQLQuery, 500, "SELECT c_name, apt_location, apt_password FROM apartments INNER JOIN characters ON (c_id = apt_owner) WHERE apt_id = %d", atoi(nOptions[0].c_str())); - + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 3; + snprintf (mSQLQuery, 500, "SELECT c_name, apt_location, apt_password FROM apartments INNER JOIN characters ON (c_id = apt_owner) WHERE apt_id = %d", atoi(nOptions[0].c_str())); + break; case 183: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_name, (SELECT count(*) FROM characters WHERE c_clan = %d), c_name, apt_id, apt_location FROM clans INNER JOIN apartments ON (cl_appid = apt_id) INNER JOIN characters ON (c_clan = cl_id) AND (apt_owner = c_id) WHERE (cl_id = %d) GROUP BY c_id", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str())); - - break; + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_name, (SELECT count(*) FROM characters WHERE c_clan = %d), c_name, apt_id, apt_location FROM clans INNER JOIN apartments ON (cl_appid = apt_id) INNER JOIN characters ON (c_clan = cl_id) AND (apt_owner = c_id) WHERE (cl_id = %d) GROUP BY c_id", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str())); + + break; case 186: - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT c_id FROM characters WHERE c_name = \"%s\"", nOptions[0].c_str()); + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT c_id FROM characters WHERE c_name = \"%s\"", nOptions[0].c_str()); break; case 220: - mResultFields = 4; //Fieldnum - snprintf (mSQLQuery, 500, "SELECT v_id, v_type, v_status, v_condition FROM vehicles WHERE v_owner = %i LIMIT %i, %i", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + mResultFields = 4; //Fieldnum + snprintf (mSQLQuery, 500, "SELECT v_id, v_type, v_status, v_condition FROM vehicles WHERE v_owner = %i LIMIT %i, %i", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); break; case 221: - //VehicleControl order. "VehicleControl", "Type", "Status", "Condition", "Repairprice?" - mResultFields = 4; //Fieldnum - snprintf (mSQLQuery, 500, "SELECT v_type, v_status, v_condition, \"0\" FROM vehicles WHERE v_id = %s", nOptions[0].c_str()); + //VehicleControl order. "VehicleControl", "Type", "Status", "Condition", "Repairprice?" + mResultFields = 4; //Fieldnum + snprintf (mSQLQuery, 500, "SELECT v_type, v_status, v_condition, \"0\" FROM vehicles WHERE v_id = %s", nOptions[0].c_str()); break; - case 225: + case 225: // Statistics. Maybe later... Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 226: + case 226: // Statistics. Maybe later... Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 230: - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT st_id, st_factid, st_curval, st_curval-st_oldval FROM stockx"); - - break; - case 231: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT st_id, st_factid, st_curval, (st_curval - st_oldval) FROM stockx WHERE (st_id = %d)", atoi(nOptions[0].c_str())); - - break; - case 232: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT sxd_id, st_factid, st_curval, sxd_amount, (sxd_amount * st_curval) FROM stockx_depots INNER JOIN stockx ON (sxd_st_id = st_id) WHERE (sxd_playerid = %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT st_id, st_factid, st_curval, st_curval-st_oldval FROM stockx"); + + break; + case 231: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT st_id, st_factid, st_curval, (st_curval - st_oldval) FROM stockx WHERE (st_id = %d)", atoi(nOptions[0].c_str())); + + break; + case 232: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT sxd_id, st_factid, st_curval, sxd_amount, (sxd_amount * st_curval) FROM stockx_depots INNER JOIN stockx ON (sxd_st_id = st_id) WHERE (sxd_playerid = %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + break; case 233: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 7; - snprintf (mSQLQuery, 500, "SELECT st_factid, sxd_amount, (st_curval - st_oldval), st_curval, sxd_paid, (sxd_amount * st_curval), ((sxd_amount * st_curval) - sxd_paid) FROM stockx_depots INNER JOIN stockx ON (sxd_st_id = st_id) where sxd_id = %d", atoi(nOptions[0].c_str())); - - break; + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 7; + snprintf (mSQLQuery, 500, "SELECT st_factid, sxd_amount, (st_curval - st_oldval), st_curval, sxd_paid, (sxd_amount * st_curval), ((sxd_amount * st_curval) - sxd_paid) FROM stockx_depots INNER JOIN stockx ON (sxd_st_id = st_id) where sxd_id = %d", atoi(nOptions[0].c_str())); + + break; case 234: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 3; - snprintf (mSQLQuery, 500, "SELECT sxd_id, sxd_amount, sxd_paid FROM stockx_depots INNER JOIN stockx ON (sxd_st_id = st_id) WHERE sxd_playerid = %d AND st_factid = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 250: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 3; + snprintf (mSQLQuery, 500, "SELECT sxd_id, sxd_amount, sxd_paid FROM stockx_depots INNER JOIN stockx ON (sxd_st_id = st_id) WHERE sxd_playerid = %d AND st_factid = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 250: // Influence from CharID? Is stockx gm controlled?? Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 251: + case 251: // What is this "influence" ? Check this on live servers! Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 260: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 2; //Fieldnum - snprintf (mSQLQuery, 500, "SELECT f_showname, f_name FROM forums WHERE f_area = %d+%d+%d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - + case 260: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 2; //Fieldnum + snprintf (mSQLQuery, 500, "SELECT f_showname, f_name FROM forums WHERE f_area = %d+%d+%d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + break; - case 261: + case 261: // Maybe even rewrite BB system.. its wrong written anyways.... Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 262: + case 262: // This is wrong! 262 is the receiveDB request for FACTION threadlist. It should be limitet to that faction then - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND (fp_id = %s OR fp_replyid = %s)", nOptions[0].c_str(), nOptions[1].c_str()); - + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND (fp_id = %s OR fp_replyid = %s)", nOptions[0].c_str(), nOptions[1].c_str()); + //TODO Check this. Same (?) for ID 52,262,267,401 and 411 break; - case 266: - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND f_name = \'%s\' AND fp_replyid = 0 AND fp_clanid = %d LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - + case 266: + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND f_name = \'%s\' AND fp_replyid = 0 AND fp_clanid = %d LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + break; - case 267: - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND (fp_id = %s OR fp_replyid = %s)", nOptions[0].c_str(), nOptions[1].c_str()); - + case 267: + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM `forum_posts`, forums, characters WHERE fp_forumid = f_id AND c_id = fp_fromid AND (fp_id = %s OR fp_replyid = %s)", nOptions[0].c_str(), nOptions[1].c_str()); + break; case 270: Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d Tablename/Name is: [%s] ThreadID is: [%d]", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID, atoi(nOptions[0].c_str()), nOptions[1].c_str()); break; - case 360: - // Gamemaster name (char), Accountname, Location, Online, CharID + case 360: + // Gamemaster name (char), Accountname, Location, Online, CharID + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT a.a_id, c.c_id, a.a_username, c.c_name, c.c_online, c.c_location FROM %s.characters AS c, %s.accounts AS a WHERE a.a_priv >= 50 AND c.c_online = %d AND c.a_id = a.a_id ORDER BY c.c_name LIMIT %d, %d", + Config->GetOption("game_sql_database").c_str(), Config->GetOption("info_sql_database").c_str(), atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 365: + // ID, short, name faction + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_faction FROM clans LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 366: + // ID, short, name faction WHERE clanname = %s + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_faction FROM clans WHERE cl_name LIKE \"%s\" LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 367: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 8; + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_leader, cl_faction, cl_appid, cl_money, (SELECT count(*) FROM characters WHERE c_clan = %d) FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str())); + + break; + case 368: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT cll_desc, cll_level FROM clanlevels WHERE cll_clanid = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 373: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT apt_id, apt_location, apt_type, apt_password FROM apartments WHERE apt_id = %d AND apt_owner = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 375: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 376: if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT a.a_id, c.c_id, a.a_username, c.c_name, c.c_online, c.c_location FROM %s.characters AS c, %s.accounts AS a WHERE a.a_priv >= 50 AND c.c_online = %d AND c.a_id = a.a_id ORDER BY c.c_name LIMIT %d, %d", - Config->GetOption("game_sql_database").c_str(), Config->GetOption("info_sql_database").c_str(), atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 365: - // ID, short, name faction - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_faction FROM clans LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 366: - // ID, short, name faction WHERE clanname = %s - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_faction FROM clans WHERE cl_name LIKE \"%s\" LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 367: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 8; - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_shortdesc, cl_name, cl_leader, cl_faction, cl_appid, cl_money, (SELECT count(*) FROM characters WHERE c_clan = %d) FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str())); - - break; - case 368: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT cll_desc, cll_level FROM clanlevels WHERE cll_clanid = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 373: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT apt_id, apt_location, apt_type, apt_password FROM apartments WHERE apt_id = %d AND apt_owner = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 375: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 376: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters WHERE c_name LIKE \"%s\" LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 377: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT DISTINCT a_id FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); - - break; - case 378: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT a_username, a_email, \"Since begin\", \"Never\", FROM_UNIXTIME(a_bandate) FROM `%s`.accounts WHERE a_id = %d", Config->GetOption("info_sql_database").c_str(), atoi(nOptions[0].c_str())); - - break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online FROM characters WHERE c_name LIKE \"%s\" LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 377: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT DISTINCT a_id FROM characters WHERE c_id = %d", atoi(nOptions[0].c_str())); + + break; + case 378: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT a_username, a_email, \"Since begin\", \"Never\", FROM_UNIXTIME(a_bandate) FROM `%s`.accounts WHERE a_id = %d", Config->GetOption("info_sql_database").c_str(), atoi(nOptions[0].c_str())); + + break; case 379: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online, c_clan, cll_level FROM characters INNER JOIN clanlevels ON (cll_charid = c_id) WHERE c_id = %d", atoi(nOptions[0].c_str())); - - break; - case 380: // clean - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT cl_name, cll_desc FROM clans INNER JOIN clanlevels ON (cll_clanid = cl_id) WHERE cl_id = %d AND cll_level = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 381: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, c_online FROM characters WHERE a_id = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 384: // clean - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT apt_id, apt_location, 0, apt_password FROM apartments WHERE apt_owner = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 400: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 401: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") AND (fp_id = %d OR fp_replyid = %d)", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 406: if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT count(fp_id) FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) WHERE f_name = \"%s\"", nOptions[0].c_str()); - - break; - case 410: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM forum_posts INNER JOIN forums ON (fp_forumid = f_area) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\" AND fp_factionid = %d) LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 411: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM forum_posts INNER JOIN forums ON (fp_forumid = f_area) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") AND (fp_id = %d OR fp_replyid = %d) AND (fp_factionid = %d)", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - - case 420: + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, c_location, c_online, c_clan, cll_level FROM characters INNER JOIN clanlevels ON (cll_charid = c_id) WHERE c_id = %d", atoi(nOptions[0].c_str())); + + break; + case 380: // clean + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT cl_name, cll_desc FROM clans INNER JOIN clanlevels ON (cll_clanid = cl_id) WHERE cl_id = %d AND cll_level = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 381: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, c_online FROM characters WHERE a_id = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 384: // clean + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT apt_id, apt_location, 0, apt_password FROM apartments WHERE apt_owner = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 400: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 401: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") AND (fp_id = %d OR fp_replyid = %d)", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 406: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT count(fp_id) FROM forum_posts INNER JOIN forums ON (fp_forumid = f_id) WHERE f_name = \"%s\"", nOptions[0].c_str()); + + break; + case 410: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT fp_id, fp_name, c_name, fp_datetime FROM forum_posts INNER JOIN forums ON (fp_forumid = f_area) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\" AND fp_factionid = %d) LIMIT %d, %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 411: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT c_name, fp_name, fp_datetime, fp_content FROM forum_posts INNER JOIN forums ON (fp_forumid = f_area) INNER JOIN characters ON (fp_fromid = c_id) WHERE (f_name = \"%s\") AND (fp_id = %d OR fp_replyid = %d) AND (fp_factionid = %d)", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + + case 420: if(!ChkOpt(nNumOptions, 3)) break; mResultFields = 6; snprintf (mSQLQuery, 500, "SELECT e_id, e_subject, c_name, e_new, e_replied, e_datetime FROM emails, characters WHERE e_fromid = c_id AND e_toid = %i LIMIT %i, %i", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); break; - case 421: + case 421: if(!ChkOpt(nNumOptions, 1)) break; - //MailControl order. "MailControl", "Mail ID", "Subject", "From", boolean Replied, "Date/Time", "FromID", "Content" + //MailControl order. "MailControl", "Mail ID", "Subject", "From", boolean Replied, "Date/Time", "FromID", "Content" mResultFields = 7; snprintf (mSQLQuery, 500, "SELECT e_id, e_subject, c_name, e_replied, e_datetime, e_fromid, e_body FROM emails, characters WHERE e_fromid = c_id AND e_id = %s", nOptions[0].c_str()); - break; - case 425: - if(!ChkOpt(nNumOptions, 1)) break; - //Send mail order. "SendMail", "id" - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT c_id FROM characters WHERE c_name = \'%s\'", nOptions[0].c_str()); - - break; - case 430: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT a.c_id, a.c_conid, b.c_name, a.c_desc FROM contacts as a, characters as b WHERE a.c_conid = b.c_id AND a.c_listid = %s AND c_type = %s", nOptions[0].c_str(), nOptions[1].c_str()); - - break; - case 431: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT a.c_id, a.c_conid, b.c_name, a.c_desc FROM contacts as a, characters as b WHERE a.c_conid = b.c_id AND a.c_id = %s", nOptions[0].c_str()); - - break; - case 435: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT count(*) FROM contacts WHERE c_listid = %s AND c_type = %s", nOptions[0].c_str(), nOptions[1].c_str()); - - break; - case 436: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name FROM characters WHERE c_name LIKE \'%%%s%%\' LIMIT %s, %s", nOptions[0].c_str(), nOptions[1].c_str(), nOptions[2].c_str()); - - break; - case 437: + break; + case 425: if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 1; //Fieldnum - snprintf (mSQLQuery, 500, "SELECT c_name FROM characters WHERE c_id = %s", nOptions[0].c_str()); - - break; - case 445: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_name FROM neochronicle WHERE nc_lang = %d ORDER BY nc_id DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 446: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT nc_id, nc_lang, nc_datetime, nc_name, nc_content FROM neochronicle WHERE nc_id = %d", atoi(nOptions[0].c_str())); - - break; - case 453: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT g_id, 0, g_part, g_title, g_language FROM guides WHERE g_chapter = %d AND g_language = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 455: + //Send mail order. "SendMail", "id" + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT c_id FROM characters WHERE c_name = \'%s\'", nOptions[0].c_str()); + + break; + case 430: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT a.c_id, a.c_conid, b.c_name, a.c_desc FROM contacts as a, characters as b WHERE a.c_conid = b.c_id AND a.c_listid = %s AND c_type = %s", nOptions[0].c_str(), nOptions[1].c_str()); + + break; + case 431: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT a.c_id, a.c_conid, b.c_name, a.c_desc FROM contacts as a, characters as b WHERE a.c_conid = b.c_id AND a.c_id = %s", nOptions[0].c_str()); + + break; + case 435: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT count(*) FROM contacts WHERE c_listid = %s AND c_type = %s", nOptions[0].c_str(), nOptions[1].c_str()); + + break; + case 436: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name FROM characters WHERE c_name LIKE \'%%%s%%\' LIMIT %s, %s", nOptions[0].c_str(), nOptions[1].c_str(), nOptions[2].c_str()); + + break; + case 437: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 1; //Fieldnum + snprintf (mSQLQuery, 500, "SELECT c_name FROM characters WHERE c_id = %s", nOptions[0].c_str()); + + break; + case 445: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_name FROM neochronicle WHERE nc_lang = %d ORDER BY nc_id DESC LIMIT %d, %d", atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 446: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT nc_id, nc_lang, nc_datetime, nc_name, nc_content FROM neochronicle WHERE nc_id = %d", atoi(nOptions[0].c_str())); + + break; + case 453: if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 3; - // Opt 2 is Language - snprintf (mSQLQuery, 500, "SELECT g_id, g_part, g_title FROM guides WHERE g_chapter = %d AND g_language = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 456: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT g_id, g_language, g_title, g_content FROM guides WHERE g_id = %d", atoi(nOptions[0].c_str())); - - break; - case 458: // Statisics - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 459: // Statisics - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 510: // ClanWars: Overview - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT cw_id, cl_name, cw_starttime, cw_status FROM clanwars INNER JOIN clans ON (cw_initclan = cl_id) or (cw_enemyclan = cl_id) WHERE (cw_enemyclan = %d OR cw_initclan = %d) AND (cl_id != %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - break; - case 511: // ClanWars: Selfdeclared wars - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT cw_id, cl_name, cw_starttime, cw_status FROM clanwars INNER JOIN clans ON (cw_enemyclan = cl_id) WHERE cw_initclan = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - break; - case 512: // ClanWars: Foreigndeclared wars - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 4; - snprintf (mSQLQuery, 500, "SELECT cw_id, cl_name, cw_starttime, cw_status FROM clanwars INNER JOIN clans ON (cw_initclan = cl_id) WHERE cw_enemyclan = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - break; - case 513: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_name FROM clans WHERE cl_faction = %d AND cl_id != %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - break; - case 514: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT cl_id, cl_name FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str())); - break; - case 520: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 10; - snprintf (mSQLQuery, 500, "SELECT cl_faction, cl_shortdesc, cl_name, cl_description, 0, cl_appid, 80, cl_money, (SELECT count(*) FROM outposts WHERE o_clan = %d), (SELECT count(*) FROM characters WHERE c_clan = %d) FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str())); - - break; - case 521: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, cll_desc, 0, c_online FROM characters INNER JOIN clanlevels ON (c_id = cll_charid) WHERE c_clan = %d AND cll_level >= %d AND cll_level < 15 LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 522: - if(!ChkOpt(nNumOptions, 5)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, cll_desc, 0, c_online FROM characters INNER JOIN clanlevels ON (c_id = cll_charid) WHERE cll_level >= %d AND cll_level <= %d AND c_clan = %d ORDER BY cll_level DESC LIMIT %d, %d", atoi(nOptions[2].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); - - break; - case 523: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT cl_shortdesc, cl_name, cl_leader, cl_description, cl_minsympathy FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str())); - - break; - case 540: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT apt_id, apt_location FROM apartments WHERE apt_owner = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 541: - if(!ChkOpt(nNumOptions, 3)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT v_id, v_type FROM vehicles WHERE v_owner = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 542: - if(!ChkOpt(nNumOptions, 2)) break; - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT v_id, v_type, v_world, v_status, v_condition FROM vehicles WHERE v_owner = %d and v_id = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); - - break; - case 544: - if(!ChkOpt(nNumOptions, 4)) break; - mResultFields = 1; - snprintf (mSQLQuery, 500, "SELECT count(*) FROM clanwars WHERE (cw_initclan = %d AND cw_enemyclan = %d) OR (cw_enemyclan = %d AND cw_initclan = %d)", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); - - break; - case 546: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 2; - snprintf (mSQLQuery, 500, "SELECT cw_starttime, (TO_DAYS(NOW()) - TO_DAYS(cw_starttime)) FROM clanwars WHERE cw_id = %d", atoi(nOptions[0].c_str())); - - break; - case 547: - if(!ChkOpt(nNumOptions, 1)) break; - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT cw_initclan, cw_enemyclan, cw_starttime, cw_status, cw_statement_initiator, cw_statement_enemy FROM clanwars WHERE cw_id = %d", atoi(nOptions[0].c_str())); - - break; - case 557: - Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d means that you want to edit an DialogScript from the server. This is not supportet yet!", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT g_id, 0, g_part, g_title, g_language FROM guides WHERE g_chapter = %d AND g_language = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 455: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 3; + // Opt 2 is Language + snprintf (mSQLQuery, 500, "SELECT g_id, g_part, g_title FROM guides WHERE g_chapter = %d AND g_language = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 456: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT g_id, g_language, g_title, g_content FROM guides WHERE g_id = %d", atoi(nOptions[0].c_str())); + + break; + case 458: // Statisics + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 459: // Statisics + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 510: // ClanWars: Overview + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT cw_id, cl_name, cw_starttime, cw_status FROM clanwars INNER JOIN clans ON (cw_initclan = cl_id) or (cw_enemyclan = cl_id) WHERE (cw_enemyclan = %d OR cw_initclan = %d) AND (cl_id != %d) LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + break; + case 511: // ClanWars: Selfdeclared wars + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT cw_id, cl_name, cw_starttime, cw_status FROM clanwars INNER JOIN clans ON (cw_enemyclan = cl_id) WHERE cw_initclan = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + break; + case 512: // ClanWars: Foreigndeclared wars + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 4; + snprintf (mSQLQuery, 500, "SELECT cw_id, cl_name, cw_starttime, cw_status FROM clanwars INNER JOIN clans ON (cw_initclan = cl_id) WHERE cw_enemyclan = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + break; + case 513: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_name FROM clans WHERE cl_faction = %d AND cl_id != %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + break; + case 514: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT cl_id, cl_name FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str())); + break; + case 520: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 10; + snprintf (mSQLQuery, 500, "SELECT cl_faction, cl_shortdesc, cl_name, cl_description, 0, cl_appid, 80, cl_money, (SELECT count(*) FROM outposts WHERE o_clan = %d), (SELECT count(*) FROM characters WHERE c_clan = %d) FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[0].c_str())); + + break; + case 521: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, cll_desc, 0, c_online FROM characters INNER JOIN clanlevels ON (c_id = cll_charid) WHERE c_clan = %d AND cll_level >= %d AND cll_level < 15 LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 522: + if(!ChkOpt(nNumOptions, 5)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT c_id, c_name, 0, cll_desc, 0, c_online FROM characters INNER JOIN clanlevels ON (c_id = cll_charid) WHERE cll_level >= %d AND cll_level <= %d AND c_clan = %d ORDER BY cll_level DESC LIMIT %d, %d", atoi(nOptions[2].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[0].c_str()), atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); + + break; + case 523: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT cl_shortdesc, cl_name, cl_leader, cl_description, cl_minsympathy FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str())); + + break; + case 540: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT apt_id, apt_location FROM apartments WHERE apt_owner = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 541: + if(!ChkOpt(nNumOptions, 3)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT v_id, v_type FROM vehicles WHERE v_owner = %d LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 542: + if(!ChkOpt(nNumOptions, 2)) break; + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT v_id, v_type, v_world, v_status, v_condition FROM vehicles WHERE v_owner = %d and v_id = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); + + break; + case 544: + if(!ChkOpt(nNumOptions, 4)) break; + mResultFields = 1; + snprintf (mSQLQuery, 500, "SELECT count(*) FROM clanwars WHERE (cw_initclan = %d AND cw_enemyclan = %d) OR (cw_enemyclan = %d AND cw_initclan = %d)", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str())); + + break; + case 546: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 2; + snprintf (mSQLQuery, 500, "SELECT cw_starttime, (TO_DAYS(NOW()) - TO_DAYS(cw_starttime)) FROM clanwars WHERE cw_id = %d", atoi(nOptions[0].c_str())); + + break; + case 547: + if(!ChkOpt(nNumOptions, 1)) break; + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT cw_initclan, cw_enemyclan, cw_starttime, cw_status, cw_statement_initiator, cw_statement_enemy FROM clanwars WHERE cw_id = %d", atoi(nOptions[0].c_str())); + + break; + case 557: + Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d means that you want to edit an DialogScript from the server. This is not supportet yet!", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; case 558: - Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d means that you want to edit an DialogScript from the server. This is not supportet yet!", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 562: - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT cb_inscription FROM datacubes WHERE cb_id = %d", atoi(nOptions[0].c_str())); - - break; - case 569: + Console->Print("%s [Pterminal::HandleReceiveDB] QueryID %d means that you want to edit an DialogScript from the server. This is not supportet yet!", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 562: + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT cb_inscription FROM datacubes WHERE cb_id = %d", atoi(nOptions[0].c_str())); + + break; + case 569: // Faction representatives. Not stored yet... is it? Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 570: - // Clan representatives. Stored but this query wants votes too... Maybe later - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 571: - // Clan representatives. Stored but this query wants votes too... Maybe later - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 572: - // Runner voting. Not stored yet + break; + case 570: + // Clan representatives. Stored but this query wants votes too... Maybe later + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 571: + // Clan representatives. Stored but this query wants votes too... Maybe later + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 572: + // Runner voting. Not stored yet + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 573: + // Next election date Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 573: - // Next election date - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 574: - mResultFields = 6; - snprintf (mSQLQuery, 500, "SELECT count(c_id) FROM characters WHERE c_faction = %d", atoi(nOptions[0].c_str())); + case 574: + mResultFields = 6; + snprintf (mSQLQuery, 500, "SELECT count(c_id) FROM characters WHERE c_faction = %d", atoi(nOptions[0].c_str())); break; - case 575: - // Runner satisfaction with faction - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 576: + case 575: + // Runner satisfaction with faction + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 576: // Check if vote from runner is already stored Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 582: - // Clan representative details. Faction rank etc... not stored yet - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 583: - // Clan representative details. Faction rank etc... not stored yet - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 584: - // Clan representative details. Faction rank etc... not stored yet - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 587: - // Clan representative stuff again... - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 603: - mResultFields = 1; - //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_status = 0"); - snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_inwork = 0 AND su_finished = 0"); - - break; - case 604: - mResultFields = 1; - //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_status = 1"); - snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_inwork = 1 AND su_finished = 0"); - - break; - case 605: - mResultFields = 1; - //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_status = 2"); - snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_finished = 1"); - - break; - case 606: - mResultFields = 1; - //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report`"); - snprintf (mSQLQuery, 500, "SELECT count(*) FROM support"); - - break; - case 607: // Dont know how to select data from sql where no data to JOIN is there anymore :/ - // This should query ID, RunnerID and Date from bug reports where runnerID is unknown - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 608: - mResultFields = 5; - snprintf (mSQLQuery, 500, "SELECT br_id, br_fromid, br_location, br_status, br_datetime FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); - - break; + case 582: + // Clan representative details. Faction rank etc... not stored yet + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 583: + // Clan representative details. Faction rank etc... not stored yet + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 584: + // Clan representative details. Faction rank etc... not stored yet + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 587: + // Clan representative stuff again... + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 603: + mResultFields = 1; + //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_status = 0"); + snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_inwork = 0 AND su_finished = 0"); + + break; + case 604: + mResultFields = 1; + //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_status = 1"); + snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_inwork = 1 AND su_finished = 0"); + + break; + case 605: + mResultFields = 1; + //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_status = 2"); + snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_finished = 1"); + + break; + case 606: + mResultFields = 1; + //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report`"); + snprintf (mSQLQuery, 500, "SELECT count(*) FROM support"); + + break; + case 607: // Dont know how to select data from sql where no data to JOIN is there anymore :/ + // This should query ID, RunnerID and Date from bug reports where runnerID is unknown + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 608: + mResultFields = 5; + snprintf (mSQLQuery, 500, "SELECT br_id, br_fromid, br_location, br_status, br_datetime FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); + + break; case 609: - mResultFields = 1; - //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_supid = %s", nOptions[0].c_str()); - snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_supporterid = %d", atoi(nOptions[0].c_str())); + mResultFields = 1; + //snprintf (mSQLQuery, 500, "SELECT count(*) FROM `bug report` WHERE br_supid = %s", nOptions[0].c_str()); + snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_supporterid = %d", atoi(nOptions[0].c_str())); break; case 610: - mResultFields = 6; - //snprintf (mSQLQuery, 500, "SELECT br_id, \"0\", c_name, br_location, br_status = 2, br_datetime FROM `bug report`, characters WHERE c_id = br_fromid AND br_supid = %s AND br_status > 0 LIMIT %s, %s", nOptions[0].c_str(), nOptions[1].c_str(), nOptions[2].c_str()); - snprintf (mSQLQuery, 500, "SELECT su_id, su_supporterid, c_name, su_worldid, su_finished, su_datetime FROM support INNER JOIN characters ON (su_supporterid = c_id) WHERE su_supporterid = %d AND su_finished = 1 LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - - break; - case 611:// Well, its meant to show date specific stuff. I will rewrite this soon... - snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_supporterid = %d", atoi(nOptions[0].c_str())); - break; - case 612:// Well, its meant to show date specific stuff. I will rewrite this soon... - snprintf (mSQLQuery, 500, "SELECT su_id, su_supporterid, c_name, su_worldid, su_finished, su_datetime FROM support INNER JOIN characters ON (su_supporterid = c_id) WHERE su_supporterid = %d AND su_finished = 1 LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); - break; - case 625: // Faction council stuff - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 626: // Faction council stuff - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 627: // Faction council stuff - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 628: // Faction council stuff - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; - case 629: // Faction council stuff - Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); - break; + mResultFields = 6; + //snprintf (mSQLQuery, 500, "SELECT br_id, \"0\", c_name, br_location, br_status = 2, br_datetime FROM `bug report`, characters WHERE c_id = br_fromid AND br_supid = %s AND br_status > 0 LIMIT %s, %s", nOptions[0].c_str(), nOptions[1].c_str(), nOptions[2].c_str()); + snprintf (mSQLQuery, 500, "SELECT su_id, su_supporterid, c_name, su_worldid, su_finished, su_datetime FROM support INNER JOIN characters ON (su_supporterid = c_id) WHERE su_supporterid = %d AND su_finished = 1 LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + + break; + case 611:// Well, its meant to show date specific stuff. I will rewrite this soon... + snprintf (mSQLQuery, 500, "SELECT count(*) FROM support WHERE su_supporterid = %d", atoi(nOptions[0].c_str())); + break; + case 612:// Well, its meant to show date specific stuff. I will rewrite this soon... + snprintf (mSQLQuery, 500, "SELECT su_id, su_supporterid, c_name, su_worldid, su_finished, su_datetime FROM support INNER JOIN characters ON (su_supporterid = c_id) WHERE su_supporterid = %d AND su_finished = 1 LIMIT %d, %d", atoi(nOptions[0].c_str()), atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); + break; + case 625: // Faction council stuff + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 626: // Faction council stuff + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 627: // Faction council stuff + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 628: // Faction council stuff + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; + case 629: // Faction council stuff + Console->Print("%s [Pterminal::HandleReceiveDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); + break; default: Console->Print("%s [Pterminal::HandleReceiveDB] Unknown QueryID %d", Console->ColorText(RED,BLACK,"Warning"), nDBID); return false; - } - - if(strlen(mSQLQuery) == 0) - return false; -// --------------- - MYSQL_RES *result = NULL; - MYSQL_ROW row; - int tNumRows = 0; - - result = MySQL->GameResQuery(mSQLQuery); - if (!result) - { - Console->Print("Cannot query DB. DBID: %d query was: %s", nDBID, mSQLQuery); - MySQL->ShowGameSQLError(); - return false; - } - - PMessage* tDBResult = new PMessage(); - tNumRows = mysql_num_rows(result); - - // Loop all result rows - for (int i = 0; i < tNumRows ; i++) - { - row = mysql_fetch_row( result ) ; - // Loop all result fields and push answers into Message - for (int t = 0; t < mResultFields; t++) - { - *tDBResult << ( u16 )(strlen(row[t]) + 1); - *tDBResult << row[t]; - } - } - - // Build result messages - char tCmd[100]; - memset(tCmd, '\0', 100); - strncpy(tCmd, nCommandName->c_str(), 100); - - PMessage* tmpMsg_allowed = MsgBuilder->BuildTryAccessAnswerMsg( nClient, tCmd, true ); - PMessage* tmpMsg_result = MsgBuilder->BuildReceiveDBAnswerMsg( nClient, tDBResult, nCommandName, tNumRows, mResultFields); - - nClient->SendUDPMessage(tmpMsg_allowed); - nClient->FragmentAndSendUDPMessage(tmpMsg_result, 0x68); - + } + + if(strlen(mSQLQuery) == 0) + return false; +// --------------- + MYSQL_RES *result = NULL; + MYSQL_ROW row; + int tNumRows = 0; + + result = MySQL->GameResQuery(mSQLQuery); + if (!result) + { + Console->Print("Cannot query DB. DBID: %d query was: %s", nDBID, mSQLQuery); + MySQL->ShowGameSQLError(); + return false; + } + + PMessage* tDBResult = new PMessage(); + tNumRows = mysql_num_rows(result); + + // Loop all result rows + for (int i = 0; i < tNumRows ; i++) + { + row = mysql_fetch_row( result ) ; + // Loop all result fields and push answers into Message + for (int t = 0; t < mResultFields; t++) + { + *tDBResult << ( u16 )(strlen(row[t]) + 1); + *tDBResult << row[t]; + } + } + + // Build result messages + char tCmd[100]; + memset(tCmd, '\0', 100); + strncpy(tCmd, nCommandName->c_str(), 100); + + PMessage* tmpMsg_allowed = MsgBuilder->BuildTryAccessAnswerMsg( nClient, tCmd, true ); + PMessage* tmpMsg_result = MsgBuilder->BuildReceiveDBAnswerMsg( nClient, tDBResult, nCommandName, tNumRows, mResultFields); + + nClient->SendUDPMessage(tmpMsg_allowed); + nClient->FragmentAndSendUDPMessage(tmpMsg_result, 0x68); + return true; } diff --git a/server/src/game/terminal_tryaccess.cpp b/server/src/game/terminal_tryaccess.cpp index 41356b6..79602a2 100644 --- a/server/src/game/terminal_tryaccess.cpp +++ b/server/src/game/terminal_tryaccess.cpp @@ -1,47 +1,47 @@ -/* + /* TinNS (TinNS is not a Neocron Server) Copyright (C) 2005 Linux Addicted Community maintainer Akiko - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - - -/* + */ + + + + /* terminal_tryaccess.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...) > Sub-File for terminal "TryAccess" command - + MODIFIED: 12 Jan 2007 Namikon REASON: - Created MODIFIED: 20 Oct 2009 Namikon REASON: - Rewritten - -*/ - + + */ + #include "main.h" -#include "terminal.h" -#include "msgbuilder.h" - +#include "include/terminal.h" +#include "include/msgbuilder.h" + bool PTerminal::DoStockXCheck(PClient* nClient, int nAmountEntered, int nNewAmount) -{ + { MYSQL_RES *result = NULL; char qry[100]; int tDepotAmount = 0; - + // First check if we BUY or SELL stockx snprintf(qry, 100, "SELECT sxd_amount FROM stockx_depots WHERE sxd_playerid = %d", nClient->GetChar()->GetID()); result = MySQL->GameResQuery(qry); @@ -51,12 +51,12 @@ bool PTerminal::DoStockXCheck(PClient* nClient, int nAmountEntered, int nNewAmou MySQL->ShowGameSQLError(); return false; } - + if(mysql_num_rows(result) > 0) tDepotAmount = atoi(mysql_fetch_row(result)[0]); - + MySQL->FreeGameSQLResult(result); - + if(nNewAmount == tDepotAmount) // We are going to SELL stockx { if(nAmountEntered > tDepotAmount) // Want to sell more than we have? @@ -75,79 +75,79 @@ bool PTerminal::DoStockXCheck(PClient* nClient, int nAmountEntered, int nNewAmou { return false; } - + // Everything went fine return true; -} - + } + bool PTerminal::HandleTryAccess(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown, bool nCheckOnly) -{ + { // Empty buffer EraseVars(); - + // Stop gcc annoying about unused var u8 dummy2 = nUnknown; u16 dummy3 = mTerminalSessionId; dummy3 = dummy2; - + char mSQLQuery[500]; bool tGetResultFromSQL = false; - bool tAllowed = false; - int nAccessLevel = nClient->GetAccountLevel(); + bool tAllowed = false; + int nAccessLevel = nClient->GetAccountLevel(); int tCharID = nClient->GetChar()->GetID(); - + switch(nDBID) - { + { case 13: // Access to Neocronicle as GameMaster - if(nAccessLevel >= PAL_VOLUNTEER) - tAllowed = true; + if(nAccessLevel >= PAL_VOLUNTEER) + tAllowed = true; break; - + case 63: // Access to Outpost security status; ClanLevel >= 3 if(!ChkOpt(nNumOptions, 1)) break; tGetResultFromSQL = true; snprintf(mSQLQuery, 500, "SELECT count(*) FROM clanlevels INNER JOIN clans ON (cll_clanid = cl_id) INNER JOIN outposts ON (o_clan = cl_id) WHERE (o_outnum = %d AND cll_charid = %d AND cll_level >= 3)", atoi(nOptions[0].c_str()), tCharID); break; - + case 64: // Clan: ClanWars if(!ChkOpt(nNumOptions, 1)) break; tGetResultFromSQL = true; snprintf(mSQLQuery, 500, "SELECT count(*) FROM clanlevels INNER JOIN clans ON (cll_clanid = cl_id) WHERE (cl_id = %d AND cll_charid = %d AND cll_level >= 14)", atoi(nOptions[0].c_str()), tCharID); break; - + case 72: // Clan: AdminMemberAccess & AdminMoneyAccess if(!ChkOpt(nNumOptions, 1)) break; tGetResultFromSQL = true; snprintf(mSQLQuery, 500, "SELECT count(*) FROM clanlevels INNER JOIN clans ON (cll_clanid = cl_id) WHERE (cl_id = %d AND cll_charid = %d AND cll_level >= 9)", atoi(nOptions[0].c_str()), tCharID); break; - + case 73: // Clan: AdminInviteMember if(!ChkOpt(nNumOptions, 1)) break; tGetResultFromSQL = true; snprintf(mSQLQuery, 500, "SELECT count(*) FROM clanlevels INNER JOIN clans ON (cll_clanid = cl_id) WHERE (cl_id = %d AND cll_charid = %d AND cll_level >= 10)", atoi(nOptions[0].c_str()), tCharID); break; - + case 74: // Clan: AdminLevelAccess & AdminChangeRank if(!ChkOpt(nNumOptions, 1)) break; tGetResultFromSQL = true; snprintf(mSQLQuery, 500, "SELECT count(*) FROM clanlevels INNER JOIN clans ON (cll_clanid = cl_id) WHERE (cl_id = %d AND cll_charid = %d AND cll_level >= 12)", atoi(nOptions[0].c_str()), tCharID); break; - + case 88: // Clan: Money transfer Check if Option1 (Entered value) is lower or equal Option2 (Either my money or clan money) if(!ChkOpt(nNumOptions, 2)) break; if((atoi(nOptions[0].c_str()) <= atoi(nOptions[1].c_str())) && (atoi(nOptions[0].c_str()) > 0 )) // This is an not-very-well check, we do the real check later when its about to transfer the money! - tAllowed = true; + tAllowed = true; break; case 95: // Clan: Check if given TextString is valid (Opt1 = String) if(!ChkOpt(nNumOptions, 1)) break; if(atoi(nOptions[0].c_str()) >= 0 && atoi(nOptions[0].c_str()) <= 15) - tAllowed = true; + tAllowed = true; break; case 110: // GMTool Access check. If GM, allowed if(nAccessLevel > PAL_VOLUNTEER) - tAllowed = true; + tAllowed = true; break; case 184: // Clan: Delete (Opt1: ClanID Opt2: CharID Opt3: ClanMemberCount) Allow clandelete only when Leader is the only one left @@ -166,7 +166,7 @@ bool PTerminal::HandleTryAccess(PClient* nClient, u16 mTerminalSessionId, std::s case 202: // CityCom and Check if given ID is > 0 if(!ChkOpt(nNumOptions, 1)) break; if(atoi(nOptions[0].c_str()) > 0) - tAllowed = true; + tAllowed = true; break; case 208: // Clan: AdminDismissMember & ClanAdminAccess & AdminInviteMember // General ClanAdmin access in CityCom @@ -246,23 +246,23 @@ bool PTerminal::HandleTryAccess(PClient* nClient, u16 mTerminalSessionId, std::s break; case 315: // Warp players around, from/to GM kick players - if(nAccessLevel >= PAL_GM) - tAllowed = true; + if(nAccessLevel >= PAL_GM) + tAllowed = true; break; case 320: - if(nAccessLevel >= PAL_GM) - tAllowed = true; + if(nAccessLevel >= PAL_GM) + tAllowed = true; break; case 330: - if(nAccessLevel >= PAL_GM) - tAllowed = true; + if(nAccessLevel >= PAL_GM) + tAllowed = true; break; case 340: - if(nAccessLevel >= PAL_GM) - tAllowed = true; + if(nAccessLevel >= PAL_GM) + tAllowed = true; break; case 350: // Delete Clans, StockX @@ -302,24 +302,24 @@ bool PTerminal::HandleTryAccess(PClient* nClient, u16 mTerminalSessionId, std::s break; case 622: // TakeMoney from Faction wallet. Check if Player is allowed to do this. For now, only GMs may do this - if(nAccessLevel >= PAL_GM) - tAllowed = true; + if(nAccessLevel >= PAL_GM) + tAllowed = true; break; case 624: // Same as 622, Take/Give money from/to Faction wallet. GM only - if(nAccessLevel >= PAL_GM) - tAllowed = true; + if(nAccessLevel >= PAL_GM) + tAllowed = true; break; default: Console->Print("%s [PTerminal::TryAccess] Unknown DBID: %d", Console->ColorText(RED,BLACK,"Error"), nDBID); return false; - } + } // ---------------- if(tGetResultFromSQL == true) - { + { MYSQL_RES *result = NULL; //MYSQL_ROW row; int tNumRows = 0; @@ -341,20 +341,20 @@ bool PTerminal::HandleTryAccess(PClient* nClient, u16 mTerminalSessionId, std::s tAllowed = true; } MySQL->FreeGameSQLResult(result); - } + } // ---------------- if (gDevDebug) Console->Print("[PTerminal::TryAccess] DBID is: [%d] LoopBack: [%s] Allowed: [%d]", nDBID, nCommandName->c_str(), tAllowed); if(!nCheckOnly) - { + { char tCmd[100]; memset(tCmd, '\0', 100); strncpy(tCmd, nCommandName->c_str(), 100); PMessage* tmpMsg = MsgBuilder->BuildTryAccessAnswerMsg(nClient, tCmd, tAllowed); nClient->SendUDPMessage(tmpMsg); - } - + } + return tAllowed; -} + } diff --git a/server/src/game/terminal_updatedb.cpp b/server/src/game/terminal_updatedb.cpp index 461760f..b5a4626 100644 --- a/server/src/game/terminal_updatedb.cpp +++ b/server/src/game/terminal_updatedb.cpp @@ -23,35 +23,37 @@ /* terminal_upcatedb.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...) - > Sub-File for terminal "UpdateDB" command + Sub-File for terminal "UpdateDB" command MODIFIED: 12 Jan 2007 Namikon REASON: - Created - + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "terminal.h" -#include "msgbuilder.h" +#include "include/terminal.h" +#include "include/msgbuilder.h" bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown) { - ostringstream tLongSQL; // omg my eyes... Stringstream is one of the worst inventions ever! Stick with printf syntax!!111 - char tShortSQL[1024]; // Use this for small updates that will not exceed 1kb - memset(tShortSQL, '\0', 1024); - bool tSuccess = false; - + std::ostringstream tLongSQL; // omg my eyes... Stringstream is one of the worst inventions ever! Stick with printf syntax!!111 + char tShortSQL[1024]; // Use this for small updates that will not exceed 1kb + memset(tShortSQL, '\0', 1024); + bool tSuccess = false; + //Console->Print("UpdateDB ID: %d", nDBID); switch (nDBID) { case 5: - tLongSQL << "INSERT INTO neochronicle (nc_icon, nc_author, nc_datetime, nc_name, nc_content)"; - tLongSQL << " VALUES (" << atoi(nOptions[0].c_str()) << ", \"" << nOptions[1] << "\", \"" << nOptions[2] << "\", \"" << nOptions[3] << "\", \"" << nOptions[4] << "\")"; + tLongSQL << "INSERT INTO neochronicle (nc_icon, nc_author, nc_datetime, nc_name, nc_content)"; + tLongSQL << " VALUES (" << atoi(nOptions[0].c_str()) << ", \"" << nOptions[1] << "\", \"" << nOptions[2] << "\", \"" << nOptions[3] << "\", \"" << nOptions[4] << "\")"; break; case 6: - // UPDATE when Neocronicle DB is changed! author must be CHAR not INT + // UPDATE when Neocronicle DB is changed! author must be CHAR not INT break; case 7: // Delete neocronicle snprintf(tShortSQL, 1024, "DELETE FROM neochronicle WHERE nc_id = %d", atoi(nOptions[0].c_str())); @@ -65,34 +67,34 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 58: Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 62: // Set new outpost security + case 62: // Set new outpost security snprintf(tShortSQL, 1024, "UPDATE outposts SET o_security = %d WHERE o_outnum = %d AND o_clan = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); break; - - case 66: // Claninfo stuff that is somehow never used... Print error if it is - case 67: - Console->Print("%s [Pterminal::HandleUpdateDB] QueryID %d should never happen. Please contact Linux Addited forums!", Console->ColorText(RED,BLACK,"Notice"), nDBID); + + case 66: // Claninfo stuff that is somehow never used... Print error if it is + case 67: + Console->Print("%s [Pterminal::HandleUpdateDB] QueryID %d should never happen. Please contact Linux Addited forums!", Console->ColorText(RED,BLACK,"Notice"), nDBID); break; - case 77: // Delete old clanlevel + case 77: // Delete old clanlevel snprintf(tShortSQL, 1024, "DELETE FROM clanlevels WHERE cll_clanid = %d AND cll_level = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); break; - case 78: // Add new clanlevel + case 78: // Add new clanlevel snprintf(tShortSQL, 1024, "INSERT INTO clanlevels (cll_clanid, cll_desc, cll_level) VALUES (%d, \"%s\", %d)", atoi(nOptions[0].c_str()), nOptions[1].c_str(), atoi(nOptions[2].c_str())); break; case 84: // Take/Give money to/from clan - tLongSQL << "INSERT INTO moneytransactions (mt_clanid, mt_player, mt_amount, mt_date, mt_comment) "; - tLongSQL << "VALUES (" << atoi(nOptions[0].c_str()) << ", " << atoi(nOptions[1].c_str()) << ", " << atoi(nOptions[2].c_str()) << ", \"" << nOptions[3] << "\", \"" << nOptions[4] << "\")"; + tLongSQL << "INSERT INTO moneytransactions (mt_clanid, mt_player, mt_amount, mt_date, mt_comment) "; + tLongSQL << "VALUES (" << atoi(nOptions[0].c_str()) << ", " << atoi(nOptions[1].c_str()) << ", " << atoi(nOptions[2].c_str()) << ", \"" << nOptions[3] << "\", \"" << nOptions[4] << "\")"; break; - case 94: // Update runner description + case 94: // Update runner description snprintf(tShortSQL, 1024, "UPDATE characters SET c_desc = \"%s\" WHERE c_id = %d", nOptions[0].c_str(), atoi(nOptions[1].c_str())); break; - case 97: - // Just ignore that... KK required some extra updates here + case 97: + // Just ignore that... KK required some extra updates here tSuccess = true; //Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 120: // Create support call + case 120: // Create support call snprintf(tShortSQL, 1024, "INSERT INTO support (su_player, su_worldid, su_type, su_desc) VALUES (%d, %d, %d, \"%s\")", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), nOptions[3].c_str()); break; case 121: @@ -107,11 +109,11 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 124: snprintf(tShortSQL, 1024, "DELETE FROM support WHERE su_id = %d", atoi(nOptions[0].c_str())); break; - case 133: + case 133: tSuccess = true; //Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 139: + case 139: snprintf(tShortSQL, 1024, "UPDATE characters SET c_location = %d WHERE c_id = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str())); break; case 142: @@ -138,12 +140,12 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 165: // Missions, not yet Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 170: // Enter new bug + case 170: // Enter new bug snprintf(tShortSQL, 1024, "INSERT INTO bug_report (br_type, br_status, br_title, br_desc, br_location, br_fromid, br_datetime) VALUES (%d, %d, \"%s\", \"%s\", %d, %d, NOW())", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), nOptions[2].c_str(), nOptions[3].c_str(), atoi(nOptions[4].c_str()), atoi(nOptions[5].c_str())); break; case 172: // Delete bug id %d - snprintf(tShortSQL, 1024, "DELETE FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); - break; + snprintf(tShortSQL, 1024, "DELETE FROM bug_report WHERE br_id = %d", atoi(nOptions[0].c_str())); + break; case 180: Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; @@ -156,7 +158,7 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 252: Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 263: // Runner writing to Faction Board + case 263: // Runner writing to Faction Board snprintf(tShortSQL, 1024, "INSERT INTO forum_posts (fp_forumid, fp_factionid, fp_replyid, fp_fromid, fp_datetime, fp_name, fp_content) VALUES ((SELECT f_area FROM forums WHERE f_name = \"%s\"), %d, %d, %d, \"%s\", \"%s\", \"%s\")", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), atoi(nOptions[3].c_str()), nOptions[4].c_str(), nOptions[5].c_str(), nOptions[6].c_str()); break; case 268: // Runner writing to ClanBoard @@ -165,34 +167,34 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 370: // GM ClanRepair snprintf(tShortSQL, 1024, "INSERT INTO clanlevels (cll_clanid, cll_level, cll_desc) VALUES (%d, %d, \"%s\")", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), nOptions[2].c_str()); break; - case 385: // Clandelete 1/7 Clanlevels + case 385: // Clandelete 1/7 Clanlevels snprintf(tShortSQL, 1024, "DELETE FROM clanlevels WHERE cl_clanid = %d", atoi(nOptions[0].c_str())); break; - case 386: // Clandelete 2/7 Outposts + case 386: // Clandelete 2/7 Outposts snprintf(tShortSQL, 1024, "UPDATE outposts SET o_clan = 0 WHERE o_clan = %d", atoi(nOptions[0].c_str())); break; - case 387: // Clandelete 3/7 Free users from clans + case 387: // Clandelete 3/7 Free users from clans snprintf(tShortSQL, 1024, "UPDATE characters SET c_clan = 0 WHERE c_clan = %d", atoi(nOptions[0].c_str())); break; - case 388: // Clandelete 4/7 The clan itself + case 388: // Clandelete 4/7 The clan itself snprintf(tShortSQL, 1024, "DELETE FROM clans WHERE cl_id = %d", atoi(nOptions[0].c_str())); break; - case 389: // Clandelete 5/7 ? + case 389: // Clandelete 5/7 ? tSuccess = true; break; - case 390: // Clandelete 6/7 Clanappartment + case 390: // Clandelete 6/7 Clanappartment snprintf(tShortSQL, 1024, "DELETE FROM apartments WHERE apt_id = %d", atoi(nOptions[0].c_str())); break; - case 391: // Clandelete 7/7 ? + case 391: // Clandelete 7/7 ? tSuccess = true; break; - case 402: // GM writing to publicforum + case 402: // GM writing to publicforum snprintf(tShortSQL, 1024, "INSERT INTO forum_posts (fp_forumid, fp_replyid, fp_fromid, fp_datetime, fp_name, fp_content) VALUES ((SELECT f_area FROM forums WHERE f_name = \"%s\"), %d, %d, \"%s\", \"%s\", \"%s\")", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), nOptions[3].c_str(), nOptions[4].c_str(), nOptions[5].c_str()); break; - case 404: // GM deleting forum entry step 1 + case 404: // GM deleting forum entry step 1 snprintf(tShortSQL, 1024, "DELETE FROM forum_posts WHERE fp_id = %d", atoi(nOptions[0].c_str())); break; - case 405: // GM deleting forum entry step 2 + case 405: // GM deleting forum entry step 2 snprintf(tShortSQL, 1024, "DELETE FROM forum_posts WHERE fp_replyid = %d", atoi(nOptions[0].c_str())); break; case 412: // GM writing to faction forum @@ -201,7 +203,7 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 422: // Mark email as replied snprintf(tShortSQL, 1024, "UPDATE emails SET e_replied = 1 WHERE e_id = %d", atoi(nOptions[0].c_str())); break; - case 423: // Write new email + case 423: // Write new email snprintf(tShortSQL, 1024, "INSERT INTO emails (e_fromid,e_toid,e_datetime,e_subject,e_body) VALUES (%d, %d, \"%s\", \"%s\", \"%s\")", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), nOptions[2].c_str(), nOptions[3].c_str(), nOptions[4].c_str()); break; case 424: // Delete email @@ -210,19 +212,19 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 426: // Mark email as read snprintf(tShortSQL, 1024, "UPDATE emails SET e_new = 0 WHERE e_id = %d", atoi(nOptions[0].c_str())); break; - case 432: // Add new contact - snprintf(tShortSQL, 1024, "INSERT INTO contacts (c_listid,c_conid,c_type,c_desc) VALUES (%d, %d, %d, \"%s\")", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), nOptions[3].c_str()); + case 432: // Add new contact + snprintf(tShortSQL, 1024, "INSERT INTO contacts (c_listid,c_conid,c_type,c_desc) VALUES (%d, %d, %d, \"%s\")", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str()), nOptions[3].c_str()); break; - case 433: // Edit contact - snprintf(tShortSQL, 1024, "UPDATE contacts SET c_type = %d, c_desc = \"%s\" WHERE c_id = %d", atoi(nOptions[0].c_str()), nOptions[1].c_str(), atoi(nOptions[2].c_str())); + case 433: // Edit contact + snprintf(tShortSQL, 1024, "UPDATE contacts SET c_type = %d, c_desc = \"%s\" WHERE c_id = %d", atoi(nOptions[0].c_str()), nOptions[1].c_str(), atoi(nOptions[2].c_str())); break; case 434: // Delete contact snprintf(tShortSQL, 1024, "DELETE FROM contacts WHERE c_id = %d", atoi(nOptions[0].c_str())); break; - case 447: + case 447: snprintf(tShortSQL, 1024, "INSERT INTO neochronicle (nc_icon, nc_author, nc_datetime, nc_name, nc_content, nc_lang) VALUES (%d, \"%s\", \"%s\", \"%s\", \"%s\", %d)", atoi(nOptions[0].c_str()), nOptions[1].c_str(), nOptions[2].c_str(), nOptions[3].c_str(), nOptions[4].c_str(), atoi(nOptions[5].c_str())); break; - case 450: + case 450: snprintf(tShortSQL, 1024, "INSERT INTO guides (g_chapter, g_part, g_title, g_content, g_language) VALUES (%d, %d, \"%s\", \"%s\", %d)", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), nOptions[2].c_str(), nOptions[3].c_str(), atoi(nOptions[4].c_str())); break; case 515: // Create new clanwar @@ -231,57 +233,57 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st case 516: Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; - case 517: - // Special: Check if Clan of our char is = nOption2 + case 517: + // Special: Check if Clan of our char is = nOption2 if(nClient->GetChar()->GetClan() == atoi(nOptions[2].c_str())) - snprintf(tShortSQL, 1024, "UPDATE clanwars SET cw_status = %d WHERE cw_id = %d AND cw_initclan = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - // else: SQL Query is empty = failed as result + snprintf(tShortSQL, 1024, "UPDATE clanwars SET cw_status = %d WHERE cw_id = %d AND cw_initclan = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + // else: SQL Query is empty = failed as result break; - case 518: + case 518: if(nClient->GetChar()->GetClan() == atoi(nOptions[2].c_str())) - snprintf(tShortSQL, 1024, "UPDATE clanwars SET cw_status = %d WHERE cw_id = %d AND cw_enemyclan = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - // else: SQL Query is empty = failed as result + snprintf(tShortSQL, 1024, "UPDATE clanwars SET cw_status = %d WHERE cw_id = %d AND cw_enemyclan = %d", atoi(nOptions[0].c_str()), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + // else: SQL Query is empty = failed as result break; case 519: Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; case 525: // Update clan short - tLongSQL << "UPDATE clans SET cl_shortdesc = \"" << nOptions[0] << "\" WHERE cl_id = " << atoi(nOptions[1].c_str()) << " AND cl_leader = " << atoi(nOptions[2].c_str()); - + tLongSQL << "UPDATE clans SET cl_shortdesc = \"" << nOptions[0] << "\" WHERE cl_id = " << atoi(nOptions[1].c_str()) << " AND cl_leader = " << atoi(nOptions[2].c_str()); + break; case 526: // Update clan name - tLongSQL << "UPDATE clans SET cl_name = \"" << nOptions[0] << "\" WHERE cl_id = " << atoi(nOptions[1].c_str()) << " AND cl_leader = " << atoi(nOptions[2].c_str()); - + tLongSQL << "UPDATE clans SET cl_name = \"" << nOptions[0] << "\" WHERE cl_id = " << atoi(nOptions[1].c_str()) << " AND cl_leader = " << atoi(nOptions[2].c_str()); + break; - case 527: // Update clanapp password + case 527: // Update clanapp password //UPDATE apartments SET apt_password = x WHERE apt_owner = x AND apt_id = (SELECT clans.cl_appid WHERE clans.cl_id = x) tLongSQL << "UPDATE apartments SET apt_password = \"" << nOptions[0] << "\" WHERE apt_owner = " << atoi(nOptions[2].c_str()) << " AND apt_id = (SELECT cl_appid FROM clans WHERE cl_id = " << atoi(nOptions[1].c_str()) << ")"; break; - case 528: + case 528: tLongSQL << "UPDATE clans SET cl_minsympathy = " << atoi(nOptions[0].c_str()) << " WHERE cl_id = " << atoi(nOptions[1].c_str()) << " AND cl_leader = " << atoi(nOptions[2].c_str()); break; - case 529: - tLongSQL << "UPDATE clans SET cl_description = \"" << nOptions[0] << "\" WHERE cl_id = " << atoi(nOptions[1].c_str()) << " AND cl_leader = " << atoi(nOptions[2].c_str()); + case 529: + tLongSQL << "UPDATE clans SET cl_description = \"" << nOptions[0] << "\" WHERE cl_id = " << atoi(nOptions[1].c_str()) << " AND cl_leader = " << atoi(nOptions[2].c_str()); break; - case 543: - // Only delete if: option 2 is >= 7 (days); option0 is 5 or 6; option 4 = our clanid - if(atoi(nOptions[2].c_str()) >= 7) - if(atoi(nOptions[0].c_str()) == 5 || atoi(nOptions[0].c_str()) == 6) - if(nClient->GetChar()->GetClan() == atoi(nOptions[4].c_str())) - snprintf(tShortSQL, 1024, "DELETE FROM clanwars WHERE (cw_status = 5 OR cw_status = 6) AND cw_id = %d AND cw_initclan = %d", atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); + case 543: + // Only delete if: option 2 is >= 7 (days); option0 is 5 or 6; option 4 = our clanid + if(atoi(nOptions[2].c_str()) >= 7) + if(atoi(nOptions[0].c_str()) == 5 || atoi(nOptions[0].c_str()) == 6) + if(nClient->GetChar()->GetClan() == atoi(nOptions[4].c_str())) + snprintf(tShortSQL, 1024, "DELETE FROM clanwars WHERE (cw_status = 5 OR cw_status = 6) AND cw_id = %d AND cw_initclan = %d", atoi(nOptions[3].c_str()), atoi(nOptions[4].c_str())); - //Console->Print("%s", tShortSQL); + //Console->Print("%s", tShortSQL); break; - case 548: - // Check clanmembership - if(nClient->GetChar()->GetClan() == atoi(nOptions[2].c_str())) + case 548: + // Check clanmembership + if(nClient->GetChar()->GetClan() == atoi(nOptions[2].c_str())) snprintf(tShortSQL, 1024, "UPDATE clanwars SET cw_statement_initiator = \"%s\" WHERE cw_id = %d AND cw_initclan = %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); break; - case 549: - // Check clanmembership + case 549: + // Check clanmembership if(nClient->GetChar()->GetClan() == atoi(nOptions[2].c_str())) - snprintf(tShortSQL, 1024, "UPDATE clanwars SET cw_statement_enemy = \"%s\" WHERE cw_id = %d AND cw_enemyclan = %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); - break; + snprintf(tShortSQL, 1024, "UPDATE clanwars SET cw_statement_enemy = \"%s\" WHERE cw_id = %d AND cw_enemyclan = %d", nOptions[0].c_str(), atoi(nOptions[1].c_str()), atoi(nOptions[2].c_str())); + break; case 555: Console->Print("%s [Pterminal::HandleUpdateDB] Nothing to do; Function not written yet for QueryID %d", Console->ColorText(YELLOW,BLACK,"Notice"), nDBID); break; @@ -328,37 +330,37 @@ bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::st Console->Print("%s [Pterminal::HandleUpdateDB] Unknown QueryID %d", Console->ColorText(RED,BLACK,"Warning"), nDBID); return false; } - -// ------- - if(tLongSQL.str().length() > 0) - { - if(MySQL->GameQuery(tLongSQL.str().c_str())) - { - Console->Print("Cannot update DB. query was: %s", tLongSQL.str().c_str()); - MySQL->ShowGameSQLError(); - tSuccess = false; - } - else - tSuccess = true; - } - else if(strlen(tShortSQL) > 0) - { - if(MySQL->GameQuery(tShortSQL)) - { - Console->Print("Cannot update DB. query was: %s", tShortSQL); - MySQL->ShowGameSQLError(); - tSuccess = false; - } - else - tSuccess = true; - } - - // Notice client about UpdateDB result - char tCmd[100]; - memset(tCmd, '\0', 100); - strncpy(tCmd, nCommandName->c_str(), 100); - - PMessage* tmpMsg = MsgBuilder->BuildTryAccessAnswerMsg(nClient, tCmd, tSuccess); - nClient->SendUDPMessage(tmpMsg); + +// ------- + if(tLongSQL.str().length() > 0) + { + if(MySQL->GameQuery(tLongSQL.str().c_str())) + { + Console->Print("Cannot update DB. query was: %s", tLongSQL.str().c_str()); + MySQL->ShowGameSQLError(); + tSuccess = false; + } + else + tSuccess = true; + } + else if(strlen(tShortSQL) > 0) + { + if(MySQL->GameQuery(tShortSQL)) + { + Console->Print("Cannot update DB. query was: %s", tShortSQL); + MySQL->ShowGameSQLError(); + tSuccess = false; + } + else + tSuccess = true; + } + + // Notice client about UpdateDB result + char tCmd[100]; + memset(tCmd, '\0', 100); + strncpy(tCmd, nCommandName->c_str(), 100); + + PMessage* tmpMsg = MsgBuilder->BuildTryAccessAnswerMsg(nClient, tCmd, tSuccess); + nClient->SendUDPMessage(tmpMsg); return true; } diff --git a/server/src/game/vehicle.cpp b/server/src/game/vehicle.cpp index 60ee1ad..56e79f0 100644 --- a/server/src/game/vehicle.cpp +++ b/server/src/game/vehicle.cpp @@ -1,39 +1,45 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* - vehicle.cpp - Vehicle handling + vehicle.cpp - Vehicle handling - Authors: - - Namikon + Authors: + - Namikon + - Akiko - MODIFIED: 08 Jan 2006 Namikon - REASON: - initial release by Namikon + MODIFIED: 08 Jan 2006 Namikon + REASON: - initial release by Namikon + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "vehicle.h" -#include "worlds.h" + +#include "include/vehicle.h" +#include "include/worlds.h" + // PVhcCoordinates void PVhcCoordinates::SetInterpolate( const PVhcCoordinates& Pos1, const PVhcCoordinates& Pos2, f32 nCoef ) @@ -447,7 +453,7 @@ PSpawnedVehicle* PSpawnedVehicles::SpawnVehicle( PVehicleInformation const* nVhc } if ( mNextFreeHint == nSize ) { - mSpawnedVehicles.push_back( NULL ); + mSpawnedVehicles.push_back( static_cast(NULL) ); } if ( mNextFreeHint < mMaxLocalVhc ) diff --git a/server/src/game/vhcaccessrequest.cpp b/server/src/game/vhcaccessrequest.cpp old mode 100755 new mode 100644 index 59a9f0a..11e3fcd --- a/server/src/game/vhcaccessrequest.cpp +++ b/server/src/game/vhcaccessrequest.cpp @@ -1,33 +1,42 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - vhcaccessrequest.cpp - classe for pendinf vhc access requests - CREATION: 14 Apr 2009 Hammag +/* + vhcaccessrequest.cpp - classe for pendinf vhc access requests + + Authors: + - Hammag + - Akiko + CREATION: 14 Apr 2009 Hammag + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "vhcaccessrequest.h" + +#include "include/vhcaccessrequest.h" + PVhcAccessRequest::PVhcAccessRequest() { diff --git a/server/src/game/worldactors.cpp b/server/src/game/worldactors.cpp index 1ced2ec..f111965 100644 --- a/server/src/game/worldactors.cpp +++ b/server/src/game/worldactors.cpp @@ -1,40 +1,44 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + maintainer Akiko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* + worldactors.cpp - Management class for dynamic worldactors - worldactors.cpp - Management class for dynamic worldactors - - CREATION: 02 Jan 2007 Namikon - - MODIFIED: - REASON: - + Authors: + - Namikon + - Akiko + CREATION: 02 Jan 2007 Namikon + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" -#include "worldactors.h" -#include "worlds.h" -#include "msgbuilder.h" + +#include "include/worldactors.h" +#include "include/worlds.h" +#include "include/msgbuilder.h" + PWorldActors::PWorldActors() { diff --git a/server/src/game/worlddatatemplate.cpp b/server/src/game/worlddatatemplate.cpp old mode 100755 new mode 100644 index 65c2743..c349f8a --- a/server/src/game/worlddatatemplate.cpp +++ b/server/src/game/worlddatatemplate.cpp @@ -1,288 +1,288 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - -/* - worlddatatemplate.cpp - world data template (from worlds .dat files) class - - MODIFIED: 04 Oct 2006 Hammag - REASON: - creation - - MODIFIED: 21 Jun 2009 Namikon - REASON: - Added NPC Template stuff - -*/ - - -#include "main.h" - -#include "worlddatatemplate.h" -#include "world_datparser.h" -#include "furnituretemplate.h" -#include "doortemplate.h" -#include "npctemplate.h" - -PWorldDataTemplate::PWorldDataTemplate() -{ - mUseCount = 0; - for ( int i = 0; i < WORLDDATATEMPLATE_MAXPOSITEMS; ++i ) - { - mPositionItems[i] = NULL; - } -} - -PWorldDataTemplate::~PWorldDataTemplate() -{ - DatFileDataCleanup(); -} - -void PWorldDataTemplate::DatFileDataCleanup() -{ - for ( PFurnitureItemsMap::iterator i = mFurnitureItems.begin(); i != mFurnitureItems.end(); i++ ) - delete i->second; - for ( PDoorsMap::iterator i = mDoors.begin(); i != mDoors.end(); i++ ) - delete i->second; - for ( PNPCsMap::iterator i = mNPCs.begin(); i != mNPCs.end(); i++ ) - delete i->second; -} - -bool PWorldDataTemplate::LoadDatFile( const std::string& WorldTemplateName, const std::string& nFilename, const bool nTestAccesOnly ) -{ - PWorldDatParser WDatLoader; - int LoadResult; - - DatFileDataCleanup(); - if ( gDevDebug ) Console->Print( "%s Loading %s", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nFilename.c_str() ); - LoadResult = WDatLoader.LoadDatFile( nFilename, this, true, nTestAccesOnly ) ; // We want to discard passive objects for now - switch ( LoadResult ) - { - case 0: - { - mName = nFilename; - mBspName = WorldTemplateName; - if ( !nTestAccesOnly ) - { - SetLinkedObjects(); // temp until better solution found from .dat & .bsp files - } - return true; - } - - case -1: - { - if ( !nTestAccesOnly ) - Console->Print( "%s Can't read file %s", Console->ColorText( RED, BLACK, "[ERROR]" ), nFilename.c_str() ); - break; - } - - case - 2: - { - Console->Print( "%s Bad data", Console->ColorText( RED, BLACK, "[ERROR]" ) ); - break; - } - - case - 3: - { - Console->Print( "%s Unexpected end of file", Console->ColorText( RED, BLACK, "[ERROR]" ) ); - break; - } - - default: - Console->Print( "%s Unknown error %d", Console->ColorText( RED, BLACK, "[ERROR]" ), LoadResult ); - } - return false; -} - -u32 PWorldDataTemplate::AddFurnitureItem( PFurnitureItemTemplate* nItem ) -{ - if ( nItem ) - { - if ( mFurnitureItems.insert( std::make_pair( nItem->GetID(), nItem ) ).second ) - { - if ( gDevDebug ) Console->Print( "%s Furniture item %d added to world template", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nItem->GetID() ); - - if ( nItem->GetFunctionType() == 21 ) - { - int v = nItem->GetFunctionValue(); - if (( v >= 0 ) && ( v < WORLDDATATEMPLATE_MAXPOSITEMS ) ) - { - if ( mPositionItems[v] ) - { - if (( v == WORLDDATATEMPLATE_MAXPOSITEMS - 2 ) && !mPositionItems[v+1] ) // We allow that only for Pos 9 in order not to mess with other pos - { - Console->Print( "%s Same position %d for two position items ID %d and %d. Last one will be put on next position.", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), v, mPositionItems[v]->GetID(), nItem->GetID() ); - ++v; - } - else - { - Console->Print( "%s Same position %d for two position items ID %d and %d. Only last one kept.", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), v, mPositionItems[v]->GetID(), nItem->GetID() ); - } - } - - mPositionItems[v] = nItem; - /* - Console->Print("Position entity %d (id 0x%x) added to world template", v, nItem->GetID()); - f32 fpX, fpY, fpZ; - u16 pX, pY, pZ; - nItem->GetPos(&fpX, &fpY, &fpZ); - pX = (u16) (fpX + 32000); - pY = (u16) (fpY + 32000); - pZ = (u16) (fpZ + 32000); - Console->Print("Position Y=%f (0x%04x) Z=%f (0x%04x) X=%f (0x%04x)", fpY, pY, fpZ, pZ, fpX, pX); - */ - } - else - { - Console->Print( "%s Invalid position %d for position item ID %d. Position ignored.", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), v, nItem->GetID() ); - } - } - return nItem->GetID(); - } - else - { - Console->Print( "%s Duplicate furniture item ID %d !!! Not added to world template", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), nItem->GetID() ); - } - } - return 0; -} - -const PFurnitureItemTemplate* PWorldDataTemplate::GetFurnitureItem( u32 ItemID ) -{ - PFurnitureItemsMap::const_iterator it = mFurnitureItems.find( ItemID ); - if ( it == mFurnitureItems.end() ) - return NULL; - else - return it->second; -} - -bool PWorldDataTemplate::getPositionItemPosition( u8 PosID, f32* pX, f32* pY, f32* pZ ) -{ - if (( PosID < WORLDDATATEMPLATE_MAXPOSITEMS ) && mPositionItems[PosID] ) - { - mPositionItems[PosID]->GetPos( pX, pY, pZ ) ; - return true; - } - return false; -} - -u32 PWorldDataTemplate::AddDoor( PDoorTemplate* nDoor ) -{ - if ( nDoor ) - { - if ( mDoors.insert( std::make_pair( nDoor->GetID(), nDoor ) ).second ) - { - if ( gDevDebug ) Console->Print( "%s Door %d added to world template", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nDoor->GetID() ); - return nDoor->GetID(); - } - else - { - Console->Print( "%s Duplicate Door ID %d !!! Not added to world template", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), nDoor->GetID() ); - } - } - return 0; -} - -const PDoorTemplate* PWorldDataTemplate::GetDoor( u32 DoorID ) -{ - PDoorsMap::const_iterator it = mDoors.find( DoorID ); - if ( it == mDoors.end() ) - return NULL; - else - return it->second; -} - - -u32 PWorldDataTemplate::AddNPC( PNPCTemplate* nNPC ) -{ - if ( nNPC ) - { - if ( mNPCs.insert( std::make_pair( nNPC->GetNpcID(), nNPC ) ).second ) - { - if ( gDevDebug ) Console->Print( "%s NPC %d added to world template", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nNPC->GetNpcID() ); - return nNPC->GetNpcID(); - } - else - { - Console->Print( "%s Duplicate NPC ID %d !!! Not added to world template", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), nNPC->GetNpcID() ); - } - } - return 0; -} - -const PNPCTemplate* PWorldDataTemplate::GetNPC( u32 NPCID ) -{ - PNPCsMap::const_iterator it = mNPCs.find( NPCID ); - if ( it == mNPCs.end() ) - return NULL; - else - return it->second; -} - -void PWorldDataTemplate::SetLinkedObjects() -{ - f32 xI, yI, zI; - f32 xD, yD, zD; - f32 D2, minD2; - u32 minObjID; - u16 fnctType; - u16 tGROrder = 0; - - for ( PFurnitureItemsMap::iterator it = mFurnitureItems.begin(); it != mFurnitureItems.end(); it++ ) - { - fnctType = it->second->GetFunctionType(); - if (( fnctType == 11 ) || ( fnctType == 12 ) || ( fnctType == 13 ) || ( fnctType == 23 ) ) // if function is apt entry button, door access if, hack button or money button - { - it->second->GetPos( &xI, &yI, &zI ); -//Console->Print("Button pos: %0.0f %0.0f %0.0f", xI, yI, zI); - minD2 = 1e9; - minObjID = 0; - for ( PDoorsMap::iterator dit = mDoors.begin(); dit != mDoors.end(); dit++ ) - { -//Console->Print("%s Found door %d (%s) : %s triggered, %s", Console->ColorText(GREEN, BLACK, "[Debug]"), dit->first, dit->second->GetName().c_str(), (dit->second->IsTriggeredDoor()?"":"not"), (dit->second->IsDoubleDoor()?"double":"single") ); - if ( dit->second->IsTriggeredDoor() ) - { - dit->second->GetPos( &xD, &yD, &zD ); -//Console->Print("Door pos: %0.0f %0.0f %0.0f", xD, yD, zD); - D2 = ( xI - xD ) * ( xI - xD ) + ( yI - yD ) * ( yI - yD ) + ( zI - zD ) * ( zI - zD ); -//Console->Print("Dist D2:%0.0f minD2:%0.0f", D2, minD2); - if ( D2 < minD2 ) - { - minD2 = D2; - minObjID = 1 + dit->first; - } - } - } - if ( minObjID-- ) - { - it->second->SetLinkedObjectID( minObjID ); - if ( gDevDebug ) Console->Print( "%s Found triggered door %d (%s) for button %d (%s)", Console->ColorText( GREEN, BLACK, "[Debug]" ), minObjID, GetDoor( minObjID )->GetName().c_str(), it->first, it->second->GetName().c_str() ); - - } - else - { - Console->Print( "%s No triggered door found for button %d (%s) in World data template %s", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), it->first, it->second->GetName().c_str(), this->GetName().c_str() ); - } - } - else if ( fnctType == 6 ) // if function is genrep - { - it->second->SetLinkedObjectID( ++tGROrder ); - } - } - -} +/* + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + +/* + worlddatatemplate.cpp - world data template (from worlds .dat files) class + + MODIFIED: 04 Oct 2006 Hammag + REASON: - creation + + MODIFIED: 21 Jun 2009 Namikon + REASON: - Added NPC Template stuff + +*/ + + +#include "main.h" + +#include "include/worlddatatemplate.h" +#include "include/world_datparser.h" +#include "include/furnituretemplate.h" +#include "include/doortemplate.h" +#include "include/npctemplate.h" + +PWorldDataTemplate::PWorldDataTemplate() +{ + mUseCount = 0; + for ( int i = 0; i < WORLDDATATEMPLATE_MAXPOSITEMS; ++i ) + { + mPositionItems[i] = NULL; + } +} + +PWorldDataTemplate::~PWorldDataTemplate() +{ + DatFileDataCleanup(); +} + +void PWorldDataTemplate::DatFileDataCleanup() +{ + for ( PFurnitureItemsMap::iterator i = mFurnitureItems.begin(); i != mFurnitureItems.end(); i++ ) + delete i->second; + for ( PDoorsMap::iterator i = mDoors.begin(); i != mDoors.end(); i++ ) + delete i->second; + for ( PNPCsMap::iterator i = mNPCs.begin(); i != mNPCs.end(); i++ ) + delete i->second; +} + +bool PWorldDataTemplate::LoadDatFile( const std::string& WorldTemplateName, const std::string& nFilename, const bool nTestAccesOnly ) +{ + PWorldDatParser WDatLoader; + int LoadResult; + + DatFileDataCleanup(); + if ( gDevDebug ) Console->Print( "%s Loading %s", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nFilename.c_str() ); + LoadResult = WDatLoader.LoadDatFile( nFilename, this, true, nTestAccesOnly ) ; // We want to discard passive objects for now + switch ( LoadResult ) + { + case 0: + { + mName = nFilename; + mBspName = WorldTemplateName; + if ( !nTestAccesOnly ) + { + SetLinkedObjects(); // temp until better solution found from .dat & .bsp files + } + return true; + } + + case -1: + { + if ( !nTestAccesOnly ) + Console->Print( "%s Can't read file %s", Console->ColorText( RED, BLACK, "[ERROR]" ), nFilename.c_str() ); + break; + } + + case - 2: + { + Console->Print( "%s Bad data", Console->ColorText( RED, BLACK, "[ERROR]" ) ); + break; + } + + case - 3: + { + Console->Print( "%s Unexpected end of file", Console->ColorText( RED, BLACK, "[ERROR]" ) ); + break; + } + + default: + Console->Print( "%s Unknown error %d", Console->ColorText( RED, BLACK, "[ERROR]" ), LoadResult ); + } + return false; +} + +u32 PWorldDataTemplate::AddFurnitureItem( PFurnitureItemTemplate* nItem ) +{ + if ( nItem ) + { + if ( mFurnitureItems.insert( std::make_pair( nItem->GetID(), nItem ) ).second ) + { + if ( gDevDebug ) Console->Print( "%s Furniture item %d added to world template", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nItem->GetID() ); + + if ( nItem->GetFunctionType() == 21 ) + { + int v = nItem->GetFunctionValue(); + if (( v >= 0 ) && ( v < WORLDDATATEMPLATE_MAXPOSITEMS ) ) + { + if ( mPositionItems[v] ) + { + if (( v == WORLDDATATEMPLATE_MAXPOSITEMS - 2 ) && !mPositionItems[v+1] ) // We allow that only for Pos 9 in order not to mess with other pos + { + Console->Print( "%s Same position %d for two position items ID %d and %d. Last one will be put on next position.", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), v, mPositionItems[v]->GetID(), nItem->GetID() ); + ++v; + } + else + { + Console->Print( "%s Same position %d for two position items ID %d and %d. Only last one kept.", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), v, mPositionItems[v]->GetID(), nItem->GetID() ); + } + } + + mPositionItems[v] = nItem; + /* + Console->Print("Position entity %d (id 0x%x) added to world template", v, nItem->GetID()); + f32 fpX, fpY, fpZ; + u16 pX, pY, pZ; + nItem->GetPos(&fpX, &fpY, &fpZ); + pX = (u16) (fpX + 32000); + pY = (u16) (fpY + 32000); + pZ = (u16) (fpZ + 32000); + Console->Print("Position Y=%f (0x%04x) Z=%f (0x%04x) X=%f (0x%04x)", fpY, pY, fpZ, pZ, fpX, pX); + */ + } + else + { + Console->Print( "%s Invalid position %d for position item ID %d. Position ignored.", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), v, nItem->GetID() ); + } + } + return nItem->GetID(); + } + else + { + Console->Print( "%s Duplicate furniture item ID %d !!! Not added to world template", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), nItem->GetID() ); + } + } + return 0; +} + +const PFurnitureItemTemplate* PWorldDataTemplate::GetFurnitureItem( u32 ItemID ) +{ + PFurnitureItemsMap::const_iterator it = mFurnitureItems.find( ItemID ); + if ( it == mFurnitureItems.end() ) + return NULL; + else + return it->second; +} + +bool PWorldDataTemplate::getPositionItemPosition( u8 PosID, f32* pX, f32* pY, f32* pZ ) +{ + if (( PosID < WORLDDATATEMPLATE_MAXPOSITEMS ) && mPositionItems[PosID] ) + { + mPositionItems[PosID]->GetPos( pX, pY, pZ ) ; + return true; + } + return false; +} + +u32 PWorldDataTemplate::AddDoor( PDoorTemplate* nDoor ) +{ + if ( nDoor ) + { + if ( mDoors.insert( std::make_pair( nDoor->GetID(), nDoor ) ).second ) + { + if ( gDevDebug ) Console->Print( "%s Door %d added to world template", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nDoor->GetID() ); + return nDoor->GetID(); + } + else + { + Console->Print( "%s Duplicate Door ID %d !!! Not added to world template", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), nDoor->GetID() ); + } + } + return 0; +} + +const PDoorTemplate* PWorldDataTemplate::GetDoor( u32 DoorID ) +{ + PDoorsMap::const_iterator it = mDoors.find( DoorID ); + if ( it == mDoors.end() ) + return NULL; + else + return it->second; +} + + +u32 PWorldDataTemplate::AddNPC( PNPCTemplate* nNPC ) +{ + if ( nNPC ) + { + if ( mNPCs.insert( std::make_pair( nNPC->GetNpcID(), nNPC ) ).second ) + { + if ( gDevDebug ) Console->Print( "%s NPC %d added to world template", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nNPC->GetNpcID() ); + return nNPC->GetNpcID(); + } + else + { + Console->Print( "%s Duplicate NPC ID %d !!! Not added to world template", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), nNPC->GetNpcID() ); + } + } + return 0; +} + +const PNPCTemplate* PWorldDataTemplate::GetNPC( u32 NPCID ) +{ + PNPCsMap::const_iterator it = mNPCs.find( NPCID ); + if ( it == mNPCs.end() ) + return NULL; + else + return it->second; +} + +void PWorldDataTemplate::SetLinkedObjects() +{ + f32 xI, yI, zI; + f32 xD, yD, zD; + f32 D2, minD2; + u32 minObjID; + u16 fnctType; + u16 tGROrder = 0; + + for ( PFurnitureItemsMap::iterator it = mFurnitureItems.begin(); it != mFurnitureItems.end(); it++ ) + { + fnctType = it->second->GetFunctionType(); + if (( fnctType == 11 ) || ( fnctType == 12 ) || ( fnctType == 13 ) || ( fnctType == 23 ) ) // if function is apt entry button, door access if, hack button or money button + { + it->second->GetPos( &xI, &yI, &zI ); +//Console->Print("Button pos: %0.0f %0.0f %0.0f", xI, yI, zI); + minD2 = 1e9; + minObjID = 0; + for ( PDoorsMap::iterator dit = mDoors.begin(); dit != mDoors.end(); dit++ ) + { +//Console->Print("%s Found door %d (%s) : %s triggered, %s", Console->ColorText(GREEN, BLACK, "[Debug]"), dit->first, dit->second->GetName().c_str(), (dit->second->IsTriggeredDoor()?"":"not"), (dit->second->IsDoubleDoor()?"double":"single") ); + if ( dit->second->IsTriggeredDoor() ) + { + dit->second->GetPos( &xD, &yD, &zD ); +//Console->Print("Door pos: %0.0f %0.0f %0.0f", xD, yD, zD); + D2 = ( xI - xD ) * ( xI - xD ) + ( yI - yD ) * ( yI - yD ) + ( zI - zD ) * ( zI - zD ); +//Console->Print("Dist D2:%0.0f minD2:%0.0f", D2, minD2); + if ( D2 < minD2 ) + { + minD2 = D2; + minObjID = 1 + dit->first; + } + } + } + if ( minObjID-- ) + { + it->second->SetLinkedObjectID( minObjID ); + if ( gDevDebug ) Console->Print( "%s Found triggered door %d (%s) for button %d (%s)", Console->ColorText( GREEN, BLACK, "[Debug]" ), minObjID, GetDoor( minObjID )->GetName().c_str(), it->first, it->second->GetName().c_str() ); + + } + else + { + Console->Print( "%s No triggered door found for button %d (%s) in World data template %s", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), it->first, it->second->GetName().c_str(), this->GetName().c_str() ); + } + } + else if ( fnctType == 6 ) // if function is genrep + { + it->second->SetLinkedObjectID( ++tGROrder ); + } + } + +} diff --git a/server/src/game/worlds.cpp b/server/src/game/worlds.cpp old mode 100755 new mode 100644 index 421a401..2921d92 --- a/server/src/game/worlds.cpp +++ b/server/src/game/worlds.cpp @@ -1,47 +1,49 @@ /* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + TinNS (TinNS is not a Neocron Server) + Copyright (C) 2005 Linux Addicted Community + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - worlds.cpp - world class and world map class - MODIFIED: 06 Oct 2006 Hammag - REASON: - creation +/* + worlds.cpp - world class and world map class + MODIFIED: 06 Oct 2006 Hammag + REASON: - creation + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #include "main.h" -#include "filesystem.h" -#include "def_worlds.h" -#include "gamedefs.h" -#include "furnituretemplate.h" -#include "worlddatatemplate.h" -#include "worlds.h" -#include "appartements.h" -#include "vehicle.h" - +#include "common/filesystem.h" +#include "include/def_worlds.h" +#include "include/gamedefs.h" +#include "include/furnituretemplate.h" +#include "include/worlddatatemplate.h" +#include "include/worlds.h" +#include "include/appartements.h" +#include "include/vehicle.h" #include + /**** PWorld ****/ u16 const PWorld::mZoneOutLimitOffset = 0x100; u16 const PWorld::mBottomZoneOutLimit = 0x4800 - PWorld::mZoneOutLimitOffset; diff --git a/server/src/game/zoning.cpp b/server/src/game/zoning.cpp index 546ddbe..00c6f13 100644 --- a/server/src/game/zoning.cpp +++ b/server/src/game/zoning.cpp @@ -26,7 +26,7 @@ Authors: - initial release by unknown person - - Sting <> + - Sting - Akiko - Namikon @@ -49,27 +49,32 @@ REASON: - Fixed zoning to / from wastelands to / from city sectors (packet1 was wrong, thanks Maxx!!) MODIFIED: 08 Jan 2006 Namikon REASON: - Added appartment handling - - Fixed minimap + - Fixed minimap MODIFIED: 17 Jan 2006 Namikon REASON: - File rewritten. Now, only 1 packet is send, like the real servers (that one fixed subway) - - Fixed several worldnames + - Fixed several worldnames MODIFIED: 26 Jul 2006 Hammag - REASON: - Fixed world 1086 (area mc5) worldname (from NeoX source) + REASON: - Fixed world 1086 (area mc5) worldname (from NeoX source) MODIFIED: 28 Sep 2006 Hammag - REASON: - Zone filename in now taken from appartments.def (for app zoning) or from worlds.ini (general case) - rather than hardcoded. - + REASON: - Zone filename in now taken from appartments.def (for app zoning) or from worlds.ini (general case) + rather than hardcoded. + + MODIFIED: 09 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem + TODO: Put get the fallback world from config Check for file existence before sending info to client to avoid client crash and bad location in char info */ + #include "main.h" -#include "worlds.h" -#include "appartements.h" -#include "msgbuilder.h" +#include "include/worlds.h" +#include "include/appartements.h" +#include "include/msgbuilder.h" + void SendZone(PClient *Client, u32 loc) { diff --git a/server/src/include/config.h b/server/src/include/config.h deleted file mode 100644 index 822aa13..0000000 --- a/server/src/include/config.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - config.h - - Authors: - - Akiko - - Namikon - - someone else? - - MODIFIED: Unknown date / Unknown author - REASON: - initial release by unknown - MODIFIED: 23 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 07 Jan 2006 Namikon - REASON: - Started to replace XML with CFG files - MODIFIED: 05 Aug 2006 Hammag - REASON: - changed LoadOptions() implementation. - This should make addition of new options really easier, as well as config syntax error tracking - See config.h for info - MODIFIED: 27 Aug 2006 Hammag - REASON: - Modified LoadOption() methode to make it generic, - with an options template and the config file as arguments - - Removed the ConfigTemplate that was used for gameserver only. - - Removed old unused code - MODIFIED: 25 Jun 2007 Hammag - REASON: - Added include support - - Now use PCRE RegEx instead of "strtok", enabling rentrance and removing - potential issues. - - Added GetOption & GetOptionInt with const std::string parameter -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "regex++.h" - -class PConfig -{ - private : - typedef std::map OptionsMap; - OptionsMap mOptions; - RegEx* mOptValRegEx; - RegEx* mIncludeRegEx; - - bool LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile, int nDepth); - - public : - PConfig(); - ~PConfig(); - - inline bool LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile) - { return LoadOptions(nConfigTemplate, nConfigFile, 0); } - inline const std::string &GetOption(const char *Name) const { return GetOption((std::string) Name); } - const std::string &GetOption(const std::string Name) const; - int GetOptionInt(const char *Name) const { return GetOptionInt((std::string) Name); } - int GetOptionInt(const std::string Name) const; -}; - -// Max nested includes -#define CONFIG_MAXDEPTH 4 - -/* - The list of valid config options is now set in the array ConfigTemplate - A default value can be set for each option, whiches makes the option optionnal in config file - If no default value is set, the option is mandatory. - Duplicate option entries in config file are also checked, and only the first value is kept - Unkown options are rejected - Duplicates, unkown and default use generate a warning in logs but don't break options loading - Missing mandatory option generate an error in log and break option loading (imediate return false) - - The ConfigTemplate parameter must have the structure shown in the following exemple: - -const char* ConfigTemplate[][2] = { - // {option_name, default_value} if default_value is empty string, it means option is mandatory - // List ends with empty string for option_name - {"info_sql_host", "127.0.0.1"}, - {"info_sql_port", "3306"}, - {"info_sql_username", ""}, - {"info_sql_password", ""}, - {"", ""} // do not change this line (end mark) -}; - -*/ -#endif - diff --git a/server/src/include/connection-tcp.h b/server/src/include/connection-tcp.h deleted file mode 100644 index 23ccad2..0000000 --- a/server/src/include/connection-tcp.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - connection-cpp.h - a connection class for tcp - - Authors: - - bakkdoor - - MODIFIED: 09 Feb 2006 bakkdoor - REASON: - introduced - - MODIFIED: 25 Jul 2006 hammag - REASON: - changed member data prefix from "m_" to "m" in for homogeneity with the reste of TinNS code - - added private members data mQueueIn and mQueueOut - - added public members methods SendMessage(), GetMessage(), DeleteOutgoingMessages() and modified code accordingly - - removed old read/write member data, and added a compatibility mSendBufferMsg* member - - MODIFIED: 05 Aug 2006 hammag - REASON: - renamed "getLocalAddress()" to "getRemoteAddress()" as it is ... what it does ! - - MODIFIED: 26 Aug 2006 hammag - REASON: - moved RECVBUFFERSIZE, SENDBUFFERSIZE, DEFAULT_TIMEOUT decalration & definition - in netcode's main.h (temporarily) - - TODO: - remove old read/write compatibility methods when not needed anymore - - see .cpp for current implementation limits - -*/ - -#ifndef CONNECTIONTCP_H -#define CONNECTIONTCP_H - -class ServerSocket; - -class ConnectionTCP -{ - private: - int mSockfd; - struct sockaddr_in mRemoteAddr; - -// u8 mReceiveBuffer[RECVBUFFERSIZE]; -// u8 mSendBuffer[SENDBUFFERSIZE]; - -// int mSendSize; -// int mRecvSize; -// int mRecvRewind; - - std::time_t mLastActive; - std::time_t mTimeOutValue; - - bool mbConnected; - - ServerSocket* mServerSocket; // pointer to the serversocket - - std::queue mQueueIn; - std::queue mQueueOut; - - PMessage* mReceiveBufferMsg; - - public: - ConnectionTCP(int sockfd, struct sockaddr_in addr, ServerSocket* server); - ~ConnectionTCP(); - - struct sockaddr_in getAddr() { return mRemoteAddr; } - int getSockfd() { return mSockfd; } - char* getRemoteAddress(); - - // add pointer to serversocket-instance - void setServer(ServerSocket* server){ if(server) { mServerSocket = server; } } - - bool timeOut() const; - inline time_t GetTimeOutValue() const { return mTimeOutValue; } - inline void SetTimeOutValue(time_t Value) { mTimeOutValue = Value; } - - bool update(); - bool isConnected() { return mbConnected; } - - inline void SendMessage(PMessage* nMessage) { mQueueOut.push(nMessage); } - PMessage* GetMessage(); - void DeleteOutgoingMessages(); - -/**************** Old I/F compatibility stuff ******************/ - private: - PMessage* mSendBufferMsg; // for old I/F compatibility only - - public: - void flushSendBuffer(); - - int getRecvBufferSize(); - int getSendBufferSize(); - - // returns a pointer to the internal receive buffer - // Size contains the number of octets to read (or 0 to read entire buffer) - // number of octets available is returned in Size - const u8* read(int* size); - - int write(const void* data, int size); - int write(u8 data); - int write(u16 data); - int write(u32 data); - int write(float data); - int write(double data); - int write(const char* string); -}; - -#endif diff --git a/server/src/include/connection-udp.h b/server/src/include/connection-udp.h deleted file mode 100644 index 5bdf753..0000000 --- a/server/src/include/connection-udp.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - connection-udp.h - a connection class for udp - - Authors: - - bakkdoor - - MODIFIED: 09 Feb 2006 bakkdoor - REASON: - introduced - - MODIFIED: 01 Jul 2006 hammag - REASON: - added private member m_ServerSocket - and added corresponding parameter in constructor; - - MODIFIED: 24 Jul 2006 hammag - REASON: - changed member data prefix from "m_" to "m" in for homogeneity with the reste of TinNS code - - added private members data mQueueIn and mQueueOut - - added public members methods SendMessage(), GetMessage(), DeleteOutgoingMessages() and modified code accordingly - - removed old read/write member data, and added a compatibility mSendBufferMsg* member - - MODIFIED: 05 Aug 2006 hammag - REASON: - renamed "getLocalAddress()" to "getRemoteAddress()" as it is ... what it does ! - - TODO: - remove old read/write compatibility methods when not needed anymore - - see .cpp for current implementation limits - -*/ - -#ifndef CONNECTIONUDP_H -#define CONNECTIONUDP_H -#define MAX_RETENTION 20 // How many packets should be stored until we can delete them -#define SESSION_UDP_OFFSET 37917 -class ServerSocket; - -class ConnectionUDP -{ - private: - int mSockfd; - struct sockaddr_in mRemoteAddr; - -// u8 mReceiveBuffer[RECVBUFFERSIZE]; -// u8 mSendBuffer[SENDBUFFERSIZE]; - -// int mSendSize; -// int mRecvSize; -// int mRecvRewind; - - std::time_t mLastActive; - std::time_t mTimeOutValue; - - int mPort; - ServerSocket* mServerSocket; // pointer to the serversocket - - std::queue mQueueIn; - std::queue mQueueOut; - std::queue mVIPQueueOut; - - public: - ConnectionUDP(int sockfd, int port, int remoteadress, int remoteport, ServerSocket* server); - ~ConnectionUDP(); - - bool update(); - - int getPort() { return mPort; } - struct sockaddr_in getAddr() { return mRemoteAddr; } - int getSockfd() { return mSockfd; } - char* getRemoteAddress(); - - bool timeOut() const; - inline time_t getTimeOutValue() const { return mTimeOutValue; } - inline void setTimeOutValue(time_t Value) { mTimeOutValue = Value; } - - void SendMessage(PMessage* nMessage, bool nVIP = false); - inline int GetReadyMessagesNumber() { return mQueueIn.size(); } - PMessage* GetMessage(); // returns NULL if no message available - void DeleteOutgoingMessages(); - - -/********************* UDP MessageBuffer stuff *********************/ - private: - typedef std::map PMessageMap; - u16 mUDP_ID; - u16 mLastUDPID; - u16 mSessionID; - u16 mTransactionID; - PMessageMap UDPMessages; - PMessageMap::iterator GetMsgListBegin() { return UDPMessages.begin(); } - PMessageMap::iterator GetMsgListEnd() { return UDPMessages.end(); } - - void InsertUDPMessage(PMessage* nMsg); // Save message for possible OOO handling later - void UpdateMessageBuffer(); // Delete old packets, depending on define "MAX_RETENTION" - void ResetMessageBuffer(); // Done when UDP_ID gets set to zero - - public: - void ReSendUDPMessage(u16 nUDP_ID); // OOO happend, resend udp packet with UDP_ID nUDP_ID - inline u16 GetUDP_ID() const { return mUDP_ID; } - inline u16 GetSessionID() const { return SESSION_UDP_OFFSET + mUDP_ID ; } - inline u16 GetTransactionID() {return mTransactionID; } - void SetUDP_ID(u16 id); - inline void IncreaseUDP_ID() { SetUDP_ID(mUDP_ID + 1); } - inline void ResetTransactionID() { mTransactionID = 10170; } - - inline void IncreaseTransactionID(u8 nInc = 1) { mTransactionID += nInc; } - -/**************** Old I/F compatibility stuff ******************/ - private: - PMessage* mSendBufferMsg; - - public: - int getRecvBufferSize(); - int getSendBufferSize(); - void flushSendBuffer(); - // returns a pointer to the internal receive buffer - // Size contains the number of octets to read (or 0 to read entire buffer) - // number of octets available is returned in Size - const u8* read(int* size); - - int write(const void* data, int size); - int write(u8 data); - int write(u16 data); - int write(u32 data); - int write(float data); - int write(double data); - int write(const char* string); - - -}; - -#endif diff --git a/server/src/include/console.h b/server/src/include/console.h deleted file mode 100644 index 7a3fe87..0000000 --- a/server/src/include/console.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - console.h - - MODIFIED: 25 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 06 Jan 2006 Namikon - REASON: - Added Print() function for colored console output - - Added ColorText() to give selectable parts of an output another color - - Added LPrint() to print like eAthena does - Dont forget to use LClose() after using LPrint :) - MODIFIED: 26 Aug 2006 Hammag - REASON: - Added nLogFile as a constructor parameter, to make the class generic - -*/ -#ifndef CONSOLE_H -#define CONSOLE_H - -enum COLORS -{ - BLACK, - RED, - GREEN, - YELLOW, - BLUE, - MAGENTA, - CYAN, - WHITE -}; - -class PConsole -{ - private : - - std::ofstream mLogFile; - std::time_t mLastLogTime; - public : - PConsole(const char *nLogFile); - ~PConsole(); - void Print(const char *Fmt_, ...); - void Print(COLORS foreground, COLORS background, const char *Fmt_, ...); - char *ColorText(COLORS foreground, COLORS background, const char *Fmt, ...); - - void LPrint(const char *Fmt_, ...); - void LPrint(COLORS foreground, COLORS background, const char *Fmt_, ...); - void LClose(); - - void Update(); -}; - -#endif - diff --git a/server/src/include/external.h b/server/src/include/external.h index 8df57f6..8d78051 100644 --- a/server/src/include/external.h +++ b/server/src/include/external.h @@ -89,6 +89,6 @@ #include #include #include -#include // std::transform +#include #endif diff --git a/server/src/include/filesystem.h b/server/src/include/filesystem.h deleted file mode 100644 index 8215ed8..0000000 --- a/server/src/include/filesystem.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - filesystem.h - - MODIFIED: 25 Dec 2005 Namikon - REASON: - Added GPL - - MODIFIED: 08 Oct 2006 Hammag - REASON: - added ClearCache() methode to clear pak cache when .pak access is not used anymore - -*/ - -#ifndef FILESYSTEM_H -#define FILESYSTEM_H - -class PFile -{ - friend class PFileSystem; - private : - std::vector mBuffer; - u32 mDataSize; - u32 mDataOffs; - bool ReadData(std::FILE *F, u32 Size); - bool ReadUnpakData(std::FILE *F, u32 Size, u32 UncSize); - public : - PFile(); - ~PFile(); - inline bool Eof() { return mDataOffs>=mDataSize; } - int Read(void *Dest, u32 DestSize); - void Seek(u32 Offset); - std::string ReadString(); - inline u32 GetSize() const { return mDataSize; } -}; - -#pragma pack(push, 1) -//#pragma pack(1) -struct PPakHeader -{ - int mID; - int mNumFiles; -}; - -struct PPakFileHeader -{ - int mUnknown0; - int mOffset; - int mCompressedSize; - int mUncompressedSize; - int mNameLen; // including 0 - char *mFilename; -}; -#pragma pack(pop) - -class PFileSystem -{ - private : - typedef std::map PPakFileList; - typedef std::map PPakFiles; - PPakFiles mPaks; - PPakFileList *CachePak(const std::string &Pak, std::FILE *F); - public : - PFileSystem(); - ~PFileSystem(); - PFile *Open(const std::string &Package, const char *File, std::string BasePath); - bool Close(PFile *File); - void ClearCache(); -}; - -#endif - diff --git a/server/src/include/message.h b/server/src/include/message.h deleted file mode 100644 index 601a8e4..0000000 --- a/server/src/include/message.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - message.h - a data message & message pool class for tcp and udp connections (and maybe more later) - - Authors: - - Hammag - - MODIFIED: 15 jul 2006 Hammag - REASON: - Creation -*/ -#ifndef MESSAGE_H -#define MESSAGE_H - -#define MESSAGE_SIZES_LIST 32, 64, 128, 256, 512, 1024, 4096 -#define MESSAGE_POOL_INIT NULL, NULL, NULL, NULL, NULL, NULL, NULL -#define MESSAGE_POOL_COUNT_INIT 0, 0, 0, 0, 0, 0, 0 -#define MESSAGE_SIZES_NB 7 -#define MESSAGE_ALLOC_NB 4 - -struct PMsgData -{ - PMsgData* mNextMsgData; - u8* mBuffer; // NB: no need to manage buffer deletion atm, as they will stay until server end -}; -//NB: putting mPoolId & mMaxSize in PMsgData rather than PMessage would be cleaner, but would put more mem overhead on each buffer -// Doesn't matter much as PMsgData management is done only through PMessage - -class PMessage -{ - private: - static const u16 smMsgSizes[MESSAGE_SIZES_NB]; - static PMsgData* smMsgPoolHead[MESSAGE_SIZES_NB]; - static int smMsgPoolCount[MESSAGE_SIZES_NB]; - static int smMsgCount; //Used to trace unreleased messages with CheckMsgCount() - - u8 mPoolId; - u16 mMaxSize; - PMsgData* mData; - u16 mUsedSize; - u16 mNextByteOffset; - - void GetMsgBuffer(u16 nRequestedSize = 0); // the requested size is just a hint to avoid internal reaffectation of buffer - void ReleaseMsgBuffer(); - void CheckAndExtend(u16 nRequestedSize); // This is SIZE checked, not max OFFSET - inline void UpdateUsedSize() { if (mNextByteOffset > mUsedSize) mUsedSize = mNextByteOffset; } - - public: - static void CheckMsgCount(); //To be used in a place where no new message should remain between calls - - PMessage(u16 nRequestedSize = 0); // max size will be extended as needed in later write accesses (up to max configured size) - PMessage(PMessage& nMessage); // creates a (size optimized, offset reset) copy of nMessage - inline ~PMessage() { ReleaseMsgBuffer(); --smMsgCount; } - - void SetNextByteOffset(u16 nPos); - inline void IncreaseNextByteOffset(u16 nIncrement) { SetNextByteOffset(mNextByteOffset + nIncrement); } - inline void SetNextByteAtEnd() { mNextByteOffset = mUsedSize; } - inline u16 GetNextByteOffset() { return mNextByteOffset; } - void ForceSize(u16 nUsedSize); - inline u16 GetSize() { return mUsedSize; } - inline u16 GetMaxSize() { return mMaxSize; } - inline bool EOM() {return (mNextByteOffset >= mUsedSize);} // End Of Message - - // Writing methods - u8* GetMessageDataPointer(u16 nUsedSize); // extends buffer as needed by nUsedSize, and sets UsedSize at min nUsedSize - PMessage& Fill(u8 Value = 0, u16 StartOffset = 0, u16 FillSize = 0); // !!! Does NOT update UsedSize, fills only up to current maxSize - inline PMessage& Reset() { mNextByteOffset = mUsedSize = 0; return *this; } - inline PMessage& Clear() { return this->Fill(0).Reset(); } - PMessage& Write(const void* nData, u16 nLength); - PMessage& operator << (PMessage& nMessage); - PMessage& operator << (const char* nString); //for null terminated string ! Copies includes ending \0 - inline PMessage& operator << (std::string& nString) { return (*this << nString.c_str()); } - PMessage& operator << (u8 nU8); - inline PMessage& operator << (char nChar) { return (*this << (u8) nChar);} - PMessage& operator << (u16 nU16); - PMessage& operator << (u32 nU32); - PMessage& operator << (f32 nF32); - - // Mixt methods - - //The next 3 methods do NOT update NextByteOffset, but DO increase message size (UsedSize ans MaxSize) as needed by nOffset. - u8& U8Data(u16 nOffset); - u16& U16Data(u16 nOffset); - u32& U32Data(u16 nOffset); - f32& F32Data(u16 nOffset); - - // *** didn't managed to overload [] operator :-/ - inline u8& operator [] (u16 nOffset) { return U8Data(nOffset); } - //inline u16& operator [] (u16 nOffset) { return U16Data(nOffset); } - //u32& operator [] (u16 nOffset); - - // Really makes a different message instance, with all data copied (no data shared) - PMessage& operator = (PMessage& nMessage); - - // Reading methods - // ChunkNumber count from 0, return NULL for empty chunk (ie StartOffset is over UsedSize). NextByteOffset NOT updated - PMessage* GetChunk(u16 StartOffset, u16 ChunkSize, u16 ChunkNumber = 0); - - // Return pointer to the START of message data. - inline u8 const* GetMessageData() { return mData->mBuffer; } - - //Following methods do NOT extend message or Used, and return 0/empty string if over UsedSize - PMessage& operator >> (std::string& nString); //read up to null or EOM - PMessage& operator >> (u8& nU8); - inline PMessage& operator >> (char& nChar) { return (*this >> (u8&) nChar);} - PMessage& operator >> (u16& nU16); - PMessage& operator >> (u32& nU32); - PMessage& operator >> (f32& nF32); - - // info/debug methods - static void ListPools(); - static void DumpPools(); - void Dump(); - void DumpHead(char* nComment = ""); -}; - -#endif diff --git a/server/src/include/misc.h b/server/src/include/misc.h deleted file mode 100644 index bfe52e5..0000000 --- a/server/src/include/misc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - misc.h - - MODIFIED: 25 Dec 2005 Namikon - REASON: - Added GPL - MODIFIED: 07 Jan 2006 Namikon - REASON: - Added function to trim a string/char - MODIFIED: 27 Aug 2006 Hammag - REASON: - Merged misc function from all 3 servers - MODIFIED: 11 Dec 2006 Hammag - REASON: - Commented out GetSVNRev() that is not used anymore -*/ - -#ifndef MISC_H -#define MISC_H - -#ifdef _MSC_VER - #pragma once -#endif - -u32 IPStringToDWord(const char *IP); -char *IPlongToString(const u32 IP); -std::string GetAccessString(int level); -//void GetSVNRev(char *version); - -void PrintPacket(u8 *Packet, int PacketSize); - -// Cleanup for strings read from .def -void CleanUpString(std::string *nString); -void Trim(char *t); -void Trim(std::string *stString); -void RTrim(char *t); -void RTrim(std::string *stString); -void LTrim(char *t); -void LTrim(std::string *stString); -std::string &Ssprintf(const char *fmt, ...); - -u16 DistanceApprox(const u16 x1, const u16 y1, const u16 z1, const u16 x2, const u16 y2, const u16 z2); -f32 Distance(const f32 x1, const f32 y1, const f32 z1, const f32 x2, const f32 y2, const f32 z2); -f32 Distance(const f32 x1, const f32 y1, const f32 x2, const f32 y2); // 2D only version - -void InitRandom(u32 nInitialisationValue); -u16 GetRandom(u16 MaxVal, u16 MinVal = 0); // u16 value between MinVal and MaxVal (inclusive) with max range 32768 -f32 GetRandomFloat(); // f32 value between 0 and 1 -#endif - diff --git a/server/src/include/netcode.h b/server/src/include/netcode.h deleted file mode 100644 index 3817f8d..0000000 --- a/server/src/include/netcode.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -#ifndef NETCODE_H -#define NETCODE_H - -#include -#include -#include -#include "message.h" -#include "connection-tcp.h" -#include "connection-udp.h" -#include "serversocket.h" - -#endif - diff --git a/server/src/include/regex++.h b/server/src/include/regex++.h deleted file mode 100755 index cef75aa..0000000 --- a/server/src/include/regex++.h +++ /dev/null @@ -1,103 +0,0 @@ -// -// regex.h 1.0 Copyright (c) 2003 Peter Petersen (pp@on-time.de) -// Simple C++ wrapper for PCRE -// -// This source file is freeware. You may use it for any purpose without -// restriction except that the copyright notice as the top of this file as -// well as this paragraph may not be removed or altered. -// -// This header file declares class RegEx, a simple and small API wrapper -// for PCRE. -// -// RegEx::RegEx(const char * regex, int options = 0) -// -// The constructor's first parameter is the regular expression the -// created object shall implement. Optional parameter options can be -// any combination of PCRE options accepted by pcre_compile(). If -// compiling the regular expression fails, an error message string is -// thrown as an exception. -// -// RegEx::~RegEx() -// -// The destructor frees all resources held by the RegEx object. -// -// int RegEx::SubStrings(void) const -// -// Method SubStrings() returns the number of substrings defined by -// the regular expression. The match of the entire expression is also -// considered a substring, so the return value will always be >= 1. -// -// bool RegEx::Search(const char * subject, int len = -1, int options = 0) -// -// Method Search() applies the regular expression to parameter subject. -// Optional parameter len can be used to pass the subject's length to -// Search(). If not specified (or less than 0), strlen() is used -// internally to determine the length. Parameter options can contain -// any combination of options PCRE_ANCHORED, PCRE_NOTBOL, PCRE_NOTEOL. -// PCRE_NOTEMPTY. Search() returns true if a match is found. -// -// bool RegEx::SearchAgain(int options = 0) -// -// SearchAgain() again applies the regular expression to parameter -// subject last passed to a successful call of Search(). It returns -// true if a further match is found. Subsequent calls to SearchAgain() -// will find all matches in subject. Example: -// -// if (Pattern.Search(astring)) { -// do { -// printf("%s\n", Pattern.Match()); -// } while (Pattern.SearchAgain()); -// } -// -// Parameter options is interpreted as for method Search(). -// -// const char * RegEx::Match(int i = 1) -// -// Method Match() returns a pointer to the matched substring specified -// with parameter i. Match() may only be called after a successful -// call to Search() or SearchAgain() and applies to that last -// Search()/SearchAgain() call. Parameter i must be less than -// SubStrings(). Match(-1) returns the last searched subject. -// Match(0) returns the match of the complete regular expression. -// Match(1) returns $1, etc. -// -// See man pcre & man pcrepattern for more info - -#ifndef _REGEX_H -#define _REGEX_H - -#include - -#ifndef _PCRE_H -#include "pcre.h" -#endif - -class RegEx -{ - private: - pcre * re; - pcre_extra * pe; - int substrcount; - int * ovector; - const char * lastsubject; - int slen; - const char * * matchlist; - - inline void ClearMatchList(void) - { - if (matchlist) - pcre_free_substring_list(matchlist), - matchlist = NULL; - } - - public: - RegEx(const char * regex, int options = 0); - ~RegEx(); - inline int SubStrings(void) const { return substrcount; } - bool Search(const char * subject, int len = -1, int options = 0); - bool SearchAgain(int options = 0); - const char * Match(int i = 1); - -}; - -#endif // _REGEX_H diff --git a/server/src/include/serversocket.h b/server/src/include/serversocket.h deleted file mode 100644 index 161ad68..0000000 --- a/server/src/include/serversocket.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - Copyright (C) 2005 Linux Addicted Community - maintainer Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - serversocket.h - a serversocket class managing all connections (udp/tcp) - - Authors: - - bakkdoor - - MODIFIED: 09 Feb 2006 bakkdoor - REASON: - introduced - - MODIFIED: 01 Jul 2006 hammag - REASON: - added settimeout method - REASON: - added fd_set m_MainSetUDP private member - REASON: - added fd_set m_MainSetGlobal private member (=m_MainSetTCP + m_MainSetUDP) - - MODIFIED: 05 Aug 2006 hammag - REASON: - server UDP port is now taken in the range [gameserver_udpport_min, gameserver_udpport_max] set in config - - removed m_LastUDPPort which is not used anymore (might be used again in futur for faster free udp port allocation) - -*/ - -#ifndef SERVERSOCKET_H -#define SERVERSOCKET_H - -//class Connection; // removed... this class doesn't exist - -class ServerSocket -{ - private: - fd_set m_MainSetTCP; // master file descriptor list for tcp-connections - fd_set m_ReadSetTCP; // temp file descriptor list for select() for tcp-connections - fd_set m_MainSetUDP; // master file descriptor list for udp-connections - fd_set m_MainSetGlobal; // master file descriptor list for udp+tcp connections - - struct sockaddr_in m_ServerAddr; // server address - - int m_ListenerTCP; // listening socket descriptor - - int m_FdMaxTCP; // highest current file-descriptor (tcp) - int m_FdMaxUDP; // highest current file-descriptor (udp) - - bool m_bNewTCPConnection; - - //int m_LastUDPPort; // not used anymore - - struct timeval m_TimeOut; - - public: - ServerSocket(); - ~ServerSocket(); - - void settimeout(long timeout_sec, long timeout_usec); - bool open(int port); - void update(); - bool newConnection(); - ConnectionTCP* getTCPConnection(); - ConnectionUDP* getUDPConnection(long remoteadress, int remoteport); - - bool isDataAvailable(int sockfd); - - void delSocketFromSet(int sockfd); - - void closeServer(); -}; - -#endif diff --git a/server/src/include/svnrevision.h b/server/src/include/svnrevision.h index 5567e77..6111157 100644 --- a/server/src/include/svnrevision.h +++ b/server/src/include/svnrevision.h @@ -28,7 +28,7 @@ #ifndef SVN_REV_DEF #define SVN_REV_DEF -#define TINNS_SVN_REVISION "133" +#define TINNS_SVN_REVISION "AKIKO_CMAKE_R2" #endif diff --git a/server/src/info/CMakeLists.txt b/server/src/info/CMakeLists.txt new file mode 100644 index 0000000..ea7f230 --- /dev/null +++ b/server/src/info/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable (infoserver accounts.cpp client.cpp globals.cpp infoserver.cpp main.cpp server.cpp sql.cpp) + +target_link_libraries (infoserver common ${MYSQL_LIBRARY} ${PCRE_LIBRARY}) diff --git a/server/src/info/Makefile b/server/src/info/Makefile deleted file mode 100644 index 0055f21..0000000 --- a/server/src/info/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -B_TARGET := infoserver - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -#L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -O0 -ggdb - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lpthread -lm -lcrypt -L"/usr/lib/mysql" -lmysqlclient -lz -EXTRA_LINKFLAGS := -L"/usr/lib/mysql" -lmysqlclient -lz -lpcre - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/info/accounts.cpp b/server/src/info/accounts.cpp index 0a0e89b..f6789f0 100644 --- a/server/src/info/accounts.cpp +++ b/server/src/info/accounts.cpp @@ -32,14 +32,14 @@ REASON: - Changed FmtTxt() to sprintf(). It does... uhm, the same :D MODIFIED: 06 Jan 2006 Namikon REASON: - Removed the old XML loading functions, and changed the SQL ones to work with the Global Neopolis/TinNS Database - - Added SetBannedStatus() to ban/unban an account (use SetBannedStatus(0) to unban a player) + - Added SetBannedStatus() to ban/unban an account (use SetBannedStatus(0) to unban a player) MODIFIED: 03 Oct 2006 Hammag REASON: - Fixed an issue in PAccount::SetBannedStatus() that was causing the "can't update banned status" error message. MODIFIED: 27 May 2007 Hammag REASON: - Full changes for on-demand account access (no more memory-resident account data) - - - MODIFIED: 2 Feb 2008 Hammag + + + MODIFIED: 02 Feb 2008 Hammag REASON: - Correction of the account creation/update SQL query (thank to drhawk ;) ) */ @@ -72,7 +72,7 @@ bool PAccount::SetUsernameRegexFilter(const char* RegexStr) delete mUsernameRegexFilter; mUsernameRegexFilter = NULL; } - + if(RegexStr) { try { @@ -92,7 +92,7 @@ bool PAccount::SetPasswordRegexFilter(const char* RegexStr) delete mPasswordRegexFilter; mPasswordRegexFilter = NULL; } - + if(RegexStr) { try { @@ -125,7 +125,7 @@ bool PAccount::IsPasswordWellFormed(const char *Password) return true; } -/** Instance members **/ +/** Instance members **/ PAccount::PAccount() { mID = 0; @@ -158,7 +158,7 @@ bool PAccount::LoadFromQuery(char* query) { MYSQL_ROW row = 0; MYSQL_RES *result = 0; - + bool FinalResult = false; //result = MySQL->InfoResQuery(query); @@ -195,7 +195,7 @@ bool PAccount::LoadFromQuery(char* query) { Console->Print(YELLOW, BLACK, "Failed to load AccountData from SQL; Nothing to load..."); } - + //MySQL->FreeInfoSQLResult(result); MySQL->FreeSQLResult(result); return FinalResult; @@ -230,7 +230,7 @@ bool PAccount::SetPassword(const std::string &Password) bool PAccount::SetPasswordEncoded(const u8* PasswordData, int PassLen, const u8* Key) { char Pass[128]; - + if(DecodePassword(PasswordData, PassLen, Key, Pass)) { return SetPassword((std::string)Pass); @@ -292,7 +292,7 @@ bool PAccount::SetBannedUntilTime(std::time_t BannedUntil) bool PAccount::DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key, char* ClearPassword) { ClearPassword[0] = 0; - + if(PassLen < 128) { if(Key[0]>7) // TODO: >7 correct? @@ -317,7 +317,7 @@ bool PAccount::DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key bool PAccount::Authenticate(const u8* PasswordData, int PassLen, const u8 *Key) { char Pass[128]; - + if(DecodePassword(PasswordData, PassLen, Key, Pass)) { return Authenticate(Pass); @@ -336,7 +336,7 @@ bool PAccount::Authenticate(const char *Password) const Console->Print(RED, BLACK, "[Bug]: user %s doesn't exist and was not checked by code !", mName.c_str()); return false; } - + return(mPassword == Password); } @@ -359,20 +359,19 @@ bool PAccount::Save(bool CreateMode) char escPassword[256]; MySQL->EscapeString(mName.c_str(), escUsername, 256); MySQL->EscapeString(mPassword.c_str(), escPassword, 256); - + std::string Query; Query = CreateMode ? "INSERT INTO" : "UPDATE"; Query += " accounts SET "; Query += Ssprintf(" a_username='%s', a_password = '%s'", escUsername, escPassword); Query += Ssprintf(", a_priv = %d, a_status = %d, a_bandate = %d", mLevel, mStatus, mBannedUntil); if(!CreateMode ) - { - Query += Ssprintf(" a_lastused = NOW()"); + { + Query += Ssprintf(" a_lastused = NOW()"); Query += Ssprintf(" WHERE a_id = %d LIMIT 1", mID); - } - else - Query += Ssprintf(" a_creationdate = NOW()"); - + } + else + Query += Ssprintf(" a_creationdate = NOW()"); //if(MySQL->InfoQuery(Query.c_str())) if(MySQL->Query(Query.c_str())) @@ -388,7 +387,7 @@ bool PAccount::Save(bool CreateMode) std::string PAccount::GetBannedTime() const { const char* unit[5] = {"seconds", "minutes", "hours", "days", "weeks"}; - + std::time_t timediff = mBannedUntil - std::time(NULL); if(timediff <=0) { diff --git a/server/src/info/accounts.h b/server/src/info/accounts.h index f68c142..b779a74 100644 --- a/server/src/info/accounts.h +++ b/server/src/info/accounts.h @@ -32,6 +32,8 @@ REASON: - Added bool var for ingame debug outputs for administrators MODIFIED: 06 Jan 2005 Namikon REASON: - Added SetBannedStatus() to ban/unban an account (use SetBannedStatus(0) to unban a player) + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #ifndef ACCOUNTS_H @@ -41,7 +43,7 @@ #pragma once #endif -#include "regex++.h" +#include "common/regex++.h" /* 0 = unregistered user @@ -75,7 +77,7 @@ enum PAccountStatus PAS_ONLINE = 1, PAS_BANNED = 2 }; - + class PAccount { private : @@ -86,16 +88,16 @@ class PAccount a_password, a_priv, a_status, - a_bandate, - a_emailaddress, - a_creationdate, + a_bandate, + a_emailaddress, + a_creationdate, a_lastused }; - + // static members static RegEx* mUsernameRegexFilter; static RegEx* mPasswordRegexFilter; - + // instance members u32 mID; std::string mName; @@ -106,17 +108,17 @@ class PAccount bool LoadFromQuery(char* query); bool DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key, char* ClearPassword); - + public : PAccount(); PAccount(const u32 AccountId); PAccount(const char *Username); - + static bool SetUsernameRegexFilter(const char* RegexStr); static bool SetPasswordRegexFilter(const char* RegexStr); static bool IsUsernameWellFormed(const char *Username); static bool IsPasswordWellFormed(const char *Password); - + inline u32 GetID() const { return mID; } bool SetName(const std::string &Pass); inline const std::string &GetName() const { return mName; } @@ -134,7 +136,7 @@ class PAccount bool Authenticate(const u8* PasswordData, int PassLen, const u8 *Key); bool Authenticate(const char *Password) const; - + bool Create(); bool Save(bool CreateMode = false); diff --git a/server/src/info/configtemplate.h b/server/src/info/configtemplate.h index 6da034a..82a3ff4 100644 --- a/server/src/info/configtemplate.h +++ b/server/src/info/configtemplate.h @@ -44,6 +44,9 @@ const char* InfoConfigTemplate[][2] = { {"isc_connect_pw", "changeme"}, {"username_filter", "^[a-z][\\w\\-]{2,14}$"}, {"password_filter", "^[[:graph:]]{3,15}$"}, + {"sqlite_databasefile", "infoDB.s3db"}, + {"database_type", "sqlite"}, + // For futur use: // {"max_chars_per_account", "4"}, diff --git a/server/src/info/globals.cpp b/server/src/info/globals.cpp index c0a049e..2c026e1 100644 --- a/server/src/info/globals.cpp +++ b/server/src/info/globals.cpp @@ -19,19 +19,26 @@ 02110-1301, USA. */ + + /* - MODIFIED: 27 Aug 2006 Hammag - REASON: - Implemented shared Config class use and config template to load conf. - Added gameserver configtemplate.h include, - Added new required parameters to Config->LoadOptions() - - Added AdditionnalConfigChecks() local function, called after config loading - taken from inital infoserver's PConfig::VerifyValues + MODIFIED: 27 Aug 2006 Hammag + REASON: - Implemented shared Config class use and config template to load conf. + - Added gameserver configtemplate.h include, + - Added new required parameters to Config->LoadOptions() + - Added AdditionnalConfigChecks() local function, called after config loading + taken from inital infoserver's PConfig::VerifyValues + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ + #include "main.h" #include "configtemplate.h" -#include "version.h" +#include "include/version.h" + + const char ServerVersion[] = TINNS_INFO_VERSION; const char SVNRevision[] = TINNS_SVN_REVISION; diff --git a/server/src/info/infoserver.cpp b/server/src/info/infoserver.cpp index ebf6d2b..561e9b1 100644 --- a/server/src/info/infoserver.cpp +++ b/server/src/info/infoserver.cpp @@ -156,8 +156,8 @@ void PInfoServer::GSLiveCheck() if(it != Serverlist.end()) { strncpy(it->second.mName, row[s_name], MAX_SERVER_NAME_LENGTH); - it->second.mLanIp = IPStringToDWord(row[s_lanaddr]); - it->second.mWanIp = IPStringToDWord(row[s_wanaddr]); + it->second.mLanIp = IPStringToDWord(row[s_lanaddr]); + it->second.mWanIp = IPStringToDWord(row[s_wanaddr]); it->second.mPort = atoi(row[s_port]); it->second.mPlayers = atoi(row[s_players]); /* Prepared for future addon Servers by Accesslevel */ @@ -184,8 +184,8 @@ void PInfoServer::GSLiveCheck() { GameServers tmpServer; - strncpy(tmpServer.mName, row[s_name], MAX_SERVER_NAME_LENGTH); - tmpServer.mLanIp = IPStringToDWord(row[s_lanaddr]); + strncpy(tmpServer.mName, row[s_name], MAX_SERVER_NAME_LENGTH); + tmpServer.mLanIp = IPStringToDWord(row[s_lanaddr]); tmpServer.mWanIp = IPStringToDWord(row[s_wanaddr]); tmpServer.mLasttimestamp = atol(row[s_lastupdate]); tmpServer.mPlayers = atoi(row[s_players]); @@ -271,7 +271,7 @@ bool PInfoServer::HandleAuthenticate(PClient *Client, PInfoState *State, const u // -99: General fault. Contact admin ConnectionTCP *Socket = Client->getTCPConn(); PAccount* currentAccount = NULL; - + if(PacketSize > 20 && *(u16*)&Packet[3]==0x8084) { const u8 *Key = &Packet[5]; // password key @@ -294,7 +294,7 @@ bool PInfoServer::HandleAuthenticate(PClient *Client, PInfoState *State, const u { delete currentAccount; currentAccount = new PAccount(); - + if(!currentAccount->SetName(UserName)) // !!! len { returnval = -7; @@ -303,7 +303,7 @@ bool PInfoServer::HandleAuthenticate(PClient *Client, PInfoState *State, const u { returnval = returnval ? -8 : -6; } - + if(!returnval) { if(currentAccount->Create()) @@ -342,7 +342,7 @@ bool PInfoServer::HandleAuthenticate(PClient *Client, PInfoState *State, const u Client->setAccountID(currentAccount->GetID()); returnval = 0; } - + } else { @@ -350,7 +350,7 @@ bool PInfoServer::HandleAuthenticate(PClient *Client, PInfoState *State, const u } } } - + bool Failed = false; if(returnval == 0) { @@ -514,7 +514,7 @@ bool PInfoServer::HandleServerList(PClient *Client, const u8 *Packet, int Packet /* Prepared for future addon Servers by Accesslevel */ // if(accesslevel >= it->second.mMinLv) // { - /* ------------------------------------------------ */ + /* ------------------------------------------------ */ // Todo: Set correct lan/wan IP here! *(u32*)&SERVERLIST[0] = it->second.mLanIp; *(u16*)&SERVERLIST[4] = it->second.mPort; @@ -527,7 +527,7 @@ bool PInfoServer::HandleServerList(PClient *Client, const u8 *Packet, int Packet } else if(it->second.mOnline == false) { - Console->Print("Sending server name: %s ip: %s player: %d port: %d online: no", it->second.mName, IPlongToString(it->second.mLanIp), it->second.mPlayers, it->second.mPort); + Console->Print("Sending server name: %s ip: %s player: %d port: %d online: no", it->second.mName, IPlongToString(it->second.mLanIp), it->second.mPlayers, it->second.mPort); *(u16*)&SERVERLIST[11] = 0; } Socket->write(SERVERLIST, sizeof(SERVERLIST)); diff --git a/server/src/info/infoserver.h b/server/src/info/infoserver.h index 191dc0a..8cab98c 100644 --- a/server/src/info/infoserver.h +++ b/server/src/info/infoserver.h @@ -30,8 +30,8 @@ struct GameServers { char mName[MAX_SERVER_NAME_LENGTH]; - unsigned int mLanIp; - unsigned int mWanIp; + unsigned int mLanIp; + unsigned int mWanIp; short mPort; int mPlayers; bool mOnline; @@ -52,8 +52,8 @@ class PInfoServer s_wanaddr, s_port, s_players, - s_lastupdate, - s_lanaddr, + s_lastupdate, + s_lanaddr, s_timecheck // computed field, not in table ! }; //int mNumClients; diff --git a/server/src/info/main.h b/server/src/info/main.h index 360fe4c..ebceffa 100644 --- a/server/src/info/main.h +++ b/server/src/info/main.h @@ -20,14 +20,15 @@ */ + /* - MODIFIED: 6 Jul 2006 Hammag - REASON: - moved include "types.h" before include "../netcode/main.h" to enable compile - - MODIFIED: 27 Aug 2006 Hammag - REASON: - replaced MAX_INFO_CLIENTS define by config setting - - removed INFO_PORT define not used anymore - + MODIFIED: 06 Jul 2006 Hammag + REASON: - moved include "types.h" before include "../netcode/main.h" to enable compile + MODIFIED: 27 Aug 2006 Hammag + REASON: - replaced MAX_INFO_CLIENTS define by config setting + - removed INFO_PORT define not used anymore + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ @@ -37,25 +38,27 @@ //#include "version.h" //basic includes -#include "external.h" +#include "include/external.h" //tinns includes -#include "types.h" -#include "netcode.h" +#include "include/types.h" +#include "common/netcode.h" // MySQL Support -#include "mysql.h" +#ifdef MYSQL_INC_DIR +#include +#else +#include +#endif + #include "sql.h" -#include "console.h" -#include "config.h" +#include "common/console.h" +#include "common/config.h" #include "accounts.h" #include "client.h" #include "server.h" #include "infoserver.h" -#include "misc.h" +#include "common/misc.h" #include "globals.h" - -using namespace std; - #endif diff --git a/server/src/options.local.exemple b/server/src/options.local.exemple deleted file mode 100644 index 6497c01..0000000 --- a/server/src/options.local.exemple +++ /dev/null @@ -1,12 +0,0 @@ -# -# Local Makefile custom options -# not in SVN ! -# -# Copy this file as options.local to add you custom complation options -# so that you don't need to change the main Makefile -# You can also uncomment some of the lines below that fit you needs -# -#DO_DEBUG = y -#CXXFLAGS += -Werror -#CXXFLAGS += -march=native -#CXXFLAGS += -fstack-protector-all diff --git a/server/src/patch/CMakeLists.txt b/server/src/patch/CMakeLists.txt new file mode 100644 index 0000000..00db822 --- /dev/null +++ b/server/src/patch/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable (patchserver client.cpp globals.cpp patchserver.cpp main.cpp server.cpp) + +target_link_libraries (patchserver common ${PCRE_LIBRARY} ${ZLIB_LIBRARY}) diff --git a/server/src/patch/Makefile b/server/src/patch/Makefile deleted file mode 100644 index be767e4..0000000 --- a/server/src/patch/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -# TinNS per-directory Makefile -# -# Adapted by Hammag from the Makefile system for Linux kernel. -# -# 14 Sep 2000, Christoph Hellwig -# Rewritten to use lists instead of if-statements. -# - -###################################################### -# Target for this directory and its sub-dirs -###################################################### -# Case 1 : target is an executable named as defined -B_TARGET := patchserver - -# Case 2 : target is a TinNS lib name -# (use short name, as in -l linker option) -#L_TARGET := tinns - -# Case 3 (usual): objects shall be made available to the parent dir -# The following line will set that automatically -# (Should match dir name + .o suffix) -#O_TARGET := $(addsuffix .o,$(notdir $(shell /bin/pwd))) -# Manualy define this only if you need to force the compiled obj name -#O_TARGET := game.o - - -###################################################### -# Local flags -###################################################### -# local dir CXX Flags -#EXTRA_CXXFLAGS := -I/usr/include/mysql - -# per-object CXX Flags -#CXXFLAGS_funcdef2.o := -g - -# local dir Linker Flags (for intermediate .o linking) -#EXTRA_LDFLAGS := - -# any tinns Lib used (short name, as in -l linker option) -LINK_TINNSLIBS := tinns - -# local dir Linker Flags (for final executable linking) -#EXTRA_LINKFLAGS := -lrt -lpthread -lz -lm -lcrypt -EXTRA_LINKFLAGS := -lz -lpcre - - -##################################################### -# Subdirectories -##################################################### -#subdir-y := def -#subdir-$(CONFIG_GAMEMONKEY) += gamemonkey - - -##################################################### -#***************************************************# -# No further config should be needed after this line -#***************************************************# -ifdef TOPDIR - -# build list of objects ib loca ldir -obj-y := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) -# add final object from each subdir -obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) - -include $(TOPDIR)/Rules.make - -else #TOPDIR undef, Makefile called from non-top dir - -# Memorize the first calling dir in case we wanted to -# lauch local actions from top Makefile - ifndef FIRSTDIR - FIRSTDIR :=$(CURDIR) - export FIRSTDIR - endif - -uptoparent : - $(MAKE) -C .. $(MAKECMDGOALS) - -.DEFAULT : - $(MAKE) -C .. $(MAKECMDGOALS) - -endif #TOPDIR - diff --git a/server/src/patch/globals.cpp b/server/src/patch/globals.cpp index b185141..94b5ade 100644 --- a/server/src/patch/globals.cpp +++ b/server/src/patch/globals.cpp @@ -19,21 +19,27 @@ 02110-1301, USA. */ + + /* + MODIFIED: 27 Aug 2006 Hammag + REASON: - Implemented shared Config class use and config template to load conf. + - Added gameserver configtemplate.h include, + - Added new required parameters to Config->LoadOptions() + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem - MODIFIED: 27 Aug 2006 Hammag - REASON: - Implemented shared Config class use and config template to load conf. - Added gameserver configtemplate.h include, - Added new required parameters to Config->LoadOptions() - - TODO: - Get logfile name from config file - + TODO: - Get logfile name from config file */ + #include "main.h" + #include "configtemplate.h" -#include "version.h" +#include "include/version.h" + + const char ServerVersion[] = TINNS_PATCH_VERSION; const char SVNRevision[] = TINNS_SVN_REVISION; diff --git a/server/src/patch/main.h b/server/src/patch/main.h index ce0f6bc..2628a17 100644 --- a/server/src/patch/main.h +++ b/server/src/patch/main.h @@ -21,8 +21,10 @@ /* - MODIFIED: 6 Jul 2006 Hammag - REASON: - moved include "types.h" before include "../netcode/main.h" to permit compile + MODIFIED: 06 Jul 2006 Hammag + REASON: - moved include "types.h" before include "../netcode/main.h" to permit compile + MODIFIED: 10 Jun 2009 Akiko + REASON: - adjusted includes for new buildsystem */ #ifndef MAIN_H @@ -34,22 +36,20 @@ #define MAX_PATCH_CLIENTS 50 //basic includes -#include "external.h" +#include "include/external.h" //tinns includes -#include "types.h" -#include "netcode.h" +#include "include/types.h" +#include "common/netcode.h" -#include "console.h" -#include "config.h" -#include "filesystem.h" +#include "common/console.h" +#include "common/config.h" +#include "common/filesystem.h" #include "client.h" #include "server.h" #include "patchserver.h" -#include "misc.h" +#include "common/misc.h" #include "globals.h" -using namespace std; - #endif diff --git a/server/src/patch/patchserver.cpp b/server/src/patch/patchserver.cpp index d4915f1..01c0e86 100644 --- a/server/src/patch/patchserver.cpp +++ b/server/src/patch/patchserver.cpp @@ -400,7 +400,7 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const u32 PPatchServer::StartPatch(PPatchState *State) { - /*std::*/stringstream path; + std::stringstream path; char patchname[13]; snprintf(patchname, 13, "sp%06d.pat", State->mCurrentPatch); path << Config->GetOption("patches_path") << "/" << patchname << '\0'; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..5147b1b --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory (pak_decompress) +add_subdirectory (vfs_viewer) diff --git a/tools/getsvnrev/Makefile b/tools/getsvnrev/Makefile deleted file mode 100644 index 84418db..0000000 --- a/tools/getsvnrev/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CC=gcc -CXX=g++ -CFLAGS=-pedantic -Wall -CXX_FLAGS=$(CFLAGS) - -SOURCES=$(wildcard *.cpp) -OBJECTS=$(patsubst %.cpp,%.o,$(SOURCES)) - -%.o:%.cpp - $(CXX) $(CXX_FLAGS) -c $< -o $@ - -all: getsvnrev - -getsvnrev: $(OBJECTS) - $(CXX) -o $@ $(OBJECTS) -lstdc++ -lz - -clean: - -rm $(OBJECTS) getsvnrev - diff --git a/tools/getsvnrev/getsvnrev.cpp b/tools/getsvnrev/getsvnrev.cpp deleted file mode 100644 index 6dcd144..0000000 --- a/tools/getsvnrev/getsvnrev.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - TinNS (TinNS is not a Neocron Server) - pak_decompress - pak file decompression tool - Copyright (C) 2005 Akiko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - - - -/* - getsvnrev - a simple tool to read out actual SVN revision-number - - Why? - Well for example my server doesnt have any SVN libs installed. Therefore, - the getsvnrev script fails. I need this little tool, and maybe someone else too ^^ - - Usage: - call getsvnrev either without parameters or with the directory you - want to know the SVN revision. - - Console output: - If no .svn directory is found, the tool returns 0. - Otherwise it will return the SVN revision of the target dir - - MODIFIED: 22 Dec 2006 Namikon - REASON: - started this tool - - TODO: - - Better way to get SVN rev than this (2nd number in file) -*/ - - -#include -#include - -using namespace std; - -int main(int argc, char **argv) -{ - string targetdir; - FILE *f; - - if(argc == 2) - { - int i = 0; - while(argv[1][i] != '\0') { i++; }; - if(argv[1][i-1] == '/') - { - targetdir = strcat(argv[1], ".svn/entries"); - } - else - { - targetdir = strcat(argv[1], "/.svn/entries"); - } - } - else - { - targetdir = ".svn/entries"; - } - - - if ((f = fopen(targetdir.c_str(), "r")) != NULL) { - char line[255]; - int rev; - bool firstnrfound = false; - - do - { - fgets (line, 255, f); - rev = atoi(line); - if(rev > 0 && firstnrfound == false) - { - firstnrfound = true; - rev = 0; - } - } while (rev == 0); - - fclose(f); - - cout << rev << endl; - } - else - { - cout << "0" << endl; - } - return(0); -} diff --git a/tools/pak_decompress/CMakeLists.txt b/tools/pak_decompress/CMakeLists.txt new file mode 100644 index 0000000..6ebd346 --- /dev/null +++ b/tools/pak_decompress/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable (pak_decompress pak_decompress.cpp) + +target_link_libraries (pak_decompress ${ZLIB_LIBRARY}) diff --git a/tools/pak_decompress/Makefile b/tools/pak_decompress/Makefile deleted file mode 100644 index b6fcf0d..0000000 --- a/tools/pak_decompress/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -CC=gcc -CXX=g++ -CFLAGS=-pedantic -Wall -CXX_FLAGS=$(CFLAGS) - -SOURCES=$(wildcard *.cpp) -OBJECTS=$(patsubst %.cpp,%.o,$(SOURCES)) - -%.o:%.cpp - $(CXX) $(CXX_FLAGS) -c $< -o $@ - -all: pak_decompress - -pak_decompress: $(OBJECTS) - $(CXX) -o $@ $(OBJECTS) -lstdc++ -lz - -clean: - -rm $(OBJECTS) pak_decompress diff --git a/tools/pak_decompress/pak_decompress.cpp b/tools/pak_decompress/pak_decompress.cpp index 395b20b..d5e7738 100644 --- a/tools/pak_decompress/pak_decompress.cpp +++ b/tools/pak_decompress/pak_decompress.cpp @@ -38,23 +38,22 @@ MODIFIED: 21 Dec 2006 Namikon REASON: - Added errorcheck for in/output file - Added check for NC and normal zLib files + MODIFIED: 15 Jun 2009 Akiko + REASON: - fixed warning TODO: - time needed for decompression - ideas for a compression tool */ - -#include -#include #include +#include +#include +#include +#include #include -#include -#include #define CHUNK 262144 -using namespace std; - int inf(FILE *source, FILE *dest, bool details) { int ret; @@ -77,7 +76,7 @@ int inf(FILE *source, FILE *dest, bool details) check = fgetc(source); if(check == 'x') { - if(details == true) cout << "Found zLibfile" << endl; + if(details == true) std::cout << "Found zLibfile" << std::endl; fseek(source, 0, SEEK_SET); } else @@ -86,12 +85,12 @@ int inf(FILE *source, FILE *dest, bool details) check = fgetc(source); if(check == 'x') { - if(details == true) cout << "Found Neocron file" << endl; + if(details == true) std::cout << "Found Neocron file" << std::endl; fseek(source, 16, SEEK_SET); } else { - if(details == true) cout << "Error: No compatible file!" << endl; + if(details == true) std::cout << "Error: No compatible file!" << std::endl; return -3; } } @@ -170,7 +169,7 @@ int main(int argc, char **argv) { int ret; long inSize; long outSize; - bool details; + bool details = false; FILE *inFile; FILE *outFile; std::string src; @@ -185,7 +184,7 @@ int main(int argc, char **argv) { dst = argv[2]; } else { - cout << "Usage: pak_decompress source " << std::endl; + std::cout << "Usage: pak_decompress source " << std::endl; return(0); } if(argc == 4) @@ -193,20 +192,18 @@ int main(int argc, char **argv) { if(argv[3][0] == '1') details = true; else if(argv[3][0] == '0') details = false; } - else - details = false; inFile = fopen(src.c_str(), "rb"); outFile = fopen(dst.c_str(), "wb"); if(inFile == NULL) { - cout << "Cannot open InFile" << endl; + std::cout << "Cannot open InFile" << std::endl; return(-1); } if(outFile == NULL) { - cout << "Cannot open OutFile" << endl; + std::cout << "Cannot open OutFile" << std::endl; return(-2); } ret = inf(inFile, outFile, details); @@ -222,17 +219,17 @@ int main(int argc, char **argv) { if(ret == Z_OK && details == true) { - cout << "bytes read: " << inSize << std::endl; - cout << "bytes written: " << outSize << std::endl; - cout << "compression ratio: " << (100-((float)inSize/(float)outSize*100)) << "%" << std::endl; + std::cout << "bytes read: " << inSize << std::endl; + std::cout << "bytes written: " << outSize << std::endl; + std::cout << "compression ratio: " << (100-((float)inSize/(float)outSize*100)) << "%" << std::endl; } else if(ret == Z_OK && details == false) { - cout << "[OK] " << src.c_str() << endl; + std::cout << "[OK] " << src.c_str() << std::endl; } else if(ret != Z_OK && details == false) { - cout << "[ERROR] " << src.c_str() << endl; + std::cout << "[ERROR] " << src.c_str() << std::endl; } return(ret); diff --git a/tools/vfs_viewer/CMakeLists.txt b/tools/vfs_viewer/CMakeLists.txt new file mode 100644 index 0000000..b39b75c --- /dev/null +++ b/tools/vfs_viewer/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable (vfs_viewer vfs_viewer.c) + +target_link_libraries (vfs_viewer ${ZLIB_LIBRARY}) diff --git a/tools/vfs_viewer/Makefile b/tools/vfs_viewer/Makefile deleted file mode 100644 index bd370f0..0000000 --- a/tools/vfs_viewer/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -CC=cc -CXX=g++ -CFLAGS=-W -Wall -O2 -CXX_FLAGS=$(CFLAGS) - -SOURCES=$(wildcard *.c) -OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) - -%.o:%.c - $(CXX) $(CXX_FLAGS) -c $< -o $@ - -all: vfs_viewer - -vfs_viewer: $(OBJECTS) - $(CXX) -o $@ $(OBJECTS) - -clean: - -rm $(OBJECTS) vfs_viewer