- supermassive buildsystem restructure, includes restructure, types fixes and code...
authorAkiko <akiko@linux-addicted.net>
Tue, 19 May 2015 09:07:56 +0000 (11:07 +0200)
committerAkiko <akiko@linux-addicted.net>
Tue, 19 May 2015 09:07:56 +0000 (11:07 +0200)
  with gcc 5.1)

576 files changed:
CMakeLists.txt
Docs/ISC Example.txt [moved from docs/ISC Example.txt with 100% similarity]
Docs/ISC ProtDef.txt [moved from docs/ISC ProtDef.txt with 100% similarity]
Docs/NPCs.txt [moved from docs/NPCs.txt with 100% similarity]
Docs/Neocron1.ChatProtocol.pdf [moved from docs/Neocron1.ChatProtocol.pdf with 100% similarity]
Docs/Neocron1.MainProtocol.pdf [moved from docs/Neocron1.MainProtocol.pdf with 100% similarity]
Docs/TinNS.QuickInstallation.pdf [moved from docs/TinNS.QuickInstallation.pdf with 100% similarity]
Docs/current_test_commands.txt [moved from docs/current_test_commands.txt with 100% similarity]
Docs/how_npc_scripts_work.txt [moved from docs/how_npc_scripts_work.txt with 100% similarity]
Docs/itemtypes.txt [moved from docs/itemtypes.txt with 100% similarity]
Docs/subversion_logs_until_first_git_version.txt [moved from docs/subversion_logs_until_first_git_version.txt with 100% similarity]
LICENSE.txt
Scripts/CodeCounter.sh [new file with mode: 0755]
TinNS/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/Common/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/Common/Config.cxx [moved from server/src/common/config.cpp with 58% similarity]
TinNS/Source/Common/Config.hxx [moved from server/src/common/config.h with 56% similarity]
TinNS/Source/Common/Console.cxx [moved from server/src/common/console.cpp with 95% similarity]
TinNS/Source/Common/Console.hxx [moved from server/src/common/console.h with 90% similarity]
TinNS/Source/Common/FileSystem.cxx [moved from server/src/common/filesystem.cpp with 95% similarity]
TinNS/Source/Common/FileSystem.hxx [moved from server/src/common/filesystem.h with 91% similarity]
TinNS/Source/Common/Includes.hxx [new file with mode: 0644]
TinNS/Source/Common/Message.cxx [moved from server/src/common/message.cpp with 99% similarity]
TinNS/Source/Common/Message.hxx [new file with mode: 0644]
TinNS/Source/Common/Misc.cxx [moved from server/src/common/misc.cpp with 94% similarity]
TinNS/Source/Common/Misc.hxx [moved from server/src/common/misc.h with 87% similarity]
TinNS/Source/Common/Mutex.hxx [new file with mode: 0644]
TinNS/Source/Common/Netcode.cxx [moved from server/src/common/netcode.cpp with 93% similarity]
TinNS/Source/Common/Netcode.hxx [moved from server/src/common/netcode.h with 98% similarity]
TinNS/Source/Common/RegEx.cxx [moved from server/src/common/regex++.cpp with 97% similarity]
TinNS/Source/Common/RegEx.hxx [new file with mode: 0644]
TinNS/Source/Common/SVNrevision.hxx [new file with mode: 0644]
TinNS/Source/Common/Semaphore.hxx [new file with mode: 0644]
TinNS/Source/Common/Thread.hxx [moved from server/src/include/tinns_thread.h with 55% similarity]
TinNS/Source/Common/Version.hxx [new file with mode: 0644]
TinNS/Source/DevelopmentTools/CMakeLists.txt [moved from server/src/dev-tools/CMakeLists.txt with 100% similarity]
TinNS/Source/DevelopmentTools/cleandepfile.c [moved from server/src/dev-tools/cleandepfile.c with 100% similarity]
TinNS/Source/DevelopmentTools/getsvnrev.cpp [moved from server/src/dev-tools/getsvnrev.cpp with 100% similarity]
TinNS/Source/DevelopmentTools/make-bin-tarball [moved from server/src/dev-tools/make-bin-tarball with 100% similarity]
TinNS/Source/DevelopmentTools/make-src-tarball [moved from server/src/dev-tools/make-src-tarball with 100% similarity]
TinNS/Source/GameServer/Accounts.cxx [moved from server/src/game/accounts.cpp with 60% similarity]
TinNS/Source/GameServer/Accounts.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Appartements.cxx [moved from server/src/game/appartements.cpp with 75% similarity]
TinNS/Source/GameServer/Appartements.hxx [new file with mode: 0644]
TinNS/Source/GameServer/BuddyList.cxx [moved from server/src/game/buddylist.cpp with 66% similarity]
TinNS/Source/GameServer/BuddyList.hxx [new file with mode: 0644]
TinNS/Source/GameServer/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/GameServer/Chars.cxx [moved from server/src/game/chars.cpp with 82% similarity]
TinNS/Source/GameServer/Chars.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Chat.cxx [moved from server/src/game/chat.cpp with 85% similarity]
TinNS/Source/GameServer/Chat.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Client.cxx [moved from server/src/game/client.cpp with 73% similarity]
TinNS/Source/GameServer/Client.hxx [new file with mode: 0644]
TinNS/Source/GameServer/ClientManager.cxx [moved from server/src/game/clientmanager.cpp with 68% similarity]
TinNS/Source/GameServer/ClientManager.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Commands.cxx [moved from server/src/game/commands.cpp with 88% similarity]
TinNS/Source/GameServer/Commands.hxx [moved from server/src/game/include/commands.h with 73% similarity]
TinNS/Source/GameServer/ConfigTemplate.hxx [moved from server/src/game/configtemplate.h with 75% similarity]
TinNS/Source/GameServer/Container.cxx [moved from server/src/game/container.cpp with 79% similarity]
TinNS/Source/GameServer/Container.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Includes.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/MessageDecoder.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/MessageDecoder.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x08.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x08.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x13.cxx [moved from server/src/game/decoder/udp_0x13.cpp with 72% similarity]
TinNS/Source/GameServer/Decoder/Udp0x13.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x1f.cxx [moved from server/src/game/decoder/udp_0x1f.cpp with 71% similarity]
TinNS/Source/GameServer/Decoder/Udp0x1f.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x22.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x22.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x2b.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/Udp0x2b.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpAnalyser.cxx [moved from server/src/game/decoder/udpanalyser.cpp with 60% similarity]
TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpAppartment.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpAppartment.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpCharMove.cxx [moved from server/src/game/decoder/udp_charmove.cpp with 83% similarity]
TinNS/Source/GameServer/Decoder/UdpCharMove.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpChat.cxx [moved from server/src/game/decoder/udp_chat.cpp with 79% similarity]
TinNS/Source/GameServer/Decoder/UdpChat.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpDeathRespawn.cxx [moved from server/src/game/decoder/udp_deathrespawn.cpp with 53% similarity]
TinNS/Source/GameServer/Decoder/UdpDeathRespawn.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpEntityPositionRequest.cxx [moved from server/src/game/decoder/udp_entityposreq.cpp with 61% similarity]
TinNS/Source/GameServer/Decoder/UdpEntityPositionRequest.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpHack.cxx [moved from server/src/game/decoder/udp_hack.cpp with 72% similarity]
TinNS/Source/GameServer/Decoder/UdpHack.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpHeldItemAction.cxx [moved from server/src/game/decoder/udp_helditemaction.cpp with 83% similarity]
TinNS/Source/GameServer/Decoder/UdpHeldItemAction.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpItemManualReload.cxx [moved from server/src/game/decoder/udp_itemmanualreload.cpp with 60% similarity]
TinNS/Source/GameServer/Decoder/UdpItemManualReload.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpItemMove.cxx [moved from server/src/game/decoder/udp_itemmove.cpp with 82% similarity]
TinNS/Source/GameServer/Decoder/UdpItemMove.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpItemUse.cxx [moved from server/src/game/decoder/udp_itemuse.cpp with 56% similarity]
TinNS/Source/GameServer/Decoder/UdpItemUse.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpKillSelf.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpKillSelf.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpMultiPart.cxx [moved from server/src/game/decoder/udp_multipart.cpp with 54% similarity]
TinNS/Source/GameServer/Decoder/UdpMultiPart.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpNpcDialog.cxx [moved from server/src/game/decoder/udp_npcdialog.cpp with 79% similarity]
TinNS/Source/GameServer/Decoder/UdpNpcDialog.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpOOO.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpOOO.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpOutfitter.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpOutfitter.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpPacket0.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpPacket0.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpPing.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpPing.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpPopupResponse.cxx [moved from server/src/game/decoder/udp_popupresponse.cpp with 72% similarity]
TinNS/Source/GameServer/Decoder/UdpPopupResponse.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpPvpTrade.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpPvpTrade.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpQuickAccessBelt.cxx [moved from server/src/game/decoder/udp_quickaccessbelt.cpp with 74% similarity]
TinNS/Source/GameServer/Decoder/UdpQuickAccessBelt.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpRequestInfo.cxx [moved from server/src/game/decoder/udp_reqinfo.cpp with 84% similarity]
TinNS/Source/GameServer/Decoder/UdpRequestInfo.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpSubSkill.cxx [moved from server/src/game/decoder/udp_subskill.cpp with 60% similarity]
TinNS/Source/GameServer/Decoder/UdpSubSkill.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpSync.cxx [moved from server/src/game/decoder/udp_sync.cpp with 75% similarity]
TinNS/Source/GameServer/Decoder/UdpSync.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpTerminal.cxx [moved from server/src/game/decoder/udp_terminal.cpp with 81% similarity]
TinNS/Source/GameServer/Decoder/UdpTerminal.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpUseObject.cxx [moved from server/src/game/decoder/udp_useobject.cpp with 89% similarity]
TinNS/Source/GameServer/Decoder/UdpUseObject.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpVehicle.cxx [moved from server/src/game/decoder/udp_vhc.cpp with 82% similarity]
TinNS/Source/GameServer/Decoder/UdpVehicle.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpWorldIdInfo.cxx [moved from server/src/game/decoder/udp_worldIDinfo.cpp with 60% similarity]
TinNS/Source/GameServer/Decoder/UdpWorldIdInfo.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Decoder/UdpZoning.cxx [moved from server/src/game/decoder/udp_zoning.cpp with 79% similarity]
TinNS/Source/GameServer/Decoder/UdpZoning.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/ActionMod.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/ActionMod.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Ammo.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Ammo.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/AppartementPlaces.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/AppartementPlaces.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Appartements.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Appartements.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/BluePrintPieces.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/BluePrintPieces.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/CharacterActions.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/CharacterActions.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/CharacterKinds.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/CharacterKinds.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Characters.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Characters.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Damage.cxx [moved from server/src/game/def/def_damage.cpp with 62% similarity]
TinNS/Source/GameServer/Definitions/Damage.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Definition.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Definition.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Drugs.cxx [moved from server/src/game/def/def_drugs.cpp with 54% similarity]
TinNS/Source/GameServer/Definitions/Drugs.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Factions.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Factions.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/GameDefinitions.cxx [moved from server/src/game/def/gamedefs.cpp with 63% similarity]
TinNS/Source/GameServer/Definitions/GameDefinitions.hxx [moved from server/src/game/include/gamedefs.h with 79% similarity]
TinNS/Source/GameServer/Definitions/Hack.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Hack.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Implants.cxx [moved from server/src/game/def/def_implants.cpp with 52% similarity]
TinNS/Source/GameServer/Definitions/Implants.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Includes.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/ItemContainer.cxx [moved from server/src/game/def/def_itemcontainer.cpp with 62% similarity]
TinNS/Source/GameServer/Definitions/ItemContainer.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/ItemMod.cxx [moved from server/src/game/def/def_itemmod.cpp with 56% similarity]
TinNS/Source/GameServer/Definitions/ItemMod.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/ItemRes.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/ItemRes.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Items.cxx [moved from server/src/game/def/def_items.cpp with 78% similarity]
TinNS/Source/GameServer/Definitions/Items.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Map.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Mission.cxx [moved from server/src/game/def/def_mission.cpp with 55% similarity]
TinNS/Source/GameServer/Definitions/Mission.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Npc.cxx [moved from server/src/game/def/def_npc.cpp with 57% similarity]
TinNS/Source/GameServer/Definitions/Npc.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/NpcArmor.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/NpcArmor.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/NpcGroupSpawn.cxx [moved from server/src/game/def/def_npcgroupspawn.cpp with 62% similarity]
TinNS/Source/GameServer/Definitions/NpcGroupSpawn.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Outposts.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Outposts.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Parser.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Parser.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Recycles.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Recycles.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Respawn.cxx [moved from server/src/game/def/def_respawn.cpp with 50% similarity]
TinNS/Source/GameServer/Definitions/Respawn.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Scripts.cxx [moved from server/src/game/def/def_scripts.cpp with 74% similarity]
TinNS/Source/GameServer/Definitions/Scripts.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Shots.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Shots.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Skills.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Skills.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/SubSkills.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/SubSkills.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Trader.cxx [moved from server/src/game/def/def_trader.cpp with 59% similarity]
TinNS/Source/GameServer/Definitions/Trader.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/VehicleSits.cxx [moved from server/src/game/def/def_vehiclesits.cpp with 51% similarity]
TinNS/Source/GameServer/Definitions/VehicleSits.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Vehicles.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Vehicles.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Weapons.cxx [moved from server/src/game/def/def_weapons.cpp with 78% similarity]
TinNS/Source/GameServer/Definitions/Weapons.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Weather.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Weather.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/WorldDatParser.cxx [moved from server/src/game/def/world_datparser.cpp with 79% similarity]
TinNS/Source/GameServer/Definitions/WorldDatParser.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/WorldDatStruct.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/WorldFile.cxx [moved from server/src/game/def/def_worldfile.cpp with 50% similarity]
TinNS/Source/GameServer/Definitions/WorldFile.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/WorldModels.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/WorldModels.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Definitions/Worlds.cxx [moved from server/src/game/def/def_worlds.cpp with 56% similarity]
TinNS/Source/GameServer/Definitions/Worlds.hxx [new file with mode: 0644]
TinNS/Source/GameServer/DoorTemplate.cxx [new file with mode: 0644]
TinNS/Source/GameServer/DoorTemplate.hxx [new file with mode: 0644]
TinNS/Source/GameServer/FurnitureTemplate.cxx [new file with mode: 0644]
TinNS/Source/GameServer/FurnitureTemplate.hxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/Ban.cxx [moved from server/src/game/gamecommands/ban.cpp with 66% similarity]
TinNS/Source/GameServer/GameCommands/Brightness.cxx [moved from server/src/game/gamecommands/brightness.cpp with 50% similarity]
TinNS/Source/GameServer/GameCommands/Broadcast.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/Color.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/Debug.cxx [moved from server/src/game/gamecommands/debug.cpp with 64% similarity]
TinNS/Source/GameServer/GameCommands/Effect.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/GiveMoney.cxx [moved from server/src/game/gamecommands/givemoney.cpp with 62% similarity]
TinNS/Source/GameServer/GameCommands/H.cxx [moved from server/src/game/gamecommands/h.cpp with 59% similarity]
TinNS/Source/GameServer/GameCommands/Info.cxx [moved from server/src/game/gamecommands/info.cpp with 78% similarity]
TinNS/Source/GameServer/GameCommands/Jail.cxx [moved from server/src/game/gamecommands/jail.cpp with 68% similarity]
TinNS/Source/GameServer/GameCommands/Kick.cxx [moved from server/src/game/gamecommands/kick.cpp with 67% similarity]
TinNS/Source/GameServer/GameCommands/ListBans.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/Npc.cxx [moved from server/src/game/gamecommands/npc.cpp with 89% similarity]
TinNS/Source/GameServer/GameCommands/NpcShop.cxx [moved from server/src/game/gamecommands/npc_shop.cpp with 89% similarity]
TinNS/Source/GameServer/GameCommands/Online.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/README [moved from server/src/game/gamecommands/README with 100% similarity]
TinNS/Source/GameServer/GameCommands/RawF.cxx [moved from server/src/game/gamecommands/rawf.cpp with 69% similarity]
TinNS/Source/GameServer/GameCommands/Recall.cxx [moved from server/src/game/gamecommands/recall.cpp with 71% similarity]
TinNS/Source/GameServer/GameCommands/Remove.cxx [moved from server/src/game/gamecommands/remove.cpp with 61% similarity]
TinNS/Source/GameServer/GameCommands/SetLevel.cxx [moved from server/src/game/gamecommands/setlevel.cpp with 64% similarity]
TinNS/Source/GameServer/GameCommands/SetMainSkill.cxx [moved from server/src/game/gamecommands/setmainskill.cpp with 71% similarity]
TinNS/Source/GameServer/GameCommands/SetSubSkill.cxx [moved from server/src/game/gamecommands/setsubskill.cpp with 67% similarity]
TinNS/Source/GameServer/GameCommands/SetTime.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/Shun.cxx [moved from server/src/game/gamecommands/shun.cpp with 61% similarity]
TinNS/Source/GameServer/GameCommands/Skin.cxx [moved from server/src/game/gamecommands/skin.cpp with 74% similarity]
TinNS/Source/GameServer/GameCommands/SpawnActor.cxx [moved from server/src/game/gamecommands/spawnactor.cpp with 64% similarity]
TinNS/Source/GameServer/GameCommands/Speed.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/T.cxx [moved from server/src/game/gamecommands/t.cpp with 60% similarity]
TinNS/Source/GameServer/GameCommands/TakeMoney.cxx [moved from server/src/game/gamecommands/takemoney.cpp with 65% similarity]
TinNS/Source/GameServer/GameCommands/Teleport.cxx [moved from server/src/game/gamecommands/teleport.cpp with 72% similarity]
TinNS/Source/GameServer/GameCommands/Test.cxx [moved from server/src/game/gamecommands/test.cpp with 57% similarity]
TinNS/Source/GameServer/GameCommands/UnBan.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/UnJail.cxx [moved from server/src/game/gamecommands/unjail.cpp with 68% similarity]
TinNS/Source/GameServer/GameCommands/UnShun.cxx [moved from server/src/game/gamecommands/unshun.cpp with 61% similarity]
TinNS/Source/GameServer/GameCommands/Uptime.cxx [moved from server/src/game/gamecommands/uptime.cpp with 72% similarity]
TinNS/Source/GameServer/GameCommands/V.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/Version.cxx [new file with mode: 0644]
TinNS/Source/GameServer/GameCommands/Warp.cxx [moved from server/src/game/gamecommands/warp.cpp with 63% similarity]
TinNS/Source/GameServer/GameCommands/WarpTo.cxx [moved from server/src/game/gamecommands/warpto.cpp with 69% similarity]
TinNS/Source/GameServer/GameCommands/Weather.cxx [moved from server/src/game/gamecommands/weather.cpp with 57% similarity]
TinNS/Source/GameServer/GameScript.cxx [moved from server/src/game/gamescript.cpp.inhib with 59% similarity]
TinNS/Source/GameServer/GameScript.hxx [new file with mode: 0644]
TinNS/Source/GameServer/GameServer.cxx [moved from server/src/game/gameserver.cpp with 73% similarity]
TinNS/Source/GameServer/GameServer.hxx [moved from server/src/game/include/gameserver.h with 55% similarity]
TinNS/Source/GameServer/GenrepList.cxx [moved from server/src/game/genreplist.cpp with 70% similarity]
TinNS/Source/GameServer/GenrepList.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Includes.cxx [moved from server/src/game/globals.cpp with 70% similarity]
TinNS/Source/GameServer/Includes.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Inventory.cxx [moved from server/src/game/inventory.cpp with 62% similarity]
TinNS/Source/GameServer/Inventory.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Isc.cxx [moved from server/src/game/isc.cpp with 71% similarity]
TinNS/Source/GameServer/Isc.hxx [moved from server/src/game/include/isc.h with 53% similarity]
TinNS/Source/GameServer/Item.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Item.hxx [new file with mode: 0644]
TinNS/Source/GameServer/LuaEngine.cxx [moved from server/src/game/lua_engine.cpp with 90% similarity]
TinNS/Source/GameServer/LuaEngine.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Main.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Main.hxx [new file with mode: 0644]
TinNS/Source/GameServer/MessageBuilder.cxx [new file with mode: 0644]
TinNS/Source/GameServer/MessageBuilder.hxx [new file with mode: 0644]
TinNS/Source/GameServer/MultiPart.cxx [moved from server/src/game/multipart.cpp with 82% similarity]
TinNS/Source/GameServer/MultiPart.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Npc.cxx [moved from server/src/game/npc.cpp with 91% similarity]
TinNS/Source/GameServer/Npc.hxx [moved from server/src/game/include/npc.h with 59% similarity]
TinNS/Source/GameServer/NpcAi.cxx [moved from server/src/game/npc_ai.cpp with 92% similarity]
TinNS/Source/GameServer/NpcConversation.cxx [moved from server/src/game/npc_conversation.cpp with 82% similarity]
TinNS/Source/GameServer/NpcTemplate.cxx [new file with mode: 0644]
TinNS/Source/GameServer/NpcTemplate.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Outpost.cxx [moved from server/src/game/outpost.cpp with 69% similarity]
TinNS/Source/GameServer/Outpost.hxx [new file with mode: 0644]
TinNS/Source/GameServer/RemoteConsole.cxx [new file with mode: 0644]
TinNS/Source/GameServer/RemoteConsole.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Server.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Server.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Skill.cxx [moved from server/src/game/skill.cpp with 91% similarity]
TinNS/Source/GameServer/Skill.hxx [moved from server/src/game/include/skill.h with 63% similarity]
TinNS/Source/GameServer/Sql.cxx [moved from server/src/game/sql.cpp with 78% similarity]
TinNS/Source/GameServer/Sql.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Subway.cxx [moved from server/src/game/subway.cpp with 61% similarity]
TinNS/Source/GameServer/Subway.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Terminal.cxx [moved from server/src/game/terminal.cpp with 50% similarity]
TinNS/Source/GameServer/Terminal.hxx [new file with mode: 0644]
TinNS/Source/GameServer/TerminalQueryDatabase.cxx [moved from server/src/game/terminal_querydb.cpp with 81% similarity]
TinNS/Source/GameServer/TerminalReceiveDatabase.cxx [moved from server/src/game/terminal_receivedb.cpp with 95% similarity]
TinNS/Source/GameServer/TerminalTryAccess.cxx [moved from server/src/game/terminal_tryaccess.cpp with 90% similarity]
TinNS/Source/GameServer/TerminalUpdateDatabase.cxx [moved from server/src/game/terminal_updatedb.cpp with 92% similarity]
TinNS/Source/GameServer/Vehicle.cxx [moved from server/src/game/vehicle.cpp with 69% similarity]
TinNS/Source/GameServer/Vehicle.hxx [new file with mode: 0644]
TinNS/Source/GameServer/VehicleAccessRequest.cxx [moved from server/src/game/vhcaccessrequest.cpp with 65% similarity]
TinNS/Source/GameServer/VehicleAccessRequest.hxx [new file with mode: 0644]
TinNS/Source/GameServer/WorldActors.cxx [moved from server/src/game/worldactors.cpp with 79% similarity]
TinNS/Source/GameServer/WorldActors.hxx [moved from server/src/game/include/worldactors.h with 56% similarity]
TinNS/Source/GameServer/WorldDataTemplate.cxx [moved from server/src/game/worlddatatemplate.cpp with 78% similarity]
TinNS/Source/GameServer/WorldDataTemplate.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Worlds.cxx [moved from server/src/game/worlds.cpp with 84% similarity]
TinNS/Source/GameServer/Worlds.hxx [new file with mode: 0644]
TinNS/Source/GameServer/Zoning.cxx [new file with mode: 0644]
TinNS/Source/GameServer/Zoning.hxx [new file with mode: 0644]
TinNS/Source/InfoServer/Accounts.cxx [moved from server/src/info/accounts.cpp with 56% similarity]
TinNS/Source/InfoServer/Accounts.hxx [new file with mode: 0644]
TinNS/Source/InfoServer/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/InfoServer/Client.cxx [new file with mode: 0644]
TinNS/Source/InfoServer/Client.hxx [new file with mode: 0644]
TinNS/Source/InfoServer/ConfigTemplate.hxx [moved from server/src/info/configtemplate.h with 53% similarity]
TinNS/Source/InfoServer/Includes.cxx [moved from server/src/info/globals.cpp with 54% similarity]
TinNS/Source/InfoServer/Includes.hxx [new file with mode: 0644]
TinNS/Source/InfoServer/InfoServer.cxx [new file with mode: 0644]
TinNS/Source/InfoServer/InfoServer.hxx [new file with mode: 0644]
TinNS/Source/InfoServer/Main.cxx [new file with mode: 0644]
TinNS/Source/InfoServer/Server.cxx [new file with mode: 0644]
TinNS/Source/InfoServer/Server.hxx [new file with mode: 0644]
TinNS/Source/InfoServer/Sql.cxx [moved from server/src/info/sql.cpp with 59% similarity]
TinNS/Source/InfoServer/Sql.hxx [new file with mode: 0644]
TinNS/Source/PatchServer/CMakeLists.txt [new file with mode: 0644]
TinNS/Source/PatchServer/Client.cxx [new file with mode: 0644]
TinNS/Source/PatchServer/Client.hxx [new file with mode: 0644]
TinNS/Source/PatchServer/ConfigTemplate.hxx [new file with mode: 0644]
TinNS/Source/PatchServer/Includes.cxx [new file with mode: 0644]
TinNS/Source/PatchServer/Includes.hxx [new file with mode: 0644]
TinNS/Source/PatchServer/Main.cxx [new file with mode: 0644]
TinNS/Source/PatchServer/PatchServer.cxx [moved from server/src/patch/patchserver.cpp with 65% similarity]
TinNS/Source/PatchServer/PatchServer.hxx [new file with mode: 0644]
TinNS/Source/PatchServer/Server.cxx [new file with mode: 0644]
TinNS/Source/PatchServer/Server.hxx [new file with mode: 0644]
TinNS/conf/commands.conf [moved from server/conf/commands.conf with 100% similarity]
TinNS/conf/gameserver.conf [moved from server/conf/gameserver.conf with 100% similarity]
TinNS/conf/global.conf [moved from server/conf/global.conf with 100% similarity]
TinNS/conf/infoserver.conf [moved from server/conf/infoserver.conf with 100% similarity]
TinNS/conf/patchserver.conf [moved from server/conf/patchserver.conf with 100% similarity]
TinNS/data/scripts/lua/zippy.lua [moved from server/data/scripts/lua/zippy.lua with 100% similarity]
TinNS/database/DB_v8/DB_v8_patch001.sql [moved from server/database/DB_v8/DB_v8_patch001.sql with 100% similarity]
TinNS/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql [moved from server/database/DB_v8/TinNS_GameDB_rev8_BaseData.sql with 100% similarity]
TinNS/database/DB_v8/changes.txt [moved from server/database/DB_v8/changes.txt with 100% similarity]
TinNS/database/DB_v8/patch_gamedb_rev7_to_rev8.sql [moved from server/database/DB_v8/patch_gamedb_rev7_to_rev8.sql with 100% similarity]
TinNS/database/DB_v8/readme.txt [moved from server/database/DB_v8/readme.txt with 100% similarity]
TinNS/database/DB_v8/unified_game_DB_rev8.sql [moved from server/database/DB_v8/unified_game_DB_rev8.sql with 100% similarity]
TinNS/database/DB_v8/unified_infoDB_rev8.sql [moved from server/database/DB_v8/unified_infoDB_rev8.sql with 100% similarity]
TinNS/database/GameDB.sql [moved from server/database/GameDB.sql with 100% similarity]
TinNS/database/GameDB_migration_rev107-rev108.sql [moved from server/database/GameDB_migration_rev107-rev108.sql with 100% similarity]
TinNS/database/GameDB_migration_rev81-rev82.sql [moved from server/database/GameDB_migration_rev81-rev82.sql with 100% similarity]
TinNS/database/GameDB_patch_rev133-rev134.sql [moved from server/database/GameDB_patch_rev133-rev134.sql with 100% similarity]
TinNS/database/GameDB_patch_rev134-rev140.sql [moved from server/database/GameDB_patch_rev134-rev140.sql with 100% similarity]
TinNS/database/InfoDB.sql [moved from server/database/InfoDB.sql with 100% similarity]
TinNS/database/infoDB.s3db [moved from server/database/infoDB.s3db with 100% similarity]
TinNS/init.d/tinns [moved from server/init.d/tinns with 100% similarity]
Tools/CMakeLists.txt [new file with mode: 0644]
Tools/PakDecompress/CMakeLists.txt [new file with mode: 0644]
Tools/PakDecompress/PakDecompress.cxx [new file with mode: 0644]
Tools/VFSviewer/CMakeLists.txt [new file with mode: 0644]
Tools/VFSviewer/VfsViewer.c [new file with mode: 0644]
cmake_distclean.sh
server/CMakeLists.txt [deleted file]
server/src/CMakeLists.txt [deleted file]
server/src/common/CMakeLists.txt [deleted file]
server/src/common/message.h [deleted file]
server/src/common/regex++.h [deleted file]
server/src/game/CMakeLists.txt [deleted file]
server/src/game/decoder/main.h [deleted file]
server/src/game/decoder/msgdecoder.cpp [deleted file]
server/src/game/decoder/udp_0x08.cpp [deleted file]
server/src/game/decoder/udp_0x08.h [deleted file]
server/src/game/decoder/udp_0x13.h [deleted file]
server/src/game/decoder/udp_0x1f.h [deleted file]
server/src/game/decoder/udp_0x22.cpp [deleted file]
server/src/game/decoder/udp_0x22.h [deleted file]
server/src/game/decoder/udp_0x2b.cpp [deleted file]
server/src/game/decoder/udp_0x2b.h [deleted file]
server/src/game/decoder/udp_OOO.cpp [deleted file]
server/src/game/decoder/udp_OOO.h [deleted file]
server/src/game/decoder/udp_appartment.cpp [deleted file]
server/src/game/decoder/udp_appartment.h [deleted file]
server/src/game/decoder/udp_charmove.h [deleted file]
server/src/game/decoder/udp_chat.h [deleted file]
server/src/game/decoder/udp_deathrespawn.h [deleted file]
server/src/game/decoder/udp_entityposreq.h [deleted file]
server/src/game/decoder/udp_hack.h [deleted file]
server/src/game/decoder/udp_helditemaction.h [deleted file]
server/src/game/decoder/udp_itemmanualreload.h [deleted file]
server/src/game/decoder/udp_itemmove.h [deleted file]
server/src/game/decoder/udp_itemuse.h [deleted file]
server/src/game/decoder/udp_killself.cpp [deleted file]
server/src/game/decoder/udp_killself.h [deleted file]
server/src/game/decoder/udp_multipart.h [deleted file]
server/src/game/decoder/udp_npcdialog.h [deleted file]
server/src/game/decoder/udp_outfitter.cpp [deleted file]
server/src/game/decoder/udp_outfitter.h [deleted file]
server/src/game/decoder/udp_packet0.cpp [deleted file]
server/src/game/decoder/udp_packet0.h [deleted file]
server/src/game/decoder/udp_ping.cpp [deleted file]
server/src/game/decoder/udp_ping.h [deleted file]
server/src/game/decoder/udp_popupresponse.h [deleted file]
server/src/game/decoder/udp_pvptrade.cpp [deleted file]
server/src/game/decoder/udp_pvptrade.h [deleted file]
server/src/game/decoder/udp_quickaccessbelt.h [deleted file]
server/src/game/decoder/udp_reqinfo.h [deleted file]
server/src/game/decoder/udp_subskill.h [deleted file]
server/src/game/decoder/udp_sync.h [deleted file]
server/src/game/decoder/udp_terminal.h [deleted file]
server/src/game/decoder/udp_useobject.h [deleted file]
server/src/game/decoder/udp_vhc.h [deleted file]
server/src/game/decoder/udp_worldIDinfo.h [deleted file]
server/src/game/decoder/udp_zoning.h [deleted file]
server/src/game/decoder/udpanalyser.h [deleted file]
server/src/game/def/def_actionmod.cpp [deleted file]
server/src/game/def/def_ammo.cpp [deleted file]
server/src/game/def/def_appartements.cpp [deleted file]
server/src/game/def/def_appplaces.cpp [deleted file]
server/src/game/def/def_blueprintpieces.cpp [deleted file]
server/src/game/def/def_characters.cpp [deleted file]
server/src/game/def/def_charaction.cpp [deleted file]
server/src/game/def/def_charkinds.cpp [deleted file]
server/src/game/def/def_factions.cpp [deleted file]
server/src/game/def/def_hack.cpp [deleted file]
server/src/game/def/def_itemres.cpp [deleted file]
server/src/game/def/def_npcarmor.cpp [deleted file]
server/src/game/def/def_outposts.cpp [deleted file]
server/src/game/def/def_recycles.cpp [deleted file]
server/src/game/def/def_shots.cpp [deleted file]
server/src/game/def/def_skills.cpp [deleted file]
server/src/game/def/def_subskills.cpp [deleted file]
server/src/game/def/def_vehicles.cpp [deleted file]
server/src/game/def/def_weather.cpp [deleted file]
server/src/game/def/def_worldmodels.cpp [deleted file]
server/src/game/def/defparser.cpp [deleted file]
server/src/game/def/main.h [deleted file]
server/src/game/def/world_datstruct.h [deleted file]
server/src/game/doortemplate.cpp [deleted file]
server/src/game/furnituretemplate.cpp [deleted file]
server/src/game/gamecommands/broadcast.cpp [deleted file]
server/src/game/gamecommands/color.cpp [deleted file]
server/src/game/gamecommands/effect.cpp [deleted file]
server/src/game/gamecommands/listbans.cpp [deleted file]
server/src/game/gamecommands/main.h [deleted file]
server/src/game/gamecommands/online.cpp [deleted file]
server/src/game/gamecommands/settime.cpp [deleted file]
server/src/game/gamecommands/speed.cpp [deleted file]
server/src/game/gamecommands/unban.cpp [deleted file]
server/src/game/gamecommands/v.cpp [deleted file]
server/src/game/gamecommands/version.cpp [deleted file]
server/src/game/include/accounts.h [deleted file]
server/src/game/include/appartements.h [deleted file]
server/src/game/include/buddylist.h [deleted file]
server/src/game/include/chars.h [deleted file]
server/src/game/include/chat.h [deleted file]
server/src/game/include/client.h [deleted file]
server/src/game/include/clientmanager.h [deleted file]
server/src/game/include/container.h [deleted file]
server/src/game/include/def.h [deleted file]
server/src/game/include/def_actionmod.h [deleted file]
server/src/game/include/def_ammo.h [deleted file]
server/src/game/include/def_appartements.h [deleted file]
server/src/game/include/def_appplaces.h [deleted file]
server/src/game/include/def_blueprintpieces.h [deleted file]
server/src/game/include/def_characters.h [deleted file]
server/src/game/include/def_charaction.h [deleted file]
server/src/game/include/def_charkinds.h [deleted file]
server/src/game/include/def_damage.h [deleted file]
server/src/game/include/def_drugs.h [deleted file]
server/src/game/include/def_factions.h [deleted file]
server/src/game/include/def_hack.h [deleted file]
server/src/game/include/def_implants.h [deleted file]
server/src/game/include/def_itemcontainer.h [deleted file]
server/src/game/include/def_itemmod.h [deleted file]
server/src/game/include/def_itemres.h [deleted file]
server/src/game/include/def_items.h [deleted file]
server/src/game/include/def_mission.h [deleted file]
server/src/game/include/def_npc.h [deleted file]
server/src/game/include/def_npcarmor.h [deleted file]
server/src/game/include/def_npcgroupspawn.h [deleted file]
server/src/game/include/def_outposts.h [deleted file]
server/src/game/include/def_recycles.h [deleted file]
server/src/game/include/def_respawn.h [deleted file]
server/src/game/include/def_scripts.h [deleted file]
server/src/game/include/def_shots.h [deleted file]
server/src/game/include/def_skills.h [deleted file]
server/src/game/include/def_subskills.h [deleted file]
server/src/game/include/def_trader.h [deleted file]
server/src/game/include/def_vehicles.h [deleted file]
server/src/game/include/def_vehiclesits.h [deleted file]
server/src/game/include/def_weapons.h [deleted file]
server/src/game/include/def_weather.h [deleted file]
server/src/game/include/def_worldfile.h [deleted file]
server/src/game/include/def_worldmodels.h [deleted file]
server/src/game/include/def_worlds.h [deleted file]
server/src/game/include/defmap.h [deleted file]
server/src/game/include/defparser.h [deleted file]
server/src/game/include/defs.h [deleted file]
server/src/game/include/doortemplate.h [deleted file]
server/src/game/include/furnituretemplate.h [deleted file]
server/src/game/include/gamescript.h [deleted file]
server/src/game/include/genreplist.h [deleted file]
server/src/game/include/globals.h [deleted file]
server/src/game/include/inventory.h [deleted file]
server/src/game/include/item.h [deleted file]
server/src/game/include/lua_engine.h [deleted file]
server/src/game/include/msgbuilder.h [deleted file]
server/src/game/include/msgdecoder.h [deleted file]
server/src/game/include/multipart.h [deleted file]
server/src/game/include/npctemplate.h [deleted file]
server/src/game/include/outpost.h [deleted file]
server/src/game/include/rconsole.h [deleted file]
server/src/game/include/server.h [deleted file]
server/src/game/include/sql.h [deleted file]
server/src/game/include/subway.h [deleted file]
server/src/game/include/terminal.h [deleted file]
server/src/game/include/vehicle.h [deleted file]
server/src/game/include/vhcaccessrequest.h [deleted file]
server/src/game/include/world_datparser.h [deleted file]
server/src/game/include/worlddatatemplate.h [deleted file]
server/src/game/include/worlds.h [deleted file]
server/src/game/include/zoning.h [deleted file]
server/src/game/item.cpp [deleted file]
server/src/game/main.cpp [deleted file]
server/src/game/main.h [deleted file]
server/src/game/msgbuilder.cpp [deleted file]
server/src/game/npctemplate.cpp [deleted file]
server/src/game/rconsole.cpp.inhib [deleted file]
server/src/game/server.cpp [deleted file]
server/src/game/zoning.cpp [deleted file]
server/src/include/external.h [deleted file]
server/src/include/svnrevision.h [deleted file]
server/src/include/tinns_mutex.h [deleted file]
server/src/include/tinns_semaphore.h [deleted file]
server/src/include/types.h [deleted file]
server/src/include/version.h [deleted file]
server/src/info/CMakeLists.txt [deleted file]
server/src/info/accounts.h [deleted file]
server/src/info/client.cpp [deleted file]
server/src/info/client.h [deleted file]
server/src/info/globals.h [deleted file]
server/src/info/infoserver.cpp [deleted file]
server/src/info/infoserver.h [deleted file]
server/src/info/main.cpp [deleted file]
server/src/info/main.h [deleted file]
server/src/info/server.cpp [deleted file]
server/src/info/server.h [deleted file]
server/src/info/sql.h [deleted file]
server/src/patch/CMakeLists.txt [deleted file]
server/src/patch/client.cpp [deleted file]
server/src/patch/client.h [deleted file]
server/src/patch/configtemplate.h [deleted file]
server/src/patch/globals.cpp [deleted file]
server/src/patch/globals.h [deleted file]
server/src/patch/main.cpp [deleted file]
server/src/patch/main.h [deleted file]
server/src/patch/patchserver.h [deleted file]
server/src/patch/server.cpp [deleted file]
server/src/patch/server.h [deleted file]
tools/CMakeLists.txt [deleted file]
tools/pak_decompress/CMakeLists.txt [deleted file]
tools/pak_decompress/pak_decompress.cpp [deleted file]
tools/pak_decompress/pak_decompress.jar [deleted file]
tools/vfs_viewer/CMakeLists.txt [deleted file]
tools/vfs_viewer/vfs_viewer.c [deleted file]

index e632613..eb7bde2 100644 (file)
@@ -34,18 +34,16 @@ ENDIF                   (USE_MYSQL_INCLUDE_DIR)
 # compiler settings
 IF                      (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
 MESSAGE                     ("Unix-like system: ${CMAKE_SYSTEM_NAME}")
-SET                         (CMAKE_CXX_FLAGS "-std=c++1z -pthread -fdiagnostics-color=always -W -Wall -Wextra -Os")
+SET                         (CMAKE_CXX_FLAGS "-std=c++14 -pthread -fdiagnostics-color=always -W -Wall -Wextra -Os")
 SET                         (CMAKE_C_FLAGS "-std=c11 -pthread -fdiagnostics-color=always -W -Wall -Wextra -Os")
 ELSEIF                  (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
 MESSAGE                     ("Windows-like system: ${CMAKE_SYSTEM_NAME}")
-SET                         (CMAKE_CXX_FLAGS "-std=c++1z -pthread -W -Wall -Wextra -Os")
+SET                         (CMAKE_CXX_FLAGS "-std=c++14 -pthread -W -Wall -Wextra -Os")
 SET                         (CMAKE_C_FLAGS "-std=c11 -pthread -W -Wall -Wextra -Os")
 ELSE                    ()
 MESSAGE                     (FATAL_ERROR "unsupported system: ${CMAKE_SYSTEM_NAME}")
 ENDIF                   ()
 
-#add_definitions         (-std=c++0x -W -Wall -march=native -mtune=native -O2 -D_THREAD_SAFE -D_REENTRANT)
-
 # source code stuff starts here
-ADD_SUBDIRECTORY        (server)
-ADD_SUBDIRECTORY        (tools)
+ADD_SUBDIRECTORY        (TinNS)
+ADD_SUBDIRECTORY        (Tools)
similarity index 100%
rename from docs/ISC Example.txt
rename to Docs/ISC Example.txt
similarity index 100%
rename from docs/ISC ProtDef.txt
rename to Docs/ISC ProtDef.txt
similarity index 100%
rename from docs/NPCs.txt
rename to Docs/NPCs.txt
similarity index 100%
rename from docs/itemtypes.txt
rename to Docs/itemtypes.txt
index d511905..e37680c 100644 (file)
@@ -278,62 +278,3 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
                     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/Scripts/CodeCounter.sh b/Scripts/CodeCounter.sh
new file mode 100755 (executable)
index 0000000..0ed195d
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# code counter
+LOG="/tmp/log.$$"
+LINES=0
+C=0
+find| grep "\.c$" >$LOG
+find| grep "\.cpp$" >>$LOG
+find| grep "\.cxx$" >>$LOG
+find| grep "\.h$" >>$LOG
+find| grep "\.hpp$" >>$LOG
+find| grep "\.hxx$" >>$LOG
+find| grep "\.sh$" >>$LOG
+find| grep "\.S$" >>$LOG
+find| grep "\.ts$" >>$LOG
+find| grep "\.ui$" >>$LOG
+find| grep "\.qrc$" >>$LOG
+find| grep "\.bat$" >>$LOG
+find| grep "\.cmake$" >>$LOG
+find| grep "CMakeLists.txt" >>$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 "--- SOURCE CODE SUMMARY ---"
+echo "source path:   $(pwd)"
+echo "source files:  $C"
+echo "lines of code: $LINES"
+echo "size of code:  $SIZE bytes"
+echo
diff --git a/TinNS/CMakeLists.txt b/TinNS/CMakeLists.txt
new file mode 100644 (file)
index 0000000..829a977
--- /dev/null
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY        (Source)
diff --git a/TinNS/Source/CMakeLists.txt b/TinNS/Source/CMakeLists.txt
new file mode 100644 (file)
index 0000000..062d55f
--- /dev/null
@@ -0,0 +1,7 @@
+INCLUDE_DIRECTORIES     (${CMAKE_CURRENT_SOURCE_DIR})
+
+ADD_SUBDIRECTORY        (Common)
+ADD_SUBDIRECTORY        (DevelopmentTools)
+ADD_SUBDIRECTORY        (GameServer)
+ADD_SUBDIRECTORY        (InfoServer)
+ADD_SUBDIRECTORY        (PatchServer)
diff --git a/TinNS/Source/Common/CMakeLists.txt b/TinNS/Source/Common/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b395c72
--- /dev/null
@@ -0,0 +1 @@
+ADD_LIBRARY             (Common Config.cxx Console.cxx FileSystem.cxx Message.cxx Misc.cxx Netcode.cxx RegEx.cxx)
similarity index 58%
rename from server/src/common/config.cpp
rename to TinNS/Source/Common/Config.cxx
index 2e04bdd..1d30b06 100644 (file)
@@ -1,8 +1,5 @@
-#include "common/config.h"\r
-\r
 #include <cstring>\r
-#include "common/console.h"\r
-#include "common/misc.h"\r
+#include "Common/Includes.hxx"\r
 \r
 PConfig::PConfig()\r
 {\r
@@ -18,34 +15,34 @@ PConfig::~PConfig()
 \r
 bool PConfig::LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile, int nDepth)\r
 {\r
-       FILE *ConfigFile;\r
-       char line[255];\r
-       std::string Opt, Val;\r
-       //int numOptions = 0;\r
-       int i;\r
-       bool Found;\r
-       bool NoError = true;\r
-  \r
-       ConfigFile = fopen(nConfigFile,"r");\r
-\r
-       if(!ConfigFile)\r
-       {\r
-           Console->Print("%s Cant open file \"%s\"", Console->ColorText(RED, BLACK, "[Error]"), nConfigFile);\r
+    FILE *ConfigFile;\r
+    char line[255];\r
+    std::string Opt, Val;\r
+    //int numOptions = 0;\r
+    int i;\r
+    bool Found;\r
+    bool NoError = true;\r
+\r
+    ConfigFile = fopen(nConfigFile,"r");\r
+\r
+    if(!ConfigFile)\r
+    {\r
+        Console->Print("%s Cant open file \"%s\"", Console->ColorText(RED, BLACK, "[Error]"), nConfigFile);\r
         return false;\r
-       }\r
+    }\r
 \r
   if(nDepth)\r
     Console->Print("%s Including file %s (nesting level %d)", Console->ColorText(GREEN, BLACK, "[Info]"), nConfigFile, nDepth);\r
   else\r
-         Console->Print("%s Loading configuration file %s", Console->ColorText(GREEN, BLACK, "[Info]"), nConfigFile);\r
\r
-       while(!feof(ConfigFile) && fgets(line, 255, ConfigFile))\r
-       {\r
-           //Console->Print("LINE: '%s'", line);\r
-           if (line[0] == '/' && line[1] == '/')\r
+      Console->Print("%s Loading configuration file %s", Console->ColorText(GREEN, BLACK, "[Info]"), nConfigFile);\r
+\r
+    while(!feof(ConfigFile) && fgets(line, 255, ConfigFile))\r
+    {\r
+        //Console->Print("LINE: '%s'", line);\r
+        if (line[0] == '/' && line[1] == '/')\r
         continue;\r
-           \r
-           if(mOptValRegEx->Search(line))\r
+\r
+        if(mOptValRegEx->Search(line))\r
       {\r
         Opt = mOptValRegEx->Match(1);\r
         Val = mOptValRegEx->Match(2);\r
@@ -64,7 +61,7 @@ bool PConfig::LoadOptions(const char* nConfigTemplate[][2], const char* nConfigF
           int BasenamePos = StartName.rfind("/");\r
           if(BasenamePos > 0)\r
             TargetName = StartName.substr(0, BasenamePos) + "/" + TargetName;\r
-         \r
+\r
           NoError = LoadOptions(nConfigTemplate, TargetName.c_str(), nDepth+1) && NoError;\r
           continue;\r
         }\r
@@ -80,7 +77,7 @@ bool PConfig::LoadOptions(const char* nConfigTemplate[][2], const char* nConfigF
       }\r
 \r
       i = 0;\r
-      Found = false;      \r
+      Found = false;\r
       while(!Found && (nConfigTemplate[i][0][0] != '\0'))\r
       {\r
         if(!strcmp(Opt.c_str(), nConfigTemplate[i++][0]))\r
@@ -90,18 +87,18 @@ bool PConfig::LoadOptions(const char* nConfigTemplate[][2], const char* nConfigF
         }\r
       }\r
 \r
-           if(!Opt.empty() && !Val.empty())\r
-           {\r
-               //Console->Print("#%d [%s] [%s]", numOptions, Opt.c_str(), Val.c_str());\r
-               if (Found)\r
-               {\r
-                 if (GetOption(Opt) != "")\r
-                 {\r
-                   Console->Print("%s trying to set option %s more than once (old value '%s' - new value '%s' ignored)", Console->ColorText(YELLOW, BLACK, "[Warning]"), Opt.c_str(), GetOption(Opt).c_str(), Val.c_str());\r
-                 }\r
-                 else\r
-                 {\r
-                   //Console->Print(GREEN, BLACK, "New option %s set to %s", Opt.c_str(), Val.c_str());\r
+        if(!Opt.empty() && !Val.empty())\r
+        {\r
+            //Console->Print("#%d [%s] [%s]", numOptions, Opt.c_str(), Val.c_str());\r
+            if (Found)\r
+            {\r
+              if (GetOption(Opt) != "")\r
+              {\r
+                Console->Print("%s trying to set option %s more than once (old value '%s' - new value '%s' ignored)", Console->ColorText(YELLOW, BLACK, "[Warning]"), Opt.c_str(), GetOption(Opt).c_str(), Val.c_str());\r
+              }\r
+              else\r
+              {\r
+                //Console->Print(GREEN, BLACK, "New option %s set to %s", Opt.c_str(), Val.c_str());\r
               mOptions.insert(std::make_pair(Opt, Val));\r
             }\r
           }\r
@@ -109,13 +106,13 @@ bool PConfig::LoadOptions(const char* nConfigTemplate[][2], const char* nConfigF
           {\r
              Console->Print("%s option %s unknow and ignored (value %s)", Console->ColorText(YELLOW, BLACK, "[Warning]"), Opt.c_str(), Val.c_str());\r
           }\r
-           }\r
-       }\r
+        }\r
+    }\r
 \r
   // Now check for completeness and set default values when needed and available\r
   if(!nDepth) // Check only if we're at top level (ie. not in an included file)\r
   {\r
-    i = 0;      \r
+    i = 0;\r
     while(nConfigTemplate[i][0][0] != '\0')\r
     {\r
       if (GetOption(nConfigTemplate[i][0]) == "")\r
@@ -137,52 +134,32 @@ bool PConfig::LoadOptions(const char* nConfigTemplate[][2], const char* nConfigF
 \r
   if (NoError)\r
   {\r
-         if(nDepth)\r
-           Console->Print("%s file included", Console->ColorText(GREEN, BLACK, "[Info]") );\r
-         else\r
+      if(nDepth)\r
+        Console->Print("%s file included", Console->ColorText(GREEN, BLACK, "[Info]") );\r
+      else\r
       Console->Print("%s Configuration file loaded", Console->ColorText(GREEN, BLACK, "[Success]") );\r
   }\r
   else\r
     Console->Print(RED, BLACK, "[Error] Fatal errors found in configuration file");\r
-       \r
-       return (NoError);\r
+\r
+    return (NoError);\r
 }\r
 \r
 const std::string &PConfig::GetOption(const std::string Name) const\r
 {\r
-       static std::string NullString = "";\r
-       OptionsMap::const_iterator i = mOptions.find(Name);\r
-       if(i!=mOptions.end())\r
-               return i->second;\r
+    static std::string NullString = "";\r
+    OptionsMap::const_iterator i = mOptions.find(Name);\r
+    if(i!=mOptions.end())\r
+        return i->second;\r
 \r
-       return NullString;\r
+    return NullString;\r
 }\r
 \r
 int PConfig::GetOptionInt(const std::string Name) const\r
 {\r
-       OptionsMap::const_iterator i = mOptions.find(Name);\r
-       if(i!=mOptions.end())\r
-               return atoi(i->second.c_str());\r
-\r
-       return 0;\r
-}\r
-/*  \r
-const std::string &PConfig::GetOption(const char *Name) const\r
-{\r
-       static std::string NullString = "";\r
-       OptionsMap::const_iterator i = mOptions.find(Name);\r
-       if(i!=mOptions.end())\r
-               return i->second;\r
-\r
-       return NullString;\r
-}\r
-\r
-int PConfig::GetOptionInt(const char *Name) const\r
-{\r
-       OptionsMap::const_iterator i = mOptions.find(Name);\r
-       if(i!=mOptions.end())\r
-               return std::atoi(i->second.c_str());\r
+    OptionsMap::const_iterator i = mOptions.find(Name);\r
+    if(i!=mOptions.end())\r
+        return atoi(i->second.c_str());\r
 \r
-       return 0;\r
+    return 0;\r
 }\r
-*/\r
similarity index 56%
rename from server/src/common/config.h
rename to TinNS/Source/Common/Config.hxx
index 6019055..0741022 100644 (file)
@@ -1,29 +1,31 @@
 #pragma once\r
 \r
+#include <cstdint>\r
 #include <iostream>\r
 #include <map>\r
-#include "common/regex++.h"\r
-\r
-class PConfig\r
-{\r
-       private :\r
-               typedef std::map<std::string, std::string> OptionsMap;\r
-               OptionsMap mOptions;\r
-               RegEx* mOptValRegEx;\r
-               RegEx* mIncludeRegEx;\r
-               \r
-               bool LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile, int nDepth);\r
-               \r
-       public :\r
-               PConfig();\r
-               ~PConfig();\r
-\r
-               inline bool LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile)\r
-                 { return LoadOptions(nConfigTemplate, nConfigFile, 0); }\r
-               inline const std::string &GetOption(const char *Name) const { return GetOption((std::string) Name); }\r
-               const std::string &GetOption(const std::string Name) const;\r
-               int GetOptionInt(const char *Name) const { return GetOptionInt((std::string) Name); }\r
-               int GetOptionInt(const std::string Name) const;\r
+#include <string>\r
+\r
+class RegEx;\r
+\r
+class PConfig {\r
+private:\r
+    typedef std::map<std::string, std::string> OptionsMap;\r
+    OptionsMap mOptions;\r
+    RegEx *mOptValRegEx;\r
+    RegEx *mIncludeRegEx;\r
+\r
+    bool LoadOptions(const char *nConfigTemplate[][2], const char *nConfigFile, int32_t nDepth);\r
+\r
+public:\r
+    PConfig();\r
+    ~PConfig();\r
+\r
+    inline bool LoadOptions(const char *nConfigTemplate[][2], const char *nConfigFile)\r
+      { return LoadOptions(nConfigTemplate, nConfigFile, 0); }\r
+    inline const std::string &GetOption(const char *Name) const { return GetOption((std::string) Name); }\r
+    const std::string &GetOption(const std::string Name) const;\r
+    int32_t GetOptionInt(const char *Name) const { return GetOptionInt((std::string) Name); }\r
+    int32_t GetOptionInt(const std::string Name) const;\r
 };\r
 \r
 // Max nested includes\r
@@ -37,7 +39,7 @@ class PConfig
   Unkown options are rejected\r
   Duplicates, unkown and default use generate a warning in logs but don't break options loading\r
   Missing mandatory option generate an error in log and break option loading (imediate return false)\r
-  \r
+\r
   The ConfigTemplate parameter must have the structure shown in the following exemple:\r
 \r
 const char* ConfigTemplate[][2] = {\r
similarity index 95%
rename from server/src/common/console.cpp
rename to TinNS/Source/Common/Console.cxx
index c8d70f1..cc12a3b 100644 (file)
@@ -1,8 +1,7 @@
-#include "common/console.h"\r
-\r
+#include <cstdarg>\r
 #include <sstream>\r
 #include <cstring>\r
-#include <cstdarg>\r
+#include "Common/Includes.hxx"\r
 \r
 PConsole::PConsole(const char *nLogFile)\r
 {\r
similarity index 90%
rename from server/src/common/console.h
rename to TinNS/Source/Common/Console.hxx
index 9a0b428..8b610c4 100644 (file)
@@ -1,11 +1,9 @@
 #pragma once\r
 \r
-#include <iostream>\r
-#include <fstream>\r
 #include <chrono>\r
+#include <fstream>\r
 \r
-enum COLORS\r
-{\r
+enum COLORS {\r
     BLACK,\r
     RED,\r
     GREEN,\r
similarity index 95%
rename from server/src/common/filesystem.cpp
rename to TinNS/Source/Common/FileSystem.cxx
index 2391f01..633b79d 100644 (file)
@@ -1,9 +1,7 @@
-#include "common/filesystem.h"\r
-\r
-#include <sstream>\r
 #include <cstring>\r
+#include <sstream>\r
 #include <zlib.h>\r
-#include "common/console.h"\r
+#include "Common/Includes.hxx"\r
 \r
 const int8_t DELIM = '/';\r
 \r
similarity index 91%
rename from server/src/common/filesystem.h
rename to TinNS/Source/Common/FileSystem.hxx
index 45b31c8..00366bd 100644 (file)
@@ -1,9 +1,8 @@
 #pragma once\r
 \r
-#include <iostream>\r
-#include <vector>\r
-#include <string>\r
+#include <cstdint>\r
 #include <map>\r
+#include <vector>\r
 \r
 class PFile {\r
        friend class PFileSystem;\r
@@ -25,7 +24,6 @@ public:
 };\r
 \r
 #pragma pack(push, 1)\r
-//#pragma pack(1)\r
 struct PPakHeader {\r
        int mID;\r
        int mNumFiles;\r
diff --git a/TinNS/Source/Common/Includes.hxx b/TinNS/Source/Common/Includes.hxx
new file mode 100644 (file)
index 0000000..0b2cc63
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "Common/Config.hxx"
+#include "Common/Console.hxx"
+#include "Common/FileSystem.hxx"
+#include "Common/Message.hxx"
+#include "Common/Misc.hxx"
+#include "Common/Netcode.hxx"
+#include "Common/RegEx.hxx"
+#include "Common/SVNrevision.hxx"
+#include "Common/Version.hxx"
similarity index 99%
rename from server/src/common/message.cpp
rename to TinNS/Source/Common/Message.cxx
index 7abddba..cca2d3c 100644 (file)
@@ -1,7 +1,5 @@
-#include "common/message.h"
-
 #include <cstring>
-#include "common/console.h"
+#include "Common/Includes.hxx"
 
 const uint16_t PMessage::smMsgSizes[] = {MESSAGE_SIZES_LIST};
 PMsgData* PMessage::smMsgPoolHead[] = {MESSAGE_POOL_INIT};
diff --git a/TinNS/Source/Common/Message.hxx b/TinNS/Source/Common/Message.hxx
new file mode 100644 (file)
index 0000000..30c19ee
--- /dev/null
@@ -0,0 +1,103 @@
+#pragma once
+
+#include <cstdint>
+
+#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 = "");
+};
similarity index 94%
rename from server/src/common/misc.cpp
rename to TinNS/Source/Common/Misc.cxx
index 7ed900f..1f8fa3b 100644 (file)
@@ -1,10 +1,7 @@
-#include "common/misc.h"\r
-\r
-#include <cstring>\r
 #include <cstdarg>\r
-#include <netinet/in.h>\r
+#include <cstring>\r
 #include <arpa/inet.h>\r
-#include "common/console.h"\r
+#include "Common/Includes.hxx"\r
 \r
 uint32_t IPStringToDWord( const char *IP )\r
 {\r
similarity index 87%
rename from server/src/common/misc.h
rename to TinNS/Source/Common/Misc.hxx
index dae6fb9..33bf941 100644 (file)
@@ -1,14 +1,14 @@
 #pragma once\r
 \r
-#include <iostream>\r
+#include <cstdint>\r
 #include <string>\r
 \r
 uint32_t IPStringToDWord(const char *IP);\r
 char *IPlongToString(const uint32_t IP);\r
-std::string GetAccessString(int level);\r
+std::string GetAccessString(int32_t level);\r
 //void GetSVNRev(char *version);\r
 \r
-void PrintPacket(uint8_t *Packet, int PacketSize);\r
+void PrintPacket(uint8_t *Packet, int32_t PacketSize);\r
 \r
 // Cleanup for strings read from .def\r
 void CleanUpString(std::string *nString);\r
diff --git a/TinNS/Source/Common/Mutex.hxx b/TinNS/Source/Common/Mutex.hxx
new file mode 100644 (file)
index 0000000..8e388fb
--- /dev/null
@@ -0,0 +1,43 @@
+#pragma once\r
+\r
+#include <pthread.h>\r
+\r
+class Mutex {\r
+private:\r
+    mutable pthread_mutex_t mut;\r
+\r
+    void operator = (Mutex &mut) {}\r
+\r
+    Mutex(const Mutex &mut) {}\r
+\r
+public:\r
+    Mutex()\r
+    {\r
+        pthread_mutexattr_t attr;\r
+        pthread_mutexattr_init(&attr);\r
+        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);\r
+        pthread_mutex_init(&mut, &attr);\r
+        pthread_mutexattr_destroy(&attr);\r
+    }\r
+\r
+    virtual ~Mutex()\r
+    {\r
+        pthread_mutex_unlock(&mut);\r
+        pthread_mutex_destroy(&mut);\r
+    }\r
+\r
+    int Lock() const\r
+    {\r
+        return (pthread_mutex_lock(&mut));\r
+    }\r
+\r
+    int TryLock() const\r
+    {\r
+        return (pthread_mutex_trylock(&mut));\r
+    }\r
+\r
+    int Unlock() const\r
+    {\r
+        return (pthread_mutex_unlock(&mut));\r
+    }\r
+};\r
similarity index 93%
rename from server/src/common/netcode.cpp
rename to TinNS/Source/Common/Netcode.cxx
index 85c8676..47a968f 100644 (file)
@@ -1,11 +1,8 @@
-#include "common/netcode.h"
-
 #include <cstring>
 #include <fcntl.h>
 #include <unistd.h>
 #include <arpa/inet.h>
-#include "common/console.h"
-#include "common/config.h"
+#include "Common/Includes.hxx"
 
 ConnectionTCP::ConnectionTCP(int sockfd, struct sockaddr_in addr, ServerSocket* server)
 {
@@ -36,12 +33,12 @@ ConnectionTCP::~ConnectionTCP()
       mServerSocket->delSocketFromSet(mSockfd);
     }
     close(mSockfd);
-    
+
     if (mReceiveBufferMsg)
     {
       delete mReceiveBufferMsg;
     }
-    
+
     while (!mQueueIn.empty())
     {
       delete mQueueIn.front();
@@ -61,17 +58,17 @@ char* ConnectionTCP::getRemoteAddress()
 
 bool ConnectionTCP::timeOut() const
 {
-       time_t now = std::time(NULL);
-       if((now-mLastActive) >= mTimeOutValue)
-               return true;
+    time_t now = std::time(NULL);
+    if((now-mLastActive) >= mTimeOutValue)
+        return true;
 
-       return false;
+    return false;
 }
 
 PMessage* ConnectionTCP::GetMessage()
 {
   PMessage* RetVal;
-  
+
   if (mQueueIn.empty())
     RetVal = NULL;
   else
@@ -88,7 +85,7 @@ void ConnectionTCP::DeleteOutgoingMessages()
   {
     delete mQueueOut.front();
     mQueueOut.pop();
-  }  
+  }
 }
 
 bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
@@ -100,7 +97,7 @@ bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
   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))
   {
@@ -109,7 +106,7 @@ bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
     {
       mReceiveBufferMsg = new PMessage(RECVBUFFERSIZE);
     }
-    
+
     DataSize = mReceiveBufferMsg->GetSize();
     numBytes = recv(mSockfd, (char*) mReceiveBufferMsg->GetMessageDataPointer(RECVBUFFERSIZE - DataSize) + DataSize, RECVBUFFERSIZE - DataSize, 0); // get the data
 
@@ -119,13 +116,13 @@ bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
       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;
@@ -141,7 +138,7 @@ bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
             {
               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));
@@ -150,9 +147,9 @@ bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
               {
                 tmpMsg = NULL;
               }
-              
+
               delete mReceiveBufferMsg;
-              mReceiveBufferMsg = tmpMsg;              
+              mReceiveBufferMsg = tmpMsg;
             }
           }
         }
@@ -169,49 +166,49 @@ bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
         {
           mServerSocket->delSocketFromSet(mSockfd);
         }
-        close(mSockfd);        
+        close(mSockfd);
         return false;
     }
     else
     {
-      if(errno != EAGAIN) 
+      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())
-       {
+    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);
+      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);
+            mLastActive = std::time(NULL);
         mQueueOut.pop(); // message written, we can remove it from queue
         delete tmpMsg; // and delete the message
-               }
-       }
+        }
+    }
 
-       return true;
+    return true;
 }
 
 /**** Old I/F compatibility functions ****/
@@ -219,23 +216,23 @@ bool ConnectionTCP::update() // non optimal read-algorithm atm, but well ... :p
 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;
+    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;
+      tmpMsg->SetNextByteOffset(0);
+      _size = tmpMsg->GetSize();
+    }
+    return _size;
 }
 
 int ConnectionTCP::getSendBufferSize()
@@ -260,7 +257,7 @@ void ConnectionTCP::flushSendBuffer()
 const uint8_t* ConnectionTCP::read(int* size)
 {
   PMessage* tmpMsg;
-//Console->Print("ConnectionTCP::read() - trying to read up to %d bytes", *size);  
+//Console->Print("ConnectionTCP::read() - trying to read up to %d bytes", *size);
   if (mQueueIn.empty() || !size)
   {
 //Console->Print("ConnectionTCP::read() - no more packet");
@@ -268,36 +265,36 @@ const uint8_t* ConnectionTCP::read(int* size)
   }
 
   tmpMsg = mQueueIn.front();
-       uint16_t _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset();
+    uint16_t _size = tmpMsg->GetSize()-tmpMsg->GetNextByteOffset();
 //Console->Print("ConnectionTCP::read() - %d bytes remaining in current packet", _size);
-       if (_size <= 0)
-       {
+    if (_size <= 0)
+    {
 //Console->Print("ConnectionTCP::read() - trying next packet");
-         mQueueIn.pop();
-         delete tmpMsg;
+      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);
+      _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;
+    return ptr;
 }
 
 int ConnectionTCP::write(const void* data, int size)
@@ -308,43 +305,43 @@ int ConnectionTCP::write(const void* data, int size)
 //Console->Print("ConnectionTCP::write() creating new mSendBufferMsg");
     mSendBufferMsg = new PMessage(SENDBUFFERSIZE);
   }
-  
-       mSendBufferMsg->Write(data, (uint16_t)size);
+
+    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;
+    return size;
 }
 
 int ConnectionTCP::write(const char *String)
 {
-       if(!String)
-               return 0;
+    if(!String)
+        return 0;
 
-       return write(String, strlen(String));
+    return write(String, strlen(String));
 }
 
 int ConnectionTCP::write(uint8_t Data)
 {
-       return write(&Data, sizeof(uint8_t));
+    return write(&Data, sizeof(uint8_t));
 }
 
 int ConnectionTCP::write(uint16_t Data)
 {
-       return write(&Data, sizeof(uint16_t));
+    return write(&Data, sizeof(uint16_t));
 }
 
 int ConnectionTCP::write(uint32_t Data)
 {
-       return write(&Data, sizeof(uint32_t));
+    return write(&Data, sizeof(uint32_t));
 }
 
 int ConnectionTCP::write(float Data)
 {
-       return write(&Data, sizeof(float));
+    return write(&Data, sizeof(float));
 }
 
 int ConnectionTCP::write(double Data)
 {
-       return write(&Data, sizeof(double));
+    return write(&Data, sizeof(double));
 }
 
 ConnectionUDP::ConnectionUDP(int sockfd, int port, int remoteadress, int remoteport, ServerSocket* server)
@@ -381,8 +378,8 @@ ConnectionUDP::ConnectionUDP(int sockfd, int port, int remoteadress, int remotep
     //    memset(&(mRemoteAddr.sin_zero), '\0', 8); // zero the rest of the struct
     mSendBufferMsg = NULL;
 
-       mUDP_ID = 0;
-       mSessionID = SESSION_UDP_OFFSET;
+    mUDP_ID = 0;
+    mSessionID = SESSION_UDP_OFFSET;
     mLastUDPID = 0;
     mTransactionID = 0;
 }
@@ -883,12 +880,12 @@ ServerSocket::ServerSocket()
     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;
 }
 
@@ -904,7 +901,6 @@ void ServerSocket::settimeout(int32_t timeout_sec, int32_t timeout_usec)
     m_TimeOut.tv_sec = timeout_sec;
     m_TimeOut.tv_usec = timeout_usec;
   }
-    
 }
 
 bool ServerSocket::open(int port)
@@ -952,9 +948,9 @@ bool ServerSocket::open(int port)
     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);
@@ -971,14 +967,14 @@ 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);
+    //FD_SET (m_ListenerTCP, &m_ReadSetTCP);
 
     // select incoming data for tcp & udp
     tmp_TimeOut = m_TimeOut; //save m_TimeOut... will be modified by select
@@ -986,7 +982,7 @@ void ServerSocket::update()
     {
         perror("select");
     }
-    
+
     //Select exit condition logging
     /*
     if ((tmp_TimeOut.tv_sec == 0) && (tmp_TimeOut.tv_usec == 0))
@@ -995,13 +991,13 @@ void ServerSocket::update()
       Console->LPrint(" Exiting select on timeout (remains %d sec and %d usec)", tmp_TimeOut.tv_sec, tmp_TimeOut.tv_usec);
       Console->LClose();
     }
-    else     
+    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!!
@@ -1079,7 +1075,7 @@ ConnectionUDP* ServerSocket::getUDPConnection(uint32_t remoteadress, int32_t rem
     while (bind(udpSockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1)
     {
       if (errno == EADDRINUSE)
-      {       
+      {
         my_addr.sin_port = htons(++Port);
         if (Port > maxPort)
         {
@@ -1088,7 +1084,7 @@ ConnectionUDP* ServerSocket::getUDPConnection(uint32_t remoteadress, int32_t rem
         }
       }
       else
-      {  
+      {
         perror("udp-bind");
         return NULL;
       }
@@ -1100,10 +1096,10 @@ ConnectionUDP* ServerSocket::getUDPConnection(uint32_t remoteadress, int32_t rem
     {
         m_FdMaxUDP = udpSockfd;
     }
-            
+
     ConnectionUDP* udpConn = new ConnectionUDP(udpSockfd, Port, remoteadress, remoteport, this);
 
-         //m_LastUDPPort++;
+      //m_LastUDPPort++;
 
     return udpConn;
 }
similarity index 98%
rename from server/src/common/netcode.h
rename to TinNS/Source/Common/Netcode.hxx
index b0db933..7ba4a63 100644 (file)
@@ -1,11 +1,8 @@
 #pragma once
 
-#include <iostream>
-#include <chrono>
+#include <cstdint>
 #include <queue>
-#include <map>
 #include <netinet/in.h>
-#include "common/message.h"
 
 #define RECVBUFFERSIZE 4096
 #define SENDBUFFERSIZE 4096
@@ -16,6 +13,7 @@
 
 class ConnectionTCP;
 class ConnectionUDP;
+class PMessage;
 class ServerSocket;
 
 class ConnectionTCP {
similarity index 97%
rename from server/src/common/regex++.cpp
rename to TinNS/Source/Common/RegEx.cxx
index b2417d7..da725cc 100644 (file)
@@ -1,6 +1,5 @@
-#include "common/regex++.h"
-
 #include <cstring>
+#include "Common/Includes.hxx"
 
 RegEx::RegEx(const char * regex, int options)
 {
diff --git a/TinNS/Source/Common/RegEx.hxx b/TinNS/Source/Common/RegEx.hxx
new file mode 100644 (file)
index 0000000..d012af6
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <cstdint>
+
+#ifndef _PCRE_H
+#include "pcre.h"
+#endif
+
+class RegEx {
+private:
+    pcre *re;
+    pcre_extra *pe;
+    int32_t substrcount;
+    int32_t *ovector;
+    const char *lastsubject;
+    int32_t slen;
+    const char **matchlist;
+
+    inline void ClearMatchList(void)
+    {
+        if (matchlist)
+        {
+            pcre_free_substring_list(matchlist);
+            matchlist = NULL;
+        }
+    }
+
+public:
+    RegEx(const char *regex, int32_t options = 0);
+    ~RegEx();
+    inline int32_t SubStrings(void) const { return substrcount; }
+    bool Search(const char *subject, int32_t len = -1, int32_t options = 0);
+    bool SearchAgain(int32_t options = 0);
+    const char *Match(int32_t i = 1);
+};
diff --git a/TinNS/Source/Common/SVNrevision.hxx b/TinNS/Source/Common/SVNrevision.hxx
new file mode 100644 (file)
index 0000000..a04c733
--- /dev/null
@@ -0,0 +1,4 @@
+#pragma once
+
+#define TINNS_SVN_REVISION "AKIKO_CMAKE_R3"
+
diff --git a/TinNS/Source/Common/Semaphore.hxx b/TinNS/Source/Common/Semaphore.hxx
new file mode 100644 (file)
index 0000000..023982d
--- /dev/null
@@ -0,0 +1,49 @@
+#pragma once\r
+\r
+#include <semaphore.h>\r
+\r
+class Semaphore {\r
+private:\r
+    sem_t sem;\r
+\r
+public:\r
+    Semaphore(int init = 0)\r
+    {\r
+        sem_init(&sem, 0, init);\r
+    }\r
+\r
+    virtual ~Semaphore()\r
+    {\r
+        sem_destroy(&sem);\r
+    }\r
+\r
+    void Wait() const\r
+    {\r
+        sem_wait((sem_t *)&sem);\r
+    }\r
+\r
+    int TryWait() const\r
+    {\r
+        return (sem_trywait((sem_t *)&sem) ? errno : 0);\r
+    }\r
+\r
+    int Post() const\r
+    {\r
+        return (sem_post((sem_t *)&sem) ? errno : 0);\r
+    }\r
+\r
+    int GetValue() const\r
+    {\r
+        int val = -1;\r
+\r
+        sem_getvalue((sem_t *)&sem, &val);\r
+\r
+        return (val);\r
+    }\r
+\r
+    void Reset(int init = 0)\r
+    {\r
+        sem_destroy(&sem);\r
+        sem_init(&sem, 0, init);\r
+    }\r
+};\r
similarity index 55%
rename from server/src/include/tinns_thread.h
rename to TinNS/Source/Common/Thread.hxx
index 5b40ee7..70c0e8a 100644 (file)
@@ -1,41 +1,8 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
+#pragma once\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       thread.h - main class of a C++ thread model using the POSIX way\r
-\r
-       MODIFIED: 26 Sep 2005 Akiko\r
-       REASON: - started the implementaion of a thread model\r
-       MODIFIED: 28 Sep 2005 Akiko\r
-       REASON: - fixed the issue with gxx 3.4.3 and gcc 4.x\r
-*/\r
-\r
-\r
-#ifndef THREAD_H\r
-#define THREAD_H\r
-\r
-//this class needs mutex.h, semaphore.h and pthread.h, but it should all come\r
-//from tinns.h\r
+#include <mutex.h>\r
+#include <semaphore.h>\r
+#include <pthread.h>\r
 \r
 #define INVALID_HANDLE 0\r
 \r
@@ -197,66 +164,3 @@ class Thread {
                        unsigned char Flags;\r
                };\r
 };\r
-\r
-/*\r
-       implementation without thread parameters\r
-*/\r
-\r
-/*template <>\r
-class Thread<void> {\r
-       private:\r
-               typedef struct Instance;\r
-\r
-       public:\r
-               typedef pthread_t Handle;\r
-               typedef void (*Handler)();\r
-\r
-       protected:\r
-               Thread<void>() {\r
-               }\r
-\r
-               virtual void ThreadMain() = 0;\r
-\r
-               static void Exit() {\r
-                       pthread_exit(0);\r
-               }\r
-\r
-               static void TextCancel() {\r
-                       pthread_testcancel();\r
-               }\r
-\r
-               static Handle Self() {\r
-                       return((Handle)pthread_self());\r
-               }\r
-\r
-       public:\r
-               static int Create(const Handler &Func, Handle *const &H = 0, const bool &CreateDetached = false,\r
-                                 const unsigned int &StackSize = 0, const bool &CancelEnable = false,\r
-                                 const bool &CancelAsync = false) {\r
-                       M_Create().Locl();\r
-                       pthread_attr_t attr;\r
-                       pthread_attr_init(&attr);\r
-\r
-                       if(CreateDetached)\r
-                               pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\r
-\r
-                       if(StackSize)\r
-                               pthread_attr_setstacksize(&attr, StackSize);\r
-\r
-                       Instance I(0, Func, CancelEnable, CancelAsync);\r
-\r
-                       int run = pthread_create((pthread_t *)H, &attr, ThreadMainHandler, (void *)&I);\r
-                       pthread_attr_destroy(&attr);\r
-\r
-                       if(!run)\r
-                               S_Create().Wait();\r
-                       else if(H)\r
-                               *H = INVALID_HANDLE;\r
-\r
-                       M_Create().Unlock();\r
-\r
-                       return(errno);\r
-               } */\r
-\r
-#endif\r
-\r
diff --git a/TinNS/Source/Common/Version.hxx b/TinNS/Source/Common/Version.hxx
new file mode 100644 (file)
index 0000000..684ebd2
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once\r
+\r
+#include "Common/SVNrevision.hxx"\r
+\r
+#define TINNS_PATCH_VERSION "0.0.2 Dev"\r
+#define TINNS_INFO_VERSION "0.0.2 Dev"\r
+#define TINNS_GAME_VERSION "0.1.38 Dev"\r
similarity index 60%
rename from server/src/game/accounts.cpp
rename to TinNS/Source/GameServer/Accounts.cxx
index a1f0bbd..062599b 100644 (file)
@@ -1,48 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       accounts.cpp\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 26 Dec 2005 Namikon\r
-       REASON: - Added SQLLoad to PAccounts. First step in adding MySQL support to accounts\r
-       MODIFIED: 01 Jan 2006 Namikon\r
-       REASON: - Changed FmtTxt() to sprintf(). It does... uhm, the same :D\r
-       MODIFIED: 06 Jan 2006 Namikon\r
-       REASON: - Removed the old XML loading functions, and changed the SQL ones to work with the Global Neopolis/TinNS Database\r
-               - Added SetBannedStatus(<unix timestamp>) to ban/unban an account (use SetBannedStatus(0) to unban a player)\r
-       MODIFIED: 03 Oct 2006 Hammag\r
-       REASON: - Fixed an issue in PAccount::SetBannedStatus() that was causing the "can't update banned status" error message.\r
-\r
-       MODIFIED: 27 May 2007 Hammag\r
-       REASON: - Full changes for on-demand account access (no more memory-resident account data)\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new build system\r
-               - clean ups\r
-*/\r
-\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /*\r
 NOTE ABOUT ACCESS LEVELS IN THE MYSQL DATABASE:\r
@@ -58,8 +15,6 @@ a_status:
 1 = Online\r
 2 = Banned\r
 */\r
-#include "main.h"\r
-#include "include/accounts.h"\r
 \r
 /** Static members **/\r
 RegEx* PAccount::mUsernameRegexFilter = NULL;\r
@@ -72,7 +27,7 @@ bool PAccount::SetUsernameRegexFilter(const char* RegexStr)
     delete mUsernameRegexFilter;\r
     mUsernameRegexFilter = NULL;\r
   }\r
-  \r
+\r
   if(RegexStr)\r
   {\r
     try {\r
@@ -92,7 +47,7 @@ bool PAccount::SetPasswordRegexFilter(const char* RegexStr)
     delete mPasswordRegexFilter;\r
     mPasswordRegexFilter = NULL;\r
   }\r
-  \r
+\r
   if(RegexStr)\r
   {\r
     try {\r
@@ -125,16 +80,16 @@ bool PAccount::IsPasswordWellFormed(const char *Password)
     return true;\r
 }\r
 \r
-/** Instance members **/           \r
+/** Instance members **/\r
 PAccount::PAccount()\r
 {\r
-       mID = 0;\r
-       mLevel = PAL_BANNED;\r
+    mID = 0;\r
+    mLevel = PAL_BANNED;\r
   mStatus = PAS_OFFLINE;\r
   mBannedUntil = 0;\r
 }\r
 \r
-PAccount::PAccount(const u32 AccountId)\r
+PAccount::PAccount(const uint32_t AccountId)\r
 {\r
   char query[256];\r
   mID = 0;\r
@@ -158,7 +113,7 @@ bool PAccount::LoadFromQuery(char* query)
 {\r
   MYSQL_ROW row = 0;\r
   MYSQL_RES *result = 0;\r
-  \r
+\r
   bool FinalResult = false;\r
 \r
   result = MySQL->InfoResQuery(query);\r
@@ -193,7 +148,7 @@ bool PAccount::LoadFromQuery(char* query)
   {\r
 Console->Print(YELLOW, BLACK, "Failed to load AccountData from SQL; Nothing to load...");\r
   }\r
-  \r
+\r
   MySQL->FreeInfoSQLResult(result);\r
   return FinalResult;\r
 }\r
@@ -224,19 +179,19 @@ bool PAccount::SetPassword(const std::string &Password)
   }\r
 }\r
 \r
-bool PAccount::SetPasswordEncoded(const u8* PasswordData, int PassLen, const u8* Key)\r
+bool PAccount::SetPasswordEncoded(const uint8_t* PasswordData, int PassLen, const uint8_t* Key)\r
 {\r
-       char Pass[128];\r
-       \r
-       if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
+    char Pass[128];\r
+\r
+    if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
   {\r
-               return SetPassword((std::string)Pass);\r
-       }\r
-       else\r
-       {\r
-               Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
-               return false;\r
-       }\r
+        return SetPassword((std::string)Pass);\r
+    }\r
+    else\r
+    {\r
+        Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
+        return false;\r
+    }\r
 }\r
 \r
 bool PAccount::SetLevel(int newLevel)\r
@@ -254,17 +209,17 @@ bool PAccount::SetLevel(int newLevel)
 \r
 std::string PAccount::GetLevelString() const\r
 {\r
-       switch(mLevel)\r
-       {\r
-               case PAL_BANNED : return "banned";\r
-               case PAL_UNREGPLAYER : return "unregplayer";\r
-               case PAL_REGPLAYER : return "regplayer";\r
-               case PAL_VOLUNTEER : return "volunteer";\r
-               case PAL_GM : return "gm";\r
-               case PAL_ADMIN : return "admin";\r
-       }\r
-\r
-       return "custom";\r
+    switch(mLevel)\r
+    {\r
+        case PAL_BANNED : return "banned";\r
+        case PAL_UNREGPLAYER : return "unregplayer";\r
+        case PAL_REGPLAYER : return "regplayer";\r
+        case PAL_VOLUNTEER : return "volunteer";\r
+        case PAL_GM : return "gm";\r
+        case PAL_ADMIN : return "admin";\r
+    }\r
+\r
+    return "custom";\r
 }\r
 \r
 bool PAccount::SetStatus(PAccountStatus Status)\r
@@ -286,55 +241,55 @@ bool PAccount::SetBannedUntilTime(std::time_t BannedUntil)
   }\r
 }\r
 \r
-bool PAccount::DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key, char* ClearPassword)\r
+bool PAccount::DecodePassword(const uint8_t* PasswordData, int PassLen, const uint8_t *Key, char* ClearPassword)\r
 {\r
   ClearPassword[0] = 0;\r
-  \r
+\r
   if(PassLen < 128)\r
-       {\r
-               if(Key[0]>7) // TODO: >7 correct?\r
-               {\r
-                       for(int i=0; i<PassLen; i+=2)\r
-                               ClearPassword[i>>1] = (char)(((PasswordData[i]&0xf0)>>4)\r
-                                       +((PasswordData[i+1]&0x0f)<<4)-Key[0]);\r
-                       ClearPassword[PassLen>>1]=0;\r
-               }\r
-               else\r
-               {\r
-                       for(int i=0; i<PassLen; i++)\r
-                               ClearPassword[i] = (char)(PasswordData[i]-Key[0]);\r
-                       ClearPassword[PassLen]=0;\r
-               }\r
-               return true;\r
-       }\r
-       else\r
-         return false;\r
+    {\r
+        if(Key[0]>7) // TODO: >7 correct?\r
+        {\r
+            for(int i=0; i<PassLen; i+=2)\r
+                ClearPassword[i>>1] = (char)(((PasswordData[i]&0xf0)>>4)\r
+                    +((PasswordData[i+1]&0x0f)<<4)-Key[0]);\r
+            ClearPassword[PassLen>>1]=0;\r
+        }\r
+        else\r
+        {\r
+            for(int i=0; i<PassLen; i++)\r
+                ClearPassword[i] = (char)(PasswordData[i]-Key[0]);\r
+            ClearPassword[PassLen]=0;\r
+        }\r
+        return true;\r
+    }\r
+    else\r
+      return false;\r
 }\r
 \r
-bool PAccount::Authenticate(const u8* PasswordData, int PassLen, const u8 *Key)\r
+bool PAccount::Authenticate(const uint8_t* PasswordData, int PassLen, const uint8_t *Key)\r
 {\r
-       char Pass[128];\r
-       \r
-       if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
+    char Pass[128];\r
+\r
+    if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
   {\r
-               return Authenticate(Pass);\r
-       }\r
-       else\r
-       {\r
-               Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
-               return false;\r
-       }\r
+        return Authenticate(Pass);\r
+    }\r
+    else\r
+    {\r
+        Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
+        return false;\r
+    }\r
 }\r
 \r
 bool PAccount::Authenticate(const char *Password) const\r
 {\r
-       if(mID == 0) // User doesn't exist and that hasn't been checked !\r
-       {\r
-         Console->Print(RED, BLACK, "[Bug]: user %s doesn't exist and was not checked by code !", mName.c_str());\r
-         return false;\r
-       }\r
-       \r
-       return(mPassword == Password);\r
+    if(mID == 0) // User doesn't exist and that hasn't been checked !\r
+    {\r
+      Console->Print(RED, BLACK, "[Bug]: user %s doesn't exist and was not checked by code !", mName.c_str());\r
+      return false;\r
+    }\r
+\r
+    return(mPassword == Password);\r
 }\r
 \r
 bool PAccount::Create()\r
@@ -355,7 +310,7 @@ bool PAccount::Save(bool CreateMode)
   char escPassword[256];\r
   MySQL->EscapeString(mName.c_str(), escUsername, 256);\r
   MySQL->EscapeString(mPassword.c_str(), escPassword, 256);\r
-    \r
+\r
   std::string Query;\r
   Query = CreateMode ? "INSERT INTO" : "UPDATE";\r
   Query += "accounts SET ";\r
@@ -375,15 +330,15 @@ bool PAccount::Save(bool CreateMode)
   return true;\r
 }\r
 \r
-u32 PAccount::GetCharIdBySlot(const u32 SlotId)\r
+uint32_t PAccount::GetCharIdBySlot(const uint32_t SlotId)\r
 {\r
   char query[256];\r
-  u32 CharId = 0;\r
-  \r
+  uint32_t CharId = 0;\r
+\r
   MYSQL_ROW row = 0;\r
   MYSQL_RES *result = 0;\r
-  \r
-  snprintf(query, 256, "SELECT c_id FROM characters WHERE a_id = %d AND c_slot = %d LIMIT 1;", mID, SlotId);  \r
+\r
+  snprintf(query, 256, "SELECT c_id FROM characters WHERE a_id = %d AND c_slot = %d LIMIT 1;", mID, SlotId);\r
 \r
   result = MySQL->GameResQuery(query);\r
   if(result == NULL)\r
@@ -397,14 +352,14 @@ u32 PAccount::GetCharIdBySlot(const u32 SlotId)
   {\r
     CharId = atoi(row[0]);\r
   }\r
-  \r
+\r
   MySQL->FreeGameSQLResult(result);\r
-  \r
+\r
   /*** Temporary workaround to cope with DB where c_slot is not set ***/\r
   if(!CharId)\r
   {\r
     snprintf(query, 256, "SELECT c_id FROM characters WHERE a_id = %d ORDER BY c_slot ASC, c_id ASC LIMIT %d, 1;", mID, SlotId);\r
-  \r
+\r
     result = MySQL->GameResQuery(query);\r
     if(result == NULL)\r
     {\r
@@ -412,16 +367,16 @@ u32 PAccount::GetCharIdBySlot(const u32 SlotId)
         MySQL->ShowGameSQLError();\r
         return 0;\r
     }\r
-    \r
+\r
     if((row = mysql_fetch_row(result)))\r
     {\r
       CharId = atoi(row[0]);\r
     }\r
-    \r
-    MySQL->FreeGameSQLResult(result);    \r
+\r
+    MySQL->FreeGameSQLResult(result);\r
   }\r
   /*** End of workaround ***/\r
-  \r
+\r
   return CharId;\r
 }\r
 \r
@@ -429,7 +384,7 @@ u32 PAccount::GetCharIdBySlot(const u32 SlotId)
 std::string PAccount::GetBannedTime() const\r
 {\r
   const char* unit[5] = {"seconds", "minutes", "hours", "days", "weeks"};\r
-  \r
+\r
   std::time_t timediff = mBannedUntil - std::time(NULL);\r
   if(timediff <=0)\r
   {\r
diff --git a/TinNS/Source/GameServer/Accounts.hxx b/TinNS/Source/GameServer/Accounts.hxx
new file mode 100644 (file)
index 0000000..7301c1e
--- /dev/null
@@ -0,0 +1,101 @@
+#pragma once\r
+\r
+#include <chrono>\r
+#include <cstdint>\r
+#include <string>\r
+\r
+class RegEx;\r
+\r
+/*\r
+0 = unregistered user\r
+1 = Registered user\r
+30 = volunteer\r
+50 = GM\r
+100 = Admin\r
+*/\r
+\r
+// New way of AccountLevel handling:\r
+// Every level is possible, the following values are only edge values. We need a bit control about that\r
+#define PAL_BANNED -1\r
+#define PAL_UNREGPLAYER 0\r
+#define PAL_REGPLAYER 1\r
+#define PAL_VOLUNTEER 30 // Special Rank: 50/50\r
+#define PAL_GM 50 // Special Rank: 120/120\r
+#define PAL_ADMIN 100 // Special Rank: 127/127\r
+\r
+// Max number of char slots per account\r
+#define MAX_CHARS_PER_ACCOUNT  4\r
+\r
+/*\r
+0 = Offline\r
+1 = Online\r
+2 = Banned\r
+*/\r
+\r
+enum PAccountStatus\r
+{\r
+    PAS_OFFLINE = 0,\r
+    PAS_ONLINE = 1,\r
+    PAS_BANNED = 2\r
+};\r
+\r
+class PAccount {\r
+    private :\r
+    // SQL Layout\r
+    enum {\r
+        a_id,\r
+        a_username,\r
+        a_password,\r
+        a_priv,\r
+        a_status,\r
+        a_bandate\r
+    };\r
+\r
+    // static members\r
+      static RegEx* mUsernameRegexFilter;\r
+      static RegEx* mPasswordRegexFilter;\r
+\r
+      // instance members\r
+      uint32_t mID;\r
+      std::string mName;\r
+      std::string mPassword;\r
+    int mLevel;\r
+    PAccountStatus mStatus;\r
+    time_t mBannedUntil;\r
+\r
+    bool LoadFromQuery(char* query);\r
+    bool DecodePassword(const uint8_t* PasswordData, int PassLen, const uint8_t *Key, char* ClearPassword);\r
+\r
+    public :\r
+      PAccount();\r
+      PAccount(const uint32_t AccountId);\r
+      PAccount(const char *Username);\r
+\r
+      static bool SetUsernameRegexFilter(const char* RegexStr);\r
+        static bool SetPasswordRegexFilter(const char* RegexStr);\r
+        static bool IsUsernameWellFormed(const char *Username);\r
+        static bool IsPasswordWellFormed(const char *Password);\r
+\r
+        inline uint32_t GetID() const { return mID; }\r
+        bool SetName(const std::string &Pass);\r
+        inline const std::string &GetName() const { return mName; }\r
+        bool SetPassword(const std::string &Pass);\r
+        bool SetPasswordEncoded(const uint8_t* PasswordData, int PassLen, const uint8_t *Key);\r
+        inline const std::string &GetPassword() const { return mPassword; }\r
+    bool SetLevel(int newLevel);\r
+        inline int GetLevel() const { return mLevel; }\r
+        std::string GetLevelString() const;\r
+    bool SetStatus(PAccountStatus Status);\r
+        inline PAccountStatus GetStatus() const { return mStatus; }\r
+        bool SetBannedUntilTime(time_t BannedUntil);\r
+    inline bool IsBanned() const { return (mBannedUntil > std::time(NULL)); }\r
+    std::string GetBannedTime() const;\r
+\r
+        bool Authenticate(const uint8_t* PasswordData, int PassLen, const uint8_t *Key);\r
+        bool Authenticate(const char *Password) const;\r
+\r
+        bool Create();\r
+    bool Save(bool CreateMode = false);\r
+\r
+    uint32_t GetCharIdBySlot(const uint32_t SlotId);\r
+};\r
similarity index 75%
rename from server/src/game/appartements.cpp
rename to TinNS/Source/GameServer/Appartements.cxx
index 0da9610..062ecc3 100644 (file)
@@ -1,40 +1,7 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       appartements.cpp - appartements class\r
-\r
-       MODIFIED: 20 Nov 2006 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "include/appartements.h"\r
-#include "include/gamedefs.h"\r
-#include "include/def_appartements.h"\r
-#include "include/worlds.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 PAppartements::PAppartements()\r
 {\r
@@ -42,15 +9,15 @@ PAppartements::PAppartements()
 \r
 //PAppartements::~PAppartements() {};\r
 \r
-u32 PAppartements::CreateBaseAppartement(u32 nCharID, std::string nPassword, u8 nFactionID)\r
+uint32_t PAppartements::CreateBaseAppartement(uint32_t nCharID, std::string nPassword, uint8_t nFactionID)\r
 {\r
   typedef std::vector< std::pair<int, int> > PAppVector; //<AppType, AppPlace>\r
-    \r
-  PAppVector CandidateApts;  \r
+\r
+  PAppVector CandidateApts;\r
   CandidateApts.reserve(32);\r
-  u16 j;\r
+  uint16_t j;\r
   int AppType;\r
-  \r
+\r
   for (std::map<int, PDefAppartement*>::const_iterator i=GameDefs->Appartements()->ConstIteratorBegin(); i!=GameDefs->Appartements()->ConstIteratorEnd(); i++)\r
   {\r
     if (i->second->GetFaction() == nFactionID)\r
@@ -66,13 +33,13 @@ if (gDevDebug) Console->Print("Added potential Apt of type %d in place %d", AppT
       }\r
     }\r
   }\r
-  \r
+\r
   if(CandidateApts.size())\r
   {\r
     j = GetRandom(CandidateApts.size()-1);\r
 if (gDevDebug) Console->Print("Apt n� %d chosen in %d for faction %d", j+1, CandidateApts.size(), nFactionID);\r
 \r
-if (gDevDebug) Console->Print("Choosed Apt of type %d in place %d", CandidateApts[j].first, CandidateApts[j].second);    \r
+if (gDevDebug) Console->Print("Choosed Apt of type %d in place %d", CandidateApts[j].first, CandidateApts[j].second);\r
 \r
     char escPassword[256];\r
     MySQL->EscapeString(nPassword.c_str(), escPassword, 256);\r
@@ -92,7 +59,7 @@ if (gDevDebug) Console->Print("Choosed Apt of type %d in place %d", CandidateApt
     return 0;\r
 }\r
 \r
-void PAppartements::DeleteCharAppartements(u32 nCharID)\r
+void PAppartements::DeleteCharAppartements(uint32_t nCharID)\r
 {\r
     char query[256];\r
     snprintf(query, 256, "DELETE FROM apartments WHERE (apt_owner='%u');", nCharID);\r
@@ -107,15 +74,15 @@ void PAppartements::DeleteCharAppartements(u32 nCharID)
 if (gDevDebug) Console->Print(YELLOW, BLACK, "PAppartements::DeleteCharAppartements does not delete appartements content yet");      \r
 }\r
 \r
-bool PAppartements::CanFreelyEnter(PChar* nChar, u32 nLocation)\r
+bool PAppartements::CanFreelyEnter(PChar* nChar, uint32_t nLocation)\r
 {\r
-  u32 OwnerID = GetAptOwner(nLocation);\r
+  uint32_t OwnerID = GetAptOwner(nLocation);\r
   return (OwnerID == nChar->GetID());\r
-  \r
+\r
   // here we could manage Clan appartements access too.\r
 }\r
 \r
-int PAppartements::GetAptID(unsigned int AptLoc, const u8 *pass)\r
+int PAppartements::GetAptID(unsigned int AptLoc, const uint8_t *pass)\r
 {\r
     int type;\r
     MYSQL_RES *result;\r
@@ -223,7 +190,7 @@ int PAppartements::GetAptLocation(int loc)
     MYSQL_ROW row;\r
     char query[255];\r
 \r
-    if((u32)loc > PWorlds::mAptBaseWorldId)\r
+    if((uint32_t)loc > PWorlds::mAptBaseWorldId)\r
         loc = loc - PWorlds::mAptBaseWorldId;\r
 \r
     snprintf (query, 255, "SELECT apt_location FROM apartments WHERE apt_id = %i", loc);\r
diff --git a/TinNS/Source/GameServer/Appartements.hxx b/TinNS/Source/GameServer/Appartements.hxx
new file mode 100644 (file)
index 0000000..9643be0
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+\r
+class PChar;\r
+\r
+class PAppartements {\r
+public:\r
+    PAppartements();\r
+    //~PAppartements();\r
+\r
+    uint32_t CreateBaseAppartement(uint32_t nCharID, std::string nPassword, uint8_t nFactionID);\r
+    void DeleteCharAppartements(uint32_t nCharID);\r
+    bool CanFreelyEnter(PChar* nChar, uint32_t nLocation);\r
+    int GetAptID(unsigned int AptLoc, const uint8_t *pass);\r
+    int GetAptType(int AptID);\r
+    int GetAptOwner(int loc);\r
+    int GetAptLocation(int loc);\r
+};\r
similarity index 66%
rename from server/src/game/buddylist.cpp
rename to TinNS/Source/GameServer/BuddyList.cxx
index 558b6db..54f32f4 100644 (file)
@@ -1,41 +1,8 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       buddylist.cpp - class for chat buddylist\r
-\r
-       MODIFIED: 19 Sep 2006 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - clean ups\r
-\r
-       TODO: - link with a online char list, updated when needed (chars in/out, or list modified)\r
-*/\r
-\r
-#include "main.h"\r
-#include "include/buddylist.h"\r
-\r
-PBuddyList::PBuddyList(u32 nOwnerCharID)\r
+PBuddyList::PBuddyList(uint32_t nOwnerCharID)\r
 {\r
     mOwnerCharID = nOwnerCharID;\r
     mListMaxSize = mListSize = 0;\r
@@ -49,7 +16,7 @@ PBuddyList::~PBuddyList()
         delete[] mCharIDList;\r
 }\r
 \r
-bool PBuddyList::AddChar(u32 nBuddyCharID)\r
+bool PBuddyList::AddChar(uint32_t nBuddyCharID)\r
 {\r
     char query[256];\r
 \r
@@ -77,10 +44,10 @@ bool PBuddyList::AddChar(u32 nBuddyCharID)
         return false;\r
 }\r
 \r
-bool PBuddyList::RemoveChar(u32 nBuddyCharID)\r
+bool PBuddyList::RemoveChar(uint32_t nBuddyCharID)\r
 {\r
     char query[256];\r
-    u8 rEntry, i;\r
+    uint8_t rEntry, i;\r
 \r
     if ((rEntry = FindEntry(nBuddyCharID)) < mListSize)\r
     {\r
@@ -111,7 +78,7 @@ bool PBuddyList::SQLLoad()
     char query[256];\r
     MYSQL_RES *result;\r
     MYSQL_ROW row;\r
-    u8 EntriesNum;\r
+    uint8_t EntriesNum;\r
 \r
     snprintf(query, 256, "SELECT * FROM buddy_list WHERE (bud_charid='%u')", mOwnerCharID);\r
     result = MySQL->GameResQuery(query);\r
@@ -139,9 +106,9 @@ bool PBuddyList::SQLLoad()
     return true;\r
 }\r
 \r
-void PBuddyList::IncreaseMaxSize(u8 nNewMax)\r
+void PBuddyList::IncreaseMaxSize(uint8_t nNewMax)\r
 {\r
-    u16 tmpSize;\r
+    uint16_t tmpSize;\r
 \r
     if (!nNewMax)\r
     {\r
@@ -159,12 +126,12 @@ void PBuddyList::IncreaseMaxSize(u8 nNewMax)
 \r
     mListMaxSize = (tmpSize < 256) ? tmpSize : 255;\r
 \r
-    u32* tmpList = new u32[mListMaxSize];\r
+    uint32_t* tmpList = new uint32_t[mListMaxSize];\r
     if (mCharIDList)\r
     {\r
         if (mListSize)\r
         {\r
-            memcpy(tmpList, mCharIDList, sizeof(u32) * mListSize);\r
+            memcpy(tmpList, mCharIDList, sizeof(uint32_t) * mListSize);\r
         }\r
 \r
         delete[] mCharIDList;\r
@@ -172,9 +139,9 @@ void PBuddyList::IncreaseMaxSize(u8 nNewMax)
     mCharIDList = tmpList;\r
 }\r
 \r
-u8 PBuddyList::FindEntry(u32 CharID)\r
+uint8_t PBuddyList::FindEntry(uint32_t CharID)\r
 {\r
-    u8 i = 255;\r
+    uint8_t i = 255;\r
 \r
     if (mCharIDList)\r
     {\r
@@ -188,11 +155,11 @@ u8 PBuddyList::FindEntry(u32 CharID)
     return i;\r
 }\r
 \r
-bool PBuddyList::IsInBuddy(u32 CharID)\r
+bool PBuddyList::IsInBuddy(uint32_t CharID)\r
 {\r
     if (mCharIDList)\r
     {\r
-        for (u8 i = 0; i < mListSize; i++)\r
+        for (uint8_t i = 0; i < mListSize; i++)\r
         {\r
             if (mCharIDList[i] == CharID)\r
                 return true;\r
diff --git a/TinNS/Source/GameServer/BuddyList.hxx b/TinNS/Source/GameServer/BuddyList.hxx
new file mode 100644 (file)
index 0000000..257c23d
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+#define BUDDYLIST_ALLOC_SIZE 4 // atomicity of list entries allocation\r
+\r
+class PBuddyList {\r
+  private:\r
+    enum { // buddy_list DB Table fields\r
+        bud_id = 0,\r
+        bud_charid,\r
+        bud_buddyid\r
+    };\r
+\r
+    uint32_t mOwnerCharID;\r
+    uint8_t mListMaxSize;\r
+    uint8_t mListSize;\r
+    uint32_t* mCharIDList;\r
+\r
+    void IncreaseMaxSize(uint8_t nNewMax = 0);\r
+    uint8_t FindEntry(uint32_t CharID);\r
+\r
+  public:\r
+    PBuddyList(uint32_t nOwnerCharID);\r
+    ~PBuddyList();\r
+    bool AddChar(uint32_t nBuddyCharID);\r
+    bool RemoveChar(uint32_t nBuddyCharID);\r
+    inline uint8_t Count() { return mListSize; }\r
+    uint16_t GetListDataSize() { return (sizeof(uint32_t) * mListSize); }\r
+    const void* GetListData() { return (const void*)mCharIDList; }\r
+    bool SQLLoad();\r
+\r
+    bool IsInBuddy(uint32_t CharID);\r
+//    bool SQLSave();\r
+};\r
diff --git a/TinNS/Source/GameServer/CMakeLists.txt b/TinNS/Source/GameServer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..479ed02
--- /dev/null
@@ -0,0 +1,18 @@
+INCLUDE_DIRECTORIES     (${CURRENT_SOURCE_DIR} ${LUA53_INCLUDE_DIR})
+
+ADD_SUBDIRECTORY        (Decoder)
+ADD_SUBDIRECTORY        (Definitions)
+ADD_SUBDIRECTORY        (GameCommands)
+
+ADD_EXECUTABLE          (GameServer
+                         Accounts.cxx Appartements.cxx BuddyList.cxx Chars.cxx Chat.cxx Client.cxx ClientManager.cxx
+                         Commands.cxx Container.cxx DoorTemplate.cxx FurnitureTemplate.cxx GameScript.cxx
+                         GameServer.cxx GenrepList.cxx Includes.cxx Isc.cxx Inventory.cxx Item.cxx LuaEngine.cxx
+                         Main.cxx MessageBuilder.cxx MultiPart.cxx Npc.cxx NpcAi.cxx NpcConversation.cxx NpcTemplate.cxx
+                         Outpost.cxx RemoteConsole.cxx Server.cxx Skill.cxx Sql.cxx Subway.cxx Terminal.cxx
+                         TerminalQueryDatabase.cxx TerminalReceiveDatabase.cxx TerminalTryAccess.cxx
+                         TerminalUpdateDatabase.cxx Vehicle.cxx VehicleAccessRequest.cxx WorldActors.cxx
+                         WorldDataTemplate.cxx Worlds.cxx Zoning.cxx)
+
+TARGET_LINK_LIBRARIES   (GameServer Common Decoder Definitions GameCommands ${MYSQL_LIBRARY} ${PCRE_LIBRARY}
+                                    ${ZLIB_LIBRARY} ${RT_LIBRARY} ${LUA53_LIBRARY})
similarity index 82%
rename from server/src/game/chars.cpp
rename to TinNS/Source/GameServer/Chars.cxx
index 99eb049..cd9f727 100644 (file)
@@ -1,93 +1,40 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       chars.cpp\r
-\r
-       MODIFIED: 22 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 01 Jan 2006 Namikon\r
-       REASON: - Added SQLLoad() function to PChar and PChars\r
-               - Changed FmtTxt() to sprintf(). It does... uhm, the same :D\r
-               - Added IsOnline var and function\r
-       MODIFIED: 06 Jan 2005 Namikon\r
-       REASON: - Added colored console ouputs\r
-               - Removed XM Load() and Save() functions\r
-               - Rewrote parts of SQLLoad to work with the global NeoPolis / TinNS database\r
-               - Added FillinCharDetails to fill the baseline up with the char details\r
-       MODIFIED: 03 Oct 2006 Hammag\r
-       REASON: - PChar::CreateNewChar() and moved effective char creation from PChars to PChar\r
-               - added PChar::SQLDelete()\r
-                 This method is put here because we want the char to be loaded when deleted from DB to avoid\r
-                 any player to use it at the same time.\r
-               - added use of auto_save_period config option in PChars::update()\r
-               - removed old XML-storage related code\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for ne buildsystem\r
-               - clean ups\r
-\r
-       TODO:   - implement PChar::SQLDelete()\r
-*/\r
-\r
-#include "main.h"\r
-#include "include/worlds.h"\r
-#include "include/appartements.h"\r
-#include "include/container.h"\r
-#include "include/inventory.h"\r
-#include "include/vhcaccessrequest.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 // PCharCoordinates\r
-void PCharCoordinates::SetInterpolate( PCharCoordinates& Pos1, PCharCoordinates& Pos2, f32 nCoef )\r
+void PCharCoordinates::SetInterpolate( PCharCoordinates& Pos1, PCharCoordinates& Pos2, float nCoef )\r
 {\r
   if (( nCoef < 0 ) || ( nCoef > 1 ) )\r
   {\r
     Console->Print( RED, BLACK, "[Error] PCharCoordinates::Interpolate : Invalid nCoef value: %f", nCoef );\r
     nCoef = 0;\r
   }\r
-  f32 rCoef = 1 - nCoef;\r
+  float rCoef = 1 - nCoef;\r
 \r
-  mY = ( u16 )( rCoef * Pos1.mY + nCoef * Pos2.mY );\r
-  mZ = ( u16 )( rCoef * Pos1.mZ + nCoef * Pos2.mZ );\r
-  mX = ( u16 )( rCoef * Pos1.mX + nCoef * Pos2.mX );\r
-  mUD = ( u8 )( rCoef * Pos1.mUD + nCoef * Pos2.mUD );\r
+  mY = ( uint16_t )( rCoef * Pos1.mY + nCoef * Pos2.mY );\r
+  mZ = ( uint16_t )( rCoef * Pos1.mZ + nCoef * Pos2.mZ );\r
+  mX = ( uint16_t )( rCoef * Pos1.mX + nCoef * Pos2.mX );\r
+  mUD = ( uint8_t )( rCoef * Pos1.mUD + nCoef * Pos2.mUD );\r
   if ( abs( Pos1.mLR - Pos2.mLR ) < 90 )\r
   {\r
-    mLR = ( u8 )( rCoef * Pos1.mLR + nCoef * Pos2.mLR );\r
+    mLR = ( uint8_t )( rCoef * Pos1.mLR + nCoef * Pos2.mLR );\r
   }\r
   else\r
   {\r
-    mLR = ( u8 )(( u16 )( rCoef * ( 180.0 + ( f32 )Pos1.mLR ) + nCoef * Pos2.mLR ) % 180 );\r
+    mLR = ( uint8_t )(( uint16_t )( rCoef * ( 180.0 + ( float )Pos1.mLR ) + nCoef * Pos2.mLR ) % 180 );\r
   }\r
 }\r
 \r
-u16 mY;     // Y-Position in world\r
-u16 mZ;     // Z-Position in world\r
-u16 mX;     // X-Position in world\r
-u8 mUD;     // Up - Mid - Down (d6 - 80 - 2a)\r
-u8 mLR;     // Compass direction (S..E..N..W..S [0-45-90-135-179])\r
-u8 mAct;    // Last user action state\r
+uint16_t mY;     // Y-Position in world\r
+uint16_t mZ;     // Z-Position in world\r
+uint16_t mX;     // X-Position in world\r
+uint8_t mUD;     // Up - Mid - Down (d6 - 80 - 2a)\r
+uint8_t mLR;     // Compass direction (S..E..N..W..S [0-45-90-135-179])\r
+uint8_t mAct;    // Last user action state\r
 \r
-void PCharCoordinates::SetPosition( u16 nY, u16 nZ, u16 nX, u8 nUD, u8 nLR )\r
+void PCharCoordinates::SetPosition( uint16_t nY, uint16_t nZ, uint16_t nX, uint8_t nUD, uint8_t nLR )\r
 {\r
   mY = nY;\r
   mZ = nZ;\r
@@ -221,7 +168,7 @@ PChar::PChar()
   mSeatInUseObjectId = 0;\r
   mSeatInUseSeatId = 0;\r
   mVhcAccessRequestList = NULL;\r
-  \r
+\r
   mContainerInExclusiveUse = NULL;\r
 \r
   mIsOnline = false;\r
@@ -300,7 +247,7 @@ bool PChar::IsCharnameWellFormed( const char *Charname )
     return true;\r
 }\r
 \r
-void PChar::SetProfession( u32 Profession )\r
+void PChar::SetProfession( uint32_t Profession )\r
 {\r
   const PDefCharKind *def = GameDefs->CharKinds()->GetDef( Profession );\r
   if ( def == NULL )\r
@@ -317,23 +264,23 @@ void PChar::SetProfession( u32 Profession )
   SetDirtyFlag();\r
 }\r
 \r
-u32 PChar::GetSkinFromCharType( u32 nType )\r
+uint32_t PChar::GetSkinFromCharType( uint32_t nType )\r
 {\r
   const PDefCharacter* nDefCharacter = GameDefs->Chars()->GetDef( nType );\r
   if ( nDefCharacter )\r
   {\r
-    return (( u32 )( nDefCharacter->GetModel() ) );\r
+    return (( uint32_t )( nDefCharacter->GetModel() ) );\r
   }\r
   else\r
     return 0;\r
 }\r
 \r
-inline u32 PChar::GetBaseModel()\r
+inline uint32_t PChar::GetBaseModel()\r
 {\r
   return GetSkinFromCharType( GetType() );\r
 }\r
 \r
-void PChar::SetRealLook( u32 nHead, u32 nTorso, u32 nLegs )\r
+void PChar::SetRealLook( uint32_t nHead, uint32_t nTorso, uint32_t nLegs )\r
 {\r
   mRealHead = nHead;\r
   mRealTorso = nTorso;\r
@@ -342,7 +289,7 @@ void PChar::SetRealLook( u32 nHead, u32 nTorso, u32 nLegs )
   ResetCurrentLook();\r
 }\r
 \r
-void PChar::GetRealLook( u32 &nSkin, u32 &nHead, u32 &nTorso, u32 &nLegs )\r
+void PChar::GetRealLook( uint32_t &nSkin, uint32_t &nHead, uint32_t &nTorso, uint32_t &nLegs )\r
 {\r
   nSkin = GetBaseModel();\r
   nHead = mRealHead;\r
@@ -350,21 +297,21 @@ void PChar::GetRealLook( u32 &nSkin, u32 &nHead, u32 &nTorso, u32 &nLegs )
   nLegs = mRealLegs;\r
 }\r
 \r
-void PChar::SetCurrentLookFromCharType( u32 nType )\r
+void PChar::SetCurrentLookFromCharType( uint32_t nType )\r
 {\r
   int iHead, iTorso, iLegs;\r
-  u32 nSkin, nHead, nTorso, nLegs;\r
-  u8 nColor, nBrightness;\r
+  uint32_t nSkin, nHead, nTorso, nLegs;\r
+  uint8_t nColor, nBrightness;\r
 \r
   const PDefCharacter* nDefCharacter = GameDefs->Chars()->GetDef( nType );\r
   if ( nDefCharacter )\r
   {\r
-    nSkin = ( u32 ) nDefCharacter->GetModel();\r
+    nSkin = ( uint32_t ) nDefCharacter->GetModel();\r
     iHead = nDefCharacter->GetHead();\r
     iTorso = nDefCharacter->GetTorso();\r
     iLegs = nDefCharacter->GetLegs();\r
-    nColor = ( u8 )( 0xff & nDefCharacter->GetColor() );\r
-    nBrightness = ( u8 )( 0xff & nDefCharacter->GetBrightness() );\r
+    nColor = ( uint8_t )( 0xff & nDefCharacter->GetColor() );\r
+    nBrightness = ( uint8_t )( 0xff & nDefCharacter->GetBrightness() );\r
 \r
 \r
     if (( iHead < 0 ) || ( iTorso < 0 ) || ( iLegs < 0 ) )\r
@@ -383,7 +330,7 @@ void PChar::SetCurrentLookFromCharType( u32 nType )
   }\r
 }\r
 \r
-void PChar::SetCurrentLook( u32 nSkin, u32 nHead, u32 nTorso, u32 nLegs )\r
+void PChar::SetCurrentLook( uint32_t nSkin, uint32_t nHead, uint32_t nTorso, uint32_t nLegs )\r
 {\r
   mSkin = nSkin;\r
   mHead = nHead;\r
@@ -400,7 +347,7 @@ void PChar::ResetCurrentLook()
 }\r
 \r
 // GetCurrentLook will later have to take Power Armors and GM overrides into account\r
-void PChar::GetCurrentLook( u32 &nSkin, u32 &nHead, u32 &nTorso, u32 &nLegs )\r
+void PChar::GetCurrentLook( uint32_t &nSkin, uint32_t &nHead, uint32_t &nTorso, uint32_t &nLegs )\r
 {\r
   nSkin = mSkin;\r
   nHead = mHead;\r
@@ -408,7 +355,7 @@ void PChar::GetCurrentLook( u32 &nSkin, u32 &nHead, u32 &nTorso, u32 &nLegs )
   nLegs = mLegs;\r
 }\r
 \r
-void PChar::SetCurrentBodyColor( u8 nHeadColor, u8 nTorsoColor, u8 nLegsColor, u8 nHeadDarkness, u8 nTorsoDarkness, u8 nLegsDarkness )\r
+void PChar::SetCurrentBodyColor( uint8_t nHeadColor, uint8_t nTorsoColor, uint8_t nLegsColor, uint8_t nHeadDarkness, uint8_t nTorsoDarkness, uint8_t nLegsDarkness )\r
 {\r
   mHeadColor = nHeadColor;\r
   mTorsoColor = nTorsoColor;\r
@@ -418,7 +365,7 @@ void PChar::SetCurrentBodyColor( u8 nHeadColor, u8 nTorsoColor, u8 nLegsColor, u
   mLegsDarkness = nLegsDarkness;\r
 }\r
 \r
-void PChar::GetCurrentBodyColor( u8 &nHeadColor, u8 &nTorsoColor, u8 &nLegsColor, u8 &nHeadDarkness, u8 &nTorsoDarkness, u8 &nLegsDarkness )\r
+void PChar::GetCurrentBodyColor( uint8_t &nHeadColor, uint8_t &nTorsoColor, uint8_t &nLegsColor, uint8_t &nHeadDarkness, uint8_t &nTorsoDarkness, uint8_t &nLegsDarkness )\r
 {\r
   nHeadColor = mHeadColor;\r
   nTorsoColor = mTorsoColor;\r
@@ -458,7 +405,7 @@ void PChar::SetBaseSkills()
   Console->Print( YELLOW, BLACK, "PChar::SetBaseSkills() not fully functionnal - unused skill points will be lost" );\r
 }\r
 \r
-void PChar::SetBaseSubskills( u8 NSZNb, const char* NonZeroSubskills )\r
+void PChar::SetBaseSubskills( uint8_t NSZNb, const char* NonZeroSubskills )\r
 {\r
   int i;\r
 \r
@@ -473,8 +420,8 @@ void PChar::SetBaseSubskills( u8 NSZNb, const char* NonZeroSubskills )
 \r
 void PChar::SetBaseInventory()\r
 {\r
-  u8 i;\r
-  u32 BaseItemID;\r
+  uint8_t i;\r
+  uint32_t BaseItemID;\r
   const PDefCharKind *def = GameDefs->CharKinds()->GetDef( mProfession );\r
 \r
   //mCash = 5000;\r
@@ -551,7 +498,7 @@ bool PChar::SQLLoad( int CharID )
     // Gender\r
     int genvalue = atoi( row[c_sex] );\r
     if (( genvalue == 0 ) || ( genvalue == 1 ) )\r
-      mGender = static_cast<u32>( genvalue );\r
+      mGender = static_cast<uint32_t>( genvalue );\r
     else\r
     {\r
       Console->Print( RED, BLACK, "Bad gender value: %d (Char ID %d)", genvalue, mID );\r
@@ -560,12 +507,12 @@ bool PChar::SQLLoad( int CharID )
 \r
     // Profession\r
     int profvalue = atoi( row[c_profession] );\r
-    SetProfession( static_cast<u32>( profvalue ) );\r
+    SetProfession( static_cast<uint32_t>( profvalue ) );\r
 \r
     // Class\r
     //int classvalue = atoi(row[c_class]);\r
     //if(classvalue < 4)\r
-    //    mClass = static_cast<u32>(classvalue);\r
+    //    mClass = static_cast<uint32_t>(classvalue);\r
     //else\r
     //{\r
     //  Console->Print(RED, BLACK, "Bad class value: %d (Char ID %d)", classvalue, mID);\r
@@ -575,46 +522,46 @@ bool PChar::SQLLoad( int CharID )
     // Faction\r
     int facvalue = atoi( row[c_faction] );\r
     if ( GameDefs->Factions()->GetDef( facvalue ) )\r
-      mFaction = static_cast<u32>( facvalue );\r
+      mFaction = static_cast<uint32_t>( facvalue );\r
     else\r
       mFaction = 1;\r
 \r
     /* // Model\r
     int modvalue = atoi(row[c_model]);\r
-    mModel = static_cast<u32>(modvalue);\r
+    mModel = static_cast<uint32_t>(modvalue);\r
     mModel = 10; */\r
     int headvalue = atoi( row[c_head] );\r
     int torsovalue = atoi( row[c_torso] );\r
     int legsvalue = atoi( row[c_legs] );\r
-    SetRealLook( static_cast<u32>( headvalue ), static_cast<u32>( torsovalue ), static_cast<u32>( legsvalue ) );\r
+    SetRealLook( static_cast<uint32_t>( headvalue ), static_cast<uint32_t>( torsovalue ), static_cast<uint32_t>( legsvalue ) );\r
 \r
     // Type\r
     /*\r
     int typevalue = std::atoi(row[c_type]);\r
-    mType = static_cast<u32>(typevalue);\r
+    mType = static_cast<uint32_t>(typevalue);\r
     //mType = 1; */\r
 \r
     // Location\r
     int locvalue = atoi( row[c_location] );\r
-    mLocation = static_cast<u32>( locvalue );\r
+    mLocation = static_cast<uint32_t>( locvalue );\r
 \r
 //This assumption is not so good ... hardcoding jailed state linked with location ...\r
     if ( mLocation == 550 || mLocation == 551 )\r
       mJailed = true;\r
 \r
     int posvalue = atoi( row[c_pos_x] );\r
-    Coords.mX = static_cast<u16>( posvalue );\r
+    Coords.mX = static_cast<uint16_t>( posvalue );\r
     posvalue = atoi( row[c_pos_y] );\r
-    Coords.mY = static_cast<u16>( posvalue );\r
+    Coords.mY = static_cast<uint16_t>( posvalue );\r
     posvalue = atoi( row[c_pos_z] );\r
-    Coords.mZ = static_cast<u16>( posvalue );\r
+    Coords.mZ = static_cast<uint16_t>( posvalue );\r
     posvalue = atoi( row[c_angle_ud] );\r
-    Coords.mUD = static_cast<u8>( posvalue );\r
+    Coords.mUD = static_cast<uint8_t>( posvalue );\r
     posvalue = atoi( row[c_angle_lr] );\r
-    Coords.mLR = static_cast<u8>( posvalue );\r
+    Coords.mLR = static_cast<uint8_t>( posvalue );\r
 \r
     int primapt = atoi( row[c_apt] );\r
-    mPrimaryApt = static_cast<u32>( primapt );\r
+    mPrimaryApt = static_cast<uint32_t>( primapt );\r
     mStartApt = mPrimaryApt;\r
 \r
     mSoullight = atoi( row[c_soullight] );\r
@@ -623,8 +570,8 @@ bool PChar::SQLLoad( int CharID )
         LoadClanLevel();\r
 \r
     // Cash\r
-    f32 cashvalue = atof( row[c_cash] );\r
-    mCash = static_cast<u32>( cashvalue );\r
+    float cashvalue = atof( row[c_cash] );\r
+    mCash = static_cast<uint32_t>( cashvalue );\r
 \r
     // ---------------------------------------------\r
     // Loading skills --- MAIN Skills with SP and XP\r
@@ -688,7 +635,7 @@ bool PChar::SQLLoad( int CharID )
     mInventory.SQLLoad();\r
 \r
     // temp value forcing, not get/saved from DB atm\r
-    mCombatRank = ( u8 )( random() % 127 ); // bad result there on randomness\r
+    mCombatRank = ( uint8_t )( random() % 127 ); // bad result there on randomness\r
     mSynaptic = 0;\r
     mIsDead = false;\r
 \r
@@ -773,8 +720,8 @@ bool PChar::SQLCreate() // Specific method for creation in order to avoid existe
   }\r
 }\r
 \r
-bool PChar::CreateNewChar( u32 Account, const std::string &Name, u32 Gender, u32 Profession, u32 Faction,\r
-                           u32 Head, u32 Torso, u32 Legs, u8 NZSNb, const char *NonZeroSubskills, u32 Slot )\r
+bool PChar::CreateNewChar( uint32_t Account, const std::string &Name, uint32_t Gender, uint32_t Profession, uint32_t Faction,\r
+                           uint32_t Head, uint32_t Torso, uint32_t Legs, uint8_t NZSNb, const char *NonZeroSubskills, uint32_t Slot )\r
 {\r
   SetName( Name );\r
   SetGender( Gender );\r
@@ -790,7 +737,7 @@ bool PChar::CreateNewChar( u32 Account, const std::string &Name, u32 Gender, u32
 \r
   // This part will have to be rewritten with proper methods\r
   mSoullight = 10;\r
-  mCombatRank = ( u8 )( random() % 80 ); // bad result there on randomness\r
+  mCombatRank = ( uint8_t )( random() % 80 ); // bad result there on randomness\r
   mSynaptic = 0;\r
   mIsDead = false;\r
 \r
@@ -976,7 +923,7 @@ void PChar::SetOnlineStatus( bool IsOnline )
   return;\r
 }\r
 \r
-u8 PChar::GetCombatRank()\r
+uint8_t PChar::GetCombatRank()\r
 {\r
     // Override for Special Account Levels\r
     PAccount Acc(mAccount);\r
@@ -991,7 +938,7 @@ u8 PChar::GetCombatRank()
 }\r
 \r
 \r
-u8 PChar::GetMainRank()\r
+uint8_t PChar::GetMainRank()\r
 {\r
     // Override for Special Account Levels\r
     PAccount Acc(mAccount);\r
@@ -1003,20 +950,40 @@ u8 PChar::GetMainRank()
         return 50;\r
     else\r
     {\r
-      u16 total;\r
+      uint16_t total;\r
       total  = Skill->GetMainSkill( MS_STR ) + Skill->GetMainSkill( MS_DEX );\r
       total += Skill->GetMainSkill( MS_CON ) + Skill->GetMainSkill( MS_INT );\r
       total += Skill->GetMainSkill( MS_PSI );\r
-      return (( u8 )( total / 5 ) );\r
+      return (( uint8_t )( total / 5 ) );\r
     }\r
 }\r
 \r
-u32 PChar::AddCash( u32 nAmount )\r
+bool PChar::AddGenrep(uint16_t nWorldID, uint16_t nStationID)\r
+{\r
+    return mGenrepList->AddGenrep(nWorldID, nStationID );\r
+}\r
+\r
+uint16_t PChar::GetGenrepListDataSize()\r
+{\r
+    return mGenrepList->GetListDataSize();\r
+}\r
+\r
+const void *PChar::GetGenrepListData()\r
+{\r
+    return mGenrepList->GetListData();\r
+}\r
+\r
+uint8_t PChar::GetGenrepCount()\r
+{\r
+    return mGenrepList->Count();\r
+}\r
+\r
+uint32_t PChar::AddCash( uint32_t nAmount )\r
 {\r
     return SetCash(nAmount + mCash);\r
 }\r
 \r
-u32 PChar::TakeCash( u32 nAmount )\r
+uint32_t PChar::TakeCash( uint32_t nAmount )\r
 {\r
     if(nAmount > mCash)\r
     {\r
@@ -1029,13 +996,13 @@ u32 PChar::TakeCash( u32 nAmount )
     }\r
 }\r
 \r
-u32 PChar::SetCash( u32 nCash )\r
+uint32_t PChar::SetCash( uint32_t nCash )\r
 {\r
   //Console->Print("Trying to set cash to nCash: %d", nCash);\r
   if (( int )nCash > Config->GetOptionInt( "max_cash" ) )\r
   {\r
     //Console->Print("Newcash would be more than dynamic maxcash, setting to maxcash");\r
-    mCash = ( u32 )Config->GetOptionInt( "max_cash" );\r
+    mCash = ( uint32_t )Config->GetOptionInt( "max_cash" );\r
   }\r
   else if ( nCash > MAXCASH )\r
   {\r
@@ -1052,7 +1019,7 @@ u32 PChar::SetCash( u32 nCash )
 }\r
 \r
 \r
-bool PChar::SetQuickBeltActiveSlot( u8 nSlotID )\r
+bool PChar::SetQuickBeltActiveSlot( uint8_t nSlotID )\r
 {\r
   if (( nSlotID == INV_WORN_QB_HAND ) || ( nSlotID == INV_WORN_QB_NONE ) )\r
   {\r
@@ -1076,7 +1043,7 @@ bool PChar::SetQuickBeltActiveSlot( u8 nSlotID )
   return false;\r
 }\r
 \r
-PSeatType PChar::GetSeatInUse( u32* nObjectId, u8* nSeatId )\r
+PSeatType PChar::GetSeatInUse( uint32_t* nObjectId, uint8_t* nSeatId )\r
 {\r
   if ( nObjectId )\r
   {\r
@@ -1090,7 +1057,7 @@ PSeatType PChar::GetSeatInUse( u32* nObjectId, u8* nSeatId )
   return mSeatInUseType;\r
 }\r
 \r
-void PChar::SetSeatInUse( PSeatType nSeatType, u32 nObjectId, u8 nSeatId )\r
+void PChar::SetSeatInUse( PSeatType nSeatType, uint32_t nObjectId, uint8_t nSeatId )\r
 {\r
   mSeatInUseType = nSeatType;\r
   mSeatInUseObjectId = nObjectId;\r
@@ -1105,13 +1072,13 @@ PVhcAccessRequestList* PChar::GetVhcAccessRequestList()
   return mVhcAccessRequestList;\r
 }\r
 \r
-void PChar::SetLookingAt( u16 nLocalCharID )\r
+void PChar::SetLookingAt( uint16_t nLocalCharID )\r
 {\r
   mLookingAt = nLocalCharID;\r
   mLookAtTimestamp = std::time( NULL );\r
 }\r
 \r
-u16 PChar::GetLookingAt( u16 nMaxDelaySec )\r
+uint16_t PChar::GetLookingAt( uint16_t nMaxDelaySec )\r
 {\r
   return ((( mLookAtTimestamp + nMaxDelaySec ) >= std::time( NULL ) ) ? mLookingAt : 0 );\r
 }\r
@@ -1152,7 +1119,7 @@ PChars::~PChars()
     delete i->second;\r
 }\r
 \r
-bool PChars::LoadChar( u32 CharID )\r
+bool PChars::LoadChar( uint32_t CharID )\r
 {\r
   if ( !CharID )\r
     return false;\r
@@ -1189,7 +1156,7 @@ bool PChars::AddChar( PChar* nChar )
   }\r
 }\r
 \r
-PChar* PChars::RemoveChar( u32 CharID )\r
+PChar* PChars::RemoveChar( uint32_t CharID )\r
 {\r
   PChar* Result = NULL;\r
 \r
@@ -1231,7 +1198,7 @@ void PChars::SQLSave()
   return;\r
 }\r
 \r
-PChar* PChars::GetChar( u32 CharID ) const\r
+PChar* PChars::GetChar( uint32_t CharID ) const\r
 {\r
   PChar *Result = 0;\r
   CharMap::const_iterator i = mChars.find( CharID );\r
@@ -1305,7 +1272,7 @@ void PChars::Update()
 }\r
 \r
 //MAX_CHARS_PER_ACCOUNT\r
-int PChars::GetCharProfiles( const u32 AccountID, PCharProfile* CharSlotsArray, const u8 ArraySize )\r
+int PChars::GetCharProfiles( const uint32_t AccountID, PCharProfile* CharSlotsArray, const uint8_t ArraySize )\r
 {\r
   char query[256];\r
   int EntriesNb = 0;\r
@@ -1325,7 +1292,7 @@ int PChars::GetCharProfiles( const u32 AccountID, PCharProfile* CharSlotsArray,
 \r
   //EntriesNb = mysql_num_rows(result);\r
   int SlotID;\r
-  u32 CharID;\r
+  uint32_t CharID;\r
   PChar* tmpChar = new PChar();\r
 \r
   while (( row = mysql_fetch_row( result ) ) )\r
@@ -1342,7 +1309,7 @@ int PChars::GetCharProfiles( const u32 AccountID, PCharProfile* CharSlotsArray,
 \r
         CharSlotsArray[SlotID].CharID = CharID;\r
         CharSlotsArray[SlotID].Type = tmpChar->GetType();\r
-        CharSlotsArray[SlotID].Location = static_cast<u32>( atoi( row[c_location] ) );\r
+        CharSlotsArray[SlotID].Location = static_cast<uint32_t>( atoi( row[c_location] ) );\r
         CharSlotsArray[SlotID].Head = atoi( row[c_head] );\r
         CharSlotsArray[SlotID].Torso = atoi( row[c_torso] );\r
         CharSlotsArray[SlotID].Legs = atoi( row[c_legs] );\r
diff --git a/TinNS/Source/GameServer/Chars.hxx b/TinNS/Source/GameServer/Chars.hxx
new file mode 100644 (file)
index 0000000..b2b3030
--- /dev/null
@@ -0,0 +1,335 @@
+#pragma once\r
+\r
+#include <chrono>\r
+#include <cstdint>\r
+#include <map>\r
+#include "GameServer/Inventory.hxx" // FIXME: class design fault\r
+\r
+#define MAXCASH 1000000000\r
+\r
+class PGenrepList;\r
+class PSkillHandler;\r
+class PVhcAccessRequestList;\r
+\r
+enum PSeatType {\r
+  seat_none = 0,\r
+  seat_chair,\r
+  seat_subway,\r
+  seat_vhc\r
+};\r
+\r
+class PCharCoordinates {\r
+  public:\r
+    uint16_t mY;     // Y-Position in world // Y increases when going East\r
+    uint16_t mZ;     // Z-Position in world // Z increases when going up\r
+    uint16_t mX;     // X-Position in world // X increases when going South\r
+    uint8_t mUD;     // Up - Mid - Down (d6 - 80 - 2a)\r
+    uint8_t mLR;     // Compass direction (S..E..N..W..S [0-45-90-135-179])\r
+    uint8_t mAct;    // Last user action state\r
+    uint8_t mUnknown;// sometime sent by client with value != 0 (usual case)\r
+    // mAct:\r
+    // 0x00 NC has no focus (player alt+tab'ed out)\r
+    // 0x04 Char on ground/dead   00000100\r
+    // 0x20 Char does nothing     00100000\r
+    // 0x22 kneeing               00100010\r
+    // 0x28 left step             00101000\r
+    // 0x30 right step            00110000\r
+    // 0x40 walking (not running) 01000000 // Seems to mean Running ? - to be verfied, with default walk/run mode !!!\r
+    // 0x60 forward               01100000\r
+    // 0xA0 backward              10100000\r
+    // bits:                      BFWRL.K.\r
+\r
+    uint8_t mJumpingState;\r
+\r
+    //inline PCharCoordinates() { mX = mY = mZ = mUD = mLR = mAct = mUnknown = mJumpingState = 0;}\r
+    void SetPosition( uint16_t nY, uint16_t nZ, uint16_t nX, uint8_t nUD = 0x80, uint8_t nLR = 0 );\r
+    void SetInterpolate( PCharCoordinates& Pos1, PCharCoordinates& Pos2, float nCoef );\r
+\r
+    //Temp\r
+    uint16_t minPos[3];\r
+    uint16_t maxPos[3];\r
+    inline PCharCoordinates() { mX = mY = mZ = mUD = mLR = mAct = mUnknown = mJumpingState = 0; for(int i=0; i<3; ++i) { minPos[i] = 0xffff; maxPos[i] = 0; } }\r
+};\r
+\r
+class PChar\r
+{\r
+  private :\r
+    // static members\r
+    static RegEx* mCharnameRegexFilter;\r
+\r
+    // instance members\r
+    uint32_t mID;\r
+    uint32_t mAccount;\r
+    uint8_t mSlot;\r
+    std::string mName;\r
+    uint32_t mGender;\r
+    uint32_t mClass;\r
+    //uint32_t mType; // Removed that and only keep GetType()\r
+    uint32_t mProfession;\r
+    uint32_t mFaction;\r
+    uint32_t mRealHead;  // Base Skin elements, in complement of (computed) mType\r
+    uint32_t mRealTorso; // " Head shouldn't be changeable, except in case of surgery !!!\r
+    uint32_t mRealLegs;  // "\r
+    uint32_t mSkin;  // Current Skin elements. *** Not saved in DB atm ***\r
+    uint32_t mHead;  // "\r
+    uint32_t mTorso; // "\r
+    uint32_t mLegs;  // "\r
+    uint8_t mHeadColor;  // "\r
+    uint8_t mTorsoColor; // "\r
+    uint8_t mLegsColor;  // "\r
+    uint8_t mHeadDarkness;  // " // 0=Bright, 255=dark\r
+    uint8_t mTorsoDarkness; // "\r
+    uint8_t mLegsDarkness;  // "\r
+    // Skin scale factor setting remain to discover, provided they are somewhere for player chars ...\r
+\r
+    bool mLocationLeased; // temp until char on-demand load/unload\r
+    uint32_t mLocation;\r
+    uint32_t mCash;\r
+    uint32_t mStartApt; // set same as PrimaryApt atm\r
+    uint32_t mPrimaryApt;\r
+\r
+    // not saved in DB atm\r
+    PSeatType mSeatInUseType;\r
+    uint32_t mSeatInUseObjectId;\r
+    uint8_t mSeatInUseSeatId;\r
+    PVhcAccessRequestList* mVhcAccessRequestList;\r
+\r
+    PContainer* mContainerInExclusiveUse;\r
+\r
+    uint16_t mHealth;\r
+    uint16_t mMana;\r
+    uint16_t mStamina;\r
+\r
+    int8_t mSoullight;\r
+    uint8_t mCombatRank; // *** Not got/saved from DB atm ***\r
+    uint8_t mSynaptic; // *** Not got/saved from DB atm ***\r
+    bool mIsDead; // *** Not got/saved from DB atm ***\r
+\r
+    // Only one body effect supported atm. Should be extended later to multiple effects\r
+    uint8_t mBodyEffect; // *** Not got/saved from DB atm ***\r
+    uint8_t mBodyEffectDensity; // *** Not got/saved from DB atm ***\r
+\r
+    uint8_t mSpeedOverride; // a hack to control move speed. Not saved in DB\r
+\r
+    uint32_t mDirectCharID; // for Direct Chat // *** Not got/saved from DB atm ***\r
+    PBuddyList* mBuddyList; // For Buddy list Chat\r
+    uint32_t mActiveChatChannels; // Active chat channels flags // *** Not got/saved from DB atm ***\r
+\r
+    PGenrepList* mGenrepList; // Character's GR list\r
+\r
+    uint8_t mQuickBeltActiveSlot; // QB SlotID of item "in hand", or INV_WORN_QB_HAND or INV_WORN_QB_NONE\r
+\r
+    uint16_t mLookingAt;  // Zone charID of currently targeted player\r
+    std::time_t mLookAtTimestamp; // Lifetimer of lookat var\r
+    uint32_t mLastUsedWorldObjectId; // Last world object clicked on\r
+\r
+    uint8_t mClanLevel; // 1-15\r
+    uint16_t mClanID;\r
+\r
+    bool mIsOnline;\r
+    bool mDirtyFlag;\r
+\r
+    bool mShunned;\r
+    bool mJailed;\r
+\r
+    uint32_t mDialogNPC; // NPCID the player talks to\r
+    uint16_t mCurrentDialogNode; // Node in .lua file we're at right now\r
+\r
+    class PInventory mInventory;\r
+\r
+  protected :\r
+    friend class PChars;\r
+    inline void SetID( uint32_t ID ) { mID = ID; }\r
+    inline void SetAccount( uint32_t Account ) { mAccount = Account; }\r
+    inline void SetCharSlot( uint8_t Slot ) { if ( Slot < 4 ) mSlot = Slot;} // TODO: set max slot according to server config\r
+    inline void SetName( const std::string &Name ) { mName = Name; }\r
+    inline void SetGender( uint32_t Gender ) { mGender = Gender; }\r
+    void SetProfession( uint32_t Profession );\r
+    //inline void SetClass(uint32_t nClass) { mClass = nClass; } // mClass is defined by setting Profession\r
+    //inline void SetType(uint32_t Type) { mType = Type; } // Removed. Type is computed from Gender & Profession (??? is it not Gender + Class ???)\r
+    inline void SetFaction( uint32_t Faction ) { mFaction = Faction; }\r
+    //inline void SetModel(uint32_t Model) { mModel = Model; } // Inhibited for the moment. Base model is deduced from from Gender & Class (Profession)\r
+    void SetRealLook( uint32_t nHead, uint32_t nTorso, uint32_t nLegs );\r
+    void SetBaseSkills();\r
+    void SetBaseSubskills( uint8_t NZSNb, const char* NonZeroSubskills );\r
+    void SetBaseInventory();\r
+\r
+    bool SQLCreate();\r
+\r
+  public :\r
+    PChar();\r
+    ~PChar();\r
+\r
+    static bool SetCharnameRegexFilter( const char* RegexStr );\r
+    static bool IsCharnameWellFormed( const char *Username );\r
+\r
+    PSkillHandler *Skill;\r
+    PCharCoordinates Coords;\r
+\r
+    void SetCurrentLook( uint32_t nSkin, uint32_t nHead = 0, uint32_t nTorso = 0, uint32_t nLegs = 0 );\r
+    void SetCurrentLookFromCharType( uint32_t nType );\r
+    void ResetCurrentLook();\r
+\r
+    void SetCurrentBodyColor( uint8_t nHeadColor, uint8_t nTorsoColor, uint8_t nLegsColor, uint8_t nHeadDarkness = 0, uint8_t nTorsoDarkness = 0, uint8_t nLegsDarkness = 0 );\r
+    inline void SetBodyEffect( uint8_t nEffect, uint8_t nDensity = 0 ) { mBodyEffect = nEffect; mBodyEffectDensity = nDensity; }\r
+    inline void SetSpeedOverride( uint8_t nSpeed = 255 ) { mSpeedOverride = nSpeed; }\r
+\r
+    void SetLookingAt( uint16_t nLocalCharID );\r
+    uint16_t GetLookingAt( uint16_t nMaxDelaySec = 1 );\r
+    inline void SetLastUsedObject ( uint32_t nRawItemId ) { mLastUsedWorldObjectId = nRawItemId; }\r
+    inline uint32_t GetLastUsedObject () const { return mLastUsedWorldObjectId; }\r
+\r
+    inline PInventory* GetInventory() { return &mInventory; }\r
+    inline uint32_t GetID() const { return mID; }\r
+    inline uint32_t GetAccount() const { return mAccount; }\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline uint32_t GetGender() const { return mGender; }\r
+    inline uint32_t GetClass() const { return mClass; }\r
+    inline uint32_t GetType() const { return 2 * mClass + mGender; }\r
+    uint32_t GetSkinFromCharType( uint32_t nType );\r
+    void GetRealLook( uint32_t &nSkin, uint32_t &nHead, uint32_t &nTorso, uint32_t &nLegs );\r
+    void GetCurrentLook( uint32_t &nSkin, uint32_t &nHead, uint32_t &nTorso, uint32_t &nLegs );\r
+    inline void GetBodyEffect( uint8_t &nEffect, uint8_t &nDensity ) { nEffect = mBodyEffect; nDensity = mBodyEffectDensity; }\r
+\r
+    inline uint8_t GetQuickBeltActiveSlot() { return mQuickBeltActiveSlot; }\r
+    bool SetQuickBeltActiveSlot( uint8_t nSlotID );\r
+\r
+    void GetCurrentBodyColor( uint8_t &nHeadColor, uint8_t &nTorsoColor, uint8_t &nLegsColor, uint8_t &nHeadDarkness, uint8_t &nTorsoDarkness, uint8_t &nLegsDarkness );\r
+    inline uint8_t GetSpeedOverride() { return mSpeedOverride; }\r
+    inline uint32_t GetBaseModel();\r
+    inline uint32_t GetProfession() const { return mProfession; }\r
+    inline uint16_t GetMaxHealth() { return mHealth; }\r
+    inline uint16_t GetMaxMana() { return mMana; }\r
+    inline uint16_t GetMaxStamina() { return mStamina; }\r
+    inline uint16_t GetHealth() { return mHealth; }\r
+    inline uint16_t GetMana() { return mMana; }\r
+    inline uint16_t GetStamina() { return mStamina; }\r
+    inline uint32_t GetFaction() const { return mFaction; }\r
+    inline uint32_t GetLocation() const { return mLocation; }\r
+\r
+    inline uint32_t GetCash() const { return mCash; }\r
+    uint32_t SetCash( uint32_t nCash );  // Does return the new cashvalue, NO udpmessage is sent out!!\r
+    uint32_t AddCash( uint32_t nAmount );\r
+    uint32_t TakeCash( uint32_t nAmount );\r
+\r
+    inline uint32_t GetBaseApartment() const { return mPrimaryApt; }\r
+\r
+    inline void SetJail( bool val ) { mJailed = val; };\r
+    inline void SetShun( bool val ) { mShunned = val; };\r
+\r
+    inline bool IsJailed() { return mJailed; };\r
+    inline bool IsShunned() { return mShunned; };\r
+\r
+    inline void SetDialogNPC( uint32_t nNPC ) { mDialogNPC = nNPC; };\r
+    inline uint32_t GetDialogNPC() const { return mDialogNPC; };\r
+\r
+    inline void SetDialogNode( uint16_t nNode ) { mCurrentDialogNode = nNode; };\r
+    inline uint16_t GetDialogNode() const { return mCurrentDialogNode; };\r
+\r
+    inline uint8_t GetClanLevel() const { return mClanLevel; };\r
+    inline uint16_t GetClan() const { return mClanID; };\r
+    void LoadClanLevel();\r
+\r
+    inline int8_t GetSoullight() const { return mSoullight; }\r
+    uint8_t GetMainRank();\r
+    uint8_t GetCombatRank();\r
+    inline uint8_t GetSynaptic() const { return mSynaptic; }\r
+    inline bool IsDead() const { return mIsDead; }\r
+\r
+    inline bool SetDirectChat( uint32_t nBuddyCharID ) { mDirectCharID = nBuddyCharID; return true; }\r
+    inline uint32_t GetDirectChat() { return mDirectCharID; }\r
+    inline void SetActiveChannels( uint32_t nChannels ) { mActiveChatChannels = nChannels; }\r
+    inline uint32_t GetActiveChannels() { return mActiveChatChannels; }\r
+\r
+    inline bool AddBuddy( uint32_t nBuddyCharID ) { return mBuddyList->AddChar( nBuddyCharID ); }\r
+    inline bool RemoveBuddy( uint32_t nBuddyCharID ) { return mBuddyList->RemoveChar( nBuddyCharID ); }\r
+    inline uint16_t GetBuddyListDataSize() { return mBuddyList->GetListDataSize(); }\r
+    inline const void* GetBuddyListData() { return mBuddyList->GetListData(); }\r
+    inline uint8_t GetBuddyCount() { return mBuddyList->Count(); }\r
+    inline bool IsBuddy( uint32_t CharID ) { return mBuddyList->IsInBuddy( CharID ); };\r
+\r
+    bool AddGenrep(uint16_t nWorldID, uint16_t nStationID);\r
+    uint16_t GetGenrepListDataSize();\r
+    const void *GetGenrepListData();\r
+    uint8_t GetGenrepCount();\r
+\r
+    inline bool IsDirty() const { return mDirtyFlag; }\r
+    inline bool IsAnyDirty() const { return mDirtyFlag || mInventory.IsDirty(); }\r
+    inline bool IsOnline() { return mIsOnline; }\r
+    void SetOnlineStatus( bool IsOnline );\r
+\r
+    bool CreateNewChar( uint32_t Account, const std::string &Name, uint32_t Gender, uint32_t Profession, uint32_t Faction,\r
+                        uint32_t Head, uint32_t Torso, uint32_t Legs, uint8_t NZSNb, const char *NonZeroSubskills, uint32_t Slot );\r
+    bool SQLLoad( int CharID );\r
+    bool SQLSave();\r
+    inline bool SQLSaveFull() { return SQLSave() && mInventory.SQLSave(); }\r
+    bool SQLDelete(); // not implemented yet\r
+\r
+    inline void SetLocation( uint32_t Location ) { mLocation = Location; }\r
+    inline void SetDirtyFlag( bool Dirty = true ) { mDirtyFlag = Dirty; }\r
+\r
+    // temp until char on-demand load/unload\r
+    inline void SetLocationLeased( bool nState = true ) { mLocationLeased = nState; }\r
+    inline bool GetLocationLeased() { return mLocationLeased; }\r
+\r
+    PSeatType GetSeatInUse( uint32_t* nObjectId = NULL, uint8_t* nSeatId = NULL );\r
+    void SetSeatInUse( PSeatType nSeatType, uint32_t nObjectId = 0, uint8_t nSeatId = 0 );\r
+\r
+    PVhcAccessRequestList* GetVhcAccessRequestList();\r
+\r
+    inline PContainer* GetContainerInExclusiveUse() { return mContainerInExclusiveUse; }\r
+    inline void SetContainerInExclusiveUse( PContainer* nContainer ) { mContainerInExclusiveUse = nContainer; }\r
+};\r
+\r
+struct PCharProfile\r
+{\r
+  uint32_t CharID;\r
+  uint16_t Type;\r
+  uint16_t Color0;\r
+  uint16_t Unknown1;\r
+  uint8_t Head;\r
+  uint8_t Torso;\r
+  uint8_t Legs;\r
+  uint32_t Location;\r
+  uint8_t NameLen;\r
+  uint8_t Unknown3;\r
+  uint8_t Unknown4;\r
+  uint8_t Unknown5;\r
+  uint8_t Unknown6;\r
+  uint8_t Unknown7;\r
+  uint8_t Unknown8;\r
+  uint8_t Unknown9;\r
+  uint8_t Unknown10;\r
+  uint8_t Unknown11;\r
+  uint8_t Unknown12;\r
+  std::string Name;\r
+  bool in_use;\r
+};\r
+\r
+class PChars\r
+{\r
+  private :\r
+    typedef std::map<uint32_t, PChar*> CharMap;\r
+    CharMap mChars;\r
+    uint32_t mLastID;\r
+\r
+    std::time_t mAutoSavePeriod;\r
+    std::time_t mLastSave;\r
+\r
+  public :\r
+    PChars();\r
+    ~PChars();\r
+\r
+    bool LoadChar( uint32_t CharID );\r
+    bool AddChar( PChar* nChar );\r
+    PChar* RemoveChar( uint32_t CharID );\r
+\r
+    PChar* GetChar( uint32_t CharID ) const;\r
+    PChar* GetChar( const std::string &Name ) const;\r
+    bool CharExist( const std::string &Name ) const;\r
+\r
+    void SQLSave();\r
+    void Update();\r
+\r
+    int GetCharProfiles( const uint32_t AccountID, PCharProfile* CharSlotsArray, const uint8_t ArraySize ); // return effective entries nb\r
+};\r
similarity index 85%
rename from server/src/game/chat.cpp
rename to TinNS/Source/GameServer/Chat.cxx
index 257b6c1..9be8592 100644 (file)
@@ -1,60 +1,11 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       chat.cpp - handles all ingame chat\r
-\r
-       Authors:\r
-       - Namikon\r
-       - bakkdoor\r
-       - Akiko\r
-\r
-        MODIFIED: 30 Nov 2005 Namikon/Akiko\r
-        REASON: - initial release by Namikon\r
-        MODIFIED: 11 Dec 2005 Namikon\r
-        REASON: - Added function SendDChat(Client, <text>, <nick>) to send a Direct to player\r
-                - Added Channel IDs for GameMaster (/gm) and Administrator (/admin) chat\r
-                - Added channel const's for sending chat packets\r
-                - Added function SendChat(Client, <channel>, <text>, <nick>) to send chat messages\r
-                  See chat.h for a list of availeable <channel>'s\r
-\r
-        MODIFIED: 17 Dec 2005 bakkdoor\r
-        REASON: - introduced new structure for chatsystem\r
-                - -> PChat class\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - clean ups\r
-\r
-       TODO:\r
-       - Add "hooks" to process chatevents everywhere in the source <-- kind of done. you can use the global PChat Instance.\r
-        Check:\r
-                Chat->send(PClient* receiver, const u8* Channel, const char* AuthorNickName, char* text, bool debugOut=false);\r
-        Example:\r
-                Chat->send(receiverClient, CHAT_DIRECT, Chars->GetChar(authorClient->GetCharID())->GetName().c_str(), text);\r
-*/\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
-#include "main.h"\r
-#include "include/msgbuilder.h"\r
+//  TODO:- Add "hooks" to process chatevents everywhere in the source <-- kind of done. you can use the global PChat Instance.\r
+//         Check:\r
+//              Chat->send(PClient* receiver, const uint8_t* Channel, const char* AuthorNickName, char* text, bool debugOut=false);\r
+//         Example:\r
+//              Chat->send(receiverClient, CHAT_DIRECT, Chars->GetChar(authorClient->GetCharID())->GetName().c_str(), text);\r
 \r
 PChat::PChat()\r
 {\r
@@ -111,7 +62,7 @@ void PChat::sendBuddy(PClient* author, const char* text, bool debugOut)
 \r
 void PChat::sendConnectedList(PClient* receiver, bool debugOut)\r
 {\r
-       const char* text = "Connected Players are:]";\r
+    const char* text = "Connected Players are:]";\r
     send(receiver, CHAT_DIRECT, "[System", text, debugOut);\r
 \r
     int counter = 1;\r
@@ -119,8 +70,8 @@ void PChat::sendConnectedList(PClient* receiver, bool debugOut)
     // send the list of currently connected players to receiver\r
     for(PClientMap::iterator it=ClientManager->getClientListBegin(); it!=ClientManager->getClientListEnd(); it++)\r
     {\r
-                 char counterText[5];\r
-                 snprintf(counterText, 5, "%d", counter);\r
+          char counterText[5];\r
+          snprintf(counterText, 5, "%d", counter);\r
 \r
         PChar* receiverChar = Chars->GetChar(it->second->GetCharID());\r
         send(receiver, CHAT_DIRECT, (receiverChar ? receiverChar->GetName().c_str() : "*"), counterText, debugOut);\r
@@ -134,7 +85,7 @@ void PChat::sendFrak(PClient* author, const char* text, bool debugOut)
 {\r
     // send the message to all clients that have same FactionID\r
     PChar* authorChar = Chars->GetChar(author->GetCharID());\r
-    u32 FID = authorChar->GetFaction(); // get LocationID of author\r
+    uint32_t FID = authorChar->GetFaction(); // get LocationID of author\r
 \r
     for(PClientMap::iterator it=ClientManager->getClientListBegin(); it!=ClientManager->getClientListEnd(); it++)\r
     {\r
@@ -155,7 +106,7 @@ void PChat::sendZone(PClient* author, const char* text, bool debugOut)
 {\r
     // send the message to all clients that have same ZoneID\r
     PChar* authorChar = Chars->GetChar(author->GetCharID());\r
-    u32 ZID = authorChar->GetLocation(); // get LocationID of author\r
+    uint32_t ZID = authorChar->GetLocation(); // get LocationID of author\r
 \r
     for(PClientMap::iterator it=ClientManager->getClientListBegin(); it!=ClientManager->getClientListEnd(); it++)\r
     {\r
@@ -175,7 +126,7 @@ void PChat::sendZone(PClient* author, const char* text, bool debugOut)
 void PChat::sendLocal(PClient* author, const char* text, bool debugOut)\r
 {\r
     PChar* authorChar = Chars->GetChar(author->GetCharID());\r
-    u32 ZID = authorChar->GetLocation(); // get LocationID of author\r
+    uint32_t ZID = authorChar->GetLocation(); // get LocationID of author\r
 \r
     // send the message to all clients that are in Area (Radius = X (needs to be defined somewhere!))\r
     for(PClientMap::iterator it=ClientManager->getClientListBegin(); it!=ClientManager->getClientListEnd(); it++)\r
@@ -186,7 +137,7 @@ void PChat::sendLocal(PClient* author, const char* text, bool debugOut)
             PChar* receiverChar = Chars->GetChar(receiver->GetCharID());\r
             if(receiverChar && (receiverChar->GetLocation() == ZID))\r
             {\r
-                u16 distance = DistanceApprox((authorChar->Coords).mX, (authorChar->Coords).mY, (authorChar->Coords).mZ, (receiverChar->Coords).mX, (receiverChar->Coords).mY, (receiverChar->Coords).mZ);\r
+                uint16_t distance = DistanceApprox((authorChar->Coords).mX, (authorChar->Coords).mY, (authorChar->Coords).mZ, (receiverChar->Coords).mX, (receiverChar->Coords).mY, (receiverChar->Coords).mZ);\r
                 if(distance < LOCALCHAT_MAXDISTANCE)\r
                 {\r
                     //sendLocalchat(receiver, author, text, debugOut); // Doesnt work!\r
@@ -332,7 +283,7 @@ void PChat::sendTeam(PClient* author, const char* text, bool debugOut)
     }\r
 }\r
 \r
-void PChat::sendPlayerDirect(PClient* author, const char* text, u32 destination, bool debugOut)\r
+void PChat::sendPlayerDirect(PClient* author, const char* text, uint32_t destination, bool debugOut)\r
 {\r
     bool tmpTargetOnline = false;\r
     for(PClientMap::iterator it=ClientManager->getClientListBegin(); it!=ClientManager->getClientListEnd(); it++)\r
@@ -348,7 +299,7 @@ void PChat::sendPlayerDirect(PClient* author, const char* text, u32 destination,
     if(tmpTargetOnline == false)\r
     {\r
         ConnectionTCP *Socket = author->getTCPConn();\r
-        u8 DirectTargetNotOnline[] = {0xFE, 0x07, 0x00, 0x83, 0x18, 0x01, 0x81, 0x54, 0x00, 0x00};\r
+        uint8_t DirectTargetNotOnline[] = {0xFE, 0x07, 0x00, 0x83, 0x18, 0x01, 0x81, 0x54, 0x00, 0x00};\r
 \r
         Socket->write(DirectTargetNotOnline, sizeof(DirectTargetNotOnline));\r
         Socket->flushSendBuffer();\r
@@ -373,7 +324,7 @@ void PChat::sendDirect(PClient* author, PClient* receiver, const char* text, boo
 \r
     ConnectionTCP *Socket = receiver->getTCPConn();\r
 \r
-    u8 BasicDirectPacket[] = {0xFE, 0x20, 0x00, 0x83, 0x17, 0xB7, 0x5F, 0x00, 0x00, 0x0C, 0x04, 0x00};\r
+    uint8_t BasicDirectPacket[] = {0xFE, 0x20, 0x00, 0x83, 0x17, 0xB7, 0x5F, 0x00, 0x00, 0x0C, 0x04, 0x00};\r
 \r
     LenText = LenNick = fpp = 0;\r
 \r
@@ -436,7 +387,7 @@ void PChat::sendLocalchat(PClient* receiver, PClient* author, const char* text,
     return; // IncreaseUDP could cause OOO here. Since this function is doing nothing, we disabled it\r
     char *LocalChatPacket;\r
     int overallsize = 0, LenText = 0;\r
-    u8 BasicLocal[] = { 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1B };\r
+    uint8_t BasicLocal[] = { 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1B };\r
 \r
     // Get size of Text to send\r
     do {\r
@@ -469,11 +420,11 @@ void PChat::sendLocalchat(PClient* receiver, PClient* author, const char* text,
 \r
     // Add UdpID, SessionID, lenght and local charid\r
     receiver->IncreaseUDP_ID();\r
-    *(u16*)&LocalChatPacket[1] = receiver->GetUDP_ID();     // UDP\r
-    *(u16*)&LocalChatPacket[3] = receiver->GetSessionID();  // Session\r
-    *(u8*)&LocalChatPacket[5] = overallsize - 6;            // Packetlen\r
-    *(u16*)&LocalChatPacket[7] = receiver->GetUDP_ID();     // 2nd UDP\r
-    *(u16*)&LocalChatPacket[10] = author->GetLocalID();     // Local ID\r
+    *(uint16_t*)&LocalChatPacket[1] = receiver->GetUDP_ID();     // UDP\r
+    *(uint16_t*)&LocalChatPacket[3] = receiver->GetSessionID();  // Session\r
+    *(uint8_t*)&LocalChatPacket[5] = overallsize - 6;            // Packetlen\r
+    *(uint16_t*)&LocalChatPacket[7] = receiver->GetUDP_ID();     // 2nd UDP\r
+    *(uint16_t*)&LocalChatPacket[10] = author->GetLocalID();     // Local ID\r
 \r
     // Sending local chat packet and removing dynamic array\r
     ConnectionUDP *Socket = receiver->getUDPConn();\r
@@ -754,15 +705,15 @@ void PChat::sendTeam70(PClient* author, const char* text, bool debugOut)
     }\r
 }\r
 \r
-bool PChat::chanEnabled(PClient* Client, u32 channel)\r
+bool PChat::chanEnabled(PClient* Client, uint32_t channel)\r
 {\r
     // Check if player has target channel enabled or disabled\r
     PChar* TargetChar = Chars->GetChar(Client->GetCharID());\r
     if(!TargetChar)\r
       return false;\r
       \r
-    u32 actChans = TargetChar->GetActiveChannels();\r
-    u32 check = actChans & channel;\r
+    uint32_t actChans = TargetChar->GetActiveChannels();\r
+    uint32_t check = actChans & channel;\r
 \r
     if(check == channel)\r
         return true;\r
@@ -770,12 +721,12 @@ bool PChat::chanEnabled(PClient* Client, u32 channel)
         return false;\r
 }\r
 \r
-bool PChat::send(PClient* receiver, const u8* Channel, const char* AuthorNickName, const char* text, bool debugOut)\r
+bool PChat::send(PClient* receiver, const uint8_t* Channel, const char* AuthorNickName, const char* text, bool debugOut)\r
 {\r
     char *ChatPacket;\r
     unsigned int packetsize = 0, c;\r
     int LenText, LenNick, fpp, d, e, loopout;\r
-    u8 TargetChannel[2];\r
+    uint8_t TargetChannel[2];\r
 \r
 //Console->Print("1: %#x", Channel[0]);\r
 //Console->Print("2: %#x", CHAT_BUDDY[0]);\r
@@ -869,7 +820,7 @@ bool PChat::send(PClient* receiver, const u8* Channel, const char* AuthorNickNam
 \r
     ConnectionTCP *Socket = receiver->getTCPConn();\r
 \r
-    u8 BasicChatPacket[] = {0xFE, 0x15, 0x00, 0x83, 0x17, 0x90, 0x03, 0x00, 0x00, 0x07, 0x05, 0x0F};\r
+    uint8_t BasicChatPacket[] = {0xFE, 0x15, 0x00, 0x83, 0x17, 0x90, 0x03, 0x00, 0x00, 0x07, 0x05, 0x0F};\r
 \r
     LenText = LenNick = fpp = 0;\r
 \r
@@ -938,7 +889,7 @@ bool PChat::send(PClient* receiver, const u8* Channel, const char* AuthorNickNam
 \r
 \r
 \r
-bool PChat::HandleGameChat(PClient *Client, const u8 *Packet)\r
+bool PChat::HandleGameChat(PClient *Client, const uint8_t *Packet)\r
 {\r
     // if player is shunned, ignore all incomming chat and game commands.\r
     // ServerAdmins are not affected by any shuns. (Should never happen anyways...)\r
@@ -946,7 +897,7 @@ bool PChat::HandleGameChat(PClient *Client, const u8 *Packet)
 \r
     int i, j, k;\r
 \r
-     u8 chattype = *(u8*)&Packet[7];\r
+     uint8_t chattype = *(uint8_t*)&Packet[7];\r
 // -----------------------------------------------\r
     if(chattype == 0x1B) {\r
       // Local chat\r
@@ -1000,146 +951,146 @@ bool PChat::HandleGameChat(PClient *Client, const u8 *Packet)
   //    Console->Print("Channel no %#x %#x %#x %#x", Channel[0], Channel[1], Channel[2], Channel[3]);\r
 \r
         // First, check if packet is a direct-chat-packet\r
-        if(*(u8*)&Packet[8] == 0x04) {\r
+        if(*(uint8_t*)&Packet[8] == 0x04) {\r
              //Console->Print("Direct Chat: %s", ChatText);\r
-             sendPlayerDirect(Client, ChatText, *(u32*)&Packet[9], false);\r
+             sendPlayerDirect(Client, ChatText, *(uint32_t*)&Packet[9], false);\r
              //sendDirect(Client, ChatText, false);\r
              // "DIRECT> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_BUDDY) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_BUDDY) {\r
              //Console->Print("Buddy Chat: %s", ChatText);\r
              sendBuddy(Client, ChatText, false);\r
              // "BUDDY> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CLAN) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CLAN) {\r
              //Console->Print("Clan Chat: %s", ChatText);\r
              sendClan(Client, ChatText, false);\r
              // "CLAN> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_TEAM) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_TEAM) {\r
              //Console->Print("Team Chat: %s", ChatText);\r
              sendTeam(Client, ChatText, false);\r
              // "TEAM> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_ZONE) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_ZONE) {\r
              //Console->Print("Custom - Zone Chat: %s", ChatText);\r
              sendZone(Client, ChatText, false);\r
              // "ZONE> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_FRAKTION) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_FRAKTION) {\r
              //Console->Print("Custom - Fraktion Chat: %s", ChatText);\r
              sendFrak(Client, ChatText, false);\r
              // "FRACTION> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TRADE_CANYON) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TRADE_CANYON) {\r
              //Console->Print("Custom - Trade_Canyon Chat: %s", ChatText);\r
              sendTradeCS(Client, ChatText, false);\r
              // "TRADE - CS> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TRADE_MB) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TRADE_MB) {\r
              //Console->Print("Custom - Trade_MB Chat: %s", ChatText);\r
              sendTradeMB(Client, ChatText, false);\r
              // "TRADE - MB> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TRADE_NC) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TRADE_NC) {\r
              //Console->Print("Custom - Trade_NC Chat: %s", ChatText);\r
              sendTradeNC(Client, ChatText, false);\r
              // "TRADE - NC> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TRADE_TH) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TRADE_TH) {\r
              //Console->Print("Custom - Trade_TH Chat: %s", ChatText);\r
              sendTradeTH(Client, ChatText, false);\r
              // "TRADE - TH> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TRADE_WASTE) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TRADE_WASTE) {\r
              //Console->Print("Custom - Trade_Waste Chat: %s", ChatText);\r
              sendTradeWL(Client, ChatText, false);\r
              // "TRADE - WL> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_OOC) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_OOC) {\r
              //Console->Print("Custom - OOC Chat: %s", ChatText);\r
              sendOOC(Client, ChatText, false);\r
              // "OOC> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_PLAYERHELP) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_PLAYERHELP) {\r
              //Console->Print("Custom - PlayerToPlayerhelp Chat: %s", ChatText);\r
              sendHelp(Client, ChatText, false);\r
              // "HELP> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_CLANSEARCH) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_CLANSEARCH) {\r
              //Console->Print("Custom - Clansearch Chat: %s", ChatText);\r
              sendClanSearch(Client, ChatText, false);\r
              // "CLANSEARCH> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_SERVICES_CANYON) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_SERVICES_CANYON) {\r
              //Console->Print("Custom - Services_Canyon Chat: %s", ChatText);\r
              sendServicesCS(Client, ChatText, false);\r
              // "SKILL - CS> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_SERVICES_MB) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_SERVICES_MB) {\r
              //Console->Print("Custom - Services_MB Chat: %s", ChatText);\r
              sendServicesMB(Client, ChatText, false);\r
              // "SKILL - MB> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_SERVICES_NC) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_SERVICES_NC) {\r
              //Console->Print("Custom - Services_NC Chat: %s", ChatText);\r
              sendServicesNC(Client, ChatText, false);\r
              // "SKILL - NC> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_SERVICES_TH) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_SERVICES_TH) {\r
              //Console->Print("Custom - Services_TH Chat: %s", ChatText);\r
              sendServicesTH(Client, ChatText, false);\r
              // "SKILL - TH> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_SERVICES_WASTE) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_SERVICES_WASTE) {\r
              //Console->Print("Custom - Services_Waste Chat: %s", ChatText);\r
              sendServicesWL(Client, ChatText, false);\r
              // "SKILL - WL> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TEAM_10) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TEAM_10) {\r
              //Console->Print("Custom - Team10 Chat: %s", ChatText);\r
              sendTeam10(Client, ChatText, false);\r
              // "TEAMSEARCH 10> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TEAM_30) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TEAM_30) {\r
              //Console->Print("Custom - Team30 Chat: %s", ChatText);\r
              sendTeam30(Client, ChatText, false);\r
              // "EAMSEARCH 30> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TEAM_50) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TEAM_50) {\r
              //Console->Print("Custom - Team50 Chat: %s", ChatText);\r
              sendTeam50(Client, ChatText, false);\r
              // "EAMSEARCH 50> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_CUS_TEAM_70) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_CUS_TEAM_70) {\r
              //Console->Print("Custom - Team70 Chat: %s", ChatText);\r
              sendTeam70(Client, ChatText, false);\r
              // "EAMSEARCH 70> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_ADMIN) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_ADMIN) {\r
              //Console->Print("Admin Chat: %s", ChatText);\r
              sendAdmin(Client, ChatText, false);\r
              // "ADMIN> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_GMADMIN) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_GMADMIN) {\r
              //Console->Print("Admin Chat: %s", ChatText);\r
              sendGMAdmin(Client, ChatText, false);\r
              // "ADMIN> %s: %s", PlayerName, ChatText\r
         }\r
-        else if(*(u32*)Channel == CHANNEL_GMCHAT) {\r
+        else if(*(uint32_t*)Channel == CHANNEL_GMCHAT) {\r
              //Console->Print("GameMaster Chat: %s", ChatText);\r
              sendGM(Client, ChatText, false);\r
              // "GM> %s: %s", PlayerName, ChatText\r
         }\r
         else {\r
-             Console->Print("Unknown Chat-Channel: %#x", *(u32*)Channel);\r
+             Console->Print("Unknown Chat-Channel: %#x", *(uint32_t*)Channel);\r
         };\r
   }\r
 }\r
 return (true);\r
 }\r
 \r
-bool PChat::cmpr(const u8 *Array1, const u8 *Array2) {\r
+bool PChat::cmpr(const uint8_t *Array1, const uint8_t *Array2) {\r
    if(Array1[0] == Array2[0] && Array1[1] == Array2[1]) {\r
        return true;\r
    } else {\r
diff --git a/TinNS/Source/GameServer/Chat.hxx b/TinNS/Source/GameServer/Chat.hxx
new file mode 100644 (file)
index 0000000..7d20a6e
--- /dev/null
@@ -0,0 +1,152 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+#define LOCALCHAT_MAXDISTANCE 1433\r
+\r
+class PClient;\r
+\r
+class PChat {\r
+public:\r
+    PChat();\r
+    ~PChat();\r
+\r
+    // INCOMING CHAT\r
+    bool HandleGameChat(PClient *Client, const uint8_t *Packet);\r
+    bool cmpr(const uint8_t *Array1, const uint8_t *Array2);\r
+\r
+    // this function is called by the other more specific functions and simply sends the data to the receiver-client\r
+    bool send(PClient* receiver, const uint8_t* Channel, const char* AuthorNickName, const char* text, bool debugOut=false);\r
+\r
+    // this is for debugging and sends the current connected playerlist to the receiver-client\r
+    void sendConnectedList(PClient* receiver, bool debugOut=false);\r
+\r
+    // specific channel functions:\r
+    void sendBuddy(PClient* author, const char* text, bool debugOut=false);\r
+    void sendLocal(PClient* author, const char* text, bool debugOut=false);\r
+    void sendClan(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTeam(PClient* author, const char* text, bool debugOut=false);\r
+    void sendDirect(PClient* author, PClient* receiver, const char* text, bool debugOut=false);\r
+    void sendZone(PClient* author, const char* text, bool debugOut=false);\r
+    void sendFrak(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTradeCS(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTradeMB(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTradeNC(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTradeTH(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTradeWL(PClient* author, const char* text, bool debugOut=false);\r
+    void sendOOC(PClient* author, const char* text, bool debugOut=false);\r
+    void sendHelp(PClient* author, const char* text, bool debugOut=false);\r
+    void sendClanSearch(PClient* author, const char* text, bool debugOut=false);\r
+    void sendServicesCS(PClient* author, const char* text, bool debugOut=false);\r
+    void sendServicesMB(PClient* author, const char* text, bool debugOut=false);\r
+    void sendServicesNC(PClient* author, const char* text, bool debugOut=false);\r
+    void sendServicesTH(PClient* author, const char* text, bool debugOut=false);\r
+    void sendServicesWL(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTeam10(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTeam30(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTeam50(PClient* author, const char* text, bool debugOut=false);\r
+    void sendTeam70(PClient* author, const char* text, bool debugOut=false);\r
+    void sendAdmin(PClient* author, const char* text, bool debugOut=false);\r
+    void sendGM(PClient* author, const char* text, bool debugOut=false);\r
+    void sendGMAdmin(PClient* author, const char* text, bool debugOut=false);\r
+\r
+    void sendBroadcast(const char* text, bool debugOut=false);\r
+    void sendOOCBroadcast(const char* text, bool debugOut=false);\r
+    void sendPlayerDirect(PClient* author, const char* text, uint32_t destination, bool debugOut=false);\r
+    void sendLocalchat(PClient* receiver, PClient* author, const char* text, bool debugOut=false);\r
+    bool chanEnabled(PClient* Client, uint32_t channel);\r
+};\r
+\r
+/** A WARNING: DO >N O T< (!!!) CHANGE >ANY< OF THE FOLLOWING VARIABLES UNLESS YOU KNOW EXACT WHAT YOU'RE DOING! **/\r
+/** You can easily mess up the entire chat subsystem. If you're unsure, ask Namikon first! **/\r
+/*\r
+####################\r
+   CHANNEL-CODES:\r
+     (INCOMING)\r
+####################\r
+*/\r
+static const uint32_t CHANNEL_BUDDY = 0x00000000;                // Buddy\r
+static const uint32_t CHANNEL_CLAN = 0x00000002;                 // Clan\r
+static const uint32_t CHANNEL_TEAM = 0x00000003;                 // Team\r
+static const uint32_t CHANNEL_DIRECT = 0xFFFFFFFF;               // Direct UNKNOWN YET\r
+static const uint32_t CHANNEL_CUS_ZONE = 0x00000105;             // Custom -> Zone\r
+static const uint32_t CHANNEL_CUS_FRAKTION = 0x00000205;         // Custom -> Fraktion\r
+static const uint32_t CHANNEL_CUS_TRADE_CANYON = 0x00002005;     // Custom -> Trade Canyon\r
+static const uint32_t CHANNEL_CUS_TRADE_MB = 0x00000805;         // Custom -> Trade MB\r
+static const uint32_t CHANNEL_CUS_TRADE_NC = 0x00000405;         // Custom -> Trade NC\r
+static const uint32_t CHANNEL_CUS_TRADE_TH = 0x00001005;         // Custom -> Trade TH\r
+static const uint32_t CHANNEL_CUS_TRADE_WASTE = 0x00004005;      // Custom -> Trade Wastelands\r
+static const uint32_t CHANNEL_CUS_OOC = 0x04000005;              // Custom -> OOC\r
+static const uint32_t CHANNEL_CUS_PLAYERHELP = 0x02000005;       // Custom -> Player 2 Player help\r
+static const uint32_t CHANNEL_CUS_CLANSEARCH = 0x01000005;       // Custom -> Searching Clan\r
+static const uint32_t CHANNEL_CUS_SERVICES_CANYON = 0x00040005;  // Custom -> Runner Services Canyon\r
+static const uint32_t CHANNEL_CUS_SERVICES_MB = 0x00010005;      // Custom -> Runner Services MB\r
+static const uint32_t CHANNEL_CUS_SERVICES_NC = 0x00008005;      // Custom -> Runner Services NC\r
+static const uint32_t CHANNEL_CUS_SERVICES_TH = 0x00020005;      // Custom -> Runner Services TH\r
+static const uint32_t CHANNEL_CUS_SERVICES_WASTE = 0x00080005;   // Custom -> Runner Services Wastelands\r
+static const uint32_t CHANNEL_CUS_TEAM_10 = 0x00100005;          // Custom -> Searching Team ~10\r
+static const uint32_t CHANNEL_CUS_TEAM_30 = 0x00200005;          // Custom -> Searching Team ~30\r
+static const uint32_t CHANNEL_CUS_TEAM_50 = 0x00400005;          // Custom -> Searching Team ~50\r
+static const uint32_t CHANNEL_CUS_TEAM_70 = 0x00800005;          // Custom -> Searching Team ~70\r
+static const uint32_t CHANNEL_ADMIN = 0x000000FF;                // Admin chat\r
+static const uint32_t CHANNEL_GMADMIN = 0x000000FE;                // Admin chat\r
+static const uint32_t CHANNEL_GMCHAT = 0x000000FD;               // GameMaster chat\r
+/*\r
+####################\r
+   CHANNEL-CODES:\r
+     (OUTGOING)\r
+####################\r
+*/\r
+static const uint8_t CHAT_BUDDY[] = {0x00, 0x10};\r
+static const uint8_t CHAT_LOCAL[] =  {0x01, 0x10};\r
+static const uint8_t CHAT_CLAN[] = {0x02, 0x10};\r
+static const uint8_t CHAT_TEAM[] = {0x03, 0x10};\r
+static const uint8_t CHAT_DIRECT[] = {0x04, 0x10};\r
+static const uint8_t CHAT_ZONE[] = {0x05, 0x00};\r
+static const uint8_t CHAT_FRAK[] = {0x05, 0x01};\r
+static const uint8_t CHAT_TRADECS[] = {0x05, 0x05};\r
+static const uint8_t CHAT_TRADEMB[] = {0x05, 0x03};\r
+static const uint8_t CHAT_TRADENC[] = {0x05, 0x02};\r
+static const uint8_t CHAT_TRADETH[] = {0x05, 0x04};\r
+static const uint8_t CHAT_TRADEWL[] = {0x05, 0x06};\r
+static const uint8_t CHAT_OOC[] = {0x05, 0x12};\r
+static const uint8_t CHAT_HELP[] = {0x05, 0x11};\r
+static const uint8_t CHAT_CLANSEARCH[] = {0x05, 0x10};\r
+static const uint8_t CHAT_SERVICECS[] =  {0x05, 0x0A};\r
+static const uint8_t CHAT_SERVICESMB[] = {0x05, 0x08};\r
+static const uint8_t CHAT_SERVICESNC[] = {0x05, 0x07};\r
+static const uint8_t CHAT_SERVICESTH[] = {0x05, 0x09};\r
+static const uint8_t CHAT_SERVICESWL[] = {0x05, 0x0B};\r
+static const uint8_t CHAT_TEAM10[] = {0x05, 0x0C};\r
+static const uint8_t CHAT_TEAM30[] = {0x05, 0x0D};\r
+static const uint8_t CHAT_TEAM50[] = {0x05, 0x0E};\r
+static const uint8_t CHAT_TEAM70[] = {0x05, 0x0F};\r
+static const uint8_t CHAT_ADMIN[] = {0xFF, 0x10};\r
+static const uint8_t CHAT_GMADMIN[] = {0xFE, 0x10};\r
+static const uint8_t CHAT_GM[] = {0xFD, 0x10};\r
+\r
+/*\r
+####################\r
+   CHANNEL-CODES:\r
+(EN/DISABLE-ABLE CHANNELS)\r
+####################\r
+*/\r
+static const uint32_t C_ZONE = 1;\r
+static const uint32_t C_FRAK = 2;\r
+static const uint32_t C_TRADENC = 4;\r
+static const uint32_t C_TRADEMB = 8;\r
+static const uint32_t C_TRADETH = 16;\r
+static const uint32_t C_TRADECS = 32;\r
+static const uint32_t C_TRADEWL = 64;\r
+static const uint32_t C_SERVICENC = 128;\r
+static const uint32_t C_SERVICEMB = 256;\r
+static const uint32_t C_SERVICETH = 512;\r
+static const uint32_t C_SERVICECS = 1024;\r
+static const uint32_t C_SERVICEWL = 2048;\r
+static const uint32_t C_TEAM10 = 4096;\r
+static const uint32_t C_TEAM30 = 8192;\r
+static const uint32_t C_TEAM50 = 16384;\r
+static const uint32_t C_TEAM70 = 32768;\r
+static const uint32_t C_CLANSEARCH = 65536;\r
+static const uint32_t C_HELP = 131072;\r
+static const uint32_t C_OOC = 262144;\r
similarity index 73%
rename from server/src/game/client.cpp
rename to TinNS/Source/GameServer/Client.cxx
index 124ca42..7011b38 100644 (file)
@@ -1,47 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       client.cpp\r
-\r
-       Authors:\r
-       - v00d00\r
-       - Akiko\r
-       - Namikon\r
-\r
-       MODIFIED: 30 Nov 2005 Akiko\r
-       REASON: - added GPL\r
-               - added modifications by Namikon\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "include/worlds.h"\r
-#include "include/msgbuilder.h"\r
-#include "include/subway.h"\r
-#include "decoder/udp_charmove.h"\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 PClient::PClient( int Index )\r
 {\r
@@ -84,7 +43,89 @@ PClient::~PClient()
 }\r
 /// ******************************************************\r
 \r
-u16 PClient::GetUDP_ID()\r
+bool PClient::GetDebugMode(PDebugMode nDebugID)\r
+{\r
+    return mDebugMode[nDebugID];\r
+}\r
+\r
+bool PClient::IsAcceptingNPCUpdates()\r
+{\r
+    return mAcceptNPCUpdates;\r
+}\r
+\r
+void PClient::SetAcceptNPCUpdates(bool nVal)\r
+{\r
+    mAcceptNPCUpdates = nVal;\r
+}\r
+\r
+bool PClient::IsZoning()\r
+{\r
+    return mZoning;\r
+}\r
+\r
+void PClient::SetZoning(bool nVal)\r
+{\r
+    mZoning = nVal;\r
+    if (!nVal)\r
+        mVhcZoning = false;\r
+}\r
+\r
+bool PClient::IsVhcZoning()\r
+{\r
+    return mVhcZoning;\r
+}\r
+\r
+void PClient::SetVhcZoning(bool nVal)\r
+{\r
+    mVhcZoning = nVal;\r
+}\r
+\r
+uint32_t PClient::GetIndex() const\r
+{\r
+    return mIndex;\r
+}\r
+\r
+uint32_t PClient::GetID() const\r
+{\r
+    return mIndex;\r
+}\r
+\r
+uint32_t PClient::GetLocalID() const\r
+{\r
+    return mIndex + 1;\r
+}\r
+\r
+uint32_t PClient::GetCharID() const\r
+{\r
+    return mCharID;\r
+}\r
+\r
+int PClient::GetRemoteUDPPort() const\r
+{\r
+    return mRemotePort;\r
+}\r
+\r
+bool PClient::IsInRemoveActorMode()\r
+{\r
+    return mActorRemoveMode;\r
+}\r
+\r
+void PClient::SetRemoveActorMode(bool nNewValue)\r
+{\r
+    mActorRemoveMode = nNewValue;\r
+}\r
+\r
+void PClient::SetRemoteUDPPort(int port)\r
+{\r
+    mRemotePort = port;\r
+}\r
+\r
+void PClient::SetCharID(int id)\r
+{\r
+    mCharID = id;\r
+}\r
+\r
+uint16_t PClient::GetUDP_ID()\r
 {\r
   if ( m_UDPConnection )\r
     return m_UDPConnection->GetUDP_ID();\r
@@ -109,7 +150,7 @@ void PClient::IncreaseUDP_ID()
     Console->Print( "%s Unable to increase UDP_ID, UDP ConnectionClass is not yet initialized!", Console->ColorText( RED, BLACK, "[WARNING]" ) );\r
 }\r
 \r
-u16 PClient::GetSessionID()\r
+uint16_t PClient::GetSessionID()\r
 {\r
   if ( m_UDPConnection )\r
     return m_UDPConnection->GetSessionID();\r
@@ -118,7 +159,7 @@ u16 PClient::GetSessionID()
   return 0;\r
 }\r
 \r
-u16 PClient::GetTransactionID()\r
+uint16_t PClient::GetTransactionID()\r
 {\r
   if ( m_UDPConnection )\r
     return m_UDPConnection->GetTransactionID();\r
@@ -135,7 +176,7 @@ void PClient::ResetTransactionID()
     Console->Print( "%s Unable to reset UDP TransactionID, UDP ConnectionClass is not yet initialized!", Console->ColorText( RED, BLACK, "[WARNING]" ) );\r
 }\r
 \r
-void PClient::IncreaseTransactionID( u8 nInc )\r
+void PClient::IncreaseTransactionID( uint8_t nInc )\r
 {\r
   if ( m_UDPConnection )\r
     m_UDPConnection->IncreaseTransactionID( nInc );\r
@@ -145,7 +186,7 @@ void PClient::IncreaseTransactionID( u8 nInc )
 \r
 void PClient::FillInUDP_ID( PMessage* nMessage )\r
 {\r
-  u16 CurrPos;\r
+  uint16_t CurrPos;\r
 \r
   if (( nMessage->GetSize() > 9 ) && ( nMessage->U8Data( 0x00 ) == 0x13 ) )\r
   {\r
@@ -164,16 +205,46 @@ void PClient::FillInUDP_ID( PMessage* nMessage )
   nMessage->U16Data( 0x03 ) = GetSessionID();\r
 }\r
 \r
-void PClient::FragmentAndSendUDPMessage( PMessage* nMessage, u8 nType )\r
+void PClient::setTCPConnection(ConnectionTCP *conn)\r
+{\r
+    m_TCPConnection = conn;\r
+    m_UDPConnection = nullptr;\r
+    mConnection = PCC_GAME;\r
+}\r
+\r
+void PClient::setUDPConnection(ConnectionUDP *conn)\r
+{\r
+    m_UDPConnection = conn;\r
+}\r
+\r
+ConnectionTCP *PClient::getTCPConn()\r
+{\r
+    return m_TCPConnection;\r
+}\r
+\r
+ConnectionUDP *PClient::getUDPConn()\r
+{\r
+    return m_UDPConnection;\r
+}\r
+\r
+void PClient::SendTCPMessage(PMessage *nMessage)\r
+{\r
+    if (m_TCPConnection)\r
+        m_TCPConnection->SendMessage(nMessage);\r
+    else\r
+        delete nMessage;\r
+}\r
+\r
+void PClient::FragmentAndSendUDPMessage( PMessage* nMessage, uint8_t nType )\r
 {\r
   PMessage* ChunkBuffer;\r
   PMessage* ChunkMsg;\r
-  const u16 ChunkSize = 220;\r
-  u16 StartIncUDPIDOnChunk = 0;\r
-  u16 IncludedHeaderSize = 0;\r
+  const uint16_t ChunkSize = 220;\r
+  uint16_t StartIncUDPIDOnChunk = 0;\r
+  uint16_t IncludedHeaderSize = 0;\r
   bool ReplaceFirstByte = false;\r
-  u8 ReplaceFirstByteValue = 0;\r
-  u16 MultiTriggeringSize = 0;\r
+  uint8_t ReplaceFirstByteValue = 0;\r
+  uint16_t MultiTriggeringSize = 0;\r
 \r
   switch ( nType )\r
   {\r
@@ -233,9 +304,9 @@ void PClient::FragmentAndSendUDPMessage( PMessage* nMessage, u8 nType )
       nMessage->U8Data( IncludedHeaderSize ) = ReplaceFirstByteValue;\r
     }\r
 \r
-    u16 ChunksNum = ( nMessage->GetSize() - IncludedHeaderSize + ChunkSize - 1 ) / ChunkSize;\r
+    uint16_t ChunksNum = ( nMessage->GetSize() - IncludedHeaderSize + ChunkSize - 1 ) / ChunkSize;\r
 \r
-    for ( u16 ChunkID = 0; ChunkID < ChunksNum; ChunkID++ )\r
+    for ( uint16_t ChunkID = 0; ChunkID < ChunksNum; ChunkID++ )\r
     {\r
       ChunkBuffer = nMessage->GetChunk( IncludedHeaderSize, ChunkSize, ChunkID );\r
       if ( ChunkBuffer == NULL )\r
@@ -250,16 +321,16 @@ void PClient::FragmentAndSendUDPMessage( PMessage* nMessage, u8 nType )
         IncreaseUDP_ID();\r
       }\r
 \r
-      *ChunkMsg << ( u8 )0x13;\r
-      *ChunkMsg << ( u16 )GetUDP_ID();\r
-      *ChunkMsg << ( u16 )GetSessionID();\r
-      *ChunkMsg << ( u8 )( 9 + ChunkBuffer->GetSize() );\r
-      *ChunkMsg << ( u8 )0x03;\r
-      *ChunkMsg << ( u16 )GetUDP_ID();\r
-      *ChunkMsg << ( u8 )0x07; // Fragmented\r
-      *ChunkMsg << ( u16 )ChunkID;\r
-      *ChunkMsg << ( u16 )ChunksNum;\r
-      *ChunkMsg << ( u8 )nType;\r
+      *ChunkMsg << ( uint8_t )0x13;\r
+      *ChunkMsg << ( uint16_t )GetUDP_ID();\r
+      *ChunkMsg << ( uint16_t )GetSessionID();\r
+      *ChunkMsg << ( uint8_t )( 9 + ChunkBuffer->GetSize() );\r
+      *ChunkMsg << ( uint8_t )0x03;\r
+      *ChunkMsg << ( uint16_t )GetUDP_ID();\r
+      *ChunkMsg << ( uint8_t )0x07; // Fragmented\r
+      *ChunkMsg << ( uint16_t )ChunkID;\r
+      *ChunkMsg << ( uint16_t )ChunksNum;\r
+      *ChunkMsg << ( uint8_t )nType;\r
       *ChunkMsg << *ChunkBuffer;\r
 \r
       delete ChunkBuffer;\r
@@ -276,7 +347,13 @@ void PClient::FragmentAndSendUDPMessage( PMessage* nMessage, u8 nType )
   }\r
 }\r
 \r
-/// ******************************************************\r
+void PClient::SendUDPMessage(PMessage *nMessage, bool nVIP)\r
+{\r
+    if (m_UDPConnection)\r
+        m_UDPConnection->SendMessage(nMessage, nVIP);\r
+    else\r
+        delete nMessage;\r
+}\r
 \r
 void PClient::SetDebugMode( PDebugMode nDebugID, bool nVal )\r
 {\r
@@ -289,7 +366,7 @@ void PClient::SetDebugMode( PDebugMode nDebugID, bool nVal )
     mDebugMode[nDebugID] = nVal;\r
 }\r
 \r
-bool PClient::ChangeCharLocation( u32 nLocation, bool DoForce )\r
+bool PClient::ChangeCharLocation( uint32_t nLocation, bool DoForce )\r
 {\r
   if ( gDevDebug )\r
     Console->Print( "%s PClient::ChangeCharLocation", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) );\r
@@ -297,7 +374,7 @@ bool PClient::ChangeCharLocation( u32 nLocation, bool DoForce )
   {\r
     mAcceptNPCUpdates = false; // Zone changed, reject NPC updates till initial NPC spawn\r
     PChar* tChar = GetChar();\r
-    u32 CurrentLocation = tChar->GetLocation();\r
+    uint32_t CurrentLocation = tChar->GetLocation();\r
     if (( CurrentLocation == nLocation ) && !DoForce )\r
       return true;\r
 \r
@@ -321,8 +398,8 @@ bool PClient::ChangeCharLocation( u32 nLocation, bool DoForce )
       if ( tChar->GetLocationLeased() )\r
       {\r
         // TAke care of sitting chars\r
-        u32 ChairObjectId;\r
-        u8 tSeatId;\r
+        uint32_t ChairObjectId;\r
+        uint8_t tSeatId;\r
         PSeatType tSeatType;\r
         if (( tSeatType = tChar->GetSeatInUse( &ChairObjectId, &tSeatId ) ) )\r
         {\r
@@ -330,7 +407,7 @@ bool PClient::ChangeCharLocation( u32 nLocation, bool DoForce )
           PSpawnedVehicle* tVhc = 0;\r
           if ( (tSeatType == seat_vhc) && IsVhcZoning() ) // If seat is vhc,\r
           { // Do  additionnal check\r
-            if (( tVhc = nWorld->GetSpawnedVehicules()->GetVehicle( ChairObjectId ) ) )\r
+            if (( tVhc = nWorld->GetSpawnedVehicles()->GetVehicle( ChairObjectId ) ) )\r
             {\r
               if ( tVhc->GetSeatUser( tSeatId ) == tChar->GetID() )\r
               {\r
@@ -367,6 +444,26 @@ bool PClient::ChangeCharLocation( u32 nLocation, bool DoForce )
   return false;\r
 }\r
 \r
+int PClient::GetConnection() const\r
+{\r
+    return mConnection;\r
+}\r
+\r
+const char *PClient::GetAddress() const\r
+{\r
+    return m_TCPConnection->getRemoteAddress();\r
+}\r
+\r
+uint32_t PClient::GetAccountID() const\r
+{\r
+    return mAccountID;\r
+}\r
+\r
+int PClient::GetAccountLevel() const\r
+{\r
+    return mAccountLevel;\r
+}\r
+\r
 void PClient::GameDisconnect()\r
 {\r
   mAccountID = 0;\r
@@ -398,8 +495,8 @@ void PClient::GameDisconnect()
       }\r
       /* // replaced by the lines above\r
       PSeatType cSeatType;\r
-      u32 cSeatObjectId;\r
-      u8 cSeatId;\r
+      uint32_t cSeatObjectId;\r
+      uint8_t cSeatId;\r
       PWorld* cWorld;\r
 \r
       cWorld = Worlds->GetWorld(tChar->GetLocation());\r
@@ -418,7 +515,7 @@ void PClient::GameDisconnect()
         }\r
         else if(cSeatType == seat_vhc)\r
         {\r
-          cWorld->GetSpawnedVehicules()->GetVehicle(cSeatObjectId)->UnsetSeatUser(cSeatId, GetLocalID());\r
+          cWorld->GetSpawnedVehicles()->GetVehicle(cSeatObjectId)->UnsetSeatUser(cSeatId, GetLocalID());\r
           tChar->SetSeatInUse(seat_none);\r
         }\r
         else\r
@@ -475,6 +572,11 @@ void PClient::RefreshAccountInfo( PAccount *Account )
   mAccountLevel = Account->GetLevel();\r
 }\r
 \r
+void PClient::LoggedIn(PAccount *Account)\r
+{\r
+    RefreshAccountInfo(Account);\r
+}\r
+\r
 void PClient::Update()\r
 {\r
   if ( m_TCPConnection )\r
@@ -522,7 +624,20 @@ PChar* PClient::GetChar() const
   }\r
 }\r
 \r
-bool PClient::GetCharAwaitingWarpto( u16* PosX, u16* PosY, u16* PosZ )\r
+int PClient::getZoneID() const\r
+{\r
+    return m_ZoneID;\r
+}\r
+\r
+void PClient::SetAwaitingWarpto(bool yesno, uint16_t NewX, uint16_t NewY, uint16_t NewZ)\r
+{\r
+    mAwaitingWarpto = yesno;\r
+    mTargetX = NewX;\r
+    mTargetY = NewY;\r
+    mTargetZ = NewZ;\r
+}\r
+\r
+bool PClient::GetCharAwaitingWarpto( uint16_t* PosX, uint16_t* PosY, uint16_t* PosZ )\r
 {\r
   if ( PosX )\r
     *PosX = mTargetX;\r
diff --git a/TinNS/Source/GameServer/Client.hxx b/TinNS/Source/GameServer/Client.hxx
new file mode 100644 (file)
index 0000000..3dbcf57
--- /dev/null
@@ -0,0 +1,172 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+class ConnectionTCP;\r
+class ConnectionUDP;\r
+class PMessage;\r
+\r
+//  TODO: - check that SetUDP_ID, and the mSessionID(UDP_ID_HIGH) real use,\r
+//          and if UDP_ID and mSessionID must be synced (like in NeoX) or not\r
+\r
+enum PClientConnection\r
+{\r
+  PCC_NONE = 0,\r
+  PCC_GAME = 1\r
+};\r
+\r
+// AccountLevel handling is part of accounts.cpp\r
+/*\r
+enum PClientLevel\r
+{\r
+ PCL_BANNED = -1,\r
+ PCL_UNREGPLAYER = 0,\r
+ PCL_REGPLAYER = 1,\r
+ PCL_VOLUNTEER = 30,\r
+ PCL_GM = 50,\r
+ PCL_ADMIN = 100\r
+};\r
+*/\r
+#define DEBUG_MODES 3\r
+enum PDebugMode\r
+{\r
+  DBG_LOCATION = 0,\r
+  DBG_ITEMID = 1,\r
+  DBG_SUBWAY = 2,\r
+  DBG_ALL = DEBUG_MODES // must always be last, with DEBUG_MODES updated as needed\r
+};\r
+\r
+\r
+class PClient\r
+{\r
+  private :\r
+    ConnectionTCP* m_TCPConnection;\r
+    ConnectionUDP* m_UDPConnection;\r
+\r
+    uint32_t mAccountID;\r
+    int mAccountLevel;\r
+    uint32_t mIndex;\r
+    uint32_t mCharID;\r
+\r
+//  uint16_t mUDP_ID;\r
+//  uint16_t mSessionID;\r
+//  uint16_t mTransactionID;\r
+\r
+    // AccountLevel handling is part of accounts.cpp\r
+    //PClientLevel mLevel;\r
+    int mConnection;\r
+    int mRemotePort;\r
+\r
+    bool mDebugMode[DEBUG_MODES];\r
+    // new multiuser-chat implementation //\r
+    int m_ZoneID;\r
+    //int[4] m_IP;\r
+\r
+    //*******\r
+    bool mActorRemoveMode;\r
+    //*******\r
+    bool mAwaitingWarpto;\r
+    uint16_t mTargetX;\r
+    uint16_t mTargetY;\r
+    uint16_t mTargetZ;\r
+    //*******\r
+    bool mAcceptNPCUpdates;\r
+    bool mZoning;\r
+    bool mVhcZoning;\r
+\r
+  public :\r
+    PClient( int Index );\r
+    ~PClient();\r
+\r
+    bool GetDebugMode(PDebugMode nDebugID);\r
+    void SetDebugMode(PDebugMode nDebugID, bool nVal = true);\r
+\r
+    bool IsAcceptingNPCUpdates();\r
+    void SetAcceptNPCUpdates(bool nVal);\r
+    bool IsZoning();\r
+    void SetZoning(bool nVal = true);\r
+    bool IsVhcZoning();\r
+    void SetVhcZoning(bool nVal = true);\r
+\r
+    uint32_t GetIndex() const; // better use GetID()\r
+    uint32_t GetID() const; // for better coherency with other classes\r
+    uint32_t GetLocalID() const;\r
+    uint32_t GetCharID() const;\r
+    PChar* GetChar() const;\r
+    bool ChangeCharLocation(uint32_t nLocation, bool DoForce = false);\r
+\r
+    int GetRemoteUDPPort() const; // Temp solution\r
+\r
+    bool IsInRemoveActorMode();\r
+    void SetRemoveActorMode(bool nNewValue);\r
+\r
+    void SetRemoteUDPPort(int port); // Temp solution\r
+    void SetCharID(int id);//NEW added\r
+\r
+    /*\r
+        inline uint16_t GetUDP_ID() const { return mUDP_ID; }\r
+        inline uint16_t GetSessionID() const { return SESSION_UDP_OFFSET + mUDP_ID ; }\r
+        inline uint16_t GetTransactionID() {return mTransactionID; }\r
+        void SetUDP_ID(int id);\r
+        inline void IncreaseUDP_ID() { SetUDP_ID(mUDP_ID + 1); }\r
+        inline void ResetTransactionID() { mTransactionID = 10170; }\r
+\r
+        inline void IncreaseTransactionID(uint8_t nInc = 1) { mTransactionID += nInc; }\r
+    */\r
+\r
+    // All outgoing ID's and stuff is now part of the ConnectionUDP class itself!\r
+    //    (which is not so good.... comment from Hammag)\r
+    // However, we still have full access to it through these functions\r
+    uint16_t GetUDP_ID();\r
+    void SetUDP_ID( int id );\r
+    void IncreaseUDP_ID();\r
+\r
+    uint16_t GetSessionID();\r
+\r
+    uint16_t GetTransactionID();\r
+    void ResetTransactionID();\r
+    void IncreaseTransactionID( uint8_t nInc = 1 );\r
+\r
+    void FillInUDP_ID( PMessage* nMessage );\r
+\r
+// ************************************************************************ //\r
+    // AccountLevel handling is part of accounts.cpp\r
+    //inline PClientLevel GetLevel() const { return mLevel; }\r
+\r
+    void setTCPConnection(ConnectionTCP *conn);\r
+    void setUDPConnection(ConnectionUDP *conn);\r
+\r
+    ConnectionTCP* getTCPConn();\r
+    ConnectionUDP* getUDPConn();\r
+\r
+    void SendTCPMessage(PMessage *nMessage);\r
+    void FragmentAndSendUDPMessage( PMessage* nMessage, uint8_t nType );\r
+    void SendUDPMessage(PMessage *nMessage, bool nVIP = false);\r
+\r
+    int GetConnection() const;\r
+    const char *GetAddress() const;\r
+    uint32_t GetAccountID() const;\r
+    int GetAccountLevel() const;\r
+\r
+    void GameDisconnect();\r
+\r
+    void RefreshAccountInfo(PAccount *Account);\r
+    void LoggedIn(PAccount *Account);\r
+    void Update();\r
+\r
+    // new multiuser-chat implementation //\r
+    int getZoneID() const;\r
+    //inline int* getIP() const { return (int*) m_IP; }\r
+\r
+    void SetAwaitingWarpto(bool yesno, uint16_t NewX, uint16_t NewY, uint16_t NewZ);\r
+    bool GetCharAwaitingWarpto(uint16_t* PosX = NULL, uint16_t* PosY = NULL, uint16_t* PosZ = NULL);\r
+\r
+    // Char broadcasted effects\r
+    void InitWarpCircle();\r
+    void InitCharVanish();\r
+\r
+    // used for dynamic ingame testing\r
+    uint8_t testval8;\r
+    uint16_t testval16;\r
+    uint32_t testval32;\r
+};\r
similarity index 68%
rename from server/src/game/clientmanager.cpp
rename to TinNS/Source/GameServer/ClientManager.cxx
index 9f3cf73..efe902a 100644 (file)
@@ -1,59 +1,7 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       client.cpp\r
-\r
-       Authors:\r
-       - bakkdoor\r
-       - Akiko\r
-\r
-       MODIFIED: 13 Dec 2005 bakkdoor\r
-       REASON: - introduced\r
-       MODIFIED: 29 Jul 2006 Hammag\r
-       REASON: - Added UDP broadcast fonction\r
-               - Added "zone players say Hello" fonction\r
-               - Modified the ID used as would should avoid muliplying the IDs for the same client.\r
-                 Now using Client.GetLocalID() as the key (=Client.mIndex + 1) which is used in NC protocol\r
-               - Modified getClientByID()\r
-               - Removed getClientID(). Simply do Client->GetLocalID()\r
-               - Modified deleteClientFromListByID() and renamed to deleteClientFromList()\r
-               - Modified destructor as to not destroy stored clients, which is already done in PServer\r
-                 (even if it could well be done here in near futur)\r
-\r
-       MODIFIED: 12 Aug 2006 Hammag\r
-       REASON: - implemented range filtering in UDPBroadcast()\r
-               - implemented the two versions of UDPBroadcast()\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - clean ups\r
-\r
-       TODO:   - these are just begining of modif, as the Client Manager is bound to be a major component for multiplayer management\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "include/msgbuilder.h"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+// TODO:   - these are just begining of modif, as the Client Manager is bound to be a major component for multiplayer management\r
 \r
 PClientManager::PClientManager()\r
 {\r
@@ -95,7 +43,7 @@ bool PClientManager::addClientToList( PClient* newClient )
 }\r
 \r
 // Check if a zone is in use\r
-bool PClientManager::IsWorldInUse( u32 nWorldID ) const\r
+bool PClientManager::IsWorldInUse( uint32_t nWorldID ) const\r
 {\r
   for ( PClientMap::const_iterator it = mClientList.begin(); it != mClientList.end(); it++ )\r
   {\r
@@ -109,7 +57,7 @@ bool PClientManager::IsWorldInUse( u32 nWorldID ) const
 }\r
 \r
 // Check if a rawObjectId belongs to a char is in use\r
-PClient* PClientManager::GetClientByCharLocalId( u32 rawObjectId, u32 nWorldID ) const\r
+PClient* PClientManager::GetClientByCharLocalId( uint32_t rawObjectId, uint32_t nWorldID ) const\r
 {\r
   PClient* nClient;\r
   for ( PClientMap::const_iterator it = mClientList.begin(); it != mClientList.end(); it++ )\r
@@ -124,7 +72,7 @@ PClient* PClientManager::GetClientByCharLocalId( u32 rawObjectId, u32 nWorldID )
   return 0;\r
 }\r
 \r
-void PClientManager::deleteClientFromList( u32 id )\r
+void PClientManager::deleteClientFromList( uint32_t id )\r
 {\r
   PClientMap::iterator it = mClientList.find( id );\r
   if ( it != mClientList.end() )\r
@@ -151,13 +99,13 @@ void PClientManager::deleteClientFromList( u32 id )
     return false;\r
 } */\r
 \r
-PClient* PClientManager::getClientByID( u32 id ) const\r
+PClient* PClientManager::getClientByID( uint32_t id ) const\r
 {\r
   PClientMap::const_iterator it = mClientList.find( id );\r
   return (( it != mClientList.end() ) ? ( PClient* )( it->second ) : NULL );\r
 }\r
 \r
-PClient* PClientManager::getClientByChar( u32 CharID ) const\r
+PClient* PClientManager::getClientByChar( uint32_t CharID ) const\r
 {\r
   for ( PClientMap::const_iterator it = mClientList.begin(); it != mClientList.end(); it++ )\r
   {\r
@@ -183,7 +131,7 @@ PClient* PClientManager::getClientByChar( const std::string &Name ) const
   return NULL;\r
 }\r
 \r
-/* u32 PClientManager::getClientID(PClient* _client)\r
+/* uint32_t PClientManager::getClientID(PClient* _client)\r
 {\r
     for(PClientMap::iterator it=mClientList.begin(); it!=mClientList<p align="center"></p>.end(); it++)\r
     {\r
@@ -197,13 +145,13 @@ PClient* PClientManager::getClientByChar( const std::string &Name ) const
 } */\r
 \r
 // Distance checking doesn't care for Z axis ATM\r
-int PClientManager::UDPBroadcast( PMessage* nMessage, u32 nZoneID, u16 nX, u16 nY, u16 nZ, u16 nMaxDist, u32 nSkipCharId, bool nNPCPing )\r
+int PClientManager::UDPBroadcast( PMessage* nMessage, uint32_t nZoneID, uint16_t nX, uint16_t nY, uint16_t nZ, uint16_t nMaxDist, uint32_t nSkipCharId, bool nNPCPing )\r
 {\r
   int msgCount = 0;\r
   PChar* nChar;\r
   PMessage* tmpMsg;\r
   PClient* itClient;\r
-  u16 Dapprox;\r
+  uint16_t Dapprox;\r
 \r
   for ( PClientMap::iterator it = mClientList.begin(); it != mClientList.end(); it++ )\r
   {\r
@@ -244,10 +192,10 @@ int PClientManager::UDPBroadcast( PMessage* nMessage, u32 nZoneID, u16 nX, u16 n
   return msgCount;\r
 }\r
 \r
-int PClientManager::UDPBroadcast( PMessage* nMessage, PClient* nClient, u16 nMaxDist, bool nSkipSource, bool nNPCPing )\r
+int PClientManager::UDPBroadcast( PMessage* nMessage, PClient* nClient, uint16_t nMaxDist, bool nSkipSource, bool nNPCPing )\r
 {\r
   PChar* nChar;\r
-  u32 skipCharId = nSkipSource ? nClient->GetCharID() : 0 ;\r
+  uint32_t skipCharId = nSkipSource ? nClient->GetCharID() : 0 ;\r
 \r
   if ( nClient && ( nChar = nClient->GetChar() ) )\r
   {\r
@@ -266,7 +214,7 @@ int PClientManager::SendUDPZoneWelcomeToClient( PClient* nClient )
   PChar* nChar;\r
   PChar* itChar;\r
   PMessage* tmpMsg;\r
-  u32 nZoneID;\r
+  uint32_t nZoneID;\r
   PClient* itClient;\r
 \r
   if ( nClient && ( nChar = nClient->GetChar() ) ) // if nClient is set, always use its zone\r
diff --git a/TinNS/Source/GameServer/ClientManager.hxx b/TinNS/Source/GameServer/ClientManager.hxx
new file mode 100644 (file)
index 0000000..71eb2db
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+\r
+typedef std::map<uint32_t, PClient*> PClientMap;\r
+\r
+class PClientManager {\r
+private:\r
+    //int       mLastID;\r
+    PClientMap mClientList;\r
+\r
+public:\r
+    PClientManager();\r
+    ~PClientManager();\r
+\r
+    PClientMap::iterator   getClientListBegin() { return mClientList.begin(); }\r
+    PClientMap::iterator   getClientListEnd() { return mClientList.end(); }\r
+\r
+    bool addClientToList( PClient* newClient );\r
+    //void deleteClientFromListByID(int id);\r
+    void deleteClientFromList( uint32_t id );\r
+    //bool deleteClientFromList(PClient* delClient); // maybe no use for this...\r
+    PClient* getClientByID( uint32_t uint32_t ) const; // returns pointer to a client for further use\r
+    PClient* getClientByChar( uint32_t CharID ) const;\r
+    PClient* getClientByChar( const std::string &Name ) const;\r
+    // int getClientID(PClient* _client); do _client->GetLocalID()\r
+    bool IsWorldInUse( uint32_t nWorldID ) const; // Temp until world content fully managed by world\r
+    PClient* GetClientByCharLocalId( uint32_t rawObjectId, uint32_t nWorldID  ) const; // Temp (called by world) until world content fuly managed by world\r
+\r
+    // each function return the number of messages sent.\r
+    int UDPBroadcast( PMessage* nMessage, uint32_t nZoneID, uint16_t nX = 0, uint16_t nY = 0, uint16_t nZ = 0, uint16_t nMaxDist = 0, uint32_t nSkipCharId = 0, bool nNPCPing = false );\r
+    int UDPBroadcast( PMessage* nMessage, PClient* nClient, uint16_t nMaxDist = 0, bool nSkipSource = false, bool nNPCPing = false );\r
+    int SendUDPZoneWelcomeToClient( PClient* nClient );\r
+};\r
similarity index 88%
rename from server/src/game/commands.cpp
rename to TinNS/Source/GameServer/Commands.cxx
index 7dc907d..0d6c973 100644 (file)
@@ -1,46 +1,6 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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.
-*/
-
-
-
-/*
-       commands.cpp - handles ingame commands (@<command>)
-
-       Authors:
-       - Namikon
-    - bakkdoor
-    - Hammag
-
-
-    File rewritten on 20th Dec 2006 by Namikon
-    Note: Later, when we add multithread support to tinns, the FlushArgs() functions
-          have to be placed ONLY in con/destructor and nowhere else.
-          Besides that, no global GameCommands, we should do that with tmpCmd = new PCommands;
-*/
-#include "main.h"
-
-#include "include/client.h"
-#include "include/msgbuilder.h"
-#include "include/worlds.h"
-#include "include/worldactors.h"
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 PCommands::PCommands()
 {
@@ -103,38 +63,38 @@ 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\r
+         // 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;
\r
-            // Now loop until next space ' '  or end '\0' is reached\r
-            // Added extraction of encapsulated strings "test 123 123"\r
+
+            // Now loop until next space ' '  or end '\0' is reached
+            // Added extraction of encapsulated strings "test 123 123"
             while (packet[posPacket] != ' ' || tEncapsedString == true)
-             {\r
-                // Watch out for >"<\r
-                if(packet[posPacket] == '"')\r
-                    tEncapsedString = !tEncapsedString;\r
-                else\r
-                {\r
-                    // Copy arg from chatpacket to final arg var\r
-                    ArgV[ArgC][tmpPos] = packet[posPacket];\r
-                    tmpPos++;\r
-                }\r
-                    // Increment tmpPos and posPacket\r
-                 posPacket++;\r
-                if(packet[posPacket] == '\0')\r
-                    break;\r
+             {
+                // Watch out for >"<
+                if(packet[posPacket] == '"')
+                    tEncapsedString = !tEncapsedString;
+                else
+                {
+                    // Copy arg from chatpacket to final arg var
+                    ArgV[ArgC][tmpPos] = packet[posPacket];
+                    tmpPos++;
+                }
+                    // Increment tmpPos and posPacket
+                 posPacket++;
+                if(packet[posPacket] == '\0')
+                    break;
             }
-            tEncapsedString = false;\r
+            tEncapsedString = false;
             // Reached either the end of packet or an whitespace
             // Terminate current ArgV
             ArgV[ArgC][tmpPos] = '\0';
 
-             // Heh, we got one! Now more to next arg\r
-             ArgC++;\r
+             // 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 +278,15 @@ void PCommands::HandleGameCommand(char *packet, PClient *Client)
     else if (strcmp(Command, "setsubskill") == 0)
     {
         doCmdSetSubSkill();
-     }\r
-    else if (strcmp(Command, "npc") == 0)\r
-     {\r
-        doNPC();\r
-     }\r
-    else if (strcmp(Command, "npcshop") == 0)\r
-     {\r
-        doNPC_Shop();\r
-     }\r
+     }
+    else if (strcmp(Command, "npc") == 0)
+     {
+        doNPC();
+     }
+    else if (strcmp(Command, "npcshop") == 0)
+     {
+        doNPC_Shop();
+     }
     // Else: unknown command. Ignore
 }
 
similarity index 73%
rename from server/src/game/include/commands.h
rename to TinNS/Source/GameServer/Commands.hxx
index 16b6ced..e06d88e 100644 (file)
@@ -1,41 +1,5 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
+#pragma once
 
-       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.
-*/
-
-
-
-/*
-       commands.h
-
-       Authors:
-       - Namikon
-
-       MODIFIED: 11 Dec 2005 Namikon
-       REASON: - initial release
-       MODIFIED: 15 Dec 2005 Namikon
-       REASON: - Added SendRawFile(...)
-
-*/
-
-#ifndef COMMANDS_H
-#define COMMANDS_H
 #define MAXARGS 10       // Define the max nr. of args here. Should never be more than 4, but who knows...
 #define MAXDUMBSIZE 256 // Max size of packetdumb
 
@@ -123,4 +87,3 @@ public:
 
     void HandleGameCommand(char *packet, PClient *Client);
 };
-#endif
similarity index 75%
rename from server/src/game/configtemplate.h
rename to TinNS/Source/GameServer/ConfigTemplate.hxx
index 00772a0..03aed73 100644 (file)
@@ -1,38 +1,10 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
+#pragma once\r
 \r
 /*\r
-    Configuration template for gameserver\r
-    Used to set available/optional/required options when loading config\r
-      with a PConfig object.\r
-\r
-       MODIFIED: 28 Sep 2006 Hammag\r
-       REASON: - added worlds_path entry\r
-  MODIFIED: 02 Oct 2006 Hammag\r
-       REASON: - added dev_debug entry\r
-\r
   TODO: put a single data_directory entry as the root directory for all NC data\r
-\r
 */\r
 \r
-const char* GameConfigTemplate[][2] = {\r
+static const char *GameConfigTemplate[][2] = {\r
   // {option_name, default_value} if default_value is empty string, it means option is mandatory\r
   // List ends with empty string for option_name\r
   {"info_sql_host", "127.0.0.1"},\r
@@ -79,7 +51,7 @@ const char* GameConfigTemplate[][2] = {
   {"password_filter", "^[[:graph:]]{3,15}$"},\r
   {"charname_filter", "^[a-z]+([\\-\\ ]?[a-z]+){0,2}$"},\r
   {"clanname_filter", "^[a-z][\\w\\-\\ ]{2,14}$"},\r
-  \r
+\r
 // For futur use:\r
 //  {"max_chars_per_account", "4"},\r
 //  {"multiple_logins_per_account", "0"}, // 0=nobody, 1=gm+ only, 2=everybody\r
@@ -90,7 +62,7 @@ const char* GameConfigTemplate[][2] = {
   {"", ""} // do not change this line (end mark)\r
 };\r
 \r
-const char* CommandsTemplate[][2] = {\r
+static const char *CommandsTemplate[][2] = {\r
     {"debug", "100"},\r
     {"settime", "100"},\r
     {"warp", "0"},\r
similarity index 79%
rename from server/src/game/container.cpp
rename to TinNS/Source/GameServer/Container.cxx
index 00f03fe..aa60f3c 100644 (file)
@@ -1,43 +1,10 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       container.cpp - base classe for containers\r
-\r
-       MODIFIED: 28 Jul 2008 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - clean ups\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "include/item.h"\r
-#include "include/container.h"\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /* --- PContainerEntry class --- */\r
 \r
-PContainerEntry::PContainerEntry( PItem* nItem, u8 X, u8 Y, u32 nInvID, bool SetDirty )\r
+PContainerEntry::PContainerEntry( PItem* nItem, uint8_t X, uint8_t Y, uint32_t nInvID, bool SetDirty )\r
 {\r
   mItem = nItem;\r
   mPosX = X;\r
@@ -54,15 +21,15 @@ PContainerEntry::PContainerEntry( MYSQL_ROW row )
   mPosY = atoi( row[i_y] );\r
   mDirtyFlag = false;\r
 \r
-  u32 nItemID = atoi( row[i_itemid] );\r
-  u8 nStackSize = atoi( row[i_qty] );\r
+  uint32_t nItemID = atoi( row[i_itemid] );\r
+  uint8_t nStackSize = atoi( row[i_qty] );\r
   //     = std::atoi(row[i_type]);\r
-  u8 CurDur = atoi( row[i_curdur] );\r
-  u8 Dmg = atoi( row[i_dmg] );\r
-  u8 Freq = atoi( row[i_freq] );\r
-  u8 Hand = atoi( row[i_hand] );\r
-  u8 Rng = atoi( row[i_rng] );\r
-  u8 Dur = atoi( row[i_maxdur] );\r
+  uint8_t CurDur = atoi( row[i_curdur] );\r
+  uint8_t Dmg = atoi( row[i_dmg] );\r
+  uint8_t Freq = atoi( row[i_freq] );\r
+  uint8_t Hand = atoi( row[i_hand] );\r
+  uint8_t Rng = atoi( row[i_rng] );\r
+  uint8_t Dur = atoi( row[i_maxdur] );\r
 \r
   mItem = new PItem( nItemID, nStackSize, CurDur, Dur, Dmg, Freq, Hand, Rng );\r
 }\r
@@ -72,7 +39,7 @@ PContainerEntry::~PContainerEntry()
   delete mItem;\r
 }\r
 \r
-bool PContainerEntry::SQLSave( u32 CharID, u32 InvLoc )\r
+bool PContainerEntry::SQLSave( uint32_t CharID, uint32_t InvLoc )\r
 {\r
   std::string query, queryv;\r
 \r
@@ -156,7 +123,7 @@ bool PContainerEntry::SQLDelete()
 \r
 /* --- PContainer class --- */\r
 \r
-PContainer::PContainer( u8 nMaxSlots )\r
+PContainer::PContainer( uint8_t nMaxSlots )\r
 {\r
   mMaxSlots = ( nMaxSlots > CONTAINER_MAX_SIZE ? CONTAINER_MAX_SIZE : nMaxSlots ) ;\r
   if ( mMaxSlots )\r
@@ -171,18 +138,18 @@ PContainer::PContainer( u8 nMaxSlots )
 \r
 PContainer::~PContainer()\r
 {\r
-  for ( u8 i = 0; i < mContContent->size(); ++i )\r
+  for ( uint8_t i = 0; i < mContContent->size(); ++i )\r
     delete mContContent->at( i );\r
 \r
   if ( mExclusiveUseCharID )\r
     Console->Print( RED, BLACK, "[ERROR] PContainer::~PContainer: Char %d still has exclusive access to container !!! Bad Pointer error will happen.", mExclusiveUseCharID );\r
 }\r
 \r
-bool PContainer::AddEntry( PContainerEntry* NewEntry, u8 nSlotId )\r
+bool PContainer::AddEntry( PContainerEntry* NewEntry, uint8_t nSlotId )\r
 {\r
   if ( IsSlotAllowed( nSlotId ) )\r
   {\r
-    for ( u8 i = mContContent->size(); i <= nSlotId; ++i ) // Extend as needed\r
+    for ( uint8_t i = mContContent->size(); i <= nSlotId; ++i ) // Extend as needed\r
       mContContent->push_back( static_cast<PContainerEntry*>(NULL) );\r
     if ( mContContent->at( nSlotId ) )\r
     {\r
@@ -206,14 +173,14 @@ bool PContainer::AddEntry( PContainerEntry* NewEntry, u8 nSlotId )
   ---            --- */\r
 }\r
 \r
-void PContainer::SetEntryPosXY( PContainerEntry* nEntry, u8 nSlotId, u8 nPosX, u8 nPosY )\r
+void PContainer::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX, uint8_t nPosY )\r
 {\r
   nPosX = nPosY;\r
   nEntry->Set2DPos( nSlotId, 0 );\r
   mDirtyFlag = mDirtyFlag || nEntry->mDirtyFlag;\r
 }\r
 \r
-PContainerEntry* PContainer::RemoveEntry( u8 nSlotId )\r
+PContainerEntry* PContainer::RemoveEntry( uint8_t nSlotId )\r
 {\r
   PContainerEntry* tEntry = NULL;\r
 \r
@@ -225,14 +192,14 @@ PContainerEntry* PContainer::RemoveEntry( u8 nSlotId )
   return tEntry;\r
 }\r
 \r
-bool PContainer::GetFreeSlot( u8* nSlotId )\r
+bool PContainer::GetFreeSlot( uint8_t* nSlotId )\r
 {\r
   return IsSlotFree( *nSlotId );\r
 }\r
 \r
-void PContainer::Compact( u8 startSlotId )\r
+void PContainer::Compact( uint8_t startSlotId )\r
 {\r
-  u8 i, j;\r
+  uint8_t i, j;\r
   PContainerEntry* tEntry;\r
 \r
   for ( i = j = startSlotId; i < mContContent->size(); ++i )\r
@@ -257,7 +224,7 @@ void PContainer::Compact( u8 startSlotId )
   }\r
 }\r
 \r
-bool PContainer::StartUse( u32 nExclusiveUseCharID )\r
+bool PContainer::StartUse( uint32_t nExclusiveUseCharID )\r
 {\r
   if ( mExclusiveUseCharID )\r
     return false;\r
@@ -268,7 +235,7 @@ bool PContainer::StartUse( u32 nExclusiveUseCharID )
   }\r
 }\r
 \r
-bool PContainer::EndUse( u32 nExclusiveUseCharID )\r
+bool PContainer::EndUse( uint32_t nExclusiveUseCharID )\r
 {\r
   if ( nExclusiveUseCharID == mExclusiveUseCharID )\r
   {\r
@@ -294,8 +261,8 @@ bool PContainer::SQLLoad()
   char query[1024];\r
   PContainerEntry* NewEntry;\r
   bool SaveDirtyFlag;\r
-  u8 nSlotId;\r
-  //u8 nPosX, nPosY, nSizeX, nSizeY;\r
+  uint8_t nSlotId;\r
+  //uint8_t nPosX, nPosY, nSizeX, nSizeY;\r
 \r
   /*if (!mContContent.empty())\r
   {\r
@@ -350,7 +317,7 @@ bool PContainer::SQLSave()
   PContainerEntry* ContEntry;\r
   bool SavedOK = true;\r
 \r
-  for ( u8 i = 0; i < mContContent->size(); ++i )\r
+  for ( uint8_t i = 0; i < mContContent->size(); ++i )\r
   {\r
     if (( ContEntry = mContContent->at( i ) ) )\r
     {\r
@@ -368,7 +335,7 @@ bool PContainer::SQLSave()
   return SavedOK;\r
 }\r
 \r
-bool PContainer::IsSlotFree( u8 nSlotId )\r
+bool PContainer::IsSlotFree( uint8_t nSlotId )\r
 {\r
   if ( !IsSlotAllowed( nSlotId ) )\r
     return false;\r
@@ -379,7 +346,7 @@ bool PContainer::IsSlotFree( u8 nSlotId )
     return !( mContContent->at( nSlotId ) );\r
 }\r
 \r
-bool PContainer::AddItem( PItem* NewItem, u32 nInvID, u8 nPosX, u8 nPosY, bool SetDirty )\r
+bool PContainer::AddItem( PItem* NewItem, uint32_t nInvID, uint8_t nPosX, uint8_t nPosY, bool SetDirty )\r
 {\r
   /* --- auto stacking not implemented yet\r
   1 - if stackable, check if same item(S) exists\r
@@ -409,13 +376,13 @@ bool PContainer::AddItem( PItem* NewItem, u32 nInvID, u8 nPosX, u8 nPosY, bool S
   }\r
 }\r
 \r
-bool PContainer::MoveItem( u8 srcSlotId, u8 nCount, PContainer* dstContainer, u8 dstSlotId, u8 nPosX, u8 nPosY )\r
+bool PContainer::MoveItem( uint8_t srcSlotId, uint8_t nCount, PContainer* dstContainer, uint8_t dstSlotId, uint8_t nPosX, uint8_t nPosY )\r
 {\r
   if ( dstContainer == this )\r
     return this->MoveItem( srcSlotId, nCount, dstSlotId );\r
   else if ( dstContainer->GetFreeSlot( &dstSlotId ) )\r
   {\r
-    u8 savePosX, savePosY;\r
+    uint8_t savePosX, savePosY;\r
     PContainerEntry* tEntry = this->GetEntry( srcSlotId );\r
     if ( tEntry )\r
     {\r
@@ -455,7 +422,7 @@ bool PContainer::MoveItem( u8 srcSlotId, u8 nCount, PContainer* dstContainer, u8
 }\r
 \r
 // !!! Not partial move yet !!!\r
-bool PContainer::MoveItem( u8 srcSlotId, u8 nCount, u8 dstSlotId )\r
+bool PContainer::MoveItem( uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId )\r
 {\r
   if ( !( IsSlotAllowed( srcSlotId ) && IsSlotAllowed( dstSlotId ) ) )\r
     return false;\r
@@ -483,7 +450,7 @@ std::vector< PContainerEntry* >* PContainer::GetEntries()
 {\r
   std::vector< PContainerEntry* >* Entries = new std::vector< PContainerEntry* >;\r
 \r
-  for ( u8 i = 0; i < mContContent->size(); ++i )\r
+  for ( uint8_t i = 0; i < mContContent->size(); ++i )\r
   {\r
     if ( mContContent->at( i ) )\r
       Entries->push_back( mContContent->at( i ) );\r
@@ -492,7 +459,7 @@ std::vector< PContainerEntry* >* PContainer::GetEntries()
   return Entries;\r
 }\r
 \r
-PContainerEntry* PContainer::GetEntry( u8 nSlotId )\r
+PContainerEntry* PContainer::GetEntry( uint8_t nSlotId )\r
 {\r
   if ( nSlotId >= mContContent->size() )\r
     return NULL;\r
@@ -500,18 +467,18 @@ PContainerEntry* PContainer::GetEntry( u8 nSlotId )
   return mContContent->at( nSlotId );\r
 }\r
 \r
-PItem* PContainer::GetItem( u8 nSlotId )\r
+PItem* PContainer::GetItem( uint8_t nSlotId )\r
 {\r
   PContainerEntry* tEntry = this->GetEntry( nSlotId );\r
   return ( tEntry ? tEntry->mItem : NULL );\r
 }\r
 \r
-u8 PContainer::RandomFill( u8 nItemCount, int nItemContainerDefIndex )\r
+uint8_t PContainer::RandomFill( uint8_t nItemCount, int nItemContainerDefIndex )\r
 {\r
   PItem* nItem = NULL;\r
   const PDefItems* nItemDef;\r
-  u32 nItemSeqId;\r
-  u8 CreatedCount = 0;\r
+  uint32_t nItemSeqId;\r
+  uint8_t CreatedCount = 0;\r
 \r
   if ( !nItemCount )\r
     nItemCount = mMaxSlots;\r
@@ -521,18 +488,18 @@ u8 PContainer::RandomFill( u8 nItemCount, int nItemContainerDefIndex )
   if ( nItemContainerDefIndex >= 0 )\r
   {\r
     int newItemIdx, newItemIndex;\r
-    u8 newItemQuality;\r
+    uint8_t newItemQuality;\r
 \r
     const PDefItemContainer* containerDef = GameDefs->ItemContainers()->GetDef( nItemContainerDefIndex );\r
     if ( containerDef )\r
     {\r
-      for ( u8 i = 0; i < nItemCount; ++i )\r
+      for ( uint8_t i = 0; i < nItemCount; ++i )\r
       {\r
         newItemIdx = containerDef->GetRandomItemIdx();\r
         if ( newItemIdx >= 0 )\r
         {\r
           newItemIndex = containerDef->GetItemId( newItemIdx );\r
-          newItemQuality = ( u8 )( 255 & int( 255.0 * containerDef->GetQuality( newItemIdx ) ) );\r
+          newItemQuality = ( uint8_t )( 255 & int( 255.0 * containerDef->GetQuality( newItemIdx ) ) );\r
           if ( newItemIndex <= 0 ) // Item group\r
           {\r
             newItemIndex = GameDefs->Items()->GetRandomItemIdFromGroup( -newItemIndex );\r
@@ -560,7 +527,7 @@ u8 PContainer::RandomFill( u8 nItemCount, int nItemContainerDefIndex )
   {\r
     int NumItemsDefs = GameDefs->Items()->GetNumDefs();\r
 \r
-    for ( u8 i = 0; i < nItemCount; ++i )\r
+    for ( uint8_t i = 0; i < nItemCount; ++i )\r
     {\r
       nItemSeqId = GetRandom( NumItemsDefs, 1 );\r
 \r
@@ -591,8 +558,8 @@ void PContainer::Dump()
 {\r
   PContainerEntry* tmpEntry;\r
   PItem* tmpItem;\r
-  u8 i;\r
-  //u8 y, x;\r
+  uint8_t i;\r
+  //uint8_t y, x;\r
 \r
   for ( i = 0; i < mContContent->size(); ++i )\r
   {\r
@@ -612,7 +579,7 @@ void PContainer::Dump()
 \r
 \r
 /* --- PContainerAutoCompact --- */\r
-PContainerEntry* PContainerAutoCompact::RemoveEntry( u8 nSlotId )\r
+PContainerEntry* PContainerAutoCompact::RemoveEntry( uint8_t nSlotId )\r
 {\r
   PContainerEntry* tEntry = NULL;\r
 \r
@@ -628,7 +595,7 @@ PContainerEntry* PContainerAutoCompact::RemoveEntry( u8 nSlotId )
   return tEntry;\r
 }\r
 \r
-bool PContainerAutoCompact::GetFreeSlot( u8* nSlotId ) // not optimal. A "first free from end" would be better at PContainer level\r
+bool PContainerAutoCompact::GetFreeSlot( uint8_t* nSlotId ) // not optimal. A "first free from end" would be better at PContainer level\r
 {\r
   bool Found = false;\r
 \r
@@ -641,7 +608,7 @@ bool PContainerAutoCompact::GetFreeSlot( u8* nSlotId ) // not optimal. A "first
   return ( Found || IsSlotAllowed( *nSlotId ) );\r
 }\r
 \r
-bool PContainerAutoCompact::MoveItem( u8 srcSlotId, u8 nCount, u8 dstSlotId )\r
+bool PContainerAutoCompact::MoveItem( uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId )\r
 {\r
   srcSlotId = nCount = dstSlotId;\r
   return false;\r
@@ -649,7 +616,7 @@ bool PContainerAutoCompact::MoveItem( u8 srcSlotId, u8 nCount, u8 dstSlotId )
 \r
 /* --- PContainer2D class --- */\r
 \r
-void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, u8 nSlotId, u8 nPosX, u8 nPosY )\r
+void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX, uint8_t nPosY )\r
 {\r
   nSlotId = nSlotId;\r
   if (( nPosX >= INV_BACKPACK_COLS ) || ( nPosY == 255 ) )\r
@@ -662,7 +629,7 @@ void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, u8 nSlotId, u8 nPosX,
 \r
 /* --- PContainer2DWorkaround --- */\r
 /////\r
-PContainer2DWorkaround::PContainer2DWorkaround( u8 nMaxSlots ) : PContainerWithHoles( nMaxSlots )\r
+PContainer2DWorkaround::PContainer2DWorkaround( uint8_t nMaxSlots ) : PContainerWithHoles( nMaxSlots )\r
 {\r
   nMaxSlots = nMaxSlots;\r
   mNextFreeSlot = 0;\r
@@ -678,13 +645,13 @@ PContainer2DWorkaround::~PContainer2DWorkaround()
     delete mContSpace[i];\r
 }\r
 \r
-bool PContainer2DWorkaround::AddEntry( PContainerEntry* tEntry, u8 nSlotId )\r
+bool PContainer2DWorkaround::AddEntry( PContainerEntry* tEntry, uint8_t nSlotId )\r
 {\r
   if ( IsSlotAllowed( nSlotId ) )\r
   {\r
     if ( FindValid2DPos( tEntry ) )\r
     {\r
-      for ( u8 i = mContContent->size(); i <= nSlotId; ++i ) // Extend as needed\r
+      for ( uint8_t i = mContContent->size(); i <= nSlotId; ++i ) // Extend as needed\r
         mContContent->push_back( static_cast<PContainerEntry *>(NULL) );\r
       if ( mContContent->at( nSlotId ) )\r
       {\r
@@ -712,7 +679,7 @@ bool PContainer2DWorkaround::AddEntry( PContainerEntry* tEntry, u8 nSlotId )
 \r
 }\r
 \r
-PContainerEntry* PContainer2DWorkaround::RemoveEntry( u8 nSlotId )\r
+PContainerEntry* PContainer2DWorkaround::RemoveEntry( uint8_t nSlotId )\r
 {\r
   PContainerEntry* tEntry = NULL;\r
 \r
@@ -726,7 +693,7 @@ PContainerEntry* PContainer2DWorkaround::RemoveEntry( u8 nSlotId )
   return tEntry;\r
 }\r
 \r
-bool PContainer2DWorkaround::GetFreeSlot( u8* nSlotId )\r
+bool PContainer2DWorkaround::GetFreeSlot( uint8_t* nSlotId )\r
 {\r
   if ( IsSlotAllowed( mNextFreeSlot ) )\r
   {\r
@@ -737,7 +704,7 @@ bool PContainer2DWorkaround::GetFreeSlot( u8* nSlotId )
     return false;\r
 }\r
 \r
-void PContainer2DWorkaround::SetEntryPosXY( PContainerEntry* nEntry, u8 nSlotId, u8 nPosX, u8 nPosY )\r
+void PContainer2DWorkaround::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX, uint8_t nPosY )\r
 {\r
   nSlotId = nSlotId;\r
   if (( nPosX == 255 ) && ( nPosY == 255 ) )\r
@@ -761,7 +728,7 @@ void PContainer2DWorkaround::SetEntryPosXY( PContainerEntry* nEntry, u8 nSlotId,
   mDirtyFlag = mDirtyFlag || nEntry->mDirtyFlag;\r
 }\r
 \r
-bool PContainer2DWorkaround::MoveItem( u8 srcSlotId, u8 nCount, u8 dstSlotId )\r
+bool PContainer2DWorkaround::MoveItem( uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId )\r
 {\r
   srcSlotId = nCount = dstSlotId;\r
   return false;\r
@@ -777,7 +744,7 @@ void PContainer2DWorkaround::AddRow()
   }\r
 }\r
 \r
-bool PContainer2DWorkaround::Is2DFree( u8 PosX, u8 PosY, u8 SizeX, u8 SizeY )\r
+bool PContainer2DWorkaround::Is2DFree( uint8_t PosX, uint8_t PosY, uint8_t SizeX, uint8_t SizeY )\r
 {\r
   if (( PosX == 255 ) && ( PosY == 255 ) )\r
   {\r
@@ -786,7 +753,7 @@ bool PContainer2DWorkaround::Is2DFree( u8 PosX, u8 PosY, u8 SizeX, u8 SizeY )
   if ( !Is2DPosAllowed( PosX, PosY, SizeX, SizeY ) )\r
     return false;\r
 \r
-  u8 h, v;\r
+  uint8_t h, v;\r
   for ( v = 0; ( v < SizeY ) && ( PosY + v < mRows ) ; v++ ) // what is over existing rows is free\r
   {\r
     for ( h = 0; h < SizeX; h++ )\r
@@ -803,10 +770,10 @@ bool PContainer2DWorkaround::Is2DFree( u8 PosX, u8 PosY, u8 SizeX, u8 SizeY )
 \r
 void PContainer2DWorkaround::SetUsed( PContainerEntry* nEntry, bool Value )\r
 {\r
-  u8 PosX = nEntry->mPosX;;\r
-  u8 PosY = nEntry->mPosY;\r
-  u8 SizeX = nEntry->mItem->GetSizeX();\r
-  u8 SizeY = nEntry->mItem->GetSizeY();\r
+  uint8_t PosX = nEntry->mPosX;;\r
+  uint8_t PosY = nEntry->mPosY;\r
+  uint8_t SizeX = nEntry->mItem->GetSizeX();\r
+  uint8_t SizeY = nEntry->mItem->GetSizeY();\r
 \r
   if ( !Is2DPosAllowed( PosX, PosY, SizeX, SizeY ) )\r
     return;\r
@@ -814,7 +781,7 @@ void PContainer2DWorkaround::SetUsed( PContainerEntry* nEntry, bool Value )
   while ( PosY + SizeY > mRows ) // add new rows when needed\r
     AddRow();\r
 \r
-  u8 h, v;\r
+  uint8_t h, v;\r
   for ( v = 0; ( v < SizeY ) && ( PosY + v < mRows ) ; v++ )\r
   {\r
     for ( h = 0; ( h < SizeX ) && ( PosX + h < mMaxCols ); h++ )\r
@@ -825,9 +792,9 @@ void PContainer2DWorkaround::SetUsed( PContainerEntry* nEntry, bool Value )
 bool PContainer2DWorkaround::FindValid2DPos( PContainerEntry* nEntry )\r
 {\r
   bool Found = false;\r
-  u8 SizeX = nEntry->mItem->GetSizeX();\r
-  u8 SizeY = nEntry->mItem->GetSizeY();\r
-  u8 dPosX, dPosY;\r
+  uint8_t SizeX = nEntry->mItem->GetSizeX();\r
+  uint8_t SizeY = nEntry->mItem->GetSizeY();\r
+  uint8_t dPosX, dPosY;\r
 \r
   if ( Is2DFree( nEntry->mPosX, nEntry->mPosY, SizeX, SizeY ) )\r
     Found = true;\r
@@ -869,7 +836,7 @@ void PContainer2DWorkaround::Dump()
   PContainer::Dump();\r
 \r
   std::string tmpS;\r
-  u8 y, x;\r
+  uint8_t y, x;\r
   for ( y = 0 ; y < mRows; y++ )\r
   {\r
     tmpS = "";\r
@@ -883,7 +850,7 @@ void PContainer2DWorkaround::Dump()
 }\r
 \r
 /* --- PContainerAutoFindFree --- */\r
-bool PContainerAutoFindFree::GetFreeSlot( u8* nSlotId )\r
+bool PContainerAutoFindFree::GetFreeSlot( uint8_t* nSlotId )\r
 {\r
   bool Found = false;\r
 \r
@@ -898,7 +865,7 @@ bool PContainerAutoFindFree::GetFreeSlot( u8* nSlotId )
 }\r
 \r
 /* --- PContainerAutoCompactOnClose --- */\r
-bool PContainerAutoCompactOnClose::EndUse( u32 nExclusiveUseCharID )\r
+bool PContainerAutoCompactOnClose::EndUse( uint32_t nExclusiveUseCharID )\r
 {\r
   if ( nExclusiveUseCharID == mExclusiveUseCharID )\r
   {\r
diff --git a/TinNS/Source/GameServer/Container.hxx b/TinNS/Source/GameServer/Container.hxx
new file mode 100644 (file)
index 0000000..4037b79
--- /dev/null
@@ -0,0 +1,194 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <vector>\r
+#ifdef MYSQL_INC_DIR\r
+#include <mysql/mysql.h>\r
+#else\r
+#include <mysql.h>\r
+#endif\r
+\r
+#define CONTAINER_MAX_SIZE 254\r
+\r
+class PItem;\r
+\r
+class PContainerEntry {\r
+  friend class PContainer;\r
+  friend class PContainer2D;\r
+  friend class PMsgBuilder;\r
+  friend class PContainer2DWorkaround;\r
+\r
+private:\r
+    enum {\r
+      i_invid = 0,\r
+      i_charid,\r
+      i_invloc,\r
+      i_x,\r
+      i_y,\r
+      i_itemid,\r
+      //i_type,\r
+      i_flag,\r
+      i_qty,\r
+      i_sqty,\r
+      i_curdur,\r
+      i_dmg,\r
+      i_freq,\r
+      i_hand,\r
+      i_rng,\r
+      i_maxdur,\r
+      i_slots,\r
+      i_slt1,\r
+      i_slt2,\r
+      i_slt3,\r
+      i_slt4,\r
+      i_slt5,\r
+      i_atype,\r
+      i_conatin\r
+    };\r
+\r
+    PItem* mItem;\r
+    uint8_t  mPosX;\r
+    uint8_t  mPosY;\r
+    uint32_t mInvID;\r
+    bool mDirtyFlag;\r
+\r
+    PContainerEntry(PItem* nItem, uint8_t X, uint8_t Y, uint32_t nInvID = 0, bool SetDirty = true);\r
+    PContainerEntry(MYSQL_ROW row);\r
+\r
+    bool SQLSave(uint32_t CharID, uint32_t InvLoc);\r
+    bool SQLDelete();\r
+\r
+    inline void Set2DPos(uint8_t nPosX, uint8_t nPosY) { mDirtyFlag = mDirtyFlag || (mPosX != nPosX) || (mPosY != nPosY) ; mPosX = nPosX; mPosY = nPosY; }\r
+\r
+public:\r
+    ~PContainerEntry();\r
+\r
+    inline void Get2DPos(uint8_t* oPosX, uint8_t* oPosY) { *oPosX = mPosX; *oPosY = mPosY; }\r
+};\r
+\r
+\r
+\r
+class PContainer // Holes allowed, no autofind free slots\r
+{\r
+    protected:\r
+    uint8_t mMaxSlots;\r
+    std::vector< PContainerEntry* >* mContContent;\r
+    uint32_t mCharID;\r
+    uint32_t mInvLoc;\r
+    uint32_t mExclusiveUseCharID;\r
+    bool mDirtyFlag;\r
+\r
+    inline bool IsSlotAllowed(uint8_t nSlotId) { return ((nSlotId < CONTAINER_MAX_SIZE) && (!mMaxSlots || (nSlotId < mMaxSlots))); }\r
+    virtual bool AddEntry(PContainerEntry* NewEntry, uint8_t nSlotId = 0);\r
+    virtual PContainerEntry* RemoveEntry(uint8_t nSlotId);\r
+    virtual bool GetFreeSlot(uint8_t* nSlotId);\r
+        void Compact(uint8_t startSlotId = 0);\r
+\r
+  public:\r
+    PContainer(uint8_t nMaxSlots = 0);\r
+    virtual ~PContainer();\r
+\r
+    inline void SetInfo(uint32_t CharID, uint32_t InvLoc) { mCharID = CharID; mInvLoc = InvLoc; }\r
+    inline uint32_t GetOwnerId() { return mCharID; }\r
+    inline bool IsDirty() { return mDirtyFlag; }\r
+    inline void SetDirty() { mDirtyFlag = true; }\r
+    bool StartUse(uint32_t nExclusiveUseCharID = 0);\r
+    virtual bool EndUse(uint32_t nExclusiveUseCharID = 0);\r
+    bool SQLLoad();\r
+    bool SQLSave();\r
+    bool IsSlotFree(uint8_t nSlotId);\r
+    virtual bool AddItem(PItem* NewItem, uint32_t nInvID = 0, uint8_t nPosX = 0, uint8_t nPosY = 0, bool SetDirty = true);\r
+    virtual bool MoveItem(uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId);\r
+    bool MoveItem(uint8_t srcSlotId, uint8_t nCount, PContainer* dstContainer, uint8_t dstSlotId = 0, uint8_t nPosX = 0, uint8_t nPosY = 0);\r
+      virtual void SetEntryPosXY(PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX = 0, uint8_t nPosY = 0);\r
+\r
+    virtual uint8_t RandomFill(uint8_t nItemCount = 0, int nItemContainerDefIndex = -1);\r
+    PContainerEntry* GetEntry(uint8_t nSlotId);\r
+    std::vector< PContainerEntry* >* GetEntries();\r
+    PItem* GetItem(uint8_t nSlotId);\r
+    virtual void Dump();\r
+};\r
+\r
+\r
+class PContainerWithHoles : public PContainer // Holes allowed, no autofind free slots\r
+{\r
+  public:\r
+    PContainerWithHoles(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    virtual ~PContainerWithHoles() {}\r
+};\r
+\r
+\r
+class PContainerAutoCompact : public PContainer // No holes allowed, automatic add to end slot (no control on insertion slot)\r
+{\r
+protected:\r
+    virtual PContainerEntry* RemoveEntry(uint8_t nSlotId);\r
+    virtual bool GetFreeSlot(uint8_t* nSlotId);\r
+\r
+public:\r
+    PContainerAutoCompact(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    virtual ~PContainerAutoCompact() {}\r
+    virtual bool MoveItem(uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId);\r
+};\r
+\r
+\r
+class PContainer2D : public PContainerAutoCompact // + slotId not used, non-significant XY used (no XY check yet)\r
+{\r
+  public:\r
+    PContainer2D(uint8_t nMaxSlots = 0) : PContainerAutoCompact(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    virtual ~PContainer2D() {}\r
+\r
+        virtual void SetEntryPosXY(PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX = 0, uint8_t nPosY = 0);\r
+};\r
+\r
+class PContainer2DWorkaround : public PContainerWithHoles // Holes allowed, autofind free slot (always increasing id)\r
+{\r
+private:\r
+    uint8_t mNextFreeSlot;\r
+    std::vector< std::vector<bool>* > mContSpace;\r
+    uint8_t mMaxCols;\r
+    uint8_t mMaxRows;\r
+    uint8_t mRows;\r
+\r
+    void AddRow();\r
+    inline bool Is2DPosAllowed(uint8_t PosX, uint8_t PosY, uint8_t SizeX, uint8_t SizeY)\r
+    {\r
+      return ((PosX < mMaxCols-SizeX+1) && (PosY < mMaxRows-SizeY+1));\r
+    }\r
+    bool Is2DFree(uint8_t PosX, uint8_t PosY, uint8_t SizeX, uint8_t SizeY);\r
+    bool FindValid2DPos(PContainerEntry* nEntry);\r
+\r
+protected:\r
+    bool AddEntry(PContainerEntry* NewEntry, uint8_t nSlotId = 0);\r
+    PContainerEntry* RemoveEntry(uint8_t nSlotId);\r
+    bool GetFreeSlot(uint8_t* nSlotId);\r
+\r
+  public:\r
+    PContainer2DWorkaround(uint8_t nMaxSlots = 0);\r
+    ~PContainer2DWorkaround();\r
+\r
+    bool MoveItem(uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId);\r
+\r
+    void Set2DPosMax(uint8_t MaxPosX, uint8_t MaxPosY = 254) { mMaxCols = MaxPosX; mMaxRows = MaxPosY; }\r
+    void SetEntryPosXY(PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX = 0, uint8_t nPosY = 0);\r
+    void SetUsed(PContainerEntry* nEntry, bool Value = true);\r
+    void Dump();\r
+};\r
+\r
+class PContainerAutoFindFree : public PContainerWithHoles // No holes kept after EndUse, automatic find first free slots (no control on insertion slot)\r
+{\r
+  protected:\r
+    virtual bool GetFreeSlot(uint8_t* nSlotId);\r
+\r
+  public:\r
+    PContainerAutoFindFree(uint8_t nMaxSlots = 0) : PContainerWithHoles(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    virtual ~PContainerAutoFindFree() {}\r
+};\r
+\r
+class PContainerAutoCompactOnClose : public PContainerAutoFindFree // No holes kept after EndUse, automatic find first free slots (no control on insertion slot)\r
+{\r
+  public:\r
+    PContainerAutoCompactOnClose(uint8_t nMaxSlots = 0) : PContainerAutoFindFree(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    virtual ~PContainerAutoCompactOnClose() {}\r
+\r
+    virtual bool EndUse(uint32_t nExclusiveUseCharID = 0);\r
+};\r
diff --git a/TinNS/Source/GameServer/Decoder/CMakeLists.txt b/TinNS/Source/GameServer/Decoder/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f7d9bb9
--- /dev/null
@@ -0,0 +1,7 @@
+ADD_LIBRARY             (Decoder MessageDecoder.cxx Udp0x08.cxx Udp0x13.cxx Udp0x1f.cxx Udp0x22.cxx Udp0x2b.cxx
+                         UdpAnalyser.cxx UdpAppartment.cxx UdpCharMove.cxx UdpChat.cxx UdpDeathRespawn.cxx 
+                         UdpEntityPositionRequest.cxx UdpHack.cxx UdpHeldItemAction.cxx UdpItemManualReload.cxx
+                         UdpItemMove.cxx UdpItemUse.cxx UdpKillSelf.cxx UdpMultiPart.cxx UdpNpcDialog.cxx UdpOOO.cxx
+                         UdpOutfitter.cxx UdpPacket0.cxx UdpPing.cxx UdpPopupResponse.cxx UdpPvpTrade.cxx
+                         UdpQuickAccessBelt.cxx UdpRequestInfo.cxx UdpSubSkill.cxx UdpSync.cxx UdpTerminal.cxx
+                         UdpUseObject.cxx UdpVehicle.cxx UdpWorldIdInfo.cxx UdpZoning.cxx)
diff --git a/TinNS/Source/GameServer/Decoder/Includes.hxx b/TinNS/Source/GameServer/Decoder/Includes.hxx
new file mode 100644 (file)
index 0000000..8e40015
--- /dev/null
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "GameServer/Decoder/MessageDecoder.hxx"
+#include "GameServer/Decoder/Udp0x08.hxx"
+#include "GameServer/Decoder/Udp0x13.hxx"
+#include "GameServer/Decoder/Udp0x1f.hxx"
+#include "GameServer/Decoder/Udp0x22.hxx"
+#include "GameServer/Decoder/Udp0x2b.hxx"
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+#include "GameServer/Decoder/UdpAppartment.hxx"
+#include "GameServer/Decoder/UdpCharMove.hxx"
+#include "GameServer/Decoder/UdpChat.hxx"
+#include "GameServer/Decoder/UdpDeathRespawn.hxx"
+#include "GameServer/Decoder/UdpEntityPositionRequest.hxx"
+#include "GameServer/Decoder/UdpHack.hxx"
+#include "GameServer/Decoder/UdpHeldItemAction.hxx"
+#include "GameServer/Decoder/UdpItemManualReload.hxx"
+#include "GameServer/Decoder/UdpItemMove.hxx"
+#include "GameServer/Decoder/UdpItemUse.hxx"
+#include "GameServer/Decoder/UdpKillSelf.hxx"
+#include "GameServer/Decoder/UdpMultiPart.hxx"
+#include "GameServer/Decoder/UdpNpcDialog.hxx"
+#include "GameServer/Decoder/UdpOOO.hxx"
+#include "GameServer/Decoder/UdpOutfitter.hxx"
+#include "GameServer/Decoder/UdpPacket0.hxx"
+#include "GameServer/Decoder/UdpPing.hxx"
+#include "GameServer/Decoder/UdpPopupResponse.hxx"
+#include "GameServer/Decoder/UdpPvpTrade.hxx"
+#include "GameServer/Decoder/UdpQuickAccessBelt.hxx"
+#include "GameServer/Decoder/UdpRequestInfo.hxx"
+#include "GameServer/Decoder/UdpSubSkill.hxx"
+#include "GameServer/Decoder/UdpSync.hxx"
+#include "GameServer/Decoder/UdpTerminal.hxx"
+#include "GameServer/Decoder/UdpUseObject.hxx"
+#include "GameServer/Decoder/UdpVehicle.hxx"
+#include "GameServer/Decoder/UdpWorldIdInfo.hxx"
+#include "GameServer/Decoder/UdpZoning.hxx"
diff --git a/TinNS/Source/GameServer/Decoder/MessageDecoder.cxx b/TinNS/Source/GameServer/Decoder/MessageDecoder.cxx
new file mode 100644 (file)
index 0000000..fa36ad3
--- /dev/null
@@ -0,0 +1,169 @@
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+void PUdpMsgDecoder::Init(PMessage *nMessage, PClient *nClient)\r
+{\r
+    mDecodeData.mMessage = nMessage;\r
+    mDecodeData.mClient = nClient;\r
+    mDecodeData.mState = (nMessage && nClient) ? DECODE_MORE : DECODE_UNDEF;\r
+    mDecodeData.mUnknownType = 0;\r
+    mDecodeData.mHandling0x13Sub = false;\r
+    mDecodeData.Sub0x13Start = mDecodeData.Sub0x13StartNext = 0;\r
+    mPacketName.erase();\r
+    mDecodeData.mName.str(mPacketName);\r
+    mDecodeData.mErrorDetail.erase();\r
+    mDecodeData.mTraceKnownMsg = false;\r
+    mDecodeData.mTraceUnknownMsg = false;\r
+    mDecodeData.mTraceDump = false;\r
+    if (mCurrentAnalyser)\r
+    {\r
+        delete mCurrentAnalyser;\r
+        mCurrentAnalyser = nullptr;\r
+    }\r
+}\r
+\r
+PUdpMsgDecoder::PUdpMsgDecoder()\r
+{\r
+  mCurrentAnalyser = nullptr;\r
+  Reset();\r
+}\r
+\r
+PUdpMsgDecoder::PUdpMsgDecoder(PMessage *nMessage, PClient *nClient)\r
+{\r
+  mCurrentAnalyser = nullptr;\r
+  Init(nMessage, nClient);\r
+}\r
+\r
+PUdpMsgDecoder::~PUdpMsgDecoder()\r
+{\r
+  if (mCurrentAnalyser)\r
+  {\r
+    delete mCurrentAnalyser;\r
+  }\r
+}\r
+\r
+bool PUdpMsgDecoder::Analyse()\r
+{\r
+  PUdpMsgAnalyser* nextAnalyser;\r
+\r
+  if ((mDecodeData.mState & DECODE_MORE) || mDecodeData.mHandling0x13Sub)\r
+  {\r
+    if (mCurrentAnalyser)\r
+    {\r
+      delete mCurrentAnalyser;\r
+      mCurrentAnalyser = nullptr;\r
+    }\r
+    if (mDecodeData.mHandling0x13Sub)\r
+    {\r
+      mPacketName.erase();\r
+      mDecodeData.mName.str(mPacketName);\r
+      mCurrentAnalyser = new PUdp0x13(&mDecodeData);\r
+      mDecodeData.mState = DECODE_MORE;\r
+    }\r
+    else\r
+    {\r
+      mCurrentAnalyser = new PUdpMsgAnalyser(&mDecodeData);\r
+    }\r
+\r
+    while (mDecodeData.mState & DECODE_MORE)\r
+    {\r
+      nextAnalyser = mCurrentAnalyser->Analyse();\r
+      if (mCurrentAnalyser != nextAnalyser)\r
+      {\r
+        delete mCurrentAnalyser;\r
+        mCurrentAnalyser = nextAnalyser;\r
+      }\r
+    }\r
+  }\r
+  return (!(mDecodeData.mState & (DECODE_MORE | DECODE_ERROR | DECODE_UNKNOWN)));\r
+}\r
+\r
+bool PUdpMsgDecoder::Analyse(PMessage *nMessage, PClient *nClient)\r
+{\r
+  Init(nMessage, nClient);\r
+  return Analyse();\r
+}\r
+\r
+void PUdpMsgDecoder::Init(PMessage *nMessage, PClient *nClient, PGameState *nClientState)\r
+{\r
+    mDecodeData.mClientState = nClientState;\r
+    Init(nMessage, nClient);\r
+}\r
+\r
+uint8_t PUdpMsgDecoder::GetState()\r
+{\r
+    return mDecodeData.mState;\r
+}\r
+\r
+bool PUdpMsgDecoder::IsError()\r
+{\r
+    return (mDecodeData.mState & DECODE_ERROR);\r
+}\r
+\r
+bool PUdpMsgDecoder::IsKnown()\r
+{\r
+    return (!(mDecodeData.mState & DECODE_UNKNOWN));\r
+}\r
+\r
+bool PUdpMsgDecoder::MoreSubMsg()\r
+{\r
+    return mDecodeData.mHandling0x13Sub;\r
+}\r
+\r
+bool PUdpMsgDecoder::IsActionReady()\r
+{\r
+    return (mDecodeData.mState & DECODE_ACTION_READY);\r
+}\r
+\r
+bool PUdpMsgDecoder::IsActionDone()\r
+{\r
+    return (mDecodeData.mState & DECODE_ACTION_DONE);\r
+}\r
+\r
+bool PUdpMsgDecoder::IsTraceKnownMsg()\r
+{\r
+    return mDecodeData.mTraceKnownMsg;\r
+}\r
+\r
+bool PUdpMsgDecoder::IsTraceUnknownMsg()\r
+{\r
+    return mDecodeData.mTraceUnknownMsg;\r
+}\r
+\r
+bool PUdpMsgDecoder::IsTraceDump()\r
+{\r
+    return mDecodeData.mTraceDump;\r
+}\r
+\r
+void PUdpMsgDecoder::DumpMsg()\r
+{\r
+    if (mDecodeData.mMessage)\r
+        mDecodeData.mMessage->Dump();\r
+}\r
+\r
+std::string const &PUdpMsgDecoder::GetName()\r
+{\r
+    return (mTmpName = mDecodeData.mName.str());\r
+}\r
+\r
+std::string const &PUdpMsgDecoder::GetError()\r
+{\r
+    return mDecodeData.mErrorDetail;\r
+}\r
+\r
+bool PUdpMsgDecoder::DoAction()\r
+{\r
+  if (mDecodeData.mState & DECODE_ACTION_READY)\r
+  {\r
+    return mCurrentAnalyser->DoAction();\r
+  }\r
+  else\r
+  {\r
+    return false;\r
+  }\r
+}\r
+\r
+void PUdpMsgDecoder::Reset()\r
+{\r
+    Init(nullptr, nullptr);\r
+}\r
diff --git a/TinNS/Source/GameServer/Decoder/MessageDecoder.hxx b/TinNS/Source/GameServer/Decoder/MessageDecoder.hxx
new file mode 100644 (file)
index 0000000..edf2a6b
--- /dev/null
@@ -0,0 +1,73 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <sstream>\r
+#include <string>\r
+\r
+struct PGameState;\r
+class PClient;\r
+class PMessage;\r
+class PUdpMsgAnalyser;\r
+\r
+#define DECODE_UNDEF 0\r
+#define DECODE_ERROR 1 // one error occured on the current decoding step\r
+#define DECODE_UNKNOWN 2 // the current decoded (sub)message is unkown\r
+#define DECODE_MORE 4 // more decoding needed for the (sub)message\r
+#define DECODE_FINISHED 8 // decoding if finished for the whole message\r
+#define DECODE_ACTION_READY 16 // an action is ready to be done\r
+#define DECODE_ACTION_DONE 32 // the action triggered hasn't to be triggered again\r
+#define DECODE_ACTION_IGNORED 64 // the action wasn't performed for some (good) reason (to combine or not with DONE)\r
+#define DECODE_ACTION_FAILED 128 // the action failed totally or partially (to combine or not with DONE)\r
+\r
+struct PMsgDecodeData {\r
+    PMessage *mMessage;\r
+    PClient *mClient;\r
+    uint8_t mState;\r
+    uint8_t mUnknownType;\r
+    bool mHandling0x13Sub;\r
+    uint16_t Sub0x13Start;\r
+    uint16_t Sub0x13StartNext;\r
+    std::stringstream mName;\r
+    std::string mErrorDetail;\r
+    bool mTraceKnownMsg;\r
+    bool mTraceUnknownMsg;\r
+    bool mTraceDump;\r
+    PGameState *mClientState; // Temporary until State is put back in Client object\r
+};\r
+\r
+// UDP Message decoder\r
+// boolean methods return true if successful\r
+\r
+class PUdpMsgDecoder {\r
+private:\r
+    PMsgDecodeData mDecodeData;\r
+    PUdpMsgAnalyser *mCurrentAnalyser;\r
+    std::string mPacketName;\r
+    std::string mTmpName;\r
+\r
+    void Init(PMessage *nMessage, PClient *nClient);\r
+\r
+public:\r
+    PUdpMsgDecoder();\r
+    PUdpMsgDecoder(PMessage *nMessage, PClient *nClient);\r
+    ~PUdpMsgDecoder();\r
+\r
+    bool Analyse();\r
+    bool Analyse(PMessage *nMessage, PClient *nClient); // Can be used on non initialized or already used object\r
+    // Temporary form until State is put back in Client object\r
+    void Init(PMessage *nMessage, PClient *nClient, PGameState *nClientState);\r
+    uint8_t GetState();\r
+    bool IsError();\r
+    bool IsKnown();\r
+    bool MoreSubMsg();\r
+    bool IsActionReady();\r
+    bool IsActionDone();\r
+    bool IsTraceKnownMsg();\r
+    bool IsTraceUnknownMsg();\r
+    bool IsTraceDump();\r
+    void DumpMsg();\r
+    std::string const &GetName();\r
+    std::string const &GetError();\r
+    bool DoAction();\r
+    void Reset();\r
+};\r
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x08.cxx b/TinNS/Source/GameServer/Decoder/Udp0x08.cxx
new file mode 100644 (file)
index 0000000..ab5424a
--- /dev/null
@@ -0,0 +1,24 @@
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+\r
+PUdp0x08::PUdp0x08(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
+{\r
+  nDecodeData->mName << "/0x08";\r
+}\r
+\r
+PUdpMsgAnalyser* PUdp0x08::Analyse()\r
+{\r
+    mDecodeData->mName << "=Client crash";\r
+    mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;\r
+\r
+    return this;\r
+}\r
+\r
+bool PUdp0x08::DoAction()\r
+{\r
+    // Client crashed, close connection from our side\r
+    GameServer->ClientDisconnected(mDecodeData->mClient);\r
+    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;\r
+\r
+    return true;\r
+}\r
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x08.hxx b/TinNS/Source/GameServer/Decoder/Udp0x08.hxx
new file mode 100644 (file)
index 0000000..81b9443
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdp0x08 : public PUdpMsgAnalyser {\r
+public:\r
+    PUdp0x08(PMsgDecodeData *nDecodeData);\r
+    //~PUdp0x08();\r
+    PUdpMsgAnalyser* Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 72%
rename from server/src/game/decoder/udp_0x13.cpp
rename to TinNS/Source/GameServer/Decoder/Udp0x13.cxx
index 3a89ad4..edd7e4e 100644 (file)
@@ -1,49 +1,6 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_0x13.cpp - decoder classes for UDP 0x13 messages
-
- CREATION: 31 Aug 2006 Hammag
-
- MODIFIED:
- REASON: -
-*/
-
-#include "main.h"
-#include "udp_0x13.h"
-
-#include "udp_OOO.h"
-#include "udp_zoning.h"
-#include "udp_0x1f.h"
-#include "udp_0x22.h"
-#include "udp_ping.h"
-#include "udp_sync.h"
-#include "udp_charmove.h"
-#include "udp_packet0.h"
-#include "udp_vhc.h"
-#include "udp_0x2b.h"
-#include "udp_itemmanualreload.h"
-#include "udp_worldIDinfo.h"
-#include "udp_multipart.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdp0x13 ****/
 
@@ -59,31 +16,31 @@ 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 );
 //Console->Print("Multi 0x13 msg continuing at %d", TmpMsg->GetNextByteOffset());
         }
         mDecodeData->Sub0x13Start = TmpMsg->GetNextByteOffset();
-        u8 PSize = TmpMsg->U8Data( mDecodeData->Sub0x13Start );
-        u16 EndOffset = mDecodeData->Sub0x13StartNext = mDecodeData->Sub0x13Start + 1 + PSize;
+        uint8_t PSize = TmpMsg->U8Data( mDecodeData->Sub0x13Start );
+        uint16_t EndOffset = mDecodeData->Sub0x13StartNext = mDecodeData->Sub0x13Start + 1 + PSize;
 
         if ( EndOffset >= TmpMsg->GetSize() )
         {
@@ -105,17 +62,17 @@ PUdpMsgAnalyser* PUdp0x13::Analyse()
         }
 
         mDecodeData->mState = DECODE_MORE;
-        u8 MsgType = TmpMsg->U8Data( mDecodeData->Sub0x13Start + 1 );
-        /*u16 PSeq = 0; // This will have to be handled to detected missing granted-delivery messages
+        uint8_t MsgType = TmpMsg->U8Data( mDecodeData->Sub0x13Start + 1 );
+        /*uint16_t PSeq = 0; // This will have to be handled to detected missing granted-delivery messages
         if (MsgType == 0x03)
-        PSeq = *(u16*)&Buf[Offset+2];*/
+        PSeq = *(uint16_t*)&Buf[Offset+2];*/
 //Console->Print("0x13 Type: %d", MsgType);
         switch ( MsgType )
-               {
+        {
         case 0x03:
         {
             mDecodeData->mName << "/0x03";
-            u8 MsgSubType = TmpMsg->U8Data( TmpMsg->GetNextByteOffset() + 4 );
+            uint8_t MsgSubType = TmpMsg->U8Data( TmpMsg->GetNextByteOffset() + 4 );
             switch ( MsgSubType )
             {
             case 0x01: // Out of order
@@ -161,25 +118,25 @@ 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:
         {
             mDecodeData->mName << "/0x1f";
-            u8 MsgSubType = TmpMsg->U8Data( TmpMsg->GetNextByteOffset() + 4 );
+            uint8_t MsgSubType = TmpMsg->U8Data( TmpMsg->GetNextByteOffset() + 4 );
             if ( MsgSubType == 0x15 ) // Weapon reload animation start
             {
                 nextAnalyser = new PUdpReloadAnimStart( mDecodeData );
@@ -189,7 +146,7 @@ PUdpMsgAnalyser* PUdp0x13::Analyse()
                 mDecodeData->mUnknownType = MsgType;
                 mDecodeData->mTraceUnknownMsg = true;
             }
-                       break;
+            break;
         }
 
         case 0x20: // Char move
@@ -201,8 +158,8 @@ PUdpMsgAnalyser* PUdp0x13::Analyse()
         case 0x27: // Sitting object info request
         {
             nextAnalyser = new PUdpRequestVhcInfo( mDecodeData );
-                       break;
-               }
+            break;
+        }
 
         case 0x2a: // "Packet0"
         {
@@ -211,15 +168,15 @@ 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 );
+            uint8_t MsgSubType = TmpMsg->U8Data( TmpMsg->GetNextByteOffset() + 4 );
             switch ( MsgSubType )
             {
             case 0x00: // Subway position update
@@ -239,13 +196,13 @@ PUdpMsgAnalyser* PUdp0x13::Analyse()
             }
             }
             break;
-               }
+        }
 
         default:
-               {
+        {
             mDecodeData->mUnknownType = MsgType;
-                       break;
-               }
+            break;
+        }
         }
 
         if ( ! nextAnalyser )
@@ -253,6 +210,6 @@ PUdpMsgAnalyser* PUdp0x13::Analyse()
             nextAnalyser = new PUdpMsgUnknown( mDecodeData );
         }
 
-       }
+    }
     return nextAnalyser;
 }
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x13.hxx b/TinNS/Source/GameServer/Decoder/Udp0x13.hxx
new file mode 100644 (file)
index 0000000..7d93ffc
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdp0x13 : public PUdpMsgAnalyser {\r
+public:\r
+    PUdp0x13(PMsgDecodeData *nDecodeData);\r
+    //~PUdp0x13();\r
+    PUdpMsgAnalyser* Analyse();\r
+    //bool DoAction();\r
+};\r
similarity index 71%
rename from server/src/game/decoder/udp_0x1f.cpp
rename to TinNS/Source/GameServer/Decoder/Udp0x1f.cxx
index e143971..d51857c 100644 (file)
@@ -1,57 +1,5 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- udp_udp0x1f.cpp - decoder classes for UDP 0x13x03x1f messages\r
-\r
- CREATION: 6 Sep 2006 Hammag\r
-\r
- MODIFIED:\r
- REASON: -\r
-\r
-*/\r
-\r
-#include "main.h"\r
-#include "udp_0x1f.h"\r
-\r
-#include "udp_zoning.h"\r
-#include "udp_charmove.h"\r
-#include "udp_vhc.h"\r
-#include "udp_subskill.h"\r
-#include "udp_chat.h"\r
-#include "udp_useobject.h"\r
-#include "udp_appartment.h"\r
-#include "udp_quickaccessbelt.h"\r
-#include "udp_itemmove.h"\r
-#include "udp_hack.h"\r
-#include "udp_outfitter.h"\r
-#include "udp_helditemaction.h"\r
-#include "udp_killself.h"\r
-#include "udp_popupresponse.h"\r
-#include "udp_itemmanualreload.h"\r
-#include "udp_itemuse.h"\r
-#include "udp_deathrespawn.h"\r
-#include "udp_pvptrade.h"\r
-#include "udp_npcdialog.h"\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /**** PUdp0x1f ****/\r
 \r
@@ -64,19 +12,19 @@ PUdpMsgAnalyser* PUdp0x1f::Analyse()
 {\r
   PUdpMsgAnalyser* nextAnalyser = NULL;\r
   mDecodeData->mState = DECODE_MORE;\r
-  u8 MsgType = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 7 );\r
-  u8 MsgSubType = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 8 );\r
+  uint8_t MsgType = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 7 );\r
+  uint8_t MsgSubType = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 8 );\r
 \r
   switch ( MsgType )\r
   {\r
     case 0x00:\r
     {\r
-         nextAnalyser = new PUdpHeldItemBasicAction( mDecodeData );\r
+      nextAnalyser = new PUdpHeldItemBasicAction( mDecodeData );\r
       break;\r
     }\r
     case 0x01:\r
     {\r
-         nextAnalyser = new PUdpHeldItemAimedAction( mDecodeData );\r
+      nextAnalyser = new PUdpHeldItemAimedAction( mDecodeData );\r
       break;\r
     }\r
     case 0x02:\r
@@ -114,9 +62,9 @@ PUdpMsgAnalyser* PUdp0x1f::Analyse()
       nextAnalyser = new PUdpItemSlotUse( mDecodeData );\r
       break;\r
     }\r
-       case 0x20: // Use item for hacking, launcher, "launcher" spell\r
+    case 0x20: // Use item for hacking, launcher, "launcher" spell\r
     {\r
-         nextAnalyser = new PUdpHeldItemLaunchingAction( mDecodeData );\r
+      nextAnalyser = new PUdpHeldItemLaunchingAction( mDecodeData );\r
       break;\r
     }\r
     case 0x22:\r
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x1f.hxx b/TinNS/Source/GameServer/Decoder/Udp0x1f.hxx
new file mode 100644 (file)
index 0000000..0613a0c
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdp0x1f : public PUdpMsgAnalyser {\r
+public:\r
+    PUdp0x1f(PMsgDecodeData *nDecodeData);\r
+    //~PUdp0x1f();\r
+    PUdpMsgAnalyser *Analyse();\r
+    //bool DoAction();\r
+};\r
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x22.cxx b/TinNS/Source/GameServer/Decoder/Udp0x22.cxx
new file mode 100644 (file)
index 0000000..459666b
--- /dev/null
@@ -0,0 +1,51 @@
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+/**** PUdp0x22 ****/\r
+\r
+PUdp0x22::PUdp0x22(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
+{\r
+  nDecodeData->mName << "/0x22";\r
+}\r
+\r
+PUdpMsgAnalyser* PUdp0x22::Analyse()\r
+{\r
+  PUdpMsgAnalyser* nextAnalyser = NULL;\r
+  mDecodeData->mState = DECODE_MORE;\r
+  uint8_t MsgType = mDecodeData->mMessage->U8Data(mDecodeData->Sub0x13Start + 5);\r
+  switch(MsgType) // MsgType is probably uint16_t rather than uint8_t\r
+  {\r
+    case 0x03: // Zoning phase 2\r
+    {\r
+      nextAnalyser = new PUdpZoning2(mDecodeData);\r
+      break;\r
+    }\r
+    case 0x06: // Char/Clan/Rank/Map Info request\r
+    {\r
+      nextAnalyser = new PUdpReqInfo(mDecodeData);\r
+      break;\r
+    }\r
+    case 0x0b: // Entity position request\r
+    {\r
+      nextAnalyser = new PUdpEntityPosRequest(mDecodeData);\r
+      break;\r
+    }\r
+    case 0x0d: // Zoning phase 1\r
+    {\r
+      nextAnalyser = new PUdpZoning1(mDecodeData);\r
+      break;\r
+    }\r
+    default:\r
+    {\r
+      mDecodeData->mUnknownType = MsgType;\r
+      break;\r
+    }\r
+  }\r
+\r
+  if (! nextAnalyser)\r
+  {\r
+    nextAnalyser = new PUdpMsgUnknown(mDecodeData);\r
+  }\r
+\r
+  return nextAnalyser;\r
+}\r
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x22.hxx b/TinNS/Source/GameServer/Decoder/Udp0x22.hxx
new file mode 100644 (file)
index 0000000..aa946b3
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdp0x22 : public PUdpMsgAnalyser {\r
+public:\r
+    PUdp0x22(PMsgDecodeData *nDecodeData);\r
+    //~PUdp0x22();\r
+    PUdpMsgAnalyser *Analyse();\r
+    //bool DoAction();\r
+};\r
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x2b.cxx b/TinNS/Source/GameServer/Decoder/Udp0x2b.cxx
new file mode 100644 (file)
index 0000000..28e9e5a
--- /dev/null
@@ -0,0 +1,57 @@
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+/**** PUdp0x2b ****/\r
+\r
+PUdp0x2b::PUdp0x2b(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
+{\r
+  nDecodeData->mName << "/0x2b";\r
+}\r
+\r
+PUdpMsgAnalyser* PUdp0x2b::Analyse()\r
+{\r
+  PUdpMsgAnalyser* nextAnalyser = nullptr;\r
+  mDecodeData->mState = DECODE_MORE;\r
+  uint8_t MsgType = mDecodeData->mMessage->U8Data(mDecodeData->Sub0x13Start + 5);\r
+  switch(MsgType)\r
+  {\r
+    case 0x17: // ReceiveDB Terminal Command\r
+    {\r
+      nextAnalyser = new PUdpReceiveDB(mDecodeData);\r
+      break;\r
+    }\r
+    case 0x18: // UpdateDB Terminal Command\r
+    {\r
+      nextAnalyser = new PUdpUpdateDB(mDecodeData);\r
+      break;\r
+    }\r
+    case 0x19: // TryAccess Terminal Command\r
+    {\r
+      nextAnalyser = new PUdpTryAccessDB(mDecodeData);\r
+      break;\r
+    }\r
+    case 0x1b: // DB Query and Command\r
+    {\r
+      nextAnalyser = new PUdpQueryDB(mDecodeData);\r
+      break;\r
+    }\r
+    case 0x1f: // Citycom?\r
+    {\r
+      nextAnalyser = new PUdpTeminal0x1f(mDecodeData);\r
+      break;\r
+    }\r
+\r
+    default:\r
+    {\r
+      mDecodeData->mUnknownType = MsgType;\r
+      break;\r
+    }\r
+  }\r
+\r
+  if (! nextAnalyser)\r
+  {\r
+    nextAnalyser = new PUdpMsgUnknown(mDecodeData);\r
+  }\r
+\r
+  return nextAnalyser;\r
+}\r
diff --git a/TinNS/Source/GameServer/Decoder/Udp0x2b.hxx b/TinNS/Source/GameServer/Decoder/Udp0x2b.hxx
new file mode 100644 (file)
index 0000000..e3baa60
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdp0x2b : public PUdpMsgAnalyser {\r
+public:\r
+    PUdp0x2b(PMsgDecodeData *nDecodeData);\r
+    //~PUdp0x2b();\r
+    PUdpMsgAnalyser *Analyse();\r
+    //bool DoAction();\r
+};\r
similarity index 60%
rename from server/src/game/decoder/udpanalyser.cpp
rename to TinNS/Source/GameServer/Decoder/UdpAnalyser.cxx
index d625b81..24d2aa3 100644 (file)
@@ -1,43 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udpanalyser.cpp - Analyser class top (used only by PUdpMsgDecoder)\r
-  Also includes the PUdpMsgUnknown derived class\r
-\r
-       CREATION: 23 Aug 2006 Hammag\r
-\r
-       MODIFIED: 30 Aug 2006 Hammag\r
-       REASON: - moved these two class in file distinct from PUdpMsgDecoder.\r
-               - made implementation\r
-\r
-*/\r
-\r
-#include "main.h"\r
-#include "udpanalyser.h"\r
-\r
-#include "udp_sync.h"\r
-#include "udp_0x13.h"\r
-#include "udp_0x08.h"\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /**** PUdpMsgAnalyser ****/\r
 \r
@@ -58,7 +20,7 @@ PUdpMsgAnalyser::~PUdpMsgAnalyser()
 PUdpMsgAnalyser* PUdpMsgAnalyser::Analyse()\r
 {\r
   PUdpMsgAnalyser* nextAnalyser;\r
-  u8 MsgType;\r
+  uint8_t MsgType;\r
 \r
   mDecodeData->mState = DECODE_MORE;\r
 //mDecodeData->mTraceKnownMsg = true; // Don't want to trace all known messages\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx b/TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx
new file mode 100644 (file)
index 0000000..8215ab5
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+class PMsgDecodeData;\r
+\r
+class PUdpMsgAnalyser {\r
+    friend class PUdpMsgDecoder;\r
+\r
+protected:\r
+    PMsgDecodeData* mDecodeData;\r
+\r
+public:\r
+    PUdpMsgAnalyser(PMsgDecodeData *nDecodeData);\r
+    virtual ~PUdpMsgAnalyser();\r
+\r
+    virtual PUdpMsgAnalyser *Analyse();\r
+    virtual bool DoAction();\r
+\r
+    static int32_t smAnaCount; // temp for check\r
+\r
+};\r
+\r
+class PUdpMsgUnknown : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpMsgUnknown(PMsgDecodeData *nDecodeData);\r
+    //~PUdpMsgUnknown();\r
+\r
+    //bool DoAction();\r
+};\r
+\r
+class PUdpMsgIgnore : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpMsgIgnore(PMsgDecodeData *nDecodeData);\r
+    //~PUdpMsgUnknown();\r
+\r
+    //bool DoAction();\r
+};\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpAppartment.cxx b/TinNS/Source/GameServer/Decoder/UdpAppartment.cxx
new file mode 100644 (file)
index 0000000..33e5ad6
--- /dev/null
@@ -0,0 +1,30 @@
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
+
+/**** PUdpAptLocInfo ****/
+
+PUdpAptLocInfo::PUdpAptLocInfo(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
+{
+  nDecodeData->mName << "/0x0a";
+}
+
+PUdpMsgAnalyser* PUdpAptLocInfo::Analyse()
+{
+  mDecodeData->mName << "=Requesting appartment location for NavRay";
+
+  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
+  return this;
+}
+
+bool PUdpAptLocInfo::DoAction()
+{
+Console->Print("Got request for app data");
+  PMessage* tmpMsg = MsgBuilder->BuildCharAptLocInfoMsg (mDecodeData->mClient);
+
+  if (tmpMsg)
+    mDecodeData->mClient->SendUDPMessage(tmpMsg);
+
+  mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
+  return true;
+}
diff --git a/TinNS/Source/GameServer/Decoder/UdpAppartment.hxx b/TinNS/Source/GameServer/Decoder/UdpAppartment.hxx
new file mode 100644 (file)
index 0000000..ca627bf
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpAptLocInfo : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpAptLocInfo(PMsgDecodeData *nDecodeData);\r
+    //~PUdpAptLocInfo();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 83%
rename from server/src/game/decoder/udp_charmove.cpp
rename to TinNS/Source/GameServer/Decoder/UdpCharMove.cxx
index 7f6d585..7100914 100644 (file)
@@ -1,41 +1,7 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-       udp_charmove.cpp - decoder classes for UDP char movement messages\r
-\r
-       CREATION: 5 Sep 2006 Hammag\r
-\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "udp_charmove.h"\r
-\r
-#include "include/worlds.h"\r
-#include "include/vehicle.h"\r
-#include "include/subway.h"\r
-\r
+#include <string>\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 #define JUMPHEIGHT 160\r
 \r
@@ -129,8 +95,8 @@ bool PUdpCharPosUpdate::DoAction()
 \r
   if ( ! (mInfoBitfield & 0x80) )\r
   {\r
-    u32 nSeatableObjectId;\r
-    u8 nSeatId;\r
+    uint32_t nSeatableObjectId;\r
+    uint8_t nSeatId;\r
     if( nChar->GetSeatInUse(&nSeatableObjectId, &nSeatId) == seat_vhc )\r
     {\r
       tmpMsg = MsgBuilder->BuildCharUseSeatMsg( nClient, nSeatableObjectId, nSeatId );\r
@@ -141,7 +107,7 @@ bool PUdpCharPosUpdate::DoAction()
       mInfoBitfield = 0x80;\r
     }\r
   }\r
-  \r
+\r
   if ( mInfoBitfield & 0x80 ) // Sitting on chair\r
   {\r
     //tmpMsg = MsgBuilder->BuildCharSittingMsg(nClient, mChairItemID);\r
@@ -209,7 +175,7 @@ bool PUdpCharPosUpdate::DoAction()
       ClientManager->UDPBroadcast(tmpMsg, nClient, 5000); // TODO: Get the range from config\r
     }*/\r
 \r
-    u16 nSaveZ = nChar->Coords.mZ;\r
+    uint16_t nSaveZ = nChar->Coords.mZ;\r
     if(nChar->Coords.mJumpingState)\r
     {\r
       mInfoBitfield |= 0x02; // Update Z and Act only\r
@@ -233,8 +199,8 @@ bool PUdpCharPosUpdate::DoAction()
     if ( IsRealMove && nClient->GetDebugMode( DBG_LOCATION ) )\r
     {\r
       char DbgMessage[128];\r
-      f32 f[3];\r
-//      u32 h[3];\r
+      float f[3];\r
+//      uint32_t h[3];\r
       f[0] = nChar->Coords.mY - 32000;\r
       f[1] = nChar->Coords.mZ - 32000;\r
       f[2] = nChar->Coords.mX - 32000;\r
@@ -242,7 +208,7 @@ bool PUdpCharPosUpdate::DoAction()
       Chat->send( nClient, CHAT_GM, "Debug", DbgMessage );\r
     }\r
     /*{\r
-      u16 p[3];\r
+      uint16_t p[3];\r
       p[0] = nChar->Coords.mY;\r
       p[1] = nChar->Coords.mZ;\r
       p[2] = nChar->Coords.mX;\r
@@ -303,19 +269,19 @@ bool PUdpCharExitChair::DoLeaveChair( PChar* nChar, PClient* nClient, PSpawnedVe
   }\r
 \r
   PMessage* tmpMsg;\r
-  u32 cSeatObjectId;\r
-  u8 cSeatId;\r
+  uint32_t cSeatObjectId;\r
+  uint8_t cSeatId;\r
   PSeatType cSeatType = nChar->GetSeatInUse( &cSeatObjectId, &cSeatId );\r
-  u32 tNowTime = GameServer->GetGameTime();\r
+  uint32_t tNowTime = GameServer->GetGameTime();\r
   bool ReadyToExit = false;\r
 \r
   // This is only for investigation on subway timing\r
   if ( nClient->GetDebugMode( DBG_SUBWAY ) && ( cSeatType == seat_subway ) )\r
   {\r
     char DbgMessage[80];\r
-    u8 tCabId;\r
+    uint8_t tCabId;\r
     Subway->GetInfoIndex( cSeatObjectId, &tCabId );\r
-    u8 tStationId = Subway->GetStation( cSeatObjectId, tNowTime );\r
+    uint8_t tStationId = Subway->GetStation( cSeatObjectId, tNowTime );\r
     std::string* StationName = Subway->GetStationName( tStationId );\r
     std::string OpenState = ( Subway->IsDoorOpen( cSeatObjectId, tNowTime ) ? "open" : "closed" );\r
 \r
@@ -353,7 +319,7 @@ bool PUdpCharExitChair::DoLeaveChair( PChar* nChar, PClient* nClient, PSpawnedVe
     }\r
     else if ( cSeatType == seat_vhc )\r
     {\r
-      PSpawnedVehicle* tVhc = tWorld->GetSpawnedVehicules()->GetVehicle( cSeatObjectId );\r
+      PSpawnedVehicle* tVhc = tWorld->GetSpawnedVehicles()->GetVehicle( cSeatObjectId );\r
       if ( tVhc && (!nVhc || (tVhc == nVhc) || nForce) )\r
       {\r
         PVhcCoordinates tCoords = tVhc->GetPosition();\r
@@ -411,8 +377,8 @@ bool PUdpCharJump::DoAction()
   else // If not moving, jump now\r
   {\r
     if ( gDevDebug ) Console->Print( "%s Send static jump", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) );\r
-    u8 mInfoBitfield = 0x22; // Update Z and Act only\r
-    u16 nSaveZ = nChar->Coords.mZ;\r
+    uint8_t mInfoBitfield = 0x22; // Update Z and Act only\r
+    uint16_t nSaveZ = nChar->Coords.mZ;\r
     (nChar->Coords.mZ) += JUMPHEIGHT;\r
     PMessage* tmpMsg = MsgBuilder->BuildCharPosUpdate2Msg( nClient, mInfoBitfield );\r
     nChar->Coords.mZ = nSaveZ;\r
@@ -445,10 +411,10 @@ bool PUdpCharTargeting::DoAction()
 {\r
   PClient* nClient = mDecodeData->mClient;\r
   PChar* tChar = nClient->GetChar();\r
-  u16 CharID = mDecodeData->mMessage->U16Data( mDecodeData->Sub0x13Start + 2 );\r
-  u8 strangeval1 = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 4 );\r
-  u8 strangeval2 = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 5 );\r
-  u8 strangeval3 = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 6 );\r
+  uint16_t CharID = mDecodeData->mMessage->U16Data( mDecodeData->Sub0x13Start + 2 );\r
+  uint8_t strangeval1 = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 4 );\r
+  uint8_t strangeval2 = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 5 );\r
+  uint8_t strangeval3 = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 6 );\r
 \r
   tChar->SetLookingAt( CharID );\r
 \r
diff --git a/TinNS/Source/GameServer/Decoder/UdpCharMove.hxx b/TinNS/Source/GameServer/Decoder/UdpCharMove.hxx
new file mode 100644 (file)
index 0000000..e0cc96e
--- /dev/null
@@ -0,0 +1,56 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PChar;\r
+class PClient;\r
+class PSpawnedVehicle;\r
+\r
+class PUdpCharPosUpdate : public PUdpMsgAnalyser {\r
+private:\r
+    uint8_t mInfoBitfield;\r
+    uint16_t mNewY;\r
+    uint16_t mNewZ;\r
+    uint16_t mNewX;\r
+    uint8_t mNewUD;\r
+    uint8_t mNewLR;\r
+    uint8_t mNewAct;\r
+    uint8_t mNewUnknown;\r
+    uint32_t mChairItemID; // uint16_t or uint32_t ???\r
+    uint8_t mChairItemSeat;\r
+\r
+public:\r
+    PUdpCharPosUpdate(PMsgDecodeData *nDecodeData);\r
+    //~PUdpCharMoves();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpCharExitChair : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpCharExitChair(PMsgDecodeData *nDecodeData);\r
+    //~PUdpCharExitChair();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+\r
+    //nClient is optionnal, nVhc is to limit to that vhc, nForce to force exit event when cab door closed\r
+    static bool DoLeaveChair(PChar *nChar, PClient *nClient = nullptr, PSpawnedVehicle *nVhc = nullptr,\r
+                             bool nForce = false);\r
+};\r
+\r
+class PUdpCharJump : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpCharJump(PMsgDecodeData *nDecodeData);\r
+    //~PUdpCharJump();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpCharTargeting : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpCharTargeting(PMsgDecodeData *nDecodeData);\r
+    //~PUdpCharTargeting();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 79%
rename from server/src/game/decoder/udp_chat.cpp
rename to TinNS/Source/GameServer/Decoder/UdpChat.cxx
index 34641fb..95bfa38 100644 (file)
@@ -1,50 +1,19 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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_chat.h - decoder classes for UDP chat  messages
-  
-       CREATION: 15 Sep 2006 Hammag
-
-       MODIFIED: 11 Dec 2006 Hammag
-       REASON: - added PUdpChatChannels
-
-*/
-
-#include "main.h"
-#include "udp_chat.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpChatLocal ****/
 
 PUdpChatLocal::PUdpChatLocal(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
 {
   nDecodeData->mName << "/0x1b";
-} 
+}
 
 PUdpMsgAnalyser* PUdpChatLocal::Analyse()
 {
   mDecodeData->mName << "=Local chat";
   mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-  
+
   return this;
 }
 
@@ -53,11 +22,11 @@ bool PUdpChatLocal::DoAction()
   // temp
   Chat->HandleGameChat(mDecodeData->mClient, mDecodeData->mMessage->GetMessageData() + mDecodeData->Sub0x13Start);
     /*PMessage* cMsg = mDecodeData->mMessage;
-    u32 ClientTime = cMsg->U32Data(mDecodeData->Sub0x13Start+2);
-    
+    uint32_t ClientTime = cMsg->U32Data(mDecodeData->Sub0x13Start+2);
+
     PMessage* tmpMsg = MsgBuilder->BuildPingMsg(mDecodeData->mClient, ClientTime);
     mDecodeData->mClient->SendUDPMessage(tmpMsg);*/
-    
+
     //cMsg->SetNextByteOffset(mDecodeData->Sub0x13StartNext);
     mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
     return true;
@@ -68,16 +37,16 @@ bool PUdpChatLocal::DoAction()
 PUdpChatGlobal::PUdpChatGlobal(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
 {
   nDecodeData->mName << "/0x3b";
-} 
+}
 
 PUdpMsgAnalyser* PUdpChatGlobal::Analyse()
 {
-  //u16 dumb;
+  //uint16_t dumb;
   mDecodeData->mName << "=Global chat";
 
 /*  PMessage* nMsg = mDecodeData->mMessage;
   nMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 12);
-  *nMsg >> mVehicleID; // ? not u32 ???
+  *nMsg >> mVehicleID; // ? not uint32_t ???
   *nMsg >> dumb;
   *nMsg >> mVehicleSeat;*/
 
@@ -101,16 +70,16 @@ bool PUdpChatGlobal::DoAction()
 PUdpChatListAdd::PUdpChatListAdd(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
 {
   nDecodeData->mName << "/0x33";
-} 
+}
 
 PUdpMsgAnalyser* PUdpChatListAdd::Analyse()
 {
   mDecodeData->mName << "=Add char to chat list";
 
   PMessage* nMsg = mDecodeData->mMessage;
-  u8 PSize = nMsg->U8Data(mDecodeData->Sub0x13Start);
+  uint8_t PSize = nMsg->U8Data(mDecodeData->Sub0x13Start);
   mChatList = mDecodeData->mMessage->U8Data(mDecodeData->Sub0x13Start + 8);
-  
+
   if ((mChatList == 1) || (mChatList == 2))
   {
     if ((PSize > 8) && (nMsg->U8Data(mDecodeData->Sub0x13StartNext -1) == 0))
@@ -123,7 +92,7 @@ PUdpMsgAnalyser* PUdpChatListAdd::Analyse()
       mDecodeData->mState = DECODE_ERROR;
       mDecodeData->mErrorDetail = "Invalid charname position";
     }
-  
+
     return this;
   }
   else
@@ -138,9 +107,9 @@ bool PUdpChatListAdd::DoAction()
   PClient* nClient = mDecodeData->mClient;
   std::string AddedChar = mAddedCharname;
   PChar* tChar = Chars->GetChar(AddedChar);
-  u32 AddedCharID = (tChar ? tChar->GetID() : 0);
+  uint32_t AddedCharID = (tChar ? tChar->GetID() : 0);
   bool AddResult = false;
-  
+
   if (AddedCharID)
   {
     switch(mChatList)
@@ -148,22 +117,22 @@ bool PUdpChatListAdd::DoAction()
       case 1:
       {
         AddResult = nClient->GetChar()->SetDirectChat(AddedCharID);
-        break; 
+        break;
       }
       case 2:
       {
         AddResult = nClient->GetChar()->AddBuddy(AddedCharID);
-        break; 
+        break;
       }
     }
   }
-  
+
   if (AddResult)
   {
     PMessage* tmpMsg = MsgBuilder->BuildChatAddMsg (nClient, AddedCharID, mChatList);
     nClient->SendUDPMessage(tmpMsg);
   }
-  
+
   mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
   return true;
 }
@@ -173,7 +142,7 @@ bool PUdpChatListAdd::DoAction()
 PUdpChatListRemove::PUdpChatListRemove(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
 {
   nDecodeData->mName << "/0x39";
-} 
+}
 
 PUdpMsgAnalyser* PUdpChatListRemove::Analyse()
 {
@@ -182,7 +151,7 @@ PUdpMsgAnalyser* PUdpChatListRemove::Analyse()
   PMessage* nMsg = mDecodeData->mMessage;
   nMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 8);
   (*nMsg) >> mChatList;
-  
+
   if ((mChatList == 1) || (mChatList == 2))
   {
     (*nMsg) >> mRemovedCharID;
@@ -199,9 +168,9 @@ PUdpMsgAnalyser* PUdpChatListRemove::Analyse()
 bool PUdpChatListRemove::DoAction()
 {
   PClient* nClient = mDecodeData->mClient;
-  
+
   bool RemoveResult = false;
-  
+
   if (mRemovedCharID)
   {
     switch(mChatList)
@@ -209,23 +178,23 @@ bool PUdpChatListRemove::DoAction()
       case 1:
       {
         RemoveResult = nClient->GetChar()->SetDirectChat(0);
-        break; 
+        break;
       }
       case 2:
       {
         RemoveResult = nClient->GetChar()->RemoveBuddy(mRemovedCharID);
-        break; 
+        break;
       }
     }
   }
-  
+
   // No known response yet ...
   /*if (AddResult)
   {
     PMessage* tmpMsg = MsgBuilder->BuildChatAddMsg (nClient, mRemovedCharID, mChatList);
     nClient->SendUDPMessage(tmpMsg);
   }*/
-  
+
   mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
   return true;
 }
@@ -235,7 +204,7 @@ bool PUdpChatListRemove::DoAction()
 PUdpChatChannels::PUdpChatChannels(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
 {
   nDecodeData->mName << "/0x4c";
-} 
+}
 
 PUdpMsgAnalyser* PUdpChatChannels::Analyse()
 {
@@ -244,7 +213,7 @@ PUdpMsgAnalyser* PUdpChatChannels::Analyse()
   PMessage* nMsg = mDecodeData->mMessage;
   nMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 8);
   (*nMsg) >> mChannelFlags;
-  
+
   mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
   return this;
 }
diff --git a/TinNS/Source/GameServer/Decoder/UdpChat.hxx b/TinNS/Source/GameServer/Decoder/UdpChat.hxx
new file mode 100644 (file)
index 0000000..5abf6d8
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpChatLocal : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpChatLocal(PMsgDecodeData *nDecodeData);\r
+    //~PUdpChatLocal();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpChatGlobal : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpChatGlobal(PMsgDecodeData *nDecodeData);\r
+    //~PUdpChatGlobal();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpChatListAdd : public PUdpMsgAnalyser {\r
+private:\r
+    uint8_t mChatList; // 1 = Direct, 2 = Buddy List\r
+    char *mAddedCharname;\r
+\r
+public:\r
+    PUdpChatListAdd(PMsgDecodeData *nDecodeData);\r
+    //~PUdpChatListAdd();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpChatListRemove : public PUdpMsgAnalyser {\r
+private:\r
+    uint8_t mChatList;\r
+    uint32_t mRemovedCharID;\r
+\r
+public:\r
+    PUdpChatListRemove(PMsgDecodeData *nDecodeData);\r
+    //~PUdpChatListRemove();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpChatChannels : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mChannelFlags; // 1 bit per custom channel, starting from LSB, in same order as in chat i/f\r
+\r
+public:\r
+    PUdpChatChannels(PMsgDecodeData *nDecodeData);\r
+    //~PUdpChatChannels();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
@@ -1,38 +1,5 @@
-/*
-  TinNS (TinNS is not a Neocron Server)
-  Copyright (C) 2005 Linux Addicted Community
-  maintainer Akiko <akiko@gmx.org>
-
-  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_deathrespawn.cpp - decoder classes for UDP respawn selection after death message
-
-  CREATION: 10 May 2009 Hammag
-
-  MODIFIED:
-  REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_deathrespawn.h"
-#include "udp_zoning.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpDeathRespawn ****/
 
diff --git a/TinNS/Source/GameServer/Decoder/UdpDeathRespawn.hxx b/TinNS/Source/GameServer/Decoder/UdpDeathRespawn.hxx
new file mode 100644 (file)
index 0000000..a95e14d
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpDeathRespawn : public PUdpMsgAnalyser {
+private:
+    uint32_t mEntity;
+    uint32_t mWorldId;
+
+public:
+    PUdpDeathRespawn(PMsgDecodeData *nDecodeData);
+    //~PUdpDeathRespawn();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
@@ -1,42 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       udp_entityposreq.cpp - decoder classes for UDP entity position request messages\r
-\r
-       CREATION: 8 jun 2007 Hammag\r
-\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "udp_entityposreq.h"\r
-\r
-#include "include/worlds.h"\r
-\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 PUdpEntityPosRequest::PUdpEntityPosRequest(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
 {\r
@@ -53,7 +17,7 @@ PUdpMsgAnalyser* PUdpEntityPosRequest::Analyse()
   PMessage* nMsg = mDecodeData->mMessage;\r
   nMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 7);\r
 \r
-  *nMsg >> mEntityID; //(u16 ... or u32 ???)\r
+  *nMsg >> mEntityID; //(uint16_t ... or uint32_t ???)\r
 \r
   if(mEntityID >= WORLDDATATEMPLATE_MAXPOSITEMS)\r
   {\r
@@ -75,16 +39,16 @@ bool PUdpEntityPosRequest::DoAction()
   PClient* nClient = mDecodeData->mClient;\r
   PChar* nChar = nClient->GetChar();\r
   PWorld* currentWorld = Worlds->GetWorld(nChar->GetLocation());\r
-  f32 fpX, fpY, fpZ;\r
-  u16 pX, pY, pZ;\r
+  float fpX, fpY, fpZ;\r
+  uint16_t pX, pY, pZ;\r
 \r
   if(currentWorld)\r
   {\r
     if((mEntityID < WORLDDATATEMPLATE_MAXPOSITEMS) && currentWorld->getPositionItemPosition(mEntityID, &fpX, &fpY, &fpZ))\r
     {\r
-      pX = (u16) (fpX + 32000);\r
-      pY = (u16) (fpY + 32000);\r
-      pZ = (u16) (fpZ + 32000);\r
+      pX = (uint16_t) (fpX + 32000);\r
+      pY = (uint16_t) (fpY + 32000);\r
+      pZ = (uint16_t) (fpZ + 32000);\r
 \r
 if(gDevDebug) Console->Print(GREEN, BLACK, "Client %d - Sending pos for entity %d : X=%d Y=%d Z=%d", mDecodeData->mClient->GetID(), mEntityID, pX, pY, pZ);\r
     }\r
@@ -93,7 +57,7 @@ if(gDevDebug) Console->Print(GREEN, BLACK, "Client %d - Sending pos for entity %
       pX = pY = pZ = 0;\r
       Console->Print("%s Client[%d] requested invalid position entity %d. Position reset.", Console->ColorText(YELLOW, BLACK, "[Notice]"), mDecodeData->mClient->GetID(), mEntityID);\r
     }\r
-    \r
+\r
     PMessage* tmpMsg;\r
     tmpMsg = MsgBuilder->BuildEntityPositionMsg(nClient, pX, pY, pZ);\r
     nClient->SendUDPMessage(tmpMsg);\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpEntityPositionRequest.hxx b/TinNS/Source/GameServer/Decoder/UdpEntityPositionRequest.hxx
new file mode 100644 (file)
index 0000000..a483d36
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpEntityPosRequest : public PUdpMsgAnalyser {\r
+private:\r
+    uint16_t mEntityID; // u16 or u32 ???\r
+\r
+public:\r
+    PUdpEntityPosRequest(PMsgDecodeData *nDecodeData);\r
+    //~PUdpEntityPosRequest();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 72%
rename from server/src/game/decoder/udp_hack.cpp
rename to TinNS/Source/GameServer/Decoder/UdpHack.cxx
index e28f92f..35473c0 100644 (file)
@@ -1,43 +1,7 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "udp_hack.h"
-
-#include "include/worlds.h"
-#include "include/furnituretemplate.h"
-#include "include/doortemplate.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpHackSuccess ****/
 
@@ -62,7 +26,7 @@ bool PUdpHackSuccess::DoAction()
     const PFurnitureItemTemplate* tFurnitureTemplate = NULL;
     const PDefWorldModel* tFurnitureModel = NULL;
 
-    u32 mRawItemID = mDecodeData->mMessage->U32Data(mDecodeData->Sub0x13Start+8);
+    uint32_t mRawItemID = mDecodeData->mMessage->U32Data(mDecodeData->Sub0x13Start+8);
     if(gDevDebug) Console->Print("DEBUG: Client %d successfully hacked object %d", mDecodeData->mClient->GetID(), mRawItemID);
 
     bool tHandleDynamicActor = false;
@@ -79,7 +43,7 @@ bool PUdpHackSuccess::DoAction()
     else
     {
         // Dat files have smaller IDs
-        u32 ItemID = mRawItemID/1024 -1;
+        uint32_t ItemID = mRawItemID/1024 -1;
 
         // Now grab the template from .dat file
         tFurnitureTemplate = CurrentWorld->GetFurnitureItemTemplate(ItemID);
diff --git a/TinNS/Source/GameServer/Decoder/UdpHack.hxx b/TinNS/Source/GameServer/Decoder/UdpHack.hxx
new file mode 100644 (file)
index 0000000..bf8eccb
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpHackFail : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpHackFail(PMsgDecodeData *nDecodeData);\r
+    //~PUdpHackFail();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpHackSuccess : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpHackSuccess(PMsgDecodeData *nDecodeData);\r
+    //~PUdpHackSuccess();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
@@ -1,39 +1,7 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_helditemaction.cpp - decoder classes for held item related messages
-
- CREATION: 20 Mar 2009 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_helditemaction.h"
-#include "include/worlds.h"
-#include "include/furnituretemplate.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpHeldItemBasicAction ****/
 
@@ -84,7 +52,7 @@ PUdpMsgAnalyser* PUdpHeldItemAimedAction::Analyse()
 
 bool PUdpHeldItemAimedAction::DoAction()
 {
-  u16 maxBroadcastDistance = 0; // parameter.
+  uint16_t maxBroadcastDistance = 0; // parameter.
   PClient* nClient = mDecodeData->mClient;
   //PChar* tChar = nClient->GetChar();
 //  PCharCoordinates& nCharCoords = nClient->GetChar()->Coords;
@@ -167,7 +135,7 @@ bool PUdpHeldItemLaunchingAction::DoAction()
   const PFurnitureItemTemplate* tFurnitureTemplate = NULL;
   const PDefWorldModel* tFurnitureModel = NULL;
 
-  u32 mRawItemID = mDecodeData->mMessage->U32Data( mDecodeData->Sub0x13Start + 24 );
+  uint32_t mRawItemID = mDecodeData->mMessage->U32Data( mDecodeData->Sub0x13Start + 24 );
   //if(gDevDebug) Console->Print("Client %d wants to hack itemID %d ***not managed yet***", mDecodeData->mClient->GetID(), mRawItemID);
 
   // First try to find out if we're hacking an dynamic actor
@@ -182,7 +150,7 @@ bool PUdpHeldItemLaunchingAction::DoAction()
   else
   {
     // Dat files have smaller IDs
-    u32 ItemID = mRawItemID / 1024 - 1;
+    uint32_t ItemID = mRawItemID / 1024 - 1;
 
     // Now grab the template from .dat file
     tFurnitureTemplate = CurrentWorld->GetFurnitureItemTemplate( ItemID );
@@ -193,8 +161,8 @@ bool PUdpHeldItemLaunchingAction::DoAction()
 
   if ( tFurnitureModel ) // We have an valid worldobject? Fine. Then start the hackgame
   {
-    u8 tHackDifficult = tFurnitureModel->GetHackDifficulty();
-    u8 tHackPenalty = tFurnitureModel->GetHackPenalty();
+    uint8_t tHackDifficult = tFurnitureModel->GetHackDifficulty();
+    uint8_t tHackPenalty = tFurnitureModel->GetHackPenalty();
 
     // Print it!
     if(tHackDifficult)
diff --git a/TinNS/Source/GameServer/Decoder/UdpHeldItemAction.hxx b/TinNS/Source/GameServer/Decoder/UdpHeldItemAction.hxx
new file mode 100644 (file)
index 0000000..e12ee6a
--- /dev/null
@@ -0,0 +1,57 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpHeldItemBasicAction : public PUdpMsgAnalyser {
+public:
+    PUdpHeldItemBasicAction(PMsgDecodeData *nDecodeData);
+    //~PUdpHeldItemBasicAction();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
+
+class PUdpHeldItemAimedAction : public PUdpMsgAnalyser {
+private:
+    uint16_t mWeaponId;
+    uint32_t mTargetRawItemID;
+    uint8_t mAiming; // 0: minimal
+    uint8_t mTargetedHeight; // 0: bottom to 26: top
+    uint8_t mScore; // ??? looks quite random...
+
+public:
+    PUdpHeldItemAimedAction(PMsgDecodeData *nDecodeData);
+    //~PUdpHeldItemAimedAction();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
+
+class PUdpHeldItemLaunchingAction : public PUdpMsgAnalyser {
+private:
+    uint16_t mWeaponId;
+    uint16_t mSourceY;
+    uint16_t mSourceZ;
+    uint16_t mSourceX;
+    uint8_t mSourceUD;
+    uint8_t mSourceLR;
+    uint16_t mUnknown1;
+    uint32_t mUnknown2; // client timestamp ? => TODO: compare with data from ping request
+    uint32_t mTargetRawItemID;
+
+public:
+    PUdpHeldItemLaunchingAction( PMsgDecodeData *nDecodeData );
+    //~PUdpHeldItemLaunchingAction();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
+
+class PUdpItemAddonActivation : public PUdpMsgAnalyser {
+private:
+    uint8_t mAddonIdx;
+
+public:
+    PUdpItemAddonActivation(PMsgDecodeData *nDecodeData);
+    //~PUdpItemAddonActivation();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
@@ -1,42 +1,7 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "udp_itemmanualreload.h"
-
-#include "include/container.h"
-
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpItemManualReload ****/
 
@@ -63,14 +28,14 @@ bool PUdpItemManualReload::DoAction()
 {
   PClient* nClient = mDecodeData->mClient;
   PChar* tChar = nClient->GetChar();
-  
+
   if ( gDevDebug )
     Console->Print( "%s Manual reload start", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) );
 
-  u8 activeSlot = tChar->GetQuickBeltActiveSlot();
+  uint8_t activeSlot = tChar->GetQuickBeltActiveSlot();
   if (( activeSlot != INV_WORN_QB_NONE ) && ( activeSlot != INV_WORN_QB_HAND ) )
   {
-    u8 newAmmoCount = GetMaxLoadableAmmos( activeSlot );
+    uint8_t newAmmoCount = GetMaxLoadableAmmos( activeSlot );
     if ( newAmmoCount )
     {
       PMessage* tmpMsg = MsgBuilder->BuildStartWeaponReloadMsg( nClient );
@@ -79,27 +44,27 @@ bool PUdpItemManualReload::DoAction()
       tmpMsg = new PMessage( 32 );
       nClient->IncreaseUDP_ID();
 
-      *tmpMsg << ( u8 )0x13;
-      *tmpMsg << ( u16 )nClient->GetUDP_ID();
-      *tmpMsg << ( u16 )nClient->GetSessionID();
+      *tmpMsg << ( uint8_t )0x13;
+      *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+      *tmpMsg << ( uint16_t )nClient->GetSessionID();
 
-      *tmpMsg << ( u8 )0x00; // Message length
-      *tmpMsg << ( u8 )0x03;
-      *tmpMsg << ( u16 )nClient->GetUDP_ID();
-      *tmpMsg << ( u8 )0x1f;
-      *tmpMsg << ( u16 )nClient->GetLocalID();
-      *tmpMsg << ( u8 )0x25;
-      *tmpMsg << ( u8 )0x13;
+      *tmpMsg << ( uint8_t )0x00; // Message length
+      *tmpMsg << ( uint8_t )0x03;
+      *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+      *tmpMsg << ( uint8_t )0x1f;
+      *tmpMsg << ( uint16_t )nClient->GetLocalID();
+      *tmpMsg << ( uint8_t )0x25;
+      *tmpMsg << ( uint8_t )0x13;
 
       nClient->IncreaseTransactionID();
-      *tmpMsg << ( u16 )nClient->GetTransactionID();
-      *tmpMsg << ( u8 )0x05; // cmd=Ammo count update
-      *tmpMsg << ( u8 )INV_LOC_WORN;
-      *tmpMsg << ( u8 )(INV_WORN_QB_START + activeSlot); // X
-      *tmpMsg << ( u8 )0x00; //(Y)
-      *tmpMsg << ( u8 )newAmmoCount; // Ammo count
+      *tmpMsg << ( uint16_t )nClient->GetTransactionID();
+      *tmpMsg << ( uint8_t )0x05; // cmd=Ammo count update
+      *tmpMsg << ( uint8_t )INV_LOC_WORN;
+      *tmpMsg << ( uint8_t )(INV_WORN_QB_START + activeSlot); // X
+      *tmpMsg << ( uint8_t )0x00; //(Y)
+      *tmpMsg << ( uint8_t )newAmmoCount; // Ammo count
 
-      ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
+      ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
 
       nClient->SendUDPMessage( tmpMsg );
     }
@@ -115,40 +80,40 @@ bool PUdpItemManualReload::DoAction()
     nClient->IncreaseUDP_ID();
     nClient->IncreaseTransactionID();
 
-    *tmpMsg << (u8)0x13;
-    *tmpMsg << (u16)nClient->GetUDP_ID();
-    *tmpMsg << (u16)nClient->GetSessionID();
-
-    *tmpMsg << (u8)0x00; // Message length
-    *tmpMsg << (u8)0x03;
-    *tmpMsg << (u16)nClient->GetUDP_ID();
-    *tmpMsg << (u8)0x1f;
-    *tmpMsg << (u16)nClient->GetLocalID();
-    *tmpMsg << (u8)0x25;
-    *tmpMsg << (u8)0x13;
-    *tmpMsg << (u16)nClient->GetTransactionID();
-    *tmpMsg << (u8)0x0a; // cmd=Ammo type update (?)
-    *tmpMsg << (u8)0x03;
-    *tmpMsg << (u8)0x02;
-    *tmpMsg << (u8)0x00;
-    *tmpMsg << (u8)0x00;
-    *tmpMsg << (u8)0x00;
+    *tmpMsg << (uint8_t)0x13;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint16_t)nClient->GetSessionID();
+
+    *tmpMsg << (uint8_t)0x00; // Message length
+    *tmpMsg << (uint8_t)0x03;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint8_t)0x1f;
+    *tmpMsg << (uint16_t)nClient->GetLocalID();
+    *tmpMsg << (uint8_t)0x25;
+    *tmpMsg << (uint8_t)0x13;
+    *tmpMsg << (uint16_t)nClient->GetTransactionID();
+    *tmpMsg << (uint8_t)0x0a; // cmd=Ammo type update (?)
+    *tmpMsg << (uint8_t)0x03;
+    *tmpMsg << (uint8_t)0x02;
+    *tmpMsg << (uint8_t)0x00;
+    *tmpMsg << (uint8_t)0x00;
+    *tmpMsg << (uint8_t)0x00;
     nClient->IncreaseTransactionID();
-    *tmpMsg << (u16)nClient->GetTransactionID();
-    *tmpMsg << (u8)0x05; // cmd=Ammo count update
-    *tmpMsg << (u8)INV_LOC_BACKPACK;
-    *tmpMsg << (u8)0x0e; // X
-    *tmpMsg << (u8)0x00; //(Y)
-    *tmpMsg << (u8)0x03; // Ammo count
+    *tmpMsg << (uint16_t)nClient->GetTransactionID();
+    *tmpMsg << (uint8_t)0x05; // cmd=Ammo count update
+    *tmpMsg << (uint8_t)INV_LOC_BACKPACK;
+    *tmpMsg << (uint8_t)0x0e; // X
+    *tmpMsg << (uint8_t)0x00; //(Y)
+    *tmpMsg << (uint8_t)0x03; // Ammo count
     nClient->IncreaseTransactionID();
-    *tmpMsg << (u16)nClient->GetTransactionID();
-    *tmpMsg << (u8)0x05; // cmd=Ammo count update
-    *tmpMsg << (u8)INV_LOC_WORN;
-    *tmpMsg << (u8)0x03; // X
-    *tmpMsg << (u8)0x00; //(Y)
-    *tmpMsg << (u8)0x02; // Ammo count
-
-    (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
+    *tmpMsg << (uint16_t)nClient->GetTransactionID();
+    *tmpMsg << (uint8_t)0x05; // cmd=Ammo count update
+    *tmpMsg << (uint8_t)INV_LOC_WORN;
+    *tmpMsg << (uint8_t)0x03; // X
+    *tmpMsg << (uint8_t)0x00; //(Y)
+    *tmpMsg << (uint8_t)0x02; // Ammo count
+
+    (*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
   tmpMsg->Dump();
     nClient->SendUDPMessage(tmpMsg);
   */
@@ -157,7 +122,7 @@ bool PUdpItemManualReload::DoAction()
   c2:01:0a:00:02:00:00:00 ?? set ammo type ?
   c3:01:05:03:00:00:12 Update ammo left
   c4:01:05:02:00:00:0c Update ammo left
-   
+
   tt:tt:02:loc:x:y delete item
   */
 
@@ -173,7 +138,7 @@ bool PUdpItemManualReload::DoAction()
   return true;
 }
 
-u8 PUdpItemManualReload::GetMaxLoadableAmmos( u8 nBeltSlotId )
+uint8_t PUdpItemManualReload::GetMaxLoadableAmmos( uint8_t nBeltSlotId )
 {
   PItem* activeItem = mDecodeData->mClient->GetChar()->GetInventory()->GetContainer( INV_DB_LOC_WORN )->GetItem( INV_WORN_QB_START + nBeltSlotId );
   if ( activeItem && ( activeItem->GetType() == ITEM_TYPE_WEAPON ) )
diff --git a/TinNS/Source/GameServer/Decoder/UdpItemManualReload.hxx b/TinNS/Source/GameServer/Decoder/UdpItemManualReload.hxx
new file mode 100644 (file)
index 0000000..53a5c11
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpItemManualReload : public PUdpMsgAnalyser {
+private:
+    uint8_t mUnknown;
+    uint8_t GetMaxLoadableAmmos(uint8_t nBeltSlotId);
+
+public:
+    PUdpItemManualReload(PMsgDecodeData *nDecodeData);
+    //~PUdpItemManualReload();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
+
+class PUdpReloadAnimStart : public PUdpMsgAnalyser {
+public:
+    PUdpReloadAnimStart(PMsgDecodeData *nDecodeData);
+    //~PUdpReloadAnimStart();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
similarity index 82%
rename from server/src/game/decoder/udp_itemmove.cpp
rename to TinNS/Source/GameServer/Decoder/UdpItemMove.cxx
index 5a1f56a..bd868ad 100644 (file)
@@ -1,46 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       udp_itemmove.cpp - decoder classes for UDP item move related messages\r
-\r
-       CREATION: 30 Dec 2006 Namikon\r
-\r
-       MODIFIED: 28 Aug 2007 Hammag\r
-       REASON: - Moved decoding part from DoAction() to Analyse(), use natural decode methods\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "udp_itemmove.h"\r
-\r
-#include "include/chars.h"\r
-#include "include/inventory.h"\r
-#include "include/container.h"\r
-\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /**** PUdpItemMove ****/\r
 \r
@@ -77,8 +37,8 @@ bool PUdpItemMove::DoAction()
   bool MoveSucceded = false;\r
   PClient* nClient = mDecodeData->mClient;\r
   PChar* tChar = nClient->GetChar();\r
-  u8 origDstX = mDstX;\r
-  u8 origDstY = mDstY;\r
+  uint8_t origDstX = mDstX;\r
+  uint8_t origDstY = mDstY;\r
   PContainerEntry* tEntry;\r
 \r
   PItem* tItem = NULL;\r
@@ -169,7 +129,7 @@ bool PUdpItemMove::DoAction()
   return true;\r
 }\r
 \r
-PContainer* PUdpItemMove::GetContainerByLoc( PChar* nChar, u8 nLoc )\r
+PContainer* PUdpItemMove::GetContainerByLoc( PChar* nChar, uint8_t nLoc )\r
 {\r
   PContainer* tContainer = NULL;\r
 \r
diff --git a/TinNS/Source/GameServer/Decoder/UdpItemMove.hxx b/TinNS/Source/GameServer/Decoder/UdpItemMove.hxx
new file mode 100644 (file)
index 0000000..4cbd9cf
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PContainer;\r
+\r
+class PUdpItemMove : public PUdpMsgAnalyser {\r
+private:\r
+    uint8_t mSrcLoc;\r
+    uint8_t mSrcX;\r
+    uint8_t mSrcY;\r
+    uint8_t mDstLoc;\r
+    uint8_t mDstX;\r
+    uint8_t mDstY;\r
+    uint8_t mItemCnt;\r
+\r
+public:\r
+      PUdpItemMove(PMsgDecodeData *nDecodeData);\r
+      //~PUdpItemMove();\r
+      PUdpMsgAnalyser *Analyse();\r
+      bool DoAction();\r
+\r
+      static PContainer *GetContainerByLoc(PChar *nChar, uint8_t nLoc);\r
+};\r
+\r
+class PUdpItemMoveBP : public PUdpMsgAnalyser {\r
+private:\r
+    uint8_t mSrcSlotId;\r
+    uint8_t mDumb;\r
+    uint8_t mDstX;\r
+    uint8_t mDstY;\r
+\r
+public:\r
+      PUdpItemMoveBP(PMsgDecodeData *nDecodeData);\r
+      //~PUdpItemMove();\r
+      PUdpMsgAnalyser *Analyse();\r
+      bool DoAction();\r
+};\r
+\r
+class PUdpItemDropOnItem : public PUdpMsgAnalyser {\r
+private:\r
+    uint8_t mSrcLoc;\r
+    uint8_t mSrcX;\r
+    uint8_t mSrcY;\r
+    uint8_t mDstLoc;\r
+    uint8_t mDstX;\r
+    uint8_t mDstY;\r
+\r
+public:\r
+    PUdpItemDropOnItem(PMsgDecodeData *nDecodeData);\r
+    //~PUdpItemDropOnItem();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 56%
rename from server/src/game/decoder/udp_itemuse.cpp
rename to TinNS/Source/GameServer/Decoder/UdpItemUse.cxx
index 4f7eed9..237dcf7 100644 (file)
@@ -1,38 +1,5 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_itemuse.cpp - decoder classes for UDP inventory item use messages
-
- CREATION: 9 May 2009 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_itemuse.h"
-
+#include "GameServer/Decoder/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpItemUse ****/
 
diff --git a/TinNS/Source/GameServer/Decoder/UdpItemUse.hxx b/TinNS/Source/GameServer/Decoder/UdpItemUse.hxx
new file mode 100644 (file)
index 0000000..a211936
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpItemUse : public PUdpMsgAnalyser {
+/*  private:
+    u16 mWeaponId;
+    u32 mTargetRawItemID;
+    u8 mUnknown2;
+    u8 mTargetedHeight;
+    u8 mScore; // ??? looks quite random...
+*/
+public:
+    PUdpItemUse(PMsgDecodeData *nDecodeData);
+    //~PUdpItemUse();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
diff --git a/TinNS/Source/GameServer/Decoder/UdpKillSelf.cxx b/TinNS/Source/GameServer/Decoder/UdpKillSelf.cxx
new file mode 100644 (file)
index 0000000..e0d3307
--- /dev/null
@@ -0,0 +1,34 @@
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+
+PUdpKillSelf::PUdpKillSelf( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData )
+{
+  nDecodeData->mName << "/0x10";
+}
+
+PUdpMsgAnalyser* PUdpKillSelf::Analyse()
+{
+  mDecodeData->mName << "=Char Kill self";
+
+  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
+  return this;
+}
+
+bool PUdpKillSelf::DoAction()
+{
+  PClient* nClient = mDecodeData->mClient;
+
+  PMessage* tmpMsg = MsgBuilder->BuildCharDeathMsg( nClient, 0 );
+  ClientManager->UDPBroadcast( tmpMsg, nClient );
+
+  mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
+  return true;
+
+  /* Server resp:
+  13:a8:00:a8:e2:
+  16: 03:a5:00:1b:01:10:00:80:24:ea:7c:cb:80:25:77:80:86:80:62:00:01:00: // Spwan belt object (?)
+  09: 03:a6:00:1f:01:00:25:23:1c: // "UndefinedUseMsg" with arg 0x1c
+  0b: 03:a7:00:1f:01:00:16:00:00:00:00: // Char Dead status
+  0e: 03:a8:00:1f:01:00:25:13:10:19:02:02:0d:00 // Inventory delete item (=item dropped to belt)
+  */
+}
diff --git a/TinNS/Source/GameServer/Decoder/UdpKillSelf.hxx b/TinNS/Source/GameServer/Decoder/UdpKillSelf.hxx
new file mode 100644 (file)
index 0000000..9f64ae2
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpKillSelf : public PUdpMsgAnalyser {
+public:
+    PUdpKillSelf(PMsgDecodeData *nDecodeData);
+    //~PUdpKillSelf();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
similarity index 54%
rename from server/src/game/decoder/udp_multipart.cpp
rename to TinNS/Source/GameServer/Decoder/UdpMultiPart.cxx
index be79334..a2087bf 100644 (file)
@@ -1,37 +1,6 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_multipart.cpp - decoder classes for UDP multipart messages (0x07)
-
- CREATION: 25 Oct 2009 Namikon
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_multipart.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpMultiPart ****/
 
@@ -46,7 +15,7 @@ PUdpMsgAnalyser* PUdpMultiPart::Analyse()
 
     PMessage* TmpMsg = mDecodeData->mMessage;
 
-    u8 tChunkSize = 0;
+    uint8_t tChunkSize = 0;
 
     ( *TmpMsg ) >> tChunkSize;
     TmpMsg->SetNextByteOffset( mDecodeData->Sub0x13Start + 5 );
diff --git a/TinNS/Source/GameServer/Decoder/UdpMultiPart.hxx b/TinNS/Source/GameServer/Decoder/UdpMultiPart.hxx
new file mode 100644 (file)
index 0000000..f89977e
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpMultiPart : public PUdpMsgAnalyser {
+private:
+    uint16_t mChunkNr;
+    uint16_t mChunkTotal;
+    uint8_t mSequence;
+    PMessage *mChunk;
+
+public:
+    PUdpMultiPart(PMsgDecodeData *nDecodeData);
+    //~PUdpPing();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
similarity index 79%
rename from server/src/game/decoder/udp_npcdialog.cpp
rename to TinNS/Source/GameServer/Decoder/UdpNpcDialog.cxx
index 0855db8..75aad3e 100644 (file)
@@ -1,37 +1,6 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpNPCDialogClose ****/
 
diff --git a/TinNS/Source/GameServer/Decoder/UdpNpcDialog.hxx b/TinNS/Source/GameServer/Decoder/UdpNpcDialog.hxx
new file mode 100644 (file)
index 0000000..014e9e1
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpNPCDialogClose : public PUdpMsgAnalyser {
+private:
+    uint16_t mPlayerID;
+    uint32_t mNPCID;
+
+public:
+    PUdpNPCDialogClose(PMsgDecodeData *nDecodeData);
+    //~PUdpNPCDialogClose();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
+
+class PUdpNPCDialogAction : public PUdpMsgAnalyser {
+private:
+    uint16_t mPlayerID;
+    uint8_t mAnswerNr;
+
+public:
+    PUdpNPCDialogAction(PMsgDecodeData *nDecodeData);
+    //~PUdpNPCDialogAction();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
diff --git a/TinNS/Source/GameServer/Decoder/UdpOOO.cxx b/TinNS/Source/GameServer/Decoder/UdpOOO.cxx
new file mode 100644 (file)
index 0000000..5be7d73
--- /dev/null
@@ -0,0 +1,29 @@
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+/**** PUdpOOO ****/\r
+\r
+PUdpOOO::PUdpOOO(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
+{\r
+  nDecodeData->mName << "/0x01";\r
+}\r
+\r
+PUdpMsgAnalyser* PUdpOOO::Analyse()\r
+{\r
+  mDecodeData->mName << "=Out Of Order";\r
+  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;\r
+\r
+  return this;\r
+}\r
+\r
+bool PUdpOOO::DoAction()\r
+{\r
+    uint16_t MissingUDP_ID = mDecodeData->mMessage->U16Data(mDecodeData->Sub0x13Start+5);\r
+\r
+    mDecodeData->mClient->getUDPConn()->ReSendUDPMessage(MissingUDP_ID);\r
+    //Console->Print("%s Out of Order packet received ! (Client is missing UDPID %d) ***not managed yet***", Console->ColorText(YELLOW, BLACK, "[Notice]"), MissingUDP_ID);\r
+\r
+    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;\r
+    return true;\r
+}\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpOOO.hxx b/TinNS/Source/GameServer/Decoder/UdpOOO.hxx
new file mode 100644 (file)
index 0000000..89c759c
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpOOO : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpOOO(PMsgDecodeData *nDecodeData);\r
+    //~PUdpPing();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpOutfitter.cxx b/TinNS/Source/GameServer/Decoder/UdpOutfitter.cxx
new file mode 100644 (file)
index 0000000..5a37704
--- /dev/null
@@ -0,0 +1,53 @@
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
+
+/**** PUdpOutfitter ****/
+
+PUdpOutfitter::PUdpOutfitter(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
+{
+    nDecodeData->mName << "/0x2e";
+}
+
+PUdpMsgAnalyser* PUdpOutfitter::Analyse()
+{
+    mDecodeData->mName << "=Outfitter validation";
+
+    uint16_t tUnknown;
+    PMessage* nMsg = mDecodeData->mMessage;
+    nMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 8);
+
+    (*nMsg) >> mSkin;
+    (*nMsg) >> tUnknown;
+    (*nMsg) >> mHead;
+    (*nMsg) >> mTorso;
+    (*nMsg) >> mLegs;
+    (*nMsg) >> mHeadColor;
+    (*nMsg) >> mTorsoColor;
+    (*nMsg) >> mLegsColor;
+    (*nMsg) >> mHeadDarkness;
+    (*nMsg) >> mTorsoDarkness;
+    (*nMsg) >> mLegsDarkness;
+
+    mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
+    return this;
+}
+
+bool PUdpOutfitter::DoAction()
+{
+    PClient* nClient = mDecodeData->mClient;
+    PChar* tChar = nClient->GetChar();
+
+    /* Some validity checks against char model and equipment can be done here */
+    /* as well as payment */
+
+    tChar->SetCurrentLook(mSkin, mHead, mTorso, mLegs);
+    tChar->SetCurrentBodyColor(mHeadColor, mTorsoColor, mLegsColor, mHeadDarkness, mTorsoDarkness, mLegsDarkness);
+
+    PMessage* tmpMsg = MsgBuilder->BuildCharHelloMsg(nClient);
+    ClientManager->UDPBroadcast(tmpMsg, nClient);
+
+
+    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
+    return true;
+}
diff --git a/TinNS/Source/GameServer/Decoder/UdpOutfitter.hxx b/TinNS/Source/GameServer/Decoder/UdpOutfitter.hxx
new file mode 100644 (file)
index 0000000..3dbe053
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpOutfitter : public PUdpMsgAnalyser {
+private:
+    uint32_t mSkin;
+    uint8_t mHead;
+    uint8_t mTorso;
+    uint8_t mLegs;
+    uint8_t mHeadColor;
+    uint8_t mTorsoColor;
+    uint8_t mLegsColor;
+    uint8_t mHeadDarkness;
+    uint8_t mTorsoDarkness;
+    uint8_t mLegsDarkness;
+
+public:
+    PUdpOutfitter(PMsgDecodeData *nDecodeData);
+    //~PUdpOutfitter();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
diff --git a/TinNS/Source/GameServer/Decoder/UdpPacket0.cxx b/TinNS/Source/GameServer/Decoder/UdpPacket0.cxx
new file mode 100644 (file)
index 0000000..aa4feb7
--- /dev/null
@@ -0,0 +1,34 @@
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+
+/**** PUdpPacket0 ****/
+
+PUdpPacket0::PUdpPacket0(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
+{
+  nDecodeData->mName << "/0x2a";
+//nDecodeData->mTraceDump=true;
+//mDecodeData->mTraceKnownMsg = true;
+}
+
+PUdpMsgAnalyser* PUdpPacket0::Analyse()
+{
+  mDecodeData->mName << "=Packet0";
+  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
+
+  return this;
+}
+
+bool PUdpPacket0::DoAction()
+{
+  if (mDecodeData->mState & DECODE_ACTION_READY)
+  {
+    PMessage* tmpMsg = MsgBuilder->BuildPacket0Msg(mDecodeData->mClient);
+    mDecodeData->mClient->SendUDPMessage(tmpMsg);
+
+    //mDecodeData->mMessage->SetNextByteOffset(mDecodeData->Sub0x13StartNext);
+    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
+    return true;
+  }
+  else
+    return false;
+}
diff --git a/TinNS/Source/GameServer/Decoder/UdpPacket0.hxx b/TinNS/Source/GameServer/Decoder/UdpPacket0.hxx
new file mode 100644 (file)
index 0000000..688815a
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpPacket0 : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpPacket0(PMsgDecodeData *nDecodeData);\r
+    //~PUdpPacket0();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpPing.cxx b/TinNS/Source/GameServer/Decoder/UdpPing.cxx
new file mode 100644 (file)
index 0000000..022f756
--- /dev/null
@@ -0,0 +1,37 @@
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
+
+/**** PUdpPing ****/
+
+PUdpPing::PUdpPing( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData )
+{
+  nDecodeData->mName << "/0x0b";
+}
+
+PUdpMsgAnalyser* PUdpPing::Analyse()
+{
+  mDecodeData->mName << "=Ping";
+
+  mClientTime = mDecodeData->mMessage->U32Data( mDecodeData->Sub0x13Start + 2 );
+
+  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
+  return this;
+}
+
+bool PUdpPing::DoAction()
+{
+  if ( mDecodeData->mState & DECODE_ACTION_READY )
+  {
+    // 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 );
+    mDecodeData->mClient->SendUDPMessage( tmpMsg );
+
+    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
+    return true;
+  }
+  else
+    return false;
+}
diff --git a/TinNS/Source/GameServer/Decoder/UdpPing.hxx b/TinNS/Source/GameServer/Decoder/UdpPing.hxx
new file mode 100644 (file)
index 0000000..fdea776
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpPing : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mClientTime;\r
+\r
+public:\r
+    PUdpPing(PMsgDecodeData *nDecodeData);\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
@@ -1,44 +1,7 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATION: 14 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "udp_popupresponse.h"
-#include "udp_vhc.h"
-
-#include "include/vhcaccessrequest.h"
-#include "include/worlds.h"
-
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdp0x1f ****/
 
@@ -51,7 +14,7 @@ PUdpMsgAnalyser* PUdpPopupResponse::Analyse()
 {
   PUdpMsgAnalyser* nextAnalyser = NULL;
   mDecodeData->mState = DECODE_MORE;
-  u8 MsgType = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 12 ); //u32 but only u8 used
+  uint8_t MsgType = mDecodeData->mMessage->U8Data( mDecodeData->Sub0x13Start + 12 ); //uint32_t but only uint8_t used
 
   switch ( MsgType )
   {
@@ -109,15 +72,15 @@ bool PUdpVentureWarpConfirm::DoAction()
 
   if ( mStatus == 1 )
   {
-    u32 newLocation;
+    uint32_t newLocation;
     do
     {
       newLocation = Worlds->GetWorldIdFromWorldmap( GetRandom( PWorlds::mOutdoorWorldmapHSize, 0 ), GetRandom( PWorlds::mOutdoorWorldmapVSize, 0 ) );
     }
     while ( ! newLocation );
 
-    u16 nEntity = 10;
-    u16 nEntityType = 1;
+    uint16_t nEntity = 10;
+    uint16_t nEntityType = 1;
 
     PMessage* tmpMsg = MsgBuilder->BuildAptLiftUseMsg( nClient, newLocation, nEntity, nEntityType );
     nClient->SendUDPMessage( tmpMsg );
@@ -163,8 +126,8 @@ bool PUdpVhcAccessResponse::DoAction()
 
   if ( nAccessRequests->RegisterResponse( mVhcAccessRequestId, ( mStatus == 1 ) ) )
   {
-    u32 requesterCharId = 0;
-    u32 vehicleId = 0;
+    uint32_t requesterCharId = 0;
+    uint32_t vehicleId = 0;
     nAccessRequests->GetInfo( mVhcAccessRequestId, &requesterCharId, &vehicleId );
     PClient* requesterClient = ClientManager->getClientByChar( requesterCharId );
     PChar* requesterChar = ( requesterClient ? requesterClient->GetChar() : NULL );
@@ -174,7 +137,7 @@ bool PUdpVhcAccessResponse::DoAction()
       PWorld* CurrentWorld = Worlds->GetWorld( requesterChar->GetLocation() );
       if ( CurrentWorld )
       {
-        PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicules()->GetVehicleByGlobalId( vehicleId );
+        PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicles()->GetVehicleByGlobalId( vehicleId );
 
         if ( tVhc )
         {
diff --git a/TinNS/Source/GameServer/Decoder/UdpPopupResponse.hxx b/TinNS/Source/GameServer/Decoder/UdpPopupResponse.hxx
new file mode 100644 (file)
index 0000000..5e696a2
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpPopupResponse : public PUdpMsgAnalyser {
+public:
+    PUdpPopupResponse(PMsgDecodeData *nDecodeData);
+    //~PUdpPopupResponse();
+    PUdpMsgAnalyser *Analyse();
+    //bool DoAction();
+};
+
+class PUdpVentureWarpConfirm : public PUdpMsgAnalyser {
+private:
+    uint32_t mRawItemId;
+    uint16_t mStatus;
+    uint32_t mUnknown1;
+    uint16_t mUnknown2;
+
+public:
+    PUdpVentureWarpConfirm(PMsgDecodeData *nDecodeData);
+    //~PUdpVentureWarpConfirm();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
+
+class PUdpVhcAccessResponse : public PUdpMsgAnalyser {
+private:
+    uint32_t mVhcAccessRequestId;
+    uint16_t mStatus;
+    uint16_t mUnknown;
+
+public:
+    PUdpVhcAccessResponse(PMsgDecodeData *nDecodeData);
+    //~PUdpVhcAccessResponse();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
diff --git a/TinNS/Source/GameServer/Decoder/UdpPvpTrade.cxx b/TinNS/Source/GameServer/Decoder/UdpPvpTrade.cxx
new file mode 100644 (file)
index 0000000..4e142a8
--- /dev/null
@@ -0,0 +1,23 @@
+#include "GameServer/Decoder/Includes.hxx"
+
+/**** PPvPTrade ****/
+
+PUdpPvPTrade::PUdpPvPTrade(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
+{
+    nDecodeData->mName << "/0x3e";
+}
+
+PUdpMsgAnalyser* PUdpPvPTrade::Analyse()
+{
+    mDecodeData->mName << "=Switch PvP Trading";
+
+    mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
+    return this;
+}
+
+bool PUdpPvPTrade::DoAction()
+{
+    // TODO: Handle client PvP trade switch on/off
+    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
+    return true;
+}
diff --git a/TinNS/Source/GameServer/Decoder/UdpPvpTrade.hxx b/TinNS/Source/GameServer/Decoder/UdpPvpTrade.hxx
new file mode 100644 (file)
index 0000000..7b61973
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PUdpPvPTrade : public PUdpMsgAnalyser {
+public:
+    PUdpPvPTrade(PMsgDecodeData *nDecodeData);
+    //~PUdpPvPTrade();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
@@ -1,45 +1,6 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       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 "include/container.h"
-#include "include/inventory.h"
-
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpItemSlotUse ****/
 
@@ -70,12 +31,12 @@ bool PUdpItemSlotUse::DoAction()
   PItem* targetItem = NULL;
   bool tUsable = false;
   bool tUsableInHand = false;
-  u16 nWeaponId = 0;
+  uint16_t nWeaponId = 0;
 
   if( gDevDebug )
     Console->Print( "%s Client trying to activate item in slot %d.", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTargetSlot );
 
-  u8 currentActiveSlot = tChar->GetQuickBeltActiveSlot();
+  uint8_t currentActiveSlot = tChar->GetQuickBeltActiveSlot();
   if ( mTargetSlot == INV_WORN_QB_HAND )
   {
     if( gDevDebug )
diff --git a/TinNS/Source/GameServer/Decoder/UdpQuickAccessBelt.hxx b/TinNS/Source/GameServer/Decoder/UdpQuickAccessBelt.hxx
new file mode 100644 (file)
index 0000000..0f47787
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpItemSlotUse : public PUdpMsgAnalyser {\r
+private:\r
+    uint8_t mTargetSlot;\r
+\r
+public:\r
+    PUdpItemSlotUse(PMsgDecodeData *nDecodeData);\r
+    //~PUdpItemSlotUse();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 84%
rename from server/src/game/decoder/udp_reqinfo.cpp
rename to TinNS/Source/GameServer/Decoder/UdpRequestInfo.cxx
index 116c015..7d5628f 100644 (file)
@@ -1,37 +1,7 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_reqinfo.cpp - decoder classes for UDP Char/Clan/Map info request messages
-
- CREATION: 6 Sep 2006 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_reqinfo.h"
+#include <cstring>
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpCharInfo ****/
 
@@ -166,7 +136,7 @@ bool PUdpReqInfo::DoAction()
 
     if (mRequestType == 7)
     {
-        u8 WorldMapData[] = { // Temp map for test, with Attack None/GR All security setting
+        uint8_t WorldMapData[] = { // Temp map for test, with Attack None/GR All security setting
                                 0xd6, 0x07, 0x05, // BT@Simmons
                                 0xfe, 0x07, 0x0b, // CM // No effect: not on OP zone
                                 0xea, 0x07, 0x03, // Next // No effect: not on OP zone
@@ -195,7 +165,7 @@ bool PUdpReqInfo::DoAction()
     // from normal reqinfo messages
     if(mRequestType == 3)
     {
-        u32 tFileLen = 0;
+        uint32_t tFileLen = 0;
         PFile* fLua = NULL;
         fLua = Filesystem->Open( "", (char*)Answer, Config->GetOption( "nc_data_path" ) );
         std::string tLUAScript = "";
diff --git a/TinNS/Source/GameServer/Decoder/UdpRequestInfo.hxx b/TinNS/Source/GameServer/Decoder/UdpRequestInfo.hxx
new file mode 100644 (file)
index 0000000..5e3163f
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpReqInfo : public PUdpMsgAnalyser {\r
+private:\r
+    uint16_t mRequestType;\r
+    uint32_t mInfoId;\r
+\r
+public:\r
+    PUdpReqInfo(PMsgDecodeData *nDecodeData);\r
+    //~PUdpCharInfo();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 60%
rename from server/src/game/decoder/udp_subskill.cpp
rename to TinNS/Source/GameServer/Decoder/UdpSubSkill.cxx
index c047466..1179e1d 100644 (file)
@@ -1,44 +1,13 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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_subskill.h - decoder classes for UDP subskill increasing messages
-  
-       CREATION: 15 Sep 2006 Hammag
-
-       MODIFIED:
-       REASON: - 
-
-*/
-
-#include "main.h"
-#include "udp_subskill.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpSubskillInc ****/
 
 PUdpSubskillInc::PUdpSubskillInc(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
 {
   nDecodeData->mName << "/0x04";
-} 
+}
 
 PUdpMsgAnalyser* PUdpSubskillInc::Analyse()
 {
@@ -46,7 +15,7 @@ PUdpMsgAnalyser* PUdpSubskillInc::Analyse()
   SubskillID = mDecodeData->mMessage->U16Data(mDecodeData->Sub0x13Start+9);
 
   mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-  
+
   return this;
 }
 
diff --git a/TinNS/Source/GameServer/Decoder/UdpSubSkill.hxx b/TinNS/Source/GameServer/Decoder/UdpSubSkill.hxx
new file mode 100644 (file)
index 0000000..4d1e394
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpSubskillInc : public PUdpMsgAnalyser {\r
+private:\r
+    uint16_t SubskillID;\r
+\r
+public:\r
+    PUdpSubskillInc(PMsgDecodeData *nDecodeData);\r
+    //~PUdpSubskillInc();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 75%
rename from server/src/game/decoder/udp_sync.cpp
rename to TinNS/Source/GameServer/Decoder/UdpSync.cxx
index 446c283..c26ff54 100644 (file)
@@ -1,46 +1,9 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       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)
-*/
-
-
-#include "main.h"
-
-#include "udp_sync.h"
-
-#include "include/worlds.h"
-#include "include/vehicle.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
+//  TODO: - put chunking code from PUdpSync2::DoAction() in a SendChunkedMessqage(PClient* nClient, PMessage* nMessage,
+//                                                                                uint8_t nChunkSize = 220)
 
 /**** PUdpSync0 ****/
 
@@ -89,7 +52,7 @@ void PUdpSync0::GetToSync1( PMsgDecodeData* nDecodeData )
   PClient* nClient = nDecodeData->mClient;
   nClient->SetZoning();
 
-  u32 loc = nClient->GetChar()->GetLocation();
+  uint32_t loc = nClient->GetChar()->GetLocation();
 //Console->Print("inside HandleGame : Location: %d", loc);
   SendZone( nClient, loc );
 
@@ -130,21 +93,21 @@ bool PUdpSync1::DoAction()
 
     nClient->IncreaseUDP_ID();
 
-    *tmpMsg << (u8)0x13;
-    *tmpMsg << (u16)nClient->GetUDP_ID();
-    *tmpMsg << (u16)nClient->GetSessionID();
-    *tmpMsg << (u8)0x0a; // Message length place;
-    *tmpMsg << (u8)0x03;
-    *tmpMsg << (u16)nClient->GetUDP_ID();
-    *tmpMsg << (u8)0x23;
-    *tmpMsg << (u8)0x0f;
-    *tmpMsg << (u8)0x00; // ??
-    *tmpMsg << (u8)0x03; // ??
-    *tmpMsg << (u8)0x00; // ??
-    *tmpMsg << (u8)0x01; // ??
-    *tmpMsg << (u8)0x00; // ??
-
-    (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
+    *tmpMsg << (uint8_t)0x13;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint16_t)nClient->GetSessionID();
+    *tmpMsg << (uint8_t)0x0a; // Message length place;
+    *tmpMsg << (uint8_t)0x03;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint8_t)0x23;
+    *tmpMsg << (uint8_t)0x0f;
+    *tmpMsg << (uint8_t)0x00; // ??
+    *tmpMsg << (uint8_t)0x03; // ??
+    *tmpMsg << (uint8_t)0x00; // ??
+    *tmpMsg << (uint8_t)0x01; // ??
+    *tmpMsg << (uint8_t)0x00; // ??
+
+    (*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
     nClient->SendUDPMessage(tmpMsg);*/
 
     mDecodeData->mClientState->UDP.mState = PGameState::UDP::GUS_SYNC2;
@@ -191,8 +154,8 @@ bool PUdpSync2::DoAction()
     nClient->SetZoning( false );
 
     // If char is sitting (vhz zoning), send it now to client
-    u32 nSeatableObjectId;
-    u8 nSeatId;
+    uint32_t nSeatableObjectId;
+    uint8_t nSeatId;
     if( nClient->GetChar()->GetSeatInUse(&nSeatableObjectId, &nSeatId) )
     {
       if( gDevDebug )
@@ -215,7 +178,7 @@ bool PUdpSync2::DoAction()
     PWorld* CurrentWorld = Worlds->GetWorld( nClient->GetChar()->GetLocation() );
     if ( CurrentWorld )
     {
-      PSpawnedVhcList* VhcList = CurrentWorld->GetSpawnedVehicules()->GetSpawnedVehicles();
+      PSpawnedVhcList* VhcList = CurrentWorld->GetSpawnedVehicles()->GetSpawnedVehicles();
       PSpawnedVehicle* VhcEntry;
       PMessage* VhcMsg;
 
diff --git a/TinNS/Source/GameServer/Decoder/UdpSync.hxx b/TinNS/Source/GameServer/Decoder/UdpSync.hxx
new file mode 100644 (file)
index 0000000..8841d52
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpSync0 : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpSync0(PMsgDecodeData *nDecodeData);\r
+    //~PUdpSync0();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+\r
+    static void GetToSync1(PMsgDecodeData *nDecodeData);\r
+};\r
+\r
+class PUdpSync1 : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpSync1(PMsgDecodeData *nDecodeData);\r
+    //~PUdpSync1();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpSync2 : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mClientTime;\r
+\r
+public:\r
+    PUdpSync2(PMsgDecodeData *nDecodeData);\r
+    //~PUdpSync2();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 81%
rename from server/src/game/decoder/udp_terminal.cpp
rename to TinNS/Source/GameServer/Decoder/UdpTerminal.cxx
index d3f7453..486c63a 100644 (file)
@@ -1,47 +1,7 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       udp_terminal.cpp - decoder classes for UDP terminal related messages\r
-\r
-       CREATION: 08 Jan 2007 Namikon\r
-\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "udp_terminal.h"\r
-#include "udp_charmove.h"\r
-\r
-#include "include/terminal.h"\r
-#include "include/vehicle.h"\r
-#include "include/worlds.h"\r
-#include "include/furnituretemplate.h"\r
-\r
 #include <cmath>\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /*******************************************************************************************/\r
 /**** PUdpReceiveDB ****/\r
@@ -55,7 +15,7 @@ PUdpReceiveDB::PUdpReceiveDB( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( n
 PUdpMsgAnalyser* PUdpReceiveDB::Analyse()\r
 {\r
   PMessage* TmpMsg = mDecodeData->mMessage;\r
-  u16 Unknown3, OptionSize;\r
+  uint16_t Unknown3, OptionSize;\r
 \r
   mDecodeData->mName << "=ReceiveDB request from client";\r
 \r
@@ -96,9 +56,9 @@ bool PUdpReceiveDB::DoAction()
   if ( gDevDebug )\r
   {\r
     Console->Print( "%s ReceiveDB request from client", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) );\r
-       Console->Print( "%s Open Terminal - Terminal session %04x (?) - Unknown1 %04x - DBId %04x - Unknown2 %02x", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId, mUnknown1, mDBId, mUnknown2 );\r
+    Console->Print( "%s Open Terminal - Terminal session %04x (?) - Unknown1 %04x - DBId %04x - Unknown2 %02x", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId, mUnknown1, mDBId, mUnknown2 );\r
     Console->Print( "%s Command: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mCommandName.c_str() );\r
-    for ( u8 i = 0; i < mOptionsCount; ++i )\r
+    for ( uint8_t i = 0; i < mOptionsCount; ++i )\r
       Console->Print( "%s Option %d: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), i, mOptions[i].c_str() );\r
   }\r
 \r
@@ -119,7 +79,7 @@ bool PUdpReceiveDB::DoAction()
   if ( !Result )\r
   {\r
     Console->Print( "%s PUdpReceiveDB - Error or unknown command %s", Console->ColorText( RED, BLACK, "[WARNING]" ), mCommandName.c_str() );\r
-    for ( u8 i = 0; i < mOptionsCount; ++i )\r
+    for ( uint8_t i = 0; i < mOptionsCount; ++i )\r
       Console->Print( "%s Option %d: '%s'", Console->ColorText( RED, BLACK, "[NOTICE]" ), i, mOptions[i].c_str() );\r
   }\r
 \r
@@ -135,16 +95,16 @@ bool PUdpReceiveDB::ActionVehicleListing()
 \r
   if ( mOptionsCount == 3 ) // CharId, StartVhcEntry, MaxVhcEntries\r
   {\r
-    if ((( u32 )atol( mOptions[0].c_str() ) ) != tChar->GetID() )\r
+    if ((( uint32_t )atol( mOptions[0].c_str() ) ) != tChar->GetID() )\r
     {\r
       // Err: invalid CharId. Can alert, But we don't care :-) (except if used for other terminal function)\r
     }\r
     // !!! some more check/regex on values to do before using !!!\r
-    u16 StartIndex = atoi( mOptions[1].c_str() );\r
-    u16 MaxEntries = atoi( mOptions[2].c_str() );\r
+    uint16_t StartIndex = atoi( mOptions[1].c_str() );\r
+    uint16_t MaxEntries = atoi( mOptions[2].c_str() );\r
 \r
-    u8 nStatus = 1;\r
-    u16 nErrcode = 0;\r
+    uint8_t nStatus = 1;\r
+    uint16_t nErrcode = 0;\r
 \r
     tmpMsg = MsgBuilder->BuildDBRequestStatusMsg( tClient, &mCommandName, nStatus, nErrcode );\r
     tClient->SendUDPMessage( tmpMsg );\r
@@ -152,9 +112,9 @@ bool PUdpReceiveDB::ActionVehicleListing()
     PVhcInfoList* VhcList = Vehicles->GetCharVehicles( tChar->GetID(), MaxEntries, StartIndex );\r
     if ( ! VhcList->empty() )\r
     {\r
-      u16 NumEntries = VhcList->size();\r
+      uint16_t NumEntries = VhcList->size();\r
       std::string* Answer = new std::string[4 * NumEntries];\r
-      u16 Index = 0;\r
+      uint16_t Index = 0;\r
       PVehicleInformation* EntryInfo;\r
 //Console->Print("VHc entries : %d", NumEntries);\r
 \r
@@ -182,18 +142,18 @@ bool PUdpReceiveDB::ActionVehicleListing()
     return false;\r
   /*\r
   // Option1=CharId, Option2=resultEntryStart, Option3=maxResultEntries\r
-  S=> 03/2b/1a <u16 size incl 0><u8 bool succes ?><u16 err code ?>VehicleListing+0\r
+  S=> 03/2b/1a <uint16_t size incl 0><uint8_t bool succes ?><uint16_t err code ?>VehicleListing+0\r
   13 2a 00 7c be 19\r
   03 2a 00 2b 1a 0f 00 01 00 00 56 65 68 69 63 6c  .*.+......Vehicl\r
   65 4c 69 73 74 69 6e 67 00  eListing.\r
-  S=> 03/2b/17 0f 00 08 00 04 00 <0f 00><u16 entries nb><04 00>\r
+  S=> 03/2b/17 0f 00 08 00 04 00 <0f 00><uint16_t entries nb><04 00>\r
   VehicleListing+0\r
   <id_size incl 0><id_string +0>\r
   <type_size><type_id_string? +0>\r
   <status_size><status_string +0> (val: 0=stored)\r
   <health_size><health_string +0> (val: 0-255)\r
   ==\r
-  03/2b/17 0f 00 01 00 04 00 <0f 00><u16 entries nb><04 00>\r
+  03/2b/17 0f 00 01 00 04 00 <0f 00><uint16_t entries nb><04 00>\r
   31\r
   03 54 00 2b 17 0f 00 01 00 04 00 56 65 68 69 63 6c 65 4c 69 73 74  .....VehicleList\r
   69 6e 67 00 06 00 32 35 32 37 37 00 03 00 36 30  ing...25277...60\r
@@ -209,13 +169,13 @@ bool PUdpReceiveDB::ActionVehicleControl()
   if ( mOptionsCount == 2 ) // VhcId, CharId\r
   {\r
     // !!! validate values !!!\r
-    u8 nStatus = 1;\r
-    u16 nErrcode = 0;\r
+    uint8_t nStatus = 1;\r
+    uint16_t nErrcode = 0;\r
 \r
     tmpMsg = MsgBuilder->BuildDBRequestStatusMsg( tClient, &mCommandName, nStatus, nErrcode );\r
     tClient->SendUDPMessage( tmpMsg );\r
 \r
-    u32 VhcId = ( u32 )atol( mOptions[0].c_str() );\r
+    uint32_t VhcId = ( uint32_t )atol( mOptions[0].c_str() );\r
     PVehicleInformation EntryInfo;\r
     if ( Vehicles->GetVehicleInfo( VhcId, &EntryInfo ) )\r
     {\r
@@ -260,7 +220,7 @@ PUdpUpdateDB::PUdpUpdateDB( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDe
 PUdpMsgAnalyser* PUdpUpdateDB::Analyse()\r
 {\r
   PMessage* TmpMsg = mDecodeData->mMessage;\r
-  u16 Unknown3, OptionSize;\r
+  uint16_t Unknown3, OptionSize;\r
 \r
   mDecodeData->mName << "=UpdateDB request from client";\r
 \r
@@ -298,7 +258,7 @@ bool PUdpUpdateDB::DoAction()
     Console->Print( "%s UpdateDB request from client", Console->ColorText( CYAN, BLACK, "[DEBUG]" ) );\r
     Console->Print( "%s Open Terminal - Terminal session %04x (?)", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId );\r
     Console->Print( "%s Command: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mCommandName.c_str() );\r
-    for ( u8 i = 0; i < mOptionsCount; ++i )\r
+    for ( uint8_t i = 0; i < mOptionsCount; ++i )\r
       Console->Print( "%s Option %d: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), i, mOptions[i].c_str() );\r
   }\r
    bool Result = false;\r
@@ -307,7 +267,7 @@ bool PUdpUpdateDB::DoAction()
  if ( !Result )\r
   {\r
     Console->Print( "%s PUdpUpdateDB - Error or unknown command %s", Console->ColorText( RED, BLACK, "[WARNING]" ), mCommandName.c_str() );\r
-    for ( u8 i = 0; i < mOptionsCount; ++i )\r
+    for ( uint8_t i = 0; i < mOptionsCount; ++i )\r
       Console->Print( "%s Option %d: '%s'", Console->ColorText( RED, BLACK, "[NOTICE]" ), i, mOptions[i].c_str() );\r
   }\r
   mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;\r
@@ -325,7 +285,7 @@ PUdpTryAccessDB::PUdpTryAccessDB( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyse
 PUdpMsgAnalyser* PUdpTryAccessDB::Analyse()\r
 {\r
   PMessage* TmpMsg = mDecodeData->mMessage;\r
-  u16 Unknown3, OptionSize;\r
+  uint16_t Unknown3, OptionSize;\r
 \r
   mDecodeData->mName << "=TryAccess request from client";\r
 \r
@@ -375,7 +335,7 @@ PUdpQueryDB::PUdpQueryDB( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDeco
 PUdpMsgAnalyser* PUdpQueryDB::Analyse()\r
 {\r
   PMessage* TmpMsg = mDecodeData->mMessage;\r
-  u16 OptionSize;\r
+  uint16_t OptionSize;\r
 \r
   mDecodeData->mName << "=QueryDB request from client";\r
 \r
@@ -423,7 +383,7 @@ bool PUdpQueryDB::DoAction()
     Console->Print( "%s Open Terminal - Terminal session %04x (?)", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mTerminalSessionId );\r
     Console->Print( "%s DBCommand: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mDBCommandName.c_str() );\r
     Console->Print( "%s Command: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), mCommandName.c_str() );\r
-    for ( u8 i = 0; i < mOptionsCount; ++i )\r
+    for ( uint8_t i = 0; i < mOptionsCount; ++i )\r
       Console->Print( "%s Option %d: '%s'", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), i, mOptions[i].c_str() );\r
   }\r
 \r
@@ -448,7 +408,7 @@ bool PUdpQueryDB::DoAction()
   if ( !Result )\r
   {\r
     Console->Print( "%s PUdpQueryDB - Error or unknown command %s", Console->ColorText( RED, BLACK, "[WARNING]" ), mDBCommandName.c_str() );\r
-    for ( u8 i = 0; i < mOptionsCount; ++i )\r
+    for ( uint8_t i = 0; i < mOptionsCount; ++i )\r
       Console->Print( "%s Option %d: '%s'", Console->ColorText( RED, BLACK, "[NOTICE]" ), i, mOptions[i].c_str() );\r
   }\r
 \r
@@ -464,12 +424,12 @@ bool PUdpQueryDB::ActionSpawnVehicle()
 \r
   if ( mOptionsCount == 3 ) // 0, VhcId, CharId\r
   {\r
-    u32 VhcId = ( u32 )atol( mOptions[1].c_str() );\r
-    //u32 CharId = (u32)atol(mOptions[2].c_str());\r
+    uint32_t VhcId = ( uint32_t )atol( mOptions[1].c_str() );\r
+    //uint32_t CharId = (uint32_t)atol(mOptions[2].c_str());\r
     // !!! validate values !!!\r
     // !!! + check CharId = current char && CharId is owner of VhcId\r
-    u8 nStatus = 1; // 1=OK, 0=Err\r
-    u16 nErrcode = 16; // 0=n/a 16=Already Spawned // MsdId = 2500+nErrcode [MISC]\r
+    uint8_t nStatus = 1; // 1=OK, 0=Err\r
+    uint16_t nErrcode = 16; // 0=n/a 16=Already Spawned // MsdId = 2500+nErrcode [MISC]\r
 \r
     tmpMsg = MsgBuilder->BuildDBRequestStatusMsg( tClient, &mCommandName, nStatus, nErrcode );\r
     tClient->SendUDPMessage( tmpMsg );\r
@@ -482,15 +442,15 @@ bool PUdpQueryDB::ActionSpawnVehicle()
       const PFurnitureItemTemplate* tFurnitureTemplate = CurrentWorld->GetFurnitureItemTemplate( tChar->GetLastUsedObject() / 1024 - 1 );\r
       if ( tFurnitureTemplate && ( tFurnitureTemplate->GetFunctionType() == 28 ) ) // vhc term\r
       {\r
-        f32 decal = 1000; // distance at which to spawn the vhc\r
-        f32 nPosX, nPosY, nPosZ;\r
+        float decal = 1000; // distance at which to spawn the vhc\r
+        float nPosX, nPosY, nPosZ;\r
         tFurnitureTemplate->GetPos( &nPosX, &nPosY, &nPosZ );\r
         nPosX += 32000;\r
         nPosY += 32000;\r
-        f32 dX = ( tChar->Coords.mX - nPosX );\r
-        f32 dY = ( tChar->Coords.mY - nPosY );\r
-        f32 d = decal / sqrt( dX * dX + dY * dY );\r
-        NewPosition.SetPosition( static_cast<u16>( nPosY + d * dY ), ( tChar->Coords ).mZ + 100, static_cast<u16>( nPosX + d * dX ), ( tChar->Coords ).mUD, 34683, 32403 );\r
+        float dX = ( tChar->Coords.mX - nPosX );\r
+        float dY = ( tChar->Coords.mY - nPosY );\r
+        float d = decal / sqrt( dX * dX + dY * dY );\r
+        NewPosition.SetPosition( static_cast<uint16_t>( nPosY + d * dY ), ( tChar->Coords ).mZ + 100, static_cast<uint16_t>( nPosX + d * dX ), ( tChar->Coords ).mUD, 34683, 32403 );\r
         relativePos = true;\r
       }\r
     }\r
@@ -518,12 +478,12 @@ bool PUdpQueryDB::ActionRepairVehicle()
 \r
   if ( mOptionsCount == 3 ) // 0, VhcId, CharId\r
   {\r
-    //u32 VhcId = (u32)atol(mOptions[1].c_str());\r
-    //u32 CharId = (u32)atol(mOptions[2].c_str());\r
+    //uint32_t VhcId = (uint32_t)atol(mOptions[1].c_str());\r
+    //uint32_t CharId = (uint32_t)atol(mOptions[2].c_str());\r
     // !!! validate values !!!\r
 \r
-    u8 nStatus = 1; // 1=OK, 0=Err\r
-    u16 nErrcode = 18; // 0=n/a 18=Still Spawned, 19=Not enough money\r
+    uint8_t nStatus = 1; // 1=OK, 0=Err\r
+    uint16_t nErrcode = 18; // 0=n/a 18=Still Spawned, 19=Not enough money\r
 \r
     tmpMsg = MsgBuilder->BuildDBRequestStatusMsg( tClient, &mCommandName, nStatus, nErrcode );\r
     tClient->SendUDPMessage( tmpMsg );\r
@@ -545,25 +505,25 @@ bool PUdpQueryDB::ActionDismissVehicle()
 \r
   if ( mOptionsCount == 3 ) // 0, VhcId, CharId\r
   {\r
-    u32 VhcId = ( u32 )atol( mOptions[1].c_str() );\r
-    //u32 CharId = (u32)atol(mOptions[2].c_str());\r
+    uint32_t VhcId = ( uint32_t )atol( mOptions[1].c_str() );\r
+    //uint32_t CharId = (uint32_t)atol(mOptions[2].c_str());\r
     // !!! validate values !!!\r
     // !!! + check CharId = current char && CharId is owner of VjhcId\r
     // !!! Check vhc empty\r
-    u8 nStatus = 0; // 1=OK, 0=Err\r
-    u16 nErrcode = 17; // 0=n/a 17=Not Spawned\r
+    uint8_t nStatus = 0; // 1=OK, 0=Err\r
+    uint16_t nErrcode = 17; // 0=n/a 17=Not Spawned\r
     PVehicleInformation nInfo;\r
-    u32 tLocalId = 0;\r
-    u32 tLocation = 0;\r
+    uint32_t tLocalId = 0;\r
+    uint32_t tLocation = 0;\r
 \r
     PSpawnedVehicle* tVhc = Vehicles->GetSpawnedVehicle( VhcId );\r
     if ( tVhc )\r
     {\r
       tLocalId = tVhc->GetLocalId();\r
       tLocation = tVhc->GetLocation();\r
-      u32 tCharId;\r
+      uint32_t tCharId;\r
       PChar* tChar;\r
-      for ( u8 i = 0; i < tVhc->GetNumSeats(); ++i )\r
+      for ( uint8_t i = 0; i < tVhc->GetNumSeats(); ++i )\r
       {\r
         if (( tCharId = tVhc->GetSeatUser( i ) ) )\r
         {\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpTerminal.hxx b/TinNS/Source/GameServer/Decoder/UdpTerminal.hxx
new file mode 100644 (file)
index 0000000..2cabd91
--- /dev/null
@@ -0,0 +1,97 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpReceiveDB : public PUdpMsgAnalyser {\r
+private:\r
+    static const uint8_t mMaxOptions = 9; // Largest: forum\forenlist.tsc(21, 114,...)\r
+    uint16_t mTerminalSessionId;\r
+    std::string mCommandName;\r
+    std::string mOptions[mMaxOptions];\r
+    uint8_t mOptionsCount;\r
+\r
+    uint16_t mUnknown1;\r
+    uint8_t mUnknown2;\r
+    uint16_t mDBId;\r
+\r
+    bool ActionVehicleListing();\r
+    bool ActionVehicleControl();\r
+\r
+public:\r
+    PUdpReceiveDB(PMsgDecodeData *nDecodeData);\r
+    //~PUdpReceiveDB();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpUpdateDB : public PUdpMsgAnalyser {\r
+private:\r
+    static const uint8_t mMaxOptions = 7; // Largest: forum\bbcnewthread.tsc(66):\r
+    uint16_t mTerminalSessionId;\r
+    std::string mCommandName;\r
+    std::string mOptions[mMaxOptions];\r
+    uint8_t mOptionsCount;\r
+\r
+    uint16_t mUnknown1;\r
+    uint8_t mUnknown2;\r
+    uint16_t mDBId;\r
+\r
+public:\r
+    PUdpUpdateDB(PMsgDecodeData *nDecodeData);\r
+    //~PUdpUpdateDB();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpTryAccessDB : public PUdpMsgAnalyser {\r
+private:\r
+    static const uint8_t mMaxOptions = 9; // Largest: stockx\depot.tsc(227):\r
+    uint16_t mTerminalSessionId;\r
+    std::string mCommandName;\r
+    std::string mOptions[mMaxOptions];\r
+    uint8_t mOptionsCount;\r
+\r
+    uint16_t mUnknown1;\r
+    uint8_t mUnknown2;\r
+    uint16_t mDBId;\r
+\r
+public:\r
+    PUdpTryAccessDB(PMsgDecodeData *nDecodeData);\r
+    //~PUdpTryAccessDB();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpQueryDB : public PUdpMsgAnalyser { // Also called "ServerMessage" in .tsc scripts!\r
+private:\r
+    static const uint8_t mMaxOptions = 5; // Largest: politics\transcomment.tsc(36):\r
+    uint16_t mTerminalSessionId;\r
+    uint16_t mDBId;\r
+    std::string mDBCommandName;\r
+    std::string mCommandName;\r
+    std::string mOptions[mMaxOptions];\r
+    uint8_t mOptionsCount;\r
+\r
+    bool ActionSpawnVehicle();\r
+    bool ActionRepairVehicle();\r
+    bool ActionDismissVehicle();\r
+\r
+public:\r
+    PUdpQueryDB(PMsgDecodeData *nDecodeData);\r
+    //~PUdpQueryDB();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpTeminal0x1f : public PUdpMsgAnalyser {\r
+private:\r
+    uint16_t mTerminalSessionId;\r
+\r
+public:\r
+    PUdpTeminal0x1f(PMsgDecodeData *nDecodeData);\r
+    //~PUdpTeminal0x1f();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 89%
rename from server/src/game/decoder/udp_useobject.cpp
rename to TinNS/Source/GameServer/Decoder/UdpUseObject.cxx
index f556016..c063aa9 100644 (file)
@@ -1,54 +1,9 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       udp_useobject.cpp - decoder classes for object use related messages\r
-\r
-       CREATION: 17 Sep 2006 Hammag\r
-\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-\r
-       TODO:\r
-       - use only RawObjectIDs to avoid complication & errors\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "udp_useobject.h"\r
-#include "udp_vhc.h"\r
-\r
-#include "include/worlds.h"\r
-#include "include/furnituretemplate.h"\r
-#include "include/doortemplate.h"\r
-#include "include/appartements.h"\r
-#include "include/container.h"\r
-#include "include/subway.h"\r
-#include "include/vhcaccessrequest.h"\r
-\r
-\r
-u32 gVhcId = 0x3ff;\r
+uint32_t gVhcId = 0x3ff;\r
 \r
 /**** PUdpVhcMove ****/\r
 \r
@@ -70,14 +25,14 @@ bool PUdpUseObject::DoAction()
 {\r
   PClient* nClient = mDecodeData->mClient;\r
   PChar* nChar = nClient->GetChar();\r
-  u32 ItemID;\r
+  uint32_t ItemID;\r
   char DbgMessage[128];\r
   PMessage* tmpMsg;\r
 \r
   bool tHandleDynamicActor = false;\r
 \r
   /*PMessage* cMsg = mDecodeData->mMessage;\r
-  u32 ClientTime = cMsg->U32Data(mDecodeData->Sub0x13Start+2);\r
+  uint32_t ClientTime = cMsg->U32Data(mDecodeData->Sub0x13Start+2);\r
 \r
   tmpMsg = MsgBuilder->BuildPingMsg(mDecodeData->mClient, ClientTime);\r
   mDecodeData->mClient->SendUDPMessage(tmpMsg);*/\r
@@ -98,7 +53,7 @@ bool PUdpUseObject::DoAction()
 \r
   if ( gDevDebug )\r
   {\r
-    Console->Print( "Char at y=%f (0x%04x) z=%f (0x%04x) x=%f (0x%04x)", ( f32 )( nChar->Coords.mY - 32000 ), nChar->Coords.mY, ( f32 )( nChar->Coords.mZ - 32000 ), nChar->Coords.mZ, ( f32 )( nChar->Coords.mX - 32000 ), nChar->Coords.mX );\r
+    Console->Print( "Char at y=%f (0x%04x) z=%f (0x%04x) x=%f (0x%04x)", ( float )( nChar->Coords.mY - 32000 ), nChar->Coords.mY, ( float )( nChar->Coords.mZ - 32000 ), nChar->Coords.mZ, ( float )( nChar->Coords.mX - 32000 ), nChar->Coords.mX );\r
     if ( mRawItemID & 1023 )\r
       Console->Print( "using item %d (0x%08x)", mRawItemID, mRawItemID );\r
     else\r
@@ -162,7 +117,7 @@ bool PUdpUseObject::DoAction()
 \r
           if ( nChar->GetSeatInUse() == seat_none ) // Refuse if Char is already sitting somewhere\r
           {\r
-            PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicules()->GetVehicle( mRawItemID );\r
+            PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicles()->GetVehicle( mRawItemID );\r
             if ( tVhc )\r
             {\r
               if ( gDevDebug )\r
@@ -198,7 +153,7 @@ bool PUdpUseObject::DoAction()
                   {\r
                     PChar* ownerChar = ownerClient->GetChar();\r
                     // We could check for valid allowed access before adding a new one\r
-                    u32 newReqId = ownerChar->GetVhcAccessRequestList()->Add( nChar->GetID(), tVhc->GetInformation().GetVehicleId() );\r
+                    uint32_t newReqId = ownerChar->GetVhcAccessRequestList()->Add( nChar->GetID(), tVhc->GetInformation().GetVehicleId() );\r
                     if ( newReqId )\r
                     {\r
                       tmpMsg = MsgBuilder->BuildVhcAccessRequestMsg( ownerClient, newReqId, nChar->GetID(), nClient->GetID(), tVhc->GetInformation().GetVehicleId() );\r
@@ -222,7 +177,7 @@ bool PUdpUseObject::DoAction()
               vhcFound = true;\r
               if ( Subway->IsDoorOpen( mRawItemID, GameServer->GetGameTime() ) )\r
               {\r
-                u8 freeSeat = Subway->GetFreeSeat( mRawItemID );\r
+                uint8_t freeSeat = Subway->GetFreeSeat( mRawItemID );\r
                 if ( freeSeat && Subway->SetSeatUser( mRawItemID, freeSeat, nChar->GetID() ) )\r
                 {\r
                   nChar->SetSeatInUse( seat_subway, mRawItemID, freeSeat );\r
@@ -263,7 +218,7 @@ bool PUdpUseObject::DoAction()
 \r
         if ( !( mDecodeData->mState & DECODE_ACTION_DONE ) ) // not a vhc nor a pc\r
         {\r
-                 //Console->Print(">>> Searching world");\r
+          //Console->Print(">>> Searching world");\r
           // Is it a NPC ?\r
           PNPC* targetNPC = 0;\r
           PNPCWorld* currentNPCWorld = NPCManager->GetWorld( nChar->GetLocation() );\r
@@ -341,7 +296,7 @@ bool PUdpUseObject::DoAction()
 \r
         if ( tFurnitureModel->GetUseFlags() & ufChair )\r
         {\r
-          u32 cSeatObjectId;\r
+          uint32_t cSeatObjectId;\r
           PSeatType cSeatType = nChar->GetSeatInUse( &cSeatObjectId );\r
           if (( cSeatType == seat_none ) || ( cSeatType == seat_chair ) )\r
           {\r
@@ -387,12 +342,12 @@ bool PUdpUseObject::DoAction()
           {\r
             case 6: //Respawn Station (GenRep)\r
             {\r
-              u32 nLocation = nChar->GetLocation();\r
-              u16 nEntity;\r
+              uint32_t nLocation = nChar->GetLocation();\r
+              uint16_t nEntity;\r
               if ( Worlds->IsPotentialAppartement( nLocation ) )\r
               {\r
-                nLocation = 0xffffffff; // (u32)-1;\r
-                nEntity = 0xffff; //(u16)-1;\r
+                nLocation = 0xffffffff; // (uint32_t)-1;\r
+                nEntity = 0xffff; //(uint16_t)-1;\r
               }\r
               else\r
               {\r
@@ -408,7 +363,7 @@ bool PUdpUseObject::DoAction()
                   nEntityInt = GameDefs->Respawns()->GetRespawnEntity( nChar->GetLocation(), WorldActors->GetLinkedObjectID( mRawItemID ) );\r
                 }\r
 \r
-                nEntity = ( nEntityInt < 0 ? 0xffff : ( u16 )nEntityInt );\r
+                nEntity = ( nEntityInt < 0 ? 0xffff : ( uint16_t )nEntityInt );\r
               }\r
 \r
               tmpMsg = MsgBuilder->BuildCharUseGenrepMsg( nClient, mRawItemID, nLocation, nEntity );\r
@@ -444,7 +399,7 @@ bool PUdpUseObject::DoAction()
             case 15: //HOLOMATCH EXIT\r
             {\r
               // temp hack + wrong entity... guess it works same as function 20\r
-              u32 HoloNum = nChar->GetLocation() - 90000; // value 1 to 16, to transalte to 540..547 550..557 for worldmodel.def\r
+              uint32_t HoloNum = nChar->GetLocation() - 90000; // value 1 to 16, to transalte to 540..547 550..557 for worldmodel.def\r
 \r
               const PDefWorldModel* tHoloExitModel = GameDefs->WorldModels()->GetDef( 539 + HoloNum + ( HoloNum > 8 ? 2 : 0 ) );\r
               if ( tHoloExitModel && ( tHoloExitModel->GetFunctionType() == 14 ) ) // we use the Holomatch entry. Takes care of bad zone id\r
@@ -452,9 +407,9 @@ bool PUdpUseObject::DoAction()
                 const PDefAppPlace* nAppPlace = GameDefs->AppPlaces()->GetDef( tHoloExitModel->GetFunctionValue() );\r
                 if ( nAppPlace )\r
                 {\r
-                  u32 Location = nAppPlace->GetExitWorldID();\r
-                  u16 Entity = nAppPlace->GetExitWorldEntity();\r
-                  u8 SewerLevel = 0;\r
+                  uint32_t Location = nAppPlace->GetExitWorldID();\r
+                  uint16_t Entity = nAppPlace->GetExitWorldEntity();\r
+                  uint8_t SewerLevel = 0;\r
 \r
                   tmpMsg = MsgBuilder->BuildChangeLocationMsg( nClient, Location, Entity, SewerLevel, 0 ); //mRawItemID\r
                   nClient->SendUDPMessage( tmpMsg );\r
@@ -490,9 +445,9 @@ bool PUdpUseObject::DoAction()
               }\r
               if ( nAppPlace )\r
               {\r
-                u32 Location = nAppPlace->GetExitWorldID();\r
-                u16 Entity = nAppPlace->GetExitWorldEntity();\r
-                u8 SewerLevel = 0;\r
+                uint32_t Location = nAppPlace->GetExitWorldID();\r
+                uint16_t Entity = nAppPlace->GetExitWorldEntity();\r
+                uint8_t SewerLevel = 0;\r
                 //if(((tFurnitureModel->GetFunctionType() == 20) && nAppPlace->GetSewerLevel()) || (tFurnitureModel->GetFunctionType() == 29))\r
                 if (( tFurnitureModel->GetFunctionType() == 20 ) || ( tFurnitureModel->GetFunctionType() == 29 ) )\r
                 {\r
@@ -644,7 +599,7 @@ bool PUdpUseObject::DoAction()
               }\r
               else\r
               {\r
-                u32 linkobjID = WorldActors->GetLinkedObjectID( mRawItemID );\r
+                uint32_t linkobjID = WorldActors->GetLinkedObjectID( mRawItemID );\r
                 if ( linkobjID )\r
                 {\r
                   if ( nClient->GetAccountLevel() >= PAL_GM ) // Allow GameMasters and higher to just bypass HackButtons\r
@@ -675,11 +630,11 @@ bool PUdpUseObject::DoAction()
               {\r
                 if ( tFurnitureTemplate->GetLinkedObjectID() )\r
                 {\r
-                  u32 OldCash = nChar->GetCash();\r
-                  u32 DoorFee = ( u32 )tFurnitureModel->GetFunctionValue();\r
+                  uint32_t OldCash = nChar->GetCash();\r
+                  uint32_t DoorFee = ( uint32_t )tFurnitureModel->GetFunctionValue();\r
                   if ( OldCash >= DoorFee )\r
                   {\r
-                    u32 NewCash = nChar->SetCash( OldCash - DoorFee );\r
+                    uint32_t NewCash = nChar->SetCash( OldCash - DoorFee );\r
                     PMessage* tmpMsg_cash = MsgBuilder->BuildCharMoneyUpdateMsg( nClient, NewCash );\r
                     nClient->SendUDPMessage( tmpMsg_cash );\r
                     tmpMsg_cash = NULL;\r
@@ -700,14 +655,14 @@ bool PUdpUseObject::DoAction()
               }\r
               else\r
               {\r
-                u32 linkobjID = WorldActors->GetLinkedObjectID( mRawItemID );\r
+                uint32_t linkobjID = WorldActors->GetLinkedObjectID( mRawItemID );\r
                 if ( linkobjID )\r
                 {\r
-                  u32 OldCash = nChar->GetCash();\r
-                  u32 DoorFee = ( u32 )tFurnitureModel->GetFunctionValue();\r
+                  uint32_t OldCash = nChar->GetCash();\r
+                  uint32_t DoorFee = ( uint32_t )tFurnitureModel->GetFunctionValue();\r
                   if ( OldCash >= DoorFee )\r
                   {\r
-                    u32 NewCash = nChar->SetCash( OldCash - DoorFee );\r
+                    uint32_t NewCash = nChar->SetCash( OldCash - DoorFee );\r
                     PMessage* tmpMsg_cash = MsgBuilder->BuildCharMoneyUpdateMsg( nClient, NewCash );\r
                     nClient->SendUDPMessage( tmpMsg_cash );\r
                     tmpMsg_cash = NULL;\r
@@ -765,7 +720,7 @@ bool PUdpUseObject::DoAction()
             }\r
             case 32: // Text message\r
             {\r
-              tmpMsg = MsgBuilder->BuildText100Msg( nClient, ( u8 )( 255 & tFurnitureModel->GetFunctionValue() ), mRawItemID );\r
+              tmpMsg = MsgBuilder->BuildText100Msg( nClient, ( uint8_t )( 255 & tFurnitureModel->GetFunctionValue() ), mRawItemID );\r
               nClient->SendUDPMessage( tmpMsg );\r
 \r
               mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpUseObject.hxx b/TinNS/Source/GameServer/Decoder/UdpUseObject.hxx
new file mode 100644 (file)
index 0000000..0b22681
--- /dev/null
@@ -0,0 +1,25 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpUseObject : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mRawItemID;\r
+\r
+    void OldHandler(); // Temp during migration only\r
+\r
+public:\r
+    PUdpUseObject(PMsgDecodeData *nDecodeData);\r
+    //~PUdpUseObject();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpCloseItemContainer : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpCloseItemContainer(PMsgDecodeData *nDecodeData);\r
+    //~PUdpCloseItemContainer();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
similarity index 82%
rename from server/src/game/decoder/udp_vhc.cpp
rename to TinNS/Source/GameServer/Decoder/UdpVehicle.cxx
index 168bdbe..a593eca 100644 (file)
@@ -1,44 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       udp_vhc.h - decoder classes for UDP vehicle related messages\r
-\r
-       CREATION: 05 Sep 2006 Hammag\r
-\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "udp_vhc.h"\r
-\r
-#include "include/worlds.h"\r
-#include "include/vehicle.h"\r
-#include "include/subway.h"\r
-\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /**** PUdpVhcMove ****/\r
 \r
@@ -133,7 +95,7 @@ bool PUdpVhcMove::DoAction()
 \r
   if ( CurrentWorld )\r
   {\r
-    PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicules()->GetVehicle( mVhcLocalId );\r
+    PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicles()->GetVehicle( mVhcLocalId );\r
     if ( tVhc )\r
     {\r
       //Todo: calc & mem Speed & Accel vectors\r
@@ -148,21 +110,21 @@ bool PUdpVhcMove::DoAction()
 \r
       if( CurrentWorld->CheckVhcNeedZoning( &nPos ) )\r
       {\r
-        u32 destWorldId;\r
+        uint32_t destWorldId;\r
         PVhcCoordinates destPos;\r
 \r
         if (( destWorldId = CurrentWorld->GetVhcZoningDestination( tVhc, &destPos ) ) )\r
         {\r
           if ( nClient->GetDebugMode( DBG_LOCATION ) )\r
           {\r
-            u8 pH = 0;\r
-            u8 pV = 0;\r
+            uint8_t pH = 0;\r
+            uint8_t pV = 0;\r
             Worlds->GetWorldmapFromWorldId( destWorldId, pH, pV );\r
             char DbgMessage[128];\r
             snprintf( DbgMessage, 128, "Vhc zoning to zone %c%02d (id %d)", ( 'a' + pV ), pH, destWorldId );\r
             Chat->send( nClient, CHAT_GM, "Debug", DbgMessage );\r
           }\r
-  \r
+\r
           DoVhcZoning( tVhc, nClient->GetChar()->GetLocation(), destWorldId, &destPos );\r
         }\r
       }\r
@@ -176,19 +138,19 @@ bool PUdpVhcMove::DoAction()
 }\r
 \r
 // Failures are not managed yet\r
-bool PUdpVhcMove::DoVhcZoning( PSpawnedVehicle* currVhc, u32 currWorldId, u32 destWorldId, PVhcCoordinates* destPos )\r
+bool PUdpVhcMove::DoVhcZoning( PSpawnedVehicle* currVhc, uint32_t currWorldId, uint32_t destWorldId, PVhcCoordinates* destPos )\r
 {\r
-  u32 seatedCharsId[8];\r
-  u32 vhcGlobalId = currVhc->GetVehicleId();\r
-  u32 vhcLocalId = currVhc->GetLocalId();\r
+  uint32_t seatedCharsId[8];\r
+  uint32_t vhcGlobalId = currVhc->GetVehicleId();\r
+  uint32_t vhcLocalId = currVhc->GetLocalId();\r
   PVhcCoordinates currCoords = currVhc->GetPosition();\r
-  u8 numSeats = currVhc->GetNumSeats();\r
-  u32 sittingCharId;\r
+  uint8_t numSeats = currVhc->GetNumSeats();\r
+  uint32_t sittingCharId;\r
   PClient* sittingClient;\r
   PClient* sittingClients[8];\r
   PMessage* tmpMsg;\r
 \r
-  for ( u8 i = 0; i < numSeats; ++i )\r
+  for ( uint8_t i = 0; i < numSeats; ++i )\r
   {\r
     // Save seated chars list\r
     seatedCharsId[i] = sittingCharId = currVhc->GetSeatUser( i );\r
@@ -228,7 +190,7 @@ bool PUdpVhcMove::DoVhcZoning( PSpawnedVehicle* currVhc, u32 currWorldId, u32 de
 \r
     // Update chars seat in use and restore vhc used seats\r
     PChar* sittingChar;\r
-    for ( u8 i = 0; i < numSeats; ++i )\r
+    for ( uint8_t i = 0; i < numSeats; ++i )\r
     {\r
       if (( sittingClient = sittingClients[i] ) )\r
       {\r
@@ -243,7 +205,7 @@ bool PUdpVhcMove::DoVhcZoning( PSpawnedVehicle* currVhc, u32 currWorldId, u32 de
   }\r
   else\r
   {\r
-    for ( u8 i = 0; i < numSeats; ++i )\r
+    for ( uint8_t i = 0; i < numSeats; ++i )\r
     {\r
       if ( sittingClients[i] )\r
       {\r
@@ -271,7 +233,7 @@ PUdpMsgAnalyser* PUdpVhcUse::Analyse()
 \r
   PMessage* nMsg = mDecodeData->mMessage;\r
   nMsg->SetNextByteOffset( mDecodeData->Sub0x13Start + 12 );\r
-  *nMsg >> mVehicleID; // u32\r
+  *nMsg >> mVehicleID; // uint32_t\r
   *nMsg >> mVehicleSeat;\r
 \r
   if ( gDevDebug )\r
@@ -291,7 +253,7 @@ bool PUdpVhcUse::DoAction()
     PWorld* CurrentWorld = Worlds->GetWorld( nChar->GetLocation() );\r
     if ( CurrentWorld )\r
     {\r
-      PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicules()->GetVehicle( mVehicleID );\r
+      PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicles()->GetVehicle( mVehicleID );\r
       if ( tVhc )\r
       {\r
         if ( tVhc->SetSeatUser( mVehicleSeat, nChar->GetID() ) ) // Char was able to sit\r
@@ -313,13 +275,13 @@ bool PUdpVhcUse::DoAction()
   return true;\r
 }\r
 \r
-void PUdpVhcUse::DoFreeSitting( PClient* nClient,  PSpawnedVehicle* nVhc, u32 nRawVhcLocalId, u8 nSeatId )\r
+void PUdpVhcUse::DoFreeSitting( PClient* nClient,  PSpawnedVehicle* nVhc, uint32_t nRawVhcLocalId, uint8_t nSeatId )\r
 {\r
   PMessage* tmpMsg;\r
 \r
   if (( nVhc->GetNbFreeSeats() > 1 ) && ( nSeatId > nVhc->GetNumSeats() ) )\r
   {\r
-    u8 freeSeats = nVhc->GetFreeSeatsFlags();\r
+    uint8_t freeSeats = nVhc->GetFreeSeatsFlags();\r
     tmpMsg = MsgBuilder->BuildCharUseVhcMsg( nClient, nRawVhcLocalId, nVhc->GetInformation().GetVehicleType(), freeSeats );\r
     nClient->SendUDPMessage( tmpMsg ); // Open seat selection window\r
   }\r
@@ -369,7 +331,7 @@ PUdpSubwayUpdate::PUdpSubwayUpdate( PMsgDecodeData* nDecodeData ) : PUdpMsgAnaly
 \r
 PUdpMsgAnalyser* PUdpSubwayUpdate::Analyse()\r
 {\r
-  u8 Dumb;\r
+  uint8_t Dumb;\r
 \r
   mDecodeData->mName << "=Subway update";\r
 \r
@@ -431,7 +393,7 @@ bool PUdpRequestVhcInfo::DoAction()
 \r
   if ( CurrentWorld )\r
   {\r
-    PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicules()->GetVehicle( mVehicleID );\r
+    PSpawnedVehicle* tVhc = CurrentWorld->GetSpawnedVehicles()->GetVehicle( mVehicleID );\r
     if ( tVhc )\r
     {\r
       if ( gDevDebug )\r
diff --git a/TinNS/Source/GameServer/Decoder/UdpVehicle.hxx b/TinNS/Source/GameServer/Decoder/UdpVehicle.hxx
new file mode 100644 (file)
index 0000000..bd93524
--- /dev/null
@@ -0,0 +1,66 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PSpawnedVehicle;\r
+class PVhcCoordinates;\r
+\r
+class PUdpVhcMove : public PUdpMsgAnalyser {\r
+private:\r
+    uint16_t mVhcLocalId;\r
+    uint16_t mNewY;\r
+    uint16_t mNewZ;\r
+    uint16_t mNewX;\r
+    uint16_t mNewLR;\r
+    uint16_t mNewRoll;\r
+    uint16_t mUnk1; // always 0x0001 ?\r
+    uint8_t mMoveType;\r
+    uint8_t mNewUD;\r
+    uint8_t mFF; // always 0xff ?\r
+    uint8_t mAction; // &1 = Left, &2 = Right, &4 = Forward, &8 = Backward\r
+\r
+public:\r
+    PUdpVhcMove(PMsgDecodeData *nDecodeData);\r
+    //~PUdpVhcMove();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+    bool DoVhcZoning(PSpawnedVehicle *currVhc, uint32_t currWorldId, uint32_t destWorldId, PVhcCoordinates *destPos);\r
+};\r
+\r
+class PUdpVhcUse : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mVehicleID;\r
+    uint8_t mVehicleSeat;\r
+\r
+public:\r
+    PUdpVhcUse(PMsgDecodeData *nDecodeData);\r
+    //~PUdpVhcUse();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+    static void DoFreeSitting(PClient *nClient, PSpawnedVehicle *nVhc, uint32_t nRawVhcLocalId, uint8_t nSeatId = 254);\r
+};\r
+\r
+class PUdpSubwayUpdate : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mVehicleID;\r
+    uint16_t mPosition;\r
+    uint8_t mDoorOpened;\r
+\r
+public:\r
+    PUdpSubwayUpdate(PMsgDecodeData *nDecodeData);\r
+    //~PUdpSubwayUpdate();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpRequestVhcInfo : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mVehicleID;\r
+\r
+public:\r
+    PUdpRequestVhcInfo(PMsgDecodeData *nDecodeData);\r
+    //~PUdpRequestVhcInfo();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
@@ -1,37 +1,6 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_worldIDinfo.cpp - decoder classes for UDP "Request for more information about WorldID xx"
-
- CREATION: 20 Jun 2009 Namikon
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_worldIDinfo.h"
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PWorldIDInfoReq ****/
 
diff --git a/TinNS/Source/GameServer/Decoder/UdpWorldIdInfo.hxx b/TinNS/Source/GameServer/Decoder/UdpWorldIdInfo.hxx
new file mode 100644 (file)
index 0000000..90b9c0b
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Decoder/UdpAnalyser.hxx"
+
+class PWorldIDInfoReq : public PUdpMsgAnalyser {
+    uint32_t mInfoId;
+
+public:
+    PWorldIDInfoReq(PMsgDecodeData *nDecodeData);
+    //~PWorldIDInfoReq();
+    PUdpMsgAnalyser *Analyse();
+    bool DoAction();
+};
similarity index 79%
rename from server/src/game/decoder/udp_zoning.cpp
rename to TinNS/Source/GameServer/Decoder/UdpZoning.cxx
index f7fc98d..f94e403 100644 (file)
@@ -1,46 +1,8 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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: 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_sync.h"
-
-#include "include/worlds.h"
-#include "include/appartements.h"
-
+#include <cstring>
+#include "GameServer/Decoder/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 /**** PUdpZoning1 ****/
 
@@ -54,20 +16,20 @@ PUdpMsgAnalyser* PUdpZoning1::Analyse()
   mDecodeData->mName << "=Zoning phase 1";
 
   PMessage* cMsg = mDecodeData->mMessage;
-  u8 dumb8;
-  u16 dumb16;
+  uint8_t dumb8;
+  uint16_t dumb16;
   //mUnknown = cMsg->U16Data(mDecodeData->Sub0x13Start+7);
   //mNewLocation = cMsg->U32Data(mDecodeData->Sub0x13Start+11);
   //mNewEntity = cMsg->U16Data(mDecodeData->Sub0x13Start+15);
 
   cMsg->SetNextByteOffset( mDecodeData->Sub0x13Start + 7 );
-  *cMsg >> dumb8; // u8 = 0x01 in NC1, other in NC2.2 ?
-  *cMsg >> mUnknown; //u8
-  *cMsg >> dumb16; //u16 unkown use
-  *cMsg >> mNewLocation; //u32
-  *cMsg >> mNewEntity; //u16
-  //*cMsg >> dumb16; //u16 0x0000
-//Console->Print("Zoning Stage 1: New location: %d, Entity %d, Unknown %d", mNewLocation, mNewEntity, (u16)mUnknown);
+  *cMsg >> dumb8; // uint8_t = 0x01 in NC1, other in NC2.2 ?
+  *cMsg >> mUnknown; //uint8_t
+  *cMsg >> dumb16; //uint16_t unkown use
+  *cMsg >> mNewLocation; //uint32_t
+  *cMsg >> mNewEntity; //uint16_t
+  //*cMsg >> dumb16; //uint16_t 0x0000
+//Console->Print("Zoning Stage 1: New location: %d, Entity %d, Unknown %d", mNewLocation, mNewEntity, (uint16_t)mUnknown);
   mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
 
   return this;
@@ -91,7 +53,7 @@ bool PUdpZoning1::DoAction()
     PCharCoordinates &C = (mDecodeData->mClient->GetChar()->Coords);
     snprintf( DbgMessage, 128, "pos min/max y:%d/%d z:%d/%d x:%d/%d", C.minPos[0], C.maxPos[0], C.minPos[1], C.maxPos[1], C.minPos[2], C.maxPos[2] );
     Chat->send( mDecodeData->mClient, CHAT_GM, "Debug", DbgMessage );
-    
+
     for(int i=0; i<3; i++)
       { C.minPos[i] = 0xffff; C.maxPos[i] = 0; }
   }*/
@@ -143,8 +105,8 @@ PUdpMsgAnalyser* PUdpGenrepZoning::Analyse()
 
   PMessage* cMsg = mDecodeData->mMessage;
   cMsg->SetNextByteOffset( mDecodeData->Sub0x13Start + 12 );
-  *cMsg >> mNewLocation; // u32
-  *cMsg >> mNewEntity; //u16
+  *cMsg >> mNewLocation; // uint32_t
+  *cMsg >> mNewEntity; //uint16_t
 
   return this;
 }
@@ -155,7 +117,7 @@ bool PUdpGenrepZoning::DoAction()
   return PUdpGenrepZoning::DoEffectiveZoning( mDecodeData->mClient, mNewLocation, mNewEntity );
 }
 
-bool PUdpGenrepZoning::DoEffectiveZoning( PClient* nClient, u32  nNewLocation, u16 nNewEntity )
+bool PUdpGenrepZoning::DoEffectiveZoning( PClient* nClient, uint32_t  nNewLocation, uint16_t nNewEntity )
 {
   PMessage* tmpMsg = MsgBuilder->BuildGenrepZoningMsg( nClient, nNewLocation, nNewEntity );
   nClient->SendUDPMessage( tmpMsg );
@@ -189,10 +151,10 @@ PUdpMsgAnalyser* PUdpAptGRZoning::Analyse()
 bool PUdpAptGRZoning::DoAction()
 {
   /*
-    //u16 newEntity = cMsg->U16Data(mDecodeData->Sub0x13Start+12); // always 0x0047 ? Not a location/entity anyway...
+    //uint16_t newEntity = cMsg->U16Data(mDecodeData->Sub0x13Start+12); // always 0x0047 ? Not a location/entity anyway...
 
-    u32 newLocation = PWorlds::mAptBaseWorldId + nClient->GetChar()->GetBaseApartment();
-    u16 newEntity = 0;
+    uint32_t newLocation = PWorlds::mAptBaseWorldId + nClient->GetChar()->GetBaseApartment();
+    uint16_t newEntity = 0;
   */
 
   mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
@@ -201,8 +163,8 @@ bool PUdpAptGRZoning::DoAction()
 
 bool PUdpAptGRZoning::DoEffectiveZoning( PClient* nClient )
 {
-  u32 newLocation = PWorlds::mAptBaseWorldId + nClient->GetChar()->GetBaseApartment();
-  u16 newEntity = 0;
+  uint32_t newLocation = PWorlds::mAptBaseWorldId + nClient->GetChar()->GetBaseApartment();
+  uint16_t newEntity = 0;
 
   PMessage* tmpMsg = MsgBuilder->BuildGenrepZoningMsg( nClient, newLocation, newEntity );
   nClient->SendUDPMessage( tmpMsg );
@@ -290,7 +252,7 @@ PUdpMsgAnalyser* PUdpAppartmentAccess::Analyse()
 bool PUdpAppartmentAccess::DoAction()
 {
   PMessage* tmpMsg;
-  u32 AppLoc, Location, Entity;
+  uint32_t AppLoc, Location, Entity;
   PClient* nClient = mDecodeData->mClient;
   PChar* nChar = nClient->GetChar();
 
@@ -314,7 +276,7 @@ bool PUdpAppartmentAccess::DoAction()
   }
   else
   {
-    u32 Location = Appartements->GetAptID( mAppartmentPlace, ( u8* )mPassword );
+    uint32_t Location = Appartements->GetAptID( mAppartmentPlace, ( uint8_t* )mPassword );
     if ( Location > 1 )
     {
       tmpMsg = MsgBuilder->BuildAptLiftUseMsg( nClient, Location, 1 );
diff --git a/TinNS/Source/GameServer/Decoder/UdpZoning.hxx b/TinNS/Source/GameServer/Decoder/UdpZoning.hxx
new file mode 100644 (file)
index 0000000..9722fb3
--- /dev/null
@@ -0,0 +1,80 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Decoder/UdpAnalyser.hxx"\r
+\r
+class PUdpZoning1 : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mNewLocation;\r
+    uint16_t mNewEntity;\r
+    uint8_t mUnknown;\r
+\r
+public:\r
+    PUdpZoning1(PMsgDecodeData *nDecodeData);\r
+    //~PUdpZoning1();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpZoning2 : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpZoning2(PMsgDecodeData *nDecodeData);\r
+    //~PUdpZoning2();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpGenrepZoning : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mNewLocation;\r
+    uint16_t mNewEntity;\r
+\r
+public:\r
+    PUdpGenrepZoning(PMsgDecodeData *nDecodeData);\r
+    //~PUdpGenrepZoning();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+    static bool DoEffectiveZoning(PClient *nClient, uint32_t nNewLocation, uint16_t nNewEntity);\r
+};\r
+\r
+class PUdpAptGRZoning : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpAptGRZoning(PMsgDecodeData *nDecodeData);\r
+    //~PUdpAptGRZoning();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+    static bool DoEffectiveZoning(PClient *nClient);\r
+};\r
+\r
+class PUdpAddGenrepToList : public PUdpMsgAnalyser {\r
+private:\r
+    uint32_t mLocation;\r
+    uint16_t mEntity;\r
+\r
+public:\r
+    PUdpAddGenrepToList(PMsgDecodeData *nDecodeData);\r
+    //~PUdpAddGenrepToList();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+class PUdpAppartmentAccess : public PUdpMsgAnalyser {\r
+private:\r
+    uint16_t mAppartmentPlace;\r
+    char *mPassword;\r
+\r
+public:\r
+    PUdpAppartmentAccess(PMsgDecodeData *nDecodeData);\r
+    //~PUdpAppartmentAccess();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
+\r
+\r
+class PUdpEndOfZoning : public PUdpMsgAnalyser {\r
+public:\r
+    PUdpEndOfZoning(PMsgDecodeData *nDecodeData);\r
+    //~PUdpEndOfZoning();\r
+    PUdpMsgAnalyser *Analyse();\r
+    bool DoAction();\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/ActionMod.cxx b/TinNS/Source/GameServer/Definitions/ActionMod.cxx
new file mode 100644 (file)
index 0000000..ac24add
--- /dev/null
@@ -0,0 +1,49 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefActionMod::PDefActionMod()
+{
+}
+
+bool PDefActionMod::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  int maxFields = 3;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+        mStartValue = atof( i->c_str() ); break;
+      case 3 :
+      {
+        mNumOfSsq = atoi( i->c_str() );
+        if( mNumOfSsq > 8 )
+          mNumOfSsq = 8;
+        maxFields = 3 + 2 * mNumOfSsq;
+        break;
+      }
+      default :
+        if( (Idx >= 4) && (Idx <= maxFields) )
+        {
+          if(Idx & 1)
+          {
+            mModFactor[(Idx - 4) / 2] = atof( i->c_str() );
+          }
+          else
+          {
+            mSsqId[(Idx - 4) / 2] = atoi( i->c_str() );
+          }
+        }
+        break;
+    }
+
+    if ( Idx >= maxFields )
+      break;
+  }
+
+  return ((Idx == maxFields));
+}
diff --git a/TinNS/Source/GameServer/Definitions/ActionMod.hxx b/TinNS/Source/GameServer/Definitions/ActionMod.hxx
new file mode 100644 (file)
index 0000000..1c689c4
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefActionMod : public PDef {
+private:
+    //int mIndex;
+    float mStartValue;
+    int32_t mNumOfSsq;
+    int32_t mSsqId[8];
+    float mModFactor[8];
+
+public:
+    PDefActionMod();
+    //~PDefActionMod();
+
+    bool LoadFromDef(PTokenList *Tokens);
+
+    inline float GetStartValue() const { return mStartValue; }
+    inline int32_t GetNumOfSsq() const { return mNumOfSsq; }
+    inline int32_t GetSsqId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mSsqId[nIdx] : 0) ; }
+       inline float GetModFactor(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mModFactor[nIdx] : 0) ; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/Ammo.cxx b/TinNS/Source/GameServer/Definitions/Ammo.cxx
new file mode 100644 (file)
index 0000000..ad8fb12
--- /dev/null
@@ -0,0 +1,36 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefAmmo::PDefAmmo()
+{
+  mShotId = mMagSize = mWeaponShotId = mDamageId = 0;
+}
+
+bool PDefAmmo::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+        mDamageId = atoi( i->c_str() ); break;
+      case 3 :
+        mWeaponShotId = atoi( i->c_str() ); break;
+      case 4 :
+        mMagSize = atoi( i->c_str() ); break;
+      case 5 :
+        mShotId = atoi( i->c_str() ); break;
+      default :
+        break;
+    }
+
+    if ( Idx >= 5 )
+      break;
+  }
+
+  return ((Idx >= 4));
+}
diff --git a/TinNS/Source/GameServer/Definitions/Ammo.hxx b/TinNS/Source/GameServer/Definitions/Ammo.hxx
new file mode 100644 (file)
index 0000000..8ef4899
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefAmmo : public PDef {
+private:
+    //int32_t mIndex;
+       int32_t mDamageId; // related to damage.def
+       int32_t mWeaponShotId; // related to shots.def ?
+       int32_t mMagSize;
+    int32_t mShotId; // related to shots.def ??? strange: hardly ever set in ammo.def
+
+public:
+    PDefAmmo();
+    //~PDefAmmo();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetDamageId() const { return mDamageId; }
+       inline int32_t GetWeaponShotId() const { return mWeaponShotId; }
+    inline int32_t GetMagSize() const { return mMagSize; }
+       inline int32_t GetShotId() const { return mShotId; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/AppartementPlaces.cxx b/TinNS/Source/GameServer/Definitions/AppartementPlaces.cxx
new file mode 100644 (file)
index 0000000..fa6078a
--- /dev/null
@@ -0,0 +1,35 @@
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+PDefAppPlace::PDefAppPlace()\r
+{\r
+}\r
+\r
+bool PDefAppPlace::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0: // setentry\r
+                    continue;\r
+\r
+            case 1: // index\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+            case 2: // name\r
+                mName = *i; break;\r
+\r
+            case 3: // Exit World\r
+                mExitWorldID = atoi(i->c_str()); break;\r
+\r
+            case 4: // Exit World entity\r
+                mExitWorldEntity = atoi(i->c_str()); break;\r
+\r
+            case 5: // Sewer level\r
+                mSewerLevel = atoi(i->c_str()); break;\r
+        }\r
+    }\r
+\r
+    return true;\r
+}\r
diff --git a/TinNS/Source/GameServer/Definitions/AppartementPlaces.hxx b/TinNS/Source/GameServer/Definitions/AppartementPlaces.hxx
new file mode 100644 (file)
index 0000000..18d0268
--- /dev/null
@@ -0,0 +1,25 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefAppPlace : public PDef {\r
+private :\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    int32_t mExitWorldID;\r
+    int32_t mExitWorldEntity;\r
+    int32_t mSewerLevel;\r
+\r
+public :\r
+    PDefAppPlace();\r
+    //~PDefAppPlace();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline int32_t GetExitWorldID() const { return mExitWorldID; }\r
+    inline int32_t GetExitWorldEntity() const { return mExitWorldEntity; }\r
+    inline int32_t GetSewerLevel() const { return mSewerLevel; }\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/Appartements.cxx b/TinNS/Source/GameServer/Definitions/Appartements.cxx
new file mode 100644 (file)
index 0000000..9f37a69
--- /dev/null
@@ -0,0 +1,50 @@
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+PDefAppartement::PDefAppartement()\r
+{\r
+}\r
+\r
+bool PDefAppartement::LoadFromDef(PTokenList *Tokens)\r
+{\r
+  mFaction = 0;\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0: // setentry\r
+                    continue;\r
+\r
+            case 1: // index\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+            case 2: // name\r
+                mName = *i; break;\r
+\r
+            case 3: // world name\r
+                mWorldName = *i; break;\r
+\r
+            case 4: // value\r
+                mValue = atoi(i->c_str()); break;\r
+\r
+            case 5: // number of places\r
+                mPlaceCount = atoi(i->c_str()); break;\r
+\r
+          case 6:\r
+          case 7:\r
+          case 8:\r
+          case 9:\r
+          case 10:\r
+          case 11:\r
+          case 12:\r
+          case 13:\r
+            mPlace[Idx-6] = atoi(i->c_str()); break;\r
+\r
+            case 14: // faction if base appartement\r
+                mFaction = atoi(i->c_str()); break;\r
+        }\r
+    }\r
+//Console->Print("%04d:%s file:%s val:%d places:%d pl1:%d pl2:%d pl8:%d faction:%d",\r
+//      mIndex, mName.c_str(), mWorldName.c_str(), mValue, mPlaceCount, mPlace[0], mPlace[1], mPlace[7], mFaction);\r
+    return true;\r
+}\r
diff --git a/TinNS/Source/GameServer/Definitions/Appartements.hxx b/TinNS/Source/GameServer/Definitions/Appartements.hxx
new file mode 100644 (file)
index 0000000..58dd293
--- /dev/null
@@ -0,0 +1,37 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+#include "GameServer/Definitions/Map.hxx"\r
+\r
+class PDefAppartement : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    std::string mWorldName;\r
+    int32_t mValue;\r
+    int32_t mPlaceCount;\r
+    int32_t mPlace[8];\r
+    int32_t mFaction;\r
+\r
+public:\r
+    PDefAppartement();\r
+    //~PDefAppartement();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline int32_t GetID() const { return mIndex; }\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline const std::string &GetWorldName() const { return mWorldName; }\r
+    inline int32_t GetValue() const { return mValue; }\r
+    inline int32_t GetPlaceCount() const { return mPlaceCount; }\r
+    inline int32_t GetPlace(int32_t nIdx) const { return ( (nIdx < mPlaceCount) ? mPlace[nIdx] : 0 ); }\r
+    inline int32_t GetFaction() const { return mFaction; }\r
+};\r
+\r
+class PDefAppartementsMap : public PDefMap<PDefAppartement> {\r
+public:\r
+    inline std::map<int32_t, PDefAppartement*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }\r
+    inline std::map<int32_t, PDefAppartement*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/BluePrintPieces.cxx b/TinNS/Source/GameServer/Definitions/BluePrintPieces.cxx
new file mode 100644 (file)
index 0000000..95513f3
--- /dev/null
@@ -0,0 +1,43 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefBlueprintPieces::PDefBlueprintPieces()
+{
+}
+
+
+bool PDefBlueprintPieces::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  int maxFields = 3;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+        mMaxPieceNum = atoi( i->c_str() ); break;
+      case 3 :
+      {
+        mPieceNum = atoi( i->c_str() );
+        if ( mPieceNum > 20 )
+          mPieceNum = 20;
+        maxFields = 3 + mPieceNum;
+        break;
+      }
+      default :
+        if (( Idx >= 4 ) && ( Idx <= maxFields ) )
+        {
+          mPieceId[ Idx - 4 ] = atoi( i->c_str() );
+        }
+        break;
+    }
+
+    if ( Idx >= maxFields )
+      break;
+  }
+
+  return (( Idx == maxFields ) );
+}
diff --git a/TinNS/Source/GameServer/Definitions/BluePrintPieces.hxx b/TinNS/Source/GameServer/Definitions/BluePrintPieces.hxx
new file mode 100644 (file)
index 0000000..c1cbd21
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefBlueprintPieces : public PDef {
+private:
+    //int32_t mIndex; // related Item Type
+    int32_t mMaxPieceNum;
+    int32_t mPieceNum;
+    int32_t mPieceId[20];
+
+public:
+    PDefBlueprintPieces();
+    //~PDefBlueprint32_tPieces();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetMaxPieceNum() const { return mMaxPieceNum; }
+    inline int32_t GetPieceNum() const { return mPieceNum; }
+    inline int32_t GetPieceId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mPieceNum)) ? mPieceId[nIdx] : 0) ; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/CMakeLists.txt b/TinNS/Source/GameServer/Definitions/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a32c0be
--- /dev/null
@@ -0,0 +1,7 @@
+ADD_LIBRARY             (Definitions ActionMod.cxx Ammo.cxx AppartementPlaces.cxx Appartements.cxx BluePrintPieces.cxx
+                         CharacterActions.cxx CharacterKinds.cxx Characters.cxx Damage.cxx Definition.cxx Drugs.cxx
+                         Factions.cxx GameDefinitions.cxx Hack.cxx Implants.cxx ItemContainer.cxx ItemMod.cxx
+                         ItemRes.cxx Items.cxx Mission.cxx Npc.cxx NpcArmor.cxx NpcGroupSpawn.cxx Outposts.cxx
+                         Parser.cxx Recycles.cxx Respawn.cxx Scripts.cxx Shots.cxx Skills.cxx SubSkills.cxx Trader.cxx
+                         VehicleSits.cxx Vehicles.cxx Weapons.cxx Weather.cxx WorldDatParser.cxx WorldFile.cxx
+                         WorldModels.cxx Worlds.cxx)
diff --git a/TinNS/Source/GameServer/Definitions/CharacterActions.cxx b/TinNS/Source/GameServer/Definitions/CharacterActions.cxx
new file mode 100644 (file)
index 0000000..ab62e2b
--- /dev/null
@@ -0,0 +1,47 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefCharAction::PDefCharAction()
+{
+}
+
+bool PDefCharAction::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  int maxFields = 2;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+      {
+        mNumOfSsq = atoi( i->c_str() );
+        if ( mNumOfSsq > 8 )
+          mNumOfSsq = 8;
+        maxFields = 2 + 2 * mNumOfSsq;
+        break;
+      }
+      default :
+        if (( Idx >= 3 ) && ( Idx <= maxFields ) )
+        {
+          if ( Idx & 1 )
+          {
+            mSsqId[( Idx - 3 ) / 2] = atoi( i->c_str() );
+          }
+          else
+          {
+            mModFactor[( Idx - 3 ) / 2] = atof( i->c_str() );
+          }
+        }
+        break;
+    }
+
+    if ( Idx >= maxFields )
+      break;
+  }
+
+  return (( Idx == maxFields ) );
+}
diff --git a/TinNS/Source/GameServer/Definitions/CharacterActions.hxx b/TinNS/Source/GameServer/Definitions/CharacterActions.hxx
new file mode 100644 (file)
index 0000000..6d2938b
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefCharAction : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mNumOfSsq;
+    int32_t mSsqId[8];
+    float mModFactor[8];
+
+public:
+    PDefCharAction();
+    //~PDefCharAction();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetNumOfSsq() const { return mNumOfSsq; }
+    inline int32_t GetSsqId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mSsqId[nIdx] : 0) ; }
+    inline int32_t GetModFactor(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mModFactor[nIdx] : 0) ; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/CharacterKinds.cxx b/TinNS/Source/GameServer/Definitions/CharacterKinds.cxx
new file mode 100644 (file)
index 0000000..4ee96b9
--- /dev/null
@@ -0,0 +1,152 @@
+#include <cstring>\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+\r
+// charkinds are character templates used for player char creation\r
+\r
+PDefCharKind::PDefCharKind()\r
+{\r
+    mSkillInfo = 0;\r
+    memset(mInventory, 0, sizeof(mInventory));\r
+}\r
+\r
+PDefCharKind::~PDefCharKind()\r
+{\r
+    delete [] mSkillInfo;\r
+    for(PSkillPtsMap::const_iterator i=mSkillPts.begin(); i!=mSkillPts.end(); i++)\r
+        delete i->second;\r
+    for(PSubSkillPtsMap::const_iterator i=mSubSkillPts.begin(); i!=mSubSkillPts.end(); i++)\r
+        delete i->second;\r
+    for(PStartLevelMap::const_iterator i=mStartLevels.begin(); i!=mStartLevels.end(); i++)\r
+        delete i->second;\r
+}\r
+\r
+bool PDefCharKind::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int NumSkills = GameDefs->Skills()->GetNumDefs();\r
+    //int NumSubSkills = GameDefs->SubSkills()->GetNumDefs();\r
+\r
+    int SkillInfoStart = 4;\r
+    int TrainPtsStart = SkillInfoStart+NumSkills*3;\r
+    int LevelsStart = TrainPtsStart + 32*2;\r
+    int MoneyStart = LevelsStart + 16*2;\r
+    int InventoryStart = MoneyStart+1;\r
+\r
+    mSkillInfo = new PSkillInfo[NumSkills];\r
+\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0 :    // setentry\r
+                continue;\r
+\r
+            case 1 :\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+            case 2 :\r
+                mName = *i; break;\r
+\r
+            case 3 :\r
+                mType = atoi(i->c_str()); break;\r
+\r
+        }\r
+\r
+        if((Idx >= SkillInfoStart) && (Idx < TrainPtsStart)) // skill info\r
+        {\r
+            int SkillIdx = (Idx-SkillInfoStart)/3;\r
+            int Value = atoi(i->c_str());\r
+\r
+            // start, max, grow per skill\r
+            switch((Idx-SkillInfoStart)%3)\r
+            {\r
+                case 0 : mSkillInfo[SkillIdx].mStart = Value; break;\r
+                case 1 : mSkillInfo[SkillIdx].mMax = Value; break;\r
+                case 2 : mSkillInfo[SkillIdx].mGrow = Value; break;\r
+            }\r
+        } else\r
+        // 32 skill/subskill train pts\r
+        if((Idx >= TrainPtsStart) && (Idx < LevelsStart))\r
+        {\r
+            static int SkillIndex = 0;\r
+            int Index = Idx-TrainPtsStart;\r
+            if((Index&1)==0)\r
+            {\r
+                SkillIndex = atoi(i->c_str());\r
+            } else\r
+            {\r
+                if(SkillIndex >= 1000)  // skill\r
+                {\r
+                    const PDefSkill *Skill = GameDefs->Skills()->GetDef(SkillIndex-1000);\r
+                    if(Skill)\r
+                    {\r
+                        int Index = Skill->GetIndex()-1;\r
+                        PSkillPtsInfo *CurrentSkillPts = new PSkillPtsInfo();\r
+                        CurrentSkillPts->mSkill = Index;\r
+                        CurrentSkillPts->mPoints = atoi(i->c_str());\r
+                        mSkillPts.insert(std::make_pair(Index, CurrentSkillPts));\r
+                    } else\r
+                    {\r
+                        if(SkillIndex-1000 != 0)\r
+                            Console->Print("Charkind def: invalid skill index %i", SkillIndex-1000);\r
+                    }\r
+                } else  // subskill\r
+                {\r
+                    const PDefSubSkill *SubSkill = GameDefs->SubSkills()->GetDef(SkillIndex);\r
+                    if(SubSkill)\r
+                    {\r
+                        int Index = SubSkill->GetIndex()-1;\r
+                        PSubSkillPtsInfo *CurrentSubSkillPts = new PSubSkillPtsInfo();\r
+                        CurrentSubSkillPts->mSubSkill = Index;\r
+                        CurrentSubSkillPts->mPoints = atoi(i->c_str());\r
+                        mSubSkillPts.insert(std::make_pair(Index, CurrentSubSkillPts));\r
+                    } else\r
+                    {\r
+                        if(SkillIndex != 0)\r
+                            Console->Print("Charkind def: invalid subskill index %i", SkillIndex);\r
+                    }\r
+                }\r
+            }\r
+        } else\r
+        // 16 subskill start levels\r
+        if((Idx >= LevelsStart) && (Idx < MoneyStart))\r
+        {\r
+            static int LevelIndex = 0;\r
+            int Index = Idx-NumSkills*3+4+(32*2);\r
+            if((Index&1)==0)\r
+            {\r
+                LevelIndex = atoi(i->c_str());\r
+            } else\r
+            {\r
+                if(LevelIndex > 0)\r
+                {\r
+                    const PDefSubSkill *SubSkill = GameDefs->SubSkills()->GetDef(LevelIndex);\r
+                    if(SubSkill)\r
+                    {\r
+                        PStartLevelInfo *Level = new PStartLevelInfo();\r
+                        Level->mSubSkill = SubSkill->GetIndex();\r
+                        Level->mLevel = atoi(i->c_str());\r
+                        mStartLevels.insert(std::make_pair(Level->mSubSkill, Level));\r
+                    } else\r
+                    {\r
+                        Console->Print("Charkind def: invalid subskill index %i", LevelIndex);\r
+                    }\r
+                }\r
+            }\r
+        } else\r
+        // money\r
+        if((Idx >= MoneyStart) && (Idx < InventoryStart))\r
+        {\r
+            mMoney = atoi(i->c_str());\r
+        } else\r
+        // inventory\r
+        if((Idx >= InventoryStart) && (Idx < InventoryStart+8))\r
+        {\r
+            mInventory[Idx-InventoryStart] = atoi(i->c_str());\r
+        }\r
+    }\r
+    \r
+    return true;\r
+}\r
+\r
diff --git a/TinNS/Source/GameServer/Definitions/CharacterKinds.hxx b/TinNS/Source/GameServer/Definitions/CharacterKinds.hxx
new file mode 100644 (file)
index 0000000..4f86772
--- /dev/null
@@ -0,0 +1,82 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+struct PSkillInfo {\r
+    int32_t mStart;\r
+    int32_t mMax;\r
+    int32_t mGrow;\r
+\r
+    inline PSkillInfo()\r
+    {\r
+        mStart = mMax = mGrow = 0;\r
+    }\r
+};\r
+\r
+struct PSkillPtsInfo {\r
+    int32_t mSkill;\r
+    int32_t mPoints;\r
+\r
+    inline PSkillPtsInfo()\r
+    {\r
+        mSkill = mPoints = 0;\r
+    }\r
+};\r
+\r
+struct PSubSkillPtsInfo {\r
+    int32_t mSubSkill;\r
+    int32_t mPoints;\r
+\r
+    inline PSubSkillPtsInfo()\r
+    {\r
+        mSubSkill = mPoints = 0;\r
+    }\r
+};\r
+\r
+struct PStartLevelInfo {\r
+    int32_t mSubSkill;\r
+    int32_t mLevel;\r
+\r
+    inline PStartLevelInfo()\r
+    {\r
+        mSubSkill = mLevel = 0;\r
+    }\r
+\r
+};\r
+\r
+class PDefCharKind : public PDef {\r
+private:\r
+    typedef std::map<int32_t, PSkillPtsInfo*> PSkillPtsMap;\r
+    typedef std::map<int32_t, PSubSkillPtsInfo*> PSubSkillPtsMap;\r
+    typedef std::map<int32_t, PStartLevelInfo*> PStartLevelMap;\r
+\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    int32_t mType;\r
+\r
+    // TODO: shouldnt this be a map?\r
+    PSkillInfo *mSkillInfo;\r
+\r
+    PSkillPtsMap mSkillPts;\r
+    PSubSkillPtsMap mSubSkillPts;\r
+    PStartLevelMap mStartLevels;\r
+    int32_t mMoney;\r
+    uint32_t mInventory[8];\r
+\r
+public:\r
+    PDefCharKind();\r
+    ~PDefCharKind();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline int32_t GetType() const { return mType; }\r
+    inline const PSkillInfo &GetSkillInfo(int32_t Skill) const { return mSkillInfo[Skill-1]; }\r
+\r
+    inline int32_t GetStartMoney() const { return mMoney; }\r
+    inline uint32_t GetStartInventory(uint8_t Index) const { return ((Index < 7) ?  mInventory[Index] : 0); }\r
+    // TODO: mission get() functions\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/Characters.cxx b/TinNS/Source/GameServer/Definitions/Characters.cxx
new file mode 100644 (file)
index 0000000..95b2ddf
--- /dev/null
@@ -0,0 +1,55 @@
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+// characters.def contains all ingame characters (player types, npc's, monsters)\r
+\r
+PDefCharacter::PDefCharacter()\r
+{\r
+    mIndex = -1;\r
+    mName = "unknown";\r
+    mModel = -1;\r
+}\r
+\r
+bool PDefCharacter::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0 :    // setentry\r
+                continue;\r
+\r
+            case 1 :\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+            case 2 :\r
+                mName = *i; break;\r
+\r
+            case 3 :\r
+                mModel = atoi(i->c_str()); break;\r
+\r
+            case 4 : // 0\r
+                continue;\r
+\r
+            case 5 :\r
+                mHead = atoi(i->c_str()); break;\r
+\r
+            case 6 :\r
+                mTorso = atoi(i->c_str()); break;\r
+\r
+            case 7 :\r
+                mLegs = atoi(i->c_str()); break;\r
+\r
+            case 8 :\r
+                mColor = atoi(i->c_str()); break;\r
+\r
+            case 9 :\r
+                mBrightness = atoi(i->c_str()); break;\r
+        }\r
+\r
+        if(Idx==9)\r
+            return true;\r
+    }\r
+\r
+    return false;\r
+}\r
diff --git a/TinNS/Source/GameServer/Definitions/Characters.hxx b/TinNS/Source/GameServer/Definitions/Characters.hxx
new file mode 100644 (file)
index 0000000..3abc2c0
--- /dev/null
@@ -0,0 +1,31 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefCharacter : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    int32_t mModel;\r
+    int32_t mHead;\r
+    int32_t mTorso;\r
+    int32_t mLegs;\r
+    int32_t mColor;\r
+    int32_t mBrightness;\r
+\r
+public:\r
+    PDefCharacter();\r
+    //~PDefCharacter();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline int32_t GetModel() const { return mModel; }\r
+    inline int32_t GetHead() const { return mHead; }\r
+    inline int32_t GetTorso() const { return mTorso; }\r
+    inline int32_t GetLegs() const { return mLegs; }\r
+    inline int32_t GetColor() const { return mColor; }\r
+    inline int32_t GetBrightness() const { return mBrightness; }\r
+};\r
similarity index 62%
rename from server/src/game/def/def_damage.cpp
rename to TinNS/Source/GameServer/Definitions/Damage.cxx
index e8e852e..9ddc793 100644 (file)
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_damage.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefDamage::PDefDamage()
 {
diff --git a/TinNS/Source/GameServer/Definitions/Damage.hxx b/TinNS/Source/GameServer/Definitions/Damage.hxx
new file mode 100644 (file)
index 0000000..fd43914
--- /dev/null
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefDamage : public PDef {
+private:
+    //int32_t mIndex;
+    //int32_t mSoundIndex; // no use
+    int32_t mDamageNum;
+    int32_t mDamageValue[4];
+    int32_t mDamageEffect[4];
+    int32_t mDamageType[4];
+    /*  int32_t mEffectNum; // Are effects needed ? (server or client triggered ?)
+        int32_t mEffectId[4]; // ?
+        int32_t mEffectTarget[4]; // float ?
+        int32_t mEffectValue[4]; // float ?
+        int32_t mEffectamorId[4]; // ????
+    */
+public:
+    PDefDamage();
+    //~PDefDamage();
+
+    bool LoadFromDef ( PTokenList *Tokens );
+
+    inline int32_t GetDamageNum() const { return mDamageNum; }
+    inline int32_t GetDamageValue ( int32_t nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < mDamageNum ) ) ? mDamageValue[nIdx] : 0 ) ; }
+    inline int32_t GetDamageEffect ( int32_t nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < mDamageNum ) ) ? mDamageEffect[nIdx] : 0 ) ; }
+    inline int32_t GetDamageType ( int32_t nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < mDamageNum ) ) ? mDamageType[nIdx] : 0 ) ; }
+    /*  inline int32_t GetEffectNum() const { return mEffectNum; }
+        inline int32_t GetEffectId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectId[nIdx] : 0) ; }
+        inline int32_t GetEffectTarget(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectTarget[nIdx] : 0) ; }
+        inline int32_t GetEffectValue(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectValue[nIdx] : 0) ; }
+        inline int32_t GetEffectamorId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectamorId[nIdx] : 0) ; }
+        */
+};
diff --git a/TinNS/Source/GameServer/Definitions/Definition.cxx b/TinNS/Source/GameServer/Definitions/Definition.cxx
new file mode 100644 (file)
index 0000000..6eb9c6d
--- /dev/null
@@ -0,0 +1,27 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDef::PDef()
+: mIndex(0)
+{
+}
+
+PDef::~PDef()
+{
+}
+
+bool PDef::LoadFromDef(PTokenList *Tokens)
+{
+    Tokens = Tokens;
+
+    return false;
+}
+
+int32_t PDef::GetIndex() const
+{
+    return mIndex;
+}
+
+const std::string &PDef::GetName() const
+{
+    return "";
+}
diff --git a/TinNS/Source/GameServer/Definitions/Definition.hxx b/TinNS/Source/GameServer/Definitions/Definition.hxx
new file mode 100644 (file)
index 0000000..c26e01d
--- /dev/null
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <cstdint>
+#include <list>
+#include <string>
+
+typedef std::list<std::string> PTokenList;
+
+/* mother class for PDef* classes */
+/* provides default members required for def file loading */
+class PDef {
+protected:
+    int32_t mIndex;
+
+public:
+    PDef();
+    virtual ~PDef();
+
+    bool LoadFromDef(PTokenList *Tokens);
+
+    int32_t GetIndex() const;
+    const std::string &GetName() const;
+};
similarity index 54%
rename from server/src/game/def/def_drugs.cpp
rename to TinNS/Source/GameServer/Definitions/Drugs.cxx
index 4326874..f21bbd0 100644 (file)
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_drugs.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefDrug::PDefDrug()
 {
diff --git a/TinNS/Source/GameServer/Definitions/Drugs.hxx b/TinNS/Source/GameServer/Definitions/Drugs.hxx
new file mode 100644 (file)
index 0000000..76f8c4a
--- /dev/null
@@ -0,0 +1,44 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefDrug : public PDef {
+protected:
+    //int32_t mIndex;
+    int32_t mType;
+    //int32_t mUseSound;
+    int32_t mDuration;
+    int32_t mChangeNum;
+    int32_t mChangeType[8]; // 1: bonus, 2:malus, ... other ?
+    float mChangeScale[8];
+    int32_t mChangeTarget[8];
+
+public:
+    PDefDrug();
+    //~PDefDrug();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetType() const { return mType; }
+    inline int32_t GetDuration() const { return mDuration; }
+    inline int32_t GetChangeNum() const { return mChangeNum; }
+    inline int32_t GetChangeType( int32_t nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < mChangeNum ) ) ? mChangeType[nIdx] : 0 ) ; }
+    inline float GetChangeScale( int32_t nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < mChangeNum ) ) ? mChangeScale[nIdx] : 0 ) ; }
+    inline int32_t GetChangeTarget( int32_t nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < mChangeNum ) ) ? mChangeTarget[nIdx] : 0 ) ; }
+};
+
+//type of drug:
+//1 normal Drug
+//2 Skill ver�ndernder PSI Spruch K�mpfer
+//3 Skill ver�ndernder PSI Spruch Supporter
+//4 Skill ver�ndernder PSI Spruch Resists
+//6+A274  PSI entferne Sprcuh
+
+// drugeffects  < 1000  Subskill
+//  <2000 Skill
+//  <2100 Energy  (permanent)
+//  <2200 Maxenergy
+//  <2300 Armor
+//  <2400 Subskills
+//  3000-3500 Actionmods
diff --git a/TinNS/Source/GameServer/Definitions/Factions.cxx b/TinNS/Source/GameServer/Definitions/Factions.cxx
new file mode 100644 (file)
index 0000000..2e5ab9a
--- /dev/null
@@ -0,0 +1,56 @@
+#include <cstring>\r
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+PDefFaction::PDefFaction()\r
+{\r
+    memset(mRelations, 0, sizeof(mRelations)); // ... array members supposed to by auto-initialized by C++\r
+}\r
+\r
+bool PDefFaction::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        // setfracc 19  "Monster"   -1024   0   0   -1024   -1024   -1024   -1\r
+        switch(Idx)\r
+        {\r
+            case 0 : // setfrac\r
+                continue;\r
+\r
+            case 1 :\r
+                mIndex = atol(i->c_str()); break;\r
+\r
+            case 2 :\r
+                mName = *i;\r
+                CleanUpString(&mName);\r
+                break;\r
+\r
+            case 3 :\r
+                mStartValue = atol(i->c_str()); break;\r
+\r
+            case 4:\r
+                mAffected = atol(i->c_str())!=0; break;\r
+\r
+            case 5:\r
+                mSL = atol(i->c_str()); break;\r
+\r
+            default :\r
+            {\r
+                if(Idx-6 < NUMFACTIONS)\r
+                    mRelations[Idx-6] = atol(i->c_str()); break;\r
+            }\r
+        }\r
+    }\r
+\r
+    return true;\r
+}\r
+\r
+int PDefFaction::GetRelation(int Faction) const\r
+{\r
+    // faction 0 has no relations\r
+    if(Faction <= 0 || Faction > NUMFACTIONS)\r
+        return 0;\r
+\r
+    return mRelations[Faction-1];\r
+}\r
+\r
diff --git a/TinNS/Source/GameServer/Definitions/Factions.hxx b/TinNS/Source/GameServer/Definitions/Factions.hxx
new file mode 100644 (file)
index 0000000..22f35a4
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+static const int32_t NUMFACTIONS = 20;  // for faction relations only\r
+\r
+class PDefFaction : public PDef {\r
+private :\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    int32_t mStartValue;\r
+    bool mAffected;\r
+    int32_t mSL;\r
+    int32_t mRelations[NUMFACTIONS];\r
+public :\r
+    PDefFaction();\r
+    //~PDefFaction();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline int32_t GetStartValue() const { return mStartValue; }\r
+    inline bool GetAffected() const { return mAffected; }\r
+    inline int32_t GetSL() const { return mSL; };\r
+    int32_t GetRelation(int32_t Faction) const;\r
+};\r
similarity index 63%
rename from server/src/game/def/gamedefs.cpp
rename to TinNS/Source/GameServer/Definitions/GameDefinitions.cxx
index bd2292c..b056c3b 100644 (file)
@@ -1,51 +1,6 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
+#include "GameServer/Definitions/Includes.hxx"\r
 \r
 /*\r
-\r
- gamedefs - this part loads "all" the definitions found in defs/\r
-\r
- MODIFIED: 30 August 2005 Akiko\r
- REASON: - added this fency header\r
-  - changed the path of every def file to fellow the TinNS way (loading by the config.xml)\r
-  - reformated code for easier reading\r
- MODIFIED: 31 August 2005 Akiko\r
- REASON: - updated paths for the def files\r
- MODIFIED: 25 Dec 2005 Namikon\r
- REASON: - Added GPL\r
- MODIFIED: 06 Jan 2006\r
- REASON: - Added GetCharKindDef(), was missing somehow\r
- MODIFIED: 21 Sep 2005 Hammag\r
- REASON: - Added PDefWorldModel related stuff\r
-         - Added PDefAppPlace related stuff\r
-         - completed PGameDefs destructor\r
-  MODIFIED: 22 Sep 2005 Hammag\r
- REASON: - Added PDefAppartement related stuff\r
-         - Added PDefRespawn related stuff\r
-  MODIFIED: 28 Sep 2005 Hammag\r
- REASON: - Added PDefWorldFile related stuff\r
-\r
-  MODIFIED: 07 Oct 2005 Hammag\r
- REASON: - Added (inline) methods to get const iterators on Appartment and WorldFile maps\r
-\r
  --------------------------------------------------------------------\r
  WARNING:\r
  When adding new .def support, don't forget to add required stuff in PGameDefs::Init()\r
          appending pak_ to its name,\r
      - else tries to load the packed file from the .pak archive which name is\r
          derived from the last part of the path.\r
-\r
 */\r
 \r
-#include "main.h"\r
-\r
 PGameDefs::PGameDefs() {}\r
 PGameDefs::~PGameDefs() {}\r
 \r
similarity index 79%
rename from server/src/game/include/gamedefs.h
rename to TinNS/Source/GameServer/Definitions/GameDefinitions.hxx
index 32f221e..d1de8d8 100644 (file)
@@ -1,49 +1,31 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
- gamedefs.h\r
-\r
- MODIFIED: 25 Dec 2005 Namikon\r
- REASON: - Added GPL\r
- MODIFIED: 21 Sep 2005 Hammag\r
- REASON: - Added PDefWorldModel related stuff\r
-         - Added PDefAppPlace related stuff\r
-  MODIFIED: 22 Sep 2005 Hammag\r
- REASON: - Added PDefAppartement related stuff\r
-         - Added PDefRespawn related stuff\r
-  MODIFIED: 28 Sep 2005 Hammag\r
- REASON: - Added PDefWorldFile related stuff\r
-\r
-  MODIFIED: 07 Oct 2005 Hammag\r
- REASON: - Added methods to get const iterators on Appartment and WorldFile maps\r
-\r
-*/\r
-\r
-#ifndef GAMEDEFS_H\r
-#define GAMEDEFS_H\r
-\r
-#include "defs.h"\r
+#pragma once\r
+\r
+#include <cstdint>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+#include "GameServer/Definitions/Implants.hxx"\r
+#include "GameServer/Definitions/ItemContainer.hxx"\r
+#include "GameServer/Definitions/ItemMod.hxx"\r
+#include "GameServer/Definitions/ItemRes.hxx"\r
+#include "GameServer/Definitions/Items.hxx"\r
+#include "GameServer/Definitions/Mission.hxx"\r
+#include "GameServer/Definitions/NpcArmor.hxx"\r
+#include "GameServer/Definitions/NpcGroupSpawn.hxx"\r
+#include "GameServer/Definitions/Npc.hxx"\r
+#include "GameServer/Definitions/Outposts.hxx"\r
+#include "GameServer/Definitions/Recycles.hxx"\r
+#include "GameServer/Definitions/Respawn.hxx"\r
+#include "GameServer/Definitions/Scripts.hxx"\r
+#include "GameServer/Definitions/Shots.hxx"\r
+#include "GameServer/Definitions/Skills.hxx"\r
+#include "GameServer/Definitions/SubSkills.hxx"\r
+#include "GameServer/Definitions/Trader.hxx"\r
+#include "GameServer/Definitions/Vehicles.hxx"\r
+#include "GameServer/Definitions/VehicleSits.hxx"\r
+#include "GameServer/Definitions/Weapons.hxx"\r
+#include "GameServer/Definitions/Weather.hxx"\r
+#include "GameServer/Definitions/WorldFile.hxx"\r
+#include "GameServer/Definitions/WorldModels.hxx"\r
+#include "GameServer/Definitions/Worlds.hxx"\r
 \r
 typedef PDefMap<PDefActionMod> PDefActionModsMap;\r
 typedef PDefMap<PDefAmmo> PDefAmmosMap;\r
@@ -86,9 +68,8 @@ class PDefScriptsMap;
 // ___Add new entries here in alpÄ¥abetical order___\r
 \r
 \r
-class PGameDefs\r
-{\r
-  private :\r
+class PGameDefs {\r
+private:\r
     PDefActionModsMap mActionModsDefs;\r
     PDefAmmosMap mAmmosDefs;\r
     PDefAppartementsMap mAppartementsDefs;\r
@@ -127,7 +108,7 @@ class PGameDefs
     PDefScriptsMap mScriptDefs;\r
     // ___Add new entries here___\r
 \r
-  public :\r
+public:\r
     PGameDefs();\r
     ~PGameDefs();\r
 \r
@@ -170,7 +151,4 @@ class PGameDefs
     inline const PDefWorldModelsMap* WorldModels() const { return &mWorldModelsDefs; }\r
     inline const PDefScriptsMap* Scripts() const { return &mScriptDefs; }\r
     // ___Add new entries here___\r
-\r
 };\r
-\r
-#endif\r
diff --git a/TinNS/Source/GameServer/Definitions/Hack.cxx b/TinNS/Source/GameServer/Definitions/Hack.cxx
new file mode 100644 (file)
index 0000000..202b60e
--- /dev/null
@@ -0,0 +1,27 @@
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+PDefHack::PDefHack()\r
+{\r
+}\r
+\r
+bool PDefHack::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0: // setentry\r
+                continue ;\r
+\r
+\r
+            case 1: // index\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+\r
+        }\r
+    }\r
+\r
+    return true;\r
+}\r
+\r
diff --git a/TinNS/Source/GameServer/Definitions/Hack.hxx b/TinNS/Source/GameServer/Definitions/Hack.hxx
new file mode 100644 (file)
index 0000000..1a6b90a
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once\r
+\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefHack : public PDef {\r
+private:\r
+    //int mIndex;\r
+    //qui aggiungere valori\r
+public:\r
+    PDefHack();\r
+    //~PDefHack();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    //qui aggiungere funzioni per i gets\r
+};\r
similarity index 52%
rename from server/src/game/def/def_implants.cpp
rename to TinNS/Source/GameServer/Definitions/Implants.cxx
index 6c65167..1ec60b0 100644 (file)
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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_implants.cpp
-
-       CREATED: 29 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_implants.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 bool PDefImplant::LoadFromDef( PTokenList *Tokens )
 {
diff --git a/TinNS/Source/GameServer/Definitions/Implants.hxx b/TinNS/Source/GameServer/Definitions/Implants.hxx
new file mode 100644 (file)
index 0000000..4f4ac83
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "GameServer/Definitions/Definition.hxx"
+
+// Implants Id 1 to 5 correspond to OP Zone bonus: mine, factory, lab, fort and comlink respectively
+
+class PDefImplant : public PDefDrug {
+public:
+    bool LoadFromDef( PTokenList *Tokens );
+};
diff --git a/TinNS/Source/GameServer/Definitions/Includes.hxx b/TinNS/Source/GameServer/Definitions/Includes.hxx
new file mode 100644 (file)
index 0000000..06e0a0a
--- /dev/null
@@ -0,0 +1,44 @@
+#pragma once
+
+#include "GameServer/Definitions/ActionMod.hxx"
+#include "GameServer/Definitions/Ammo.hxx"
+#include "GameServer/Definitions/AppartementPlaces.hxx"
+#include "GameServer/Definitions/Appartements.hxx"
+#include "GameServer/Definitions/BluePrintPieces.hxx"
+#include "GameServer/Definitions/CharacterActions.hxx"
+#include "GameServer/Definitions/CharacterKinds.hxx"
+#include "GameServer/Definitions/Characters.hxx"
+#include "GameServer/Definitions/Damage.hxx"
+#include "GameServer/Definitions/Definition.hxx"
+#include "GameServer/Definitions/Drugs.hxx"
+#include "GameServer/Definitions/Factions.hxx"
+#include "GameServer/Definitions/GameDefinitions.hxx"
+#include "GameServer/Definitions/Hack.hxx"
+#include "GameServer/Definitions/Implants.hxx"
+#include "GameServer/Definitions/ItemContainer.hxx"
+#include "GameServer/Definitions/ItemMod.hxx"
+#include "GameServer/Definitions/ItemRes.hxx"
+#include "GameServer/Definitions/Items.hxx"
+#include "GameServer/Definitions/Map.hxx"
+#include "GameServer/Definitions/Mission.hxx"
+#include "GameServer/Definitions/Npc.hxx"
+#include "GameServer/Definitions/NpcArmor.hxx"
+#include "GameServer/Definitions/NpcGroupSpawn.hxx"
+#include "GameServer/Definitions/Outposts.hxx"
+#include "GameServer/Definitions/Parser.hxx"
+#include "GameServer/Definitions/Recycles.hxx"
+#include "GameServer/Definitions/Respawn.hxx"
+#include "GameServer/Definitions/Scripts.hxx"
+#include "GameServer/Definitions/Shots.hxx"
+#include "GameServer/Definitions/Skills.hxx"
+#include "GameServer/Definitions/SubSkills.hxx"
+#include "GameServer/Definitions/Trader.hxx"
+#include "GameServer/Definitions/VehicleSits.hxx"
+#include "GameServer/Definitions/Vehicles.hxx"
+#include "GameServer/Definitions/Weapons.hxx"
+#include "GameServer/Definitions/Weather.hxx"
+#include "GameServer/Definitions/WorldDatParser.hxx"
+#include "GameServer/Definitions/WorldDatStruct.hxx"
+#include "GameServer/Definitions/WorldFile.hxx"
+#include "GameServer/Definitions/WorldModels.hxx"
+#include "GameServer/Definitions/Worlds.hxx"
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_itemcontainer.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefItemContainer::PDefItemContainer()
 {
diff --git a/TinNS/Source/GameServer/Definitions/ItemContainer.hxx b/TinNS/Source/GameServer/Definitions/ItemContainer.hxx
new file mode 100644 (file)
index 0000000..5e8d395
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefItemContainer : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mNumItemsAtOnce;
+    int32_t mRespawnTime;
+    int32_t mNumItems;
+    int32_t mItemId[6]; // <0: Group, >0: Item
+    float mQuality[6]; // usually <1, <=> % ?
+    int32_t mChance[6]; // a weight, not a %
+
+    int32_t mCumulatedChance[6]; // Computed data in order to select random item entry
+
+    void BuildCumulatedChance();
+
+public:
+    PDefItemContainer();
+    //~PDefItemContainer();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetNumItemsAtOnce() const { return mNumItemsAtOnce; }
+    inline int32_t GetRespawnTime() const { return mRespawnTime; }
+    inline int32_t GetNumItems() const { return mNumItems; }
+    inline int32_t GetItemId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumItems)) ? mItemId[nIdx] : 0) ; }
+    inline float GetQuality(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumItems)) ? mQuality[nIdx] : 0) ; }
+    inline int32_t GetChance(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumItems)) ? mChance[nIdx] : 0) ; }
+    int32_t GetRandomItemIdx() const; // Return Idx based on Entry chance
+};
similarity index 56%
rename from server/src/game/def/def_itemmod.cpp
rename to TinNS/Source/GameServer/Definitions/ItemMod.cxx
index b814d63..5a3a4b7 100644 (file)
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_itemmod.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefItemMod::PDefItemMod()
 {
diff --git a/TinNS/Source/GameServer/Definitions/ItemMod.hxx b/TinNS/Source/GameServer/Definitions/ItemMod.hxx
new file mode 100644 (file)
index 0000000..fc7f870
--- /dev/null
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefItemMod : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mType; // if mType > 0, it refers to a weapon type from weapons.def +1
+    //int32_t mDuration; // "implant base build time" = ???? always 0 anyway...
+    int32_t mChangeNum;
+    int32_t mChangeTarget[4]; // qualifier id   0 - 7   item qualifier id   4=range
+    float mChangeValue[4];
+    float mChangeScale[4];
+    std::string mName;
+    //int32_t mIconId;
+
+public:
+    PDefItemMod();
+    //~PDefItemMod();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline const std::string &GetName() const { return mName; }
+    inline int32_t GetType() const { return mType; }
+    //inline int32_t GetDuration() const { return mDuration; }
+    inline int32_t GetChangeNum() const { return mChangeNum; }
+    inline int32_t GetChangeTarget(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mChangeNum)) ? mChangeTarget[nIdx] : 0) ; }
+    inline float GetChangeValue(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mChangeNum)) ? mChangeValue[nIdx] : 0) ; }
+    inline float GetChangeScale(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mChangeNum)) ? mChangeScale[nIdx] : 0) ; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/ItemRes.cxx b/TinNS/Source/GameServer/Definitions/ItemRes.cxx
new file mode 100644 (file)
index 0000000..933763f
--- /dev/null
@@ -0,0 +1,47 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefItemRestriction::PDefItemRestriction()
+{
+}
+
+bool PDefItemRestriction::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  int maxFields = 2;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+      {
+        mNumRestrictions = atoi( i->c_str() );
+        if( mNumRestrictions > 6 )
+          mNumRestrictions = 6;
+        maxFields = 2 + 2 * mNumRestrictions;
+        break;
+      }
+      default :
+        if( (Idx >= 3) && (Idx <= maxFields) )
+        {
+          if(Idx & 1)
+          {
+            mSsqId[(Idx - 3) / 2] = atoi( i->c_str() );
+          }
+          else
+          {
+            mMinValue[(Idx - 3) / 2] = atoi( i->c_str() );
+          }
+        }
+        break;
+    }
+
+    if ( Idx >= maxFields )
+      break;
+  }
+
+  return ((Idx == maxFields));
+}
diff --git a/TinNS/Source/GameServer/Definitions/ItemRes.hxx b/TinNS/Source/GameServer/Definitions/ItemRes.hxx
new file mode 100644 (file)
index 0000000..1f1d07b
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefItemRestriction : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mNumRestrictions;
+    int32_t mSsqId[6]; // Skill/Subs
+    int32_t mMinValue[6];
+
+public:
+    PDefItemRestriction();
+    //~PDefItemRestriction();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetNumRestrictions() const { return mNumRestrictions; }
+    inline int32_t GetSsqId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumRestrictions)) ? mSsqId[nIdx] : 0) ; }
+    inline float GetMinValue(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumRestrictions)) ? mMinValue[nIdx] : 0) ; }
+};
similarity index 78%
rename from server/src/game/def/def_items.cpp
rename to TinNS/Source/GameServer/Definitions/Items.cxx
index f870547..ab1ab49 100644 (file)
@@ -1,48 +1,7 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
+#include "GameServer/Definitions/Includes.hxx"\r
 \r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_item.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-\r
-        MODIFIED: 10 Jul Hammag\r
-        REASON: - Full Item Def implementation\r
-*/\r
-\r
-#include "main.h"\r
 #define GAMEDEFS_DEFITEMSMAXSEQ 100\r
 \r
-\r
 PDefItems::PDefItems()\r
 {\r
   //mIndex = 0;\r
diff --git a/TinNS/Source/GameServer/Definitions/Items.hxx b/TinNS/Source/GameServer/Definitions/Items.hxx
new file mode 100644 (file)
index 0000000..0bf6903
--- /dev/null
@@ -0,0 +1,77 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefItems : public PDef {\r
+private:\r
+    //int32_t mIndex;//1\r
+    std::string mName;//2\r
+    int32_t mModel; // used for IG display\r
+    int32_t mType;\r
+    int32_t mValue1;\r
+    int32_t mValue2;\r
+    int32_t mValue3;\r
+    // int32_t mBmNum; // used IG for inventory display\r
+    // int32_t mmBmNumIndex; // used IG for inventory display\r
+    int32_t mSizeX;\r
+    int32_t mSizeY;\r
+    // int32_t mSmallbmnum; // used IG for inventory display\r
+    float mWeight;\r
+    int32_t mStackable;\r
+    float mFillWeight;\r
+    int32_t mQualifier;\r
+    int32_t mGfxMods;\r
+    int32_t mItemGroupID;\r
+    int32_t mTextDescID;\r
+    int32_t mBasePrice;\r
+    int32_t mTechlevel;\r
+    int32_t mItemflags;\r
+    // std::mShortname; // used IG for display on inventories Icons\r
+\r
+public:\r
+    PDefItems();\r
+    //~PDefItems();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline int32_t GetModel() const { return mModel; }\r
+    inline int32_t GetType() const { return mType; }\r
+    inline int32_t GetValue1() const { return mValue1; }\r
+    inline int32_t GetValue2() const { return mValue2; }\r
+    inline int32_t GetValue3() const { return mValue3; }\r
+    inline int32_t GetSizeX() const { return mSizeX; }\r
+    inline int32_t GetSizeY() const { return mSizeY; }\r
+    inline float GetWeight() const { return mWeight; }\r
+    inline bool IsStackable() const { return (mStackable == 1); }\r
+    inline float GetFillWeight() const { return mFillWeight; }\r
+    inline int32_t GetQualifier() const { return mQualifier; }\r
+    inline int32_t GetGfxMods() const { return mGfxMods; }\r
+    inline int32_t GetItemGroupID() const { return mItemGroupID; }\r
+    inline int32_t GetTextDescID() const { return mTextDescID; }\r
+    inline int32_t GetBasePrice() const { return mBasePrice; }\r
+    inline int32_t GetTechlevel() const { return mTechlevel; }\r
+    inline int32_t GetItemflags() const { return mItemflags; }\r
+};\r
+\r
+class PDefItemsMap : public PDefMap<PDefItems> {\r
+private:\r
+    std::map<int32_t, PDefItems*>::const_iterator* mMapItCache;\r
+    int32_t mMapItCacheCount;\r
+    std::map<int32_t, std::vector<int32_t> > mItemGroups;\r
+    int32_t mMaxItemGroupId;\r
+    void BuildMapItCache();\r
+    void BuildItemGroups();\r
+\r
+public:\r
+    PDefItemsMap();\r
+    ~PDefItemsMap();\r
+    bool Load(const char* nName, const char* nFilename);\r
+    const PDefItems* GetDefBySeqIndex( int32_t nSeqIndex ) const;\r
+    int32_t GetRandomItemIdFromGroup( int32_t nGroupId ) const;\r
+\r
+    inline std::map<int32_t, PDefItems*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }\r
+    inline std::map<int32_t, PDefItems*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/Map.hxx b/TinNS/Source/GameServer/Definitions/Map.hxx
new file mode 100644 (file)
index 0000000..6939584
--- /dev/null
@@ -0,0 +1,105 @@
+#pragma once
+
+#include <cstdint>
+#include <map>
+#include <string>
+#include "GameServer/Definitions/Parser.hxx"
+#include "Common/Includes.hxx"
+
+template <class T>
+class PDefMap {
+protected:
+    std::string mName;
+    std::map<int32_t, T *> mDefs;
+
+    void Clear()
+    {
+        for (auto it = mDefs.begin(); it != mDefs.end(); ++it)
+            delete it->second;
+
+        mDefs.clear();
+    }
+
+public:
+    PDefMap()
+    {
+    }
+
+    ~PDefMap()
+    {
+        Clear();
+    }
+
+    bool 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;
+      int32_t nDefs = 0, nErrors = 0;
+
+      if ( parser.Parse( nFilename ) )
+      {
+        const PDefTokenList &t = parser.GetTokens();
+
+        for ( PDefTokenList::const_iterator i = t.begin(); i != t.end(); i++ )
+        {
+          T* entry = new T();
+          bool insertfail = false;
+          bool loadfail = ! entry->LoadFromDef( *i );
+
+          if ( !loadfail )
+            insertfail = ! mDefs.insert( std::make_pair( entry->GetIndex(), entry ) ).second;
+
+          if ( loadfail || insertfail )
+          {
+            if ( insertfail )
+              Console->Print( "%s %s def error (duplicate id %i): %s", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ),  mName.c_str(), entry->GetIndex(), entry->GetName().c_str() );
+            else
+              Console->Print( "%s def load error @ %i", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), mName.c_str(), nDefs + nErrors );
+            ++nErrors;
+            delete entry;
+          }
+          else
+            ++nDefs;
+        }
+      }
+      else
+      {
+        Console->Print( "%s Error loading %s defs", Console->ColorText( YELLOW, BLACK, "[WARNING]" ),  mName.c_str() );
+        return (false);
+      }
+
+      if ( nErrors > 0 )
+        Console->Print( "%s Loaded %i %s defs, %i error(s).", Console->ColorText( RED, BLACK, "[WARNING]" ), nDefs,  mName.c_str(), nErrors );
+      else
+        Console->Print( "%s Loaded %i %s defs, %i error(s).", Console->ColorText( GREEN, BLACK, "[Success]" ), nDefs,  mName.c_str(), nErrors );
+
+      return ( true );
+    }
+
+    int32_t GetNumDefs() const
+    {
+        return mDefs.size();
+    }
+
+    const T *GetDef(int32_t Index) const
+    {
+      T* Result;
+
+      auto it = mDefs.find( Index );
+      Result = ( ( it != mDefs.end() ) ? it->second : nullptr );
+
+      return ( Result );
+    }
+};
similarity index 55%
rename from server/src/game/def/def_mission.cpp
rename to TinNS/Source/GameServer/Definitions/Mission.cxx
index 76adb17..1d1aa78 100644 (file)
@@ -1,40 +1,6 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_mission.h"
+#include "GameServer/Definitions/Includes.hxx"
 
+const std::string EmptyString;
 
 PDefMission::PDefMission()
 {
@@ -106,3 +72,78 @@ bool PDefMission::LoadFromDef ( PTokenList *Tokens )
 
   return ( ( Idx >= 38 ) );
 }
+
+int32_t PDefMission::GetSourceId() const
+{
+    return mSourceId;
+}
+
+const std::string &PDefMission::GetStartDialog() const
+{
+    return mStartDialog;
+}
+
+int32_t PDefMission::GetDescTextId() const
+{
+    return mDescTextId;
+}
+
+int32_t PDefMission::GetNpcType(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < 4)) ? mNpcType[nIdx] : 0);
+}
+
+const std::string &PDefMission::GetNpcDialog(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < 4)) ? mNpcDialog[nIdx] : EmptyString);
+}
+
+int32_t PDefMission::GetNpcDialogStartState(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < 4)) ? mNpcDialogStartState[nIdx] : 0);
+}
+
+int32_t PDefMission::GetTargetType(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < 4)) ? mTargetType[nIdx] : 0);
+}
+
+int32_t PDefMission::GetTargetValue(int32_t nIdx, int32_t nValIdx) const
+{
+    return (((nIdx >= 0) && (nIdx < 4) && (nValIdx >= 0) && (nValIdx < 3)) ? mTargetValue[nIdx][nValIdx] : 0);
+}
+
+int32_t PDefMission::GetEndMoney() const
+{
+    return mEndMoney;
+}
+
+int32_t PDefMission::GetEndXp() const
+{
+    return mEndXp;
+}
+
+int32_t PDefMission::GetMaxTime() const
+{
+    return mMaxTime;
+}
+
+int32_t PDefMission::GetDifficulty() const
+{
+    return mDifficulty;
+}
+
+int32_t PDefMission::GetMinFactionValue() const
+{
+    return mMinFactionValue;
+}
+
+int32_t PDefMission::GetPoints() const
+{
+    return mPoints;
+}
+
+int32_t PDefMission::GetFlags() const
+{
+    return mFlags;
+}
diff --git a/TinNS/Source/GameServer/Definitions/Mission.hxx b/TinNS/Source/GameServer/Definitions/Mission.hxx
new file mode 100644 (file)
index 0000000..1b9b364
--- /dev/null
@@ -0,0 +1,65 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefMission : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mSourceId;
+    std::string mStartDialog;
+    int32_t mDescTextId;
+    int32_t mNpcType[4];
+    std::string mNpcDialog[4];
+    int32_t mNpcDialogStartState[4];
+    int32_t mTargetType[4];
+    int32_t mTargetValue[4][3];
+    int32_t mEndMoney;
+    int32_t mEndXp;
+    int32_t mMaxTime;
+    int32_t mDifficulty;
+    int32_t mMinFactionValue;
+    int32_t mPoints;
+    int32_t mFlags;
+
+public:
+    PDefMission();
+    //~PDefMission();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    int32_t GetSourceId() const;
+    const std::string &GetStartDialog() const;
+    int32_t GetDescTextId() const;
+    int32_t GetNpcType(int32_t nIdx) const;
+    const std::string &GetNpcDialog(int32_t nIdx) const;
+    int32_t GetNpcDialogStartState(int32_t nIdx) const;
+    int32_t GetTargetType(int32_t nIdx) const;
+    int32_t GetTargetValue(int32_t nIdx, int32_t nValIdx) const;
+    int32_t GetEndMoney() const ;
+    int32_t GetEndXp() const;
+    int32_t GetMaxTime() const;
+    int32_t GetDifficulty() const;
+    int32_t GetMinFactionValue() const;
+    int32_t GetPoints() const;
+    int32_t GetFlags() const;
+};
+
+/*
+//mission source ID > 0 NPC Type for mission source < 0 Terminal ID for mission source
+
+//mission NPC Type  > 0 NPC Type for mission NPC    < 0 Fraction ID for mission NPC
+//mission target Type   1 - kill NPC    2 - kill NPC type   "3 - dialogtrigger" 4 - kill NPC type range 5-dialogtrigger + counter   "6 - conquer outpost"   7 - conquer outpost + counter   8 - conquer + hold outpost      9-KillPlayer    10 - LootNPC    11 - LootNPCType
+
+//target value 1    ID of related mission NPC   > 0 NPC Type of NPCs to kill    < 0 FractionID of NPCs to kill  "ID of related mission NPC" > 0 NPC Type of NPCs to kill    ID of related mission NPC   "> 0 outpost Type < 0 current outpost factionid"    > 0 outpost type < 0 original outpost faction type  > 0 outpost Type < 0 current outpost factionid      PlayerFaction   ID of related Mission NPC(0-4)  > 0 NPC Type of NPCs to kill    < 0 FractionID of NPCs to kill
+
+//target value 2        Count of NPCs to kill   "ID of DialogTrigger"   Count of NPCs to kill   ID of DialogTrigger     Count of outposts to conquer    time to hold outpost        Kill Cnt    ItemID  NPC Cnt
+
+//target value 3                Range of NPC Type   Trigger Counter - must reach 0 to be successfull                    Max Leveldiff       Item ID
+//missionflags  (bit field)
+// NPC0 No Search   1
+// NPC1 No Search   2
+// NPC2 No Search   4
+// NPC3 No Search   8
+*/
similarity index 57%
rename from server/src/game/def/def_npc.cpp
rename to TinNS/Source/GameServer/Definitions/Npc.cxx
index 36a3c64..76fe682 100644 (file)
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_npc.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefNpc::PDefNpc()
 {
@@ -68,8 +32,8 @@ bool PDefNpc::LoadFromDef( PTokenList *Tokens )
         mWeaponId = atoi( i->c_str() ); break;
       case 10 :
         mDialogScript = *i;
-               CleanUpString(&mDialogScript);
-               break;
+        CleanUpString(&mDialogScript);
+        break;
       case 11 :
         mCombat = atoi( i->c_str() ); break;
       case 12 :
@@ -86,12 +50,12 @@ bool PDefNpc::LoadFromDef( PTokenList *Tokens )
         mSkillScale = atof( i->c_str() ); break;
       case 18 :
         mStandardScript = *i;
-               CleanUpString(&mStandardScript);
-               break;
+        CleanUpString(&mStandardScript);
+        break;
       case 19 :
         mStandardParameter = *i;
-               CleanUpString(&mStandardParameter);
-               break;
+        CleanUpString(&mStandardParameter);
+        break;
       case 20 :
         mMass = atoi( i->c_str() ); break;
       case 24 :
diff --git a/TinNS/Source/GameServer/Definitions/Npc.hxx b/TinNS/Source/GameServer/Definitions/Npc.hxx
new file mode 100644 (file)
index 0000000..a30f5c8
--- /dev/null
@@ -0,0 +1,59 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefNpc : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mModel; // <0: from characters.def, >0: from models.ini, [players] section (?)
+    //int32_t mSoundId; // always 0: not used
+    int32_t mNGT; // ? 1 - 4
+    int32_t mGender; // 0 - 1
+    int32_t mFaction;
+    int32_t mHealth;
+    int32_t mArmorId; // -1 or ref to NpcArmor
+    int32_t mWeaponId;
+    std::string mDialogScript;
+    int32_t mCombat; // ? 20 - 800
+    int32_t mLoot; // 0 or ref to ItemContained
+    int32_t mMovementEnd; // 0 - 4
+    int32_t mFunctionType; // 0 - 4
+    float mModelScaling; // 0 - 0.9
+    int32_t mMoneyLoose; // 0 - 190
+    float mSkillScale; // 0 - 120
+    std::string mStandardScript; 
+    std::string mStandardParameter;
+    int32_t mMass; // 1 - 10000
+    //int32_t mStartHour; // not used
+    //int32_t mEndHour; // not used
+    //std::string mTempScript; // not used
+    int32_t mFlags; // values: 513, 259, 256, 128, 64, 48, 35, 34, 33, 32, 2, 1, 0
+
+public:
+    PDefNpc();
+    //~PDefNpc();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetModel() const { return mModel; }
+    inline int32_t GetNGT() const { return mNGT; }
+    inline int32_t GetGender() const { return mGender; }
+    inline int32_t GetFaction() const { return mFaction; }
+    inline int32_t GetHealth() const { return mHealth; }
+    inline int32_t GetArmorId() const { return mArmorId; }
+    inline int32_t GetWeaponId() const { return mWeaponId; }
+    inline const std::string &GetDialogScript() const { return mDialogScript; }
+    inline int32_t GetCombat() const { return mCombat; }
+    inline int32_t GetLoot() const { return mLoot; }
+    inline int32_t GetMovementEnd() const { return mMovementEnd; }
+    inline int32_t GetFunctionType() const { return mFunctionType; }
+    inline float GetModelScaling() const { return mModelScaling; }
+    inline int32_t GetMoneyLoose() const { return mMoneyLoose; }
+    inline float GetSkillScale() const { return mSkillScale; }
+    inline const std::string &GetStandardScript() const { return mStandardScript; }
+    inline const std::string &GetStandardParameter() const { return mStandardParameter; }
+    inline int32_t GetMass() const { return mMass; }
+    inline int32_t GetFlags() const { return mFlags; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/NpcArmor.cxx b/TinNS/Source/GameServer/Definitions/NpcArmor.cxx
new file mode 100644 (file)
index 0000000..9e22e2f
--- /dev/null
@@ -0,0 +1,28 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefNpcArmor::PDefNpcArmor()
+{
+}
+
+bool PDefNpcArmor::LoadFromDef ( PTokenList *Tokens )
+{
+  int Idx=0;
+  for ( PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;;
+      case 1 :
+        mIndex = atoi ( i->c_str() ); break;
+      default :
+        if ( ( Idx - 2 ) < 7 )
+        {
+          mValue[Idx - 2] = atoi ( i->c_str() );
+        }
+        break;
+    }
+  }
+
+  return ( Idx >= 8 );
+}
diff --git a/TinNS/Source/GameServer/Definitions/NpcArmor.hxx b/TinNS/Source/GameServer/Definitions/NpcArmor.hxx
new file mode 100644 (file)
index 0000000..c19bfc6
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefNpcArmor : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mValue[7]; // force piercing fire energy xray psi poison
+
+public:
+    PDefNpcArmor();
+    //~PDefNpcArmor();
+
+    bool LoadFromDef ( PTokenList *Tokens );
+
+    inline int32_t GetValue ( int32_t nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < 7 ) ) ? mValue[nIdx] : 0 ) ; }
+};
@@ -1,40 +1,6 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_npcgroupspawn.h"
+#include "GameServer/Definitions/Includes.hxx"
 
+const std::string EmptyString;
 
 PDefNpcGroupSpawn::PDefNpcGroupSpawn()
 {
@@ -87,6 +53,41 @@ bool PDefNpcGroupSpawn::LoadFromDef( PTokenList *Tokens )
   return ((Idx >= (3 + 5*mNumNpc)));
 }
 
+int32_t PDefNpcGroupSpawn::GetIgnoreNearPC() const
+{
+    return mIgnoreNearPC;
+}
+
+int32_t PDefNpcGroupSpawn::GetNumNpc() const
+{
+    return mNumNpc;
+}
+
+int32_t PDefNpcGroupSpawn::GetNpcType(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mNpcType[nIdx] : 0);
+}
+
+const std::string &PDefNpcGroupSpawn::GetScript(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mScript[nIdx] : EmptyString);
+}
+
+const std::string &PDefNpcGroupSpawn::GetScriptParameter(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mScriptParameter[nIdx] : EmptyString);
+}
+
+int32_t PDefNpcGroupSpawn::GetFunctionValue(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mFunctionValue[nIdx] : 0);
+}
+
+int32_t PDefNpcGroupSpawn::GetSpawnChance(int32_t nIdx) const
+{
+    return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mSpawnChance[nIdx] : 0);
+}
+
 /*
 class PDefNpcGroupSpawn : public PDef
 {
diff --git a/TinNS/Source/GameServer/Definitions/NpcGroupSpawn.hxx b/TinNS/Source/GameServer/Definitions/NpcGroupSpawn.hxx
new file mode 100644 (file)
index 0000000..6fe52b9
--- /dev/null
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefNpcGroupSpawn : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mIgnoreNearPC;
+    int32_t mNumNpc; // Size of the list. But that should be the size of the group...
+    int32_t mNpcType[8];
+    std::string mScript[8];
+    std::string mScriptParameter[8];
+    int32_t mFunctionValue[8];
+    int32_t mSpawnChance[8];
+
+public:
+    PDefNpcGroupSpawn();
+    //~PDefNpcGroupSpawn();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    int32_t GetIgnoreNearPC() const;
+    int32_t GetNumNpc() const;
+    int32_t GetNpcType(int32_t nIdx) const;
+    const std::string& GetScript(int32_t nIdx) const;
+    const std::string& GetScriptParameter(int32_t nIdx) const;
+    int32_t GetFunctionValue(int32_t nIdx) const;
+    int32_t GetSpawnChance(int32_t nIdx) const;
+};
diff --git a/TinNS/Source/GameServer/Definitions/Outposts.cxx b/TinNS/Source/GameServer/Definitions/Outposts.cxx
new file mode 100644 (file)
index 0000000..8d98312
--- /dev/null
@@ -0,0 +1,45 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefOutpost::PDefOutpost()
+{
+  for ( int i = 0;  i < 8; ++i )
+    mInfluenceZone[i] = 0;
+}
+
+bool PDefOutpost::LoadFromDef ( PTokenList *Tokens )
+{
+  int Idx=0;
+  for ( PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0: // setentry
+        break;
+      case 1: // index
+        mIndex = atoi ( i->c_str() ); break;
+      case 2:
+        mName = *i; break;
+      case 3:
+        mType = atoi ( i->c_str() ); break;
+      case 4:
+        mStandardFaction = atoi ( i->c_str() ); break;
+      case 5:
+        mRevenue = atof ( i->c_str() ); break;
+      case 6:
+        mConquestReward = atof ( i->c_str() ); break;
+      case 7:
+        mMaxSecurity = atoi ( i->c_str() ); break;
+      default :
+        if ( ( Idx - 8 ) < 8 )
+        {
+          mInfluenceZone[Idx - 8] = atoi ( i->c_str() );
+        }
+        break;
+    }
+
+    if ( Idx == 15 )
+      break;
+  }
+
+  return ( Idx >= 7 );
+}
diff --git a/TinNS/Source/GameServer/Definitions/Outposts.hxx b/TinNS/Source/GameServer/Definitions/Outposts.hxx
new file mode 100644 (file)
index 0000000..810e928
--- /dev/null
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefOutpost : public PDef {
+private:
+    //int32_t mIndex;
+    std::string mName;
+    int32_t mType;
+    int32_t mStandardFaction;
+    float mRevenue;
+    float mConquestReward;
+    int32_t mMaxSecurity;
+    int32_t mInfluenceZone[8]; // ex: 12 for zone A12, 112 for B12
+
+public:
+    PDefOutpost();
+    //~PDefOutpost();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline const std::string &GetName() const { return mName; }
+    inline int32_t GetType() const { return mType; }
+    inline int32_t GetStandardFaction() const { return mStandardFaction; }
+    inline float GetRevenue() const { return mRevenue; }
+    inline float GetConquestReward() const { return mConquestReward; }
+    inline int32_t GetMaxSecurity() const { return mMaxSecurity; }
+    inline int32_t GetInfluenceZone(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < 8)) ? mInfluenceZone[nIdx] : 0) ; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/Parser.cxx b/TinNS/Source/GameServer/Definitions/Parser.cxx
new file mode 100644 (file)
index 0000000..a91e76a
--- /dev/null
@@ -0,0 +1,121 @@
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+\r
+PDefParser::PDefParser()\r
+{\r
+}\r
+\r
+PDefParser::~PDefParser()\r
+{\r
+    for(PDefTokenList::iterator i=mTokens.begin(); i!=mTokens.end(); i++)\r
+        delete *i;\r
+}\r
+\r
+bool PDefParser::Parse(const char *File)\r
+{\r
+    PFile *f = Filesystem->Open("", File, Config->GetOption("nc_data_path"));\r
+    enum { NOPE, MAYBE, LINE, BLOCK, MAYBE_END } Comment = NOPE;\r
+\r
+    if(f)\r
+    {\r
+        while(!f->Eof())\r
+        {\r
+            std::string Str = f->ReadString();\r
+            int Len = Str.length();\r
+            if(Len <= 0)\r
+                continue;\r
+\r
+            if(Str.substr(0, 3)!="set")\r
+                continue;\r
+\r
+            //Console->Print("%s", Str.c_str());//NEW was commented , just to be sure of what we are reading\r
+\r
+            PTokenList *List = new PTokenList();\r
+            int Start=0, Tokens=0;\r
+            bool Quote=false;\r
+            for(int i=0; i<Len; i++)\r
+            {\r
+                if(Str[i]=='\r' || Str[i]=='\n' || Str[i]=='|' || Str[i]==';')\r
+                {\r
+                    if(Comment < LINE)\r
+                    {\r
+                        int End=i-1;\r
+                        if(End >= Start)\r
+                        {\r
+                            List->push_back(std::string(Str.substr(Start, (End-Start)+1)));\r
+                            Tokens++;\r
+                            break;\r
+                        }\r
+                        Quote=false;\r
+                    }\r
+                    if(Comment != BLOCK)\r
+                        Comment=NOPE;\r
+                    break;\r
+                }\r
+\r
+                if(!Quote)\r
+                {\r
+                    if(Comment < LINE && (Str[i]=='\t' || Str[i]==',' || Str[i]==' ' || Str[i]==';' || Str[i]=='|' || i==Len-1))\r
+                    {\r
+                        int End=i-1;\r
+                        if(End >= Start)\r
+                        {\r
+                            List->push_back(std::string(Str.substr(Start, (End-Start)+1)));\r
+                            Tokens++;\r
+                        }\r
+                        Start=i+1;\r
+                    }\r
+\r
+                    if(Str[i] <= ' ')\r
+                        continue;\r
+\r
+                    if(Str[i]=='*')\r
+                    {\r
+                        if(Comment==MAYBE)\r
+                            Comment=BLOCK;\r
+                        else\r
+                        if(Comment==BLOCK)\r
+                            Comment=MAYBE_END;\r
+                    } else\r
+                    if(Str[i]=='/')\r
+                    {\r
+                        if(Comment==MAYBE)\r
+                        {\r
+                            // second slash, skip rest of line\r
+                            Comment=LINE;\r
+                            break;\r
+                        } else\r
+                        if(Comment==MAYBE_END)\r
+                        {\r
+                            Comment=NOPE;   // comment block ends\r
+                            Start=i+1;\r
+                        } else\r
+                            if(Comment != BLOCK)\r
+                                Comment=MAYBE;  // first slash\r
+                    } else\r
+                    {\r
+                        if(Comment==MAYBE)\r
+                            Comment=NOPE;   // stand-alone slash\r
+                        else\r
+                        if(Comment==MAYBE_END)\r
+                            Comment=BLOCK;  // comment block did not end\r
+                    }\r
+                }\r
+\r
+                if(Str[i]=='"')\r
+                    Quote ^= true;\r
+            }\r
+\r
+            if(Tokens > 0)\r
+                mTokens.push_back(List);\r
+            else\r
+                delete List;\r
+        }\r
+    } else\r
+    {\r
+        Console->Print("%s PDefParser::Parse: could not open file %s", Console->ColorText( RED, BLACK, "[ERROR]" ), File);\r
+        return false;\r
+    }\r
+\r
+    return true;\r
+}\r
diff --git a/TinNS/Source/GameServer/Definitions/Parser.hxx b/TinNS/Source/GameServer/Definitions/Parser.hxx
new file mode 100644 (file)
index 0000000..c9f3741
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once\r
+\r
+#include <list>\r
+#include <string>\r
+\r
+typedef std::list<std::string> PTokenList;\r
+typedef std::list<PTokenList *> PDefTokenList;\r
+\r
+class PDefParser {\r
+private:\r
+    PDefTokenList mTokens;\r
+\r
+public:\r
+    PDefParser();\r
+    ~PDefParser();\r
+    bool Parse(const char *File);\r
+    inline const PDefTokenList &GetTokens() const { return mTokens; }\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/Recycles.cxx b/TinNS/Source/GameServer/Definitions/Recycles.cxx
new file mode 100644 (file)
index 0000000..27e25ce
--- /dev/null
@@ -0,0 +1,45 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefRecycle::PDefRecycle()
+{
+}
+
+bool PDefRecycle::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  int maxFields = 4;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        //mIndex = atoi ( i->c_str() );
+        break;
+      case 2 : // We use resultitem as index
+        mIndex = mResultItemId = atoi ( i->c_str() ); break;
+      case 3:
+        mBuildTime = atoi ( i->c_str() ); break;
+      case 4 :
+      {
+        mNumParts = atoi ( i->c_str() );
+        if ( mNumParts > 8 )
+          mNumParts = 8;
+        maxFields = 4 + mNumParts;
+        break;
+      }
+      default :
+        if ( ( Idx >= 5 ) && ( Idx <= maxFields ) )
+        {
+              mPartId[ Idx - 5 ] = atoi ( i->c_str() ); break;
+        }
+        break;
+    }
+
+    if ( Idx >= 12 )
+      break;
+  }
+
+  return ( ( Idx >= 5 ) );
+}
diff --git a/TinNS/Source/GameServer/Definitions/Recycles.hxx b/TinNS/Source/GameServer/Definitions/Recycles.hxx
new file mode 100644 (file)
index 0000000..a4ccbea
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefRecycle : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mResultItemId; // We use resultitem as mIndex
+    int32_t mBuildTime;
+    int32_t mNumParts;
+    int32_t mPartId[8];
+
+public:
+    PDefRecycle();
+    //~PDefRecycle();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetResultItemId() const { return mResultItemId; }
+    inline int32_t GetBuildTime() const { return mBuildTime; }
+    inline int32_t GetNumParts() const { return mNumParts; }
+    inline int32_t GetPartId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumParts)) ? mPartId[nIdx] : 0 ) ; }
+};
similarity index 50%
rename from server/src/game/def/def_respawn.cpp
rename to TinNS/Source/GameServer/Definitions/Respawn.cxx
index 9a23f5c..bf992e7 100644 (file)
@@ -1,35 +1,4 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
- def_respawn.cpp\r
-\r
- MODIFIED: 22 Sep 2006 Hammag\r
- REASON: - Creation\r
-\r
-*/\r
-\r
-#include "main.h"\r
+#include "GameServer/Definitions/Includes.hxx"\r
 \r
 PDefRespawn::PDefRespawn()\r
 {\r
@@ -69,13 +38,13 @@ bool PDefRespawn::LoadFromDef( PTokenList *Tokens )
 }\r
 \r
 // class PDefRespawnMap defined in gamedefs.h\r
-int PDefRespawnsMap::GetRespawnEntity( u32 nWorldID, u16 nGROrder ) const\r
+int PDefRespawnsMap::GetRespawnEntity( uint32_t nWorldID, uint16_t nGROrder ) const\r
 {\r
-  u16 tOrder = 0;\r
+  uint16_t tOrder = 0;\r
 \r
   for ( std::map<int, PDefRespawn*>::const_iterator it = mDefs.begin(); it != mDefs.end(); it++ )\r
   {\r
-    if (( u32 )( it->second->GetWorldID() ) == nWorldID )\r
+    if (( uint32_t )( it->second->GetWorldID() ) == nWorldID )\r
     {\r
       ++tOrder;\r
       if (( nWorldID == 1 ) || ( nWorldID == 2 ) ) // hack for zones 1 & 2\r
diff --git a/TinNS/Source/GameServer/Definitions/Respawn.hxx b/TinNS/Source/GameServer/Definitions/Respawn.hxx
new file mode 100644 (file)
index 0000000..52b573d
--- /dev/null
@@ -0,0 +1,32 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefRespawn : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    int32_t mWorldID;\r
+    int32_t mEntityID; // Station ID\r
+    int32_t mHazardLevel;\r
+    std::string mName; // Description\r
+    std::string mFlag; // ???\r
+\r
+public:\r
+    PDefRespawn();\r
+    //~PDefRespawn();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline int32_t GetWorldID() const { return mWorldID; }\r
+    inline int32_t GetEntityID() const { return mEntityID; }\r
+    inline int32_t GetHazardLevel() const { return mHazardLevel; }\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline const std::string &GetFlag() const { return mFlag; }\r
+};\r
+\r
+class PDefRespawnsMap : public PDefMap<PDefRespawn> {\r
+public:\r
+    int32_t GetRespawnEntity( uint32_t nWorldID, uint16_t nGROrder ) const;\r
+};\r
similarity index 74%
rename from server/src/game/def/def_scripts.cpp
rename to TinNS/Source/GameServer/Definitions/Scripts.cxx
index 67b833b..95b2a1e 100644 (file)
@@ -1,33 +1,4 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefScripts::PDefScripts()
 {
diff --git a/TinNS/Source/GameServer/Definitions/Scripts.hxx b/TinNS/Source/GameServer/Definitions/Scripts.hxx
new file mode 100644 (file)
index 0000000..85ff527
--- /dev/null
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <cstdint>
+#include <map>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefScripts : public PDef {
+private:
+    //int32_t 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<PDefScripts> {
+public:
+    //bool Load(const char* nName, const char* nFilename);
+    inline std::map<int32_t, PDefScripts*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }
+    inline std::map<int32_t, PDefScripts*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }
+};
diff --git a/TinNS/Source/GameServer/Definitions/Shots.cxx b/TinNS/Source/GameServer/Definitions/Shots.cxx
new file mode 100644 (file)
index 0000000..a683635
--- /dev/null
@@ -0,0 +1,34 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefShot::PDefShot()
+{ }
+
+bool PDefShot::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+        mDamageId = atoi( i->c_str() ); break;
+      case 3 :
+        mMass = atoi( i->c_str() ); break;
+      case 4 :
+        mRadius = atoi( i->c_str() ); break;
+      case 5 :
+        mSpeed = atof( i->c_str() ); break;
+      default :
+        break;
+    }
+
+    if ( Idx >= 5 )
+      break;
+  }
+
+  return (( Idx >= 5 ) );
+}
diff --git a/TinNS/Source/GameServer/Definitions/Shots.hxx b/TinNS/Source/GameServer/Definitions/Shots.hxx
new file mode 100644 (file)
index 0000000..32240d4
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefShot : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mDamageId;
+    int32_t mMass;
+    int32_t mRadius;
+    float mSpeed;
+    //int32_t mHitSound;
+    //int32_t mCustomType;
+    //std::string mCustomFrameFx;
+    //std::string mCustomHitFx;
+
+public:
+    PDefShot();
+    //~PDefShot();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetDamageId() const { return mDamageId; }
+    inline int32_t GetMass() const { return mMass; }
+    inline int32_t GetRadius() const { return mRadius; }
+    inline int32_t GetSpeed() const { return mSpeed; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/Skills.cxx b/TinNS/Source/GameServer/Definitions/Skills.cxx
new file mode 100644 (file)
index 0000000..14c28c5
--- /dev/null
@@ -0,0 +1,63 @@
+#include <cstring>\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
+\r
+// skill.def includes skill names and skill/subskill mapping\r
+\r
+PDefSkill::PDefSkill()\r
+{\r
+    mSubSkills = 0;\r
+    mNumSubSkills = 0;\r
+}\r
+\r
+PDefSkill::~PDefSkill()\r
+{\r
+    delete [] mSubSkills;\r
+}\r
+\r
+bool PDefSkill::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0 :    // setentry\r
+                continue;\r
+\r
+            case 1 :\r
+                mIndex = atol(i->c_str()); break;\r
+\r
+            case 2 :\r
+                mName = *i; break;\r
+\r
+            case 3 :\r
+                mShortName = *i; break;\r
+\r
+            case 4 :\r
+            {\r
+                mNumSubSkills = atol(i->c_str());\r
+                mSubSkills = new int[mNumSubSkills];\r
+                std::memset(mSubSkills, 0, sizeof(int)*mNumSubSkills);\r
+                break;\r
+            }\r
+        }\r
+\r
+        if(Idx >= 5)\r
+        {\r
+            mSubSkills[Idx-5] = atoi(i->c_str());\r
+            if(!GameDefs->SubSkills()->GetDef(mSubSkills[Idx-5]))\r
+            {\r
+                Console->Print("Skill def error: skill %s refers to nonexistant subskill %i", mShortName.c_str(), mSubSkills[Idx-5]);\r
+                return false;\r
+            }\r
+        }\r
+    }\r
+\r
+    if(Idx-5 != mNumSubSkills)\r
+    {\r
+        Console->Print("Warning: skill %s has incorrect number of subskills", mShortName.c_str());\r
+        Console->Print("  Expected %i, available %i", mNumSubSkills, Idx-5);\r
+    }\r
+    return true;\r
+}\r
diff --git a/TinNS/Source/GameServer/Definitions/Skills.hxx b/TinNS/Source/GameServer/Definitions/Skills.hxx
new file mode 100644 (file)
index 0000000..dcf42f8
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefSkill : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    std::string mShortName;\r
+    int32_t mNumSubSkills;\r
+    int32_t *mSubSkills;\r
+public:\r
+    PDefSkill();\r
+    ~PDefSkill();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline const std::string &GetShortName() const { return mShortName; }\r
+    inline int32_t GetNumSubSkills() const { return mNumSubSkills; }\r
+    inline int32_t GetSubSkill(int32_t Index) const { return mSubSkills[Index]; }\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/SubSkills.cxx b/TinNS/Source/GameServer/Definitions/SubSkills.cxx
new file mode 100644 (file)
index 0000000..ac6512f
--- /dev/null
@@ -0,0 +1,54 @@
+#include <cstring>\r
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+// subskill.def, names and parameters of all subskills\r
+\r
+PDefSubSkill::PDefSubSkill()\r
+{\r
+    mActionModifiers = 0;\r
+    mNumActionModifiers = 0;\r
+}\r
+\r
+PDefSubSkill::~PDefSubSkill()\r
+{\r
+    delete [] mActionModifiers;\r
+}\r
+\r
+bool PDefSubSkill::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0 :    // setentry\r
+                continue;\r
+\r
+            case 1 :\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+            case 2 :\r
+                mName = *i; break;\r
+\r
+            case 3 :\r
+                mShortName = *i; break;\r
+\r
+            case 4 :\r
+                mStrengthenFactor = static_cast<float>(atof(i->c_str())); break;\r
+\r
+            case 5 :\r
+            {\r
+                mNumActionModifiers = atoi(i->c_str());\r
+                mActionModifiers = new int[mNumActionModifiers];\r
+                std::memset(mActionModifiers, 0, sizeof(int)*mNumActionModifiers);\r
+                break;\r
+            }\r
+        }\r
+\r
+        if(Idx>=6)\r
+            mActionModifiers[Idx-6] = atoi(i->c_str());\r
+    }\r
+\r
+    return true;\r
+}\r
+\r
diff --git a/TinNS/Source/GameServer/Definitions/SubSkills.hxx b/TinNS/Source/GameServer/Definitions/SubSkills.hxx
new file mode 100644 (file)
index 0000000..d2d1195
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefSubSkill : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    std::string mShortName;\r
+    float mStrengthenFactor;\r
+    int32_t mNumActionModifiers;\r
+    int32_t *mActionModifiers;\r
+\r
+public:\r
+    PDefSubSkill();\r
+    ~PDefSubSkill();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline const std::string &GetShortName() const { return mShortName; }\r
+    inline float GetStrengthenFactor() const { return mStrengthenFactor; }\r
+    inline int32_t GetNumActionModifiers() const { return mNumActionModifiers; }\r
+    inline int32_t GetActionModifier(int32_t Index) const { return mActionModifiers[Index]; }\r
+};\r
similarity index 59%
rename from server/src/game/def/def_trader.cpp
rename to TinNS/Source/GameServer/Definitions/Trader.cxx
index 7928c99..e61d7b7 100644 (file)
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_trader.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefTrader::PDefTrader()
 {
diff --git a/TinNS/Source/GameServer/Definitions/Trader.hxx b/TinNS/Source/GameServer/Definitions/Trader.hxx
new file mode 100644 (file)
index 0000000..bd462c7
--- /dev/null
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+#define DEF_TRADER_MAXENTRIES 17
+
+class PDefTrader : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mType;
+    float mMaxWealth;
+    float mWealthRespawn;
+    int32_t mQuality;
+    int32_t mItemId[DEF_TRADER_MAXENTRIES]; // <0: item group
+    float mItemPriceScale[DEF_TRADER_MAXENTRIES]; // sometime string like "1/5" ??? <=> 0.2 or Sell:1 / Buy 5 ????
+
+public:
+    PDefTrader();
+    //~PDefTrader();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetType() const { return mType; }
+    inline float GetMaxWealth() const { return mMaxWealth; }
+    inline float GetWealthRespawn() const { return mWealthRespawn; }
+    inline int32_t GetQuality() const { return mQuality; }
+    inline int32_t GetItemId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < DEF_TRADER_MAXENTRIES)) ? mItemId[nIdx] : 0 ) ; }
+    inline float GetItemPriceScale(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < DEF_TRADER_MAXENTRIES)) ? mItemPriceScale[nIdx] : 0 ) ; }
+};
+/* Trader/Buyer mType
+//  1   weapons
+//  2   ammo
+//  3   armor
+//  4   tools
+//  5   psi equipment
+//
+//  10  chemicals
+//  11  item parts
+//  12  implants
+//  13  bone enforcements
+//
+//  16  Buy anything
+//
+//  20  refreshments
+//  21  drugs
+//  22  medicaments
+//  23  real estate
+//  24  vehicles
+//
+*/
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_vehiclesits.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefVhcSeat::PDefVhcSeat()
 {
diff --git a/TinNS/Source/GameServer/Definitions/VehicleSits.hxx b/TinNS/Source/GameServer/Definitions/VehicleSits.hxx
new file mode 100644 (file)
index 0000000..e7c1a1e
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefVhcSeat : public PDef {
+private:
+    //int32_t mIndex; //Field 1
+    int32_t mType;
+    std::string mName; //Field 3
+    //BasePosX Y Z
+    //BaseAngleX Y Z
+    float mLeavePos[3]; //X Y Z - Fields 10-12
+    float mLeaveAngle[3]; //X Y Z - Fields 13-15
+    //FirePosX Y Z //Field 16
+    //XLock Ylock MinX MaxX TurnSpeed ForceExternalCam ShowActor
+    //SitBone RotXBone RotYBone WeaponBone
+    int32_t mWeaponId; //Field 30
+    int32_t mTL;
+    float mDamageFactor;
+    //SitAnimType SitYOffset //Field 33
+    //SitFlags
+
+public:
+    PDefVhcSeat();
+    //~PDefVhcSeat();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetType() const { return mType; }
+    inline const std::string &GetName() const { return mName; }
+    inline float GetLeavePos(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < 3)) ? mLeavePos[nIdx] : 0) ; }
+    inline float GetLeaveAngle(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < 3)) ? mLeaveAngle[nIdx] : 0) ; }
+    inline int32_t GetWeaponId() const { return mWeaponId; }
+    inline int32_t GetTL() const { return mTL; }
+    inline float GetDamageFactor() const { return mDamageFactor; }
+};
+/*
+mType:
+0 - Driver          (Ground vhc)
+1 - Gunner
+2 - Passenger
+3 - Driver/Gunner
+4 - Pilot           (Flying vhc)
+5 - Pilot/Gunner        (Flying vhc)
+6 - Pilot           (Senkrechtstarter ????)
+
+mFlags:
+1 - Winkel f�r Spieler und Waffe wird auf Fahrzeugrichtung gelockt. Zielrichtung darf nur leicht von der Fahrzeugrichtung abweichen
+2 - Spieler wird gelockt
+4 - Waffe ist nicht um X Achse drehbar
+8 - Waffe ist nicht um Y Achse drehbar
+16 - Spielermodel um 180 Grad gedreht
+*/
diff --git a/TinNS/Source/GameServer/Definitions/Vehicles.cxx b/TinNS/Source/GameServer/Definitions/Vehicles.cxx
new file mode 100644 (file)
index 0000000..82a9629
--- /dev/null
@@ -0,0 +1,45 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefVhc::PDefVhc()
+{
+    mNumSeats = mArmor = mHealth = mModel = 0;
+    mName = "undefined";
+    for(int i=0; i<8; ++i)
+      mSeatId[i] = -1;
+}
+
+bool PDefVhc::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+        mModel = atoi( i->c_str() ); break;
+      case 3 :
+        mName = *i; break;
+      case 34 :
+        mHealth = atoi( i->c_str() ); break;
+      case 35 :
+        mArmor = atoi( i->c_str() ); break;
+      default :
+        if( (Idx >= 16) && (Idx <= 23) )
+        {
+          mSeatId[Idx - 16] = atoi( i->c_str() );
+          if(mSeatId[Idx - 16] >= 0) // In theroy, we should check that it is a valid VhcSeat Index
+            ++mNumSeats;
+        }
+        break;
+    }
+
+    if ( Idx >= 36 )
+      break;
+  }
+
+  return ((Idx >= 35));
+}
diff --git a/TinNS/Source/GameServer/Definitions/Vehicles.hxx b/TinNS/Source/GameServer/Definitions/Vehicles.hxx
new file mode 100644 (file)
index 0000000..122e6f2
--- /dev/null
@@ -0,0 +1,58 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefVhc : public PDef {
+private:
+    //int32_t mIndex; // field 1
+    int32_t mModel;
+    std::string mName;
+    /*
+    float mLeftFront; // field 4
+    float mFront;
+    float mRightBack;
+    float mBack;
+    float mSideFriction;
+    float mDownFriction;
+    float mForwardFriction;
+    float mAcceleration;
+    float mBrakeFactor;
+    float mTurnSpeed;
+    float mFullTurnDelay;
+    int32_t mAnimClass; // field 15
+    */
+    int32_t mSeatId[8]; // fields 16 - 23
+    /*
+    float mSpeedTiltFactor; // field 24
+    float mSpeedGlideFactor;
+    float mMinHover;
+    float mMaxHover;
+    float mHoverLoopLen;
+    int32_t mWheelCnt;
+    float mWheelSpeed;
+    float mMaxDive;
+    int32_t mEffectsID;
+    int32_t mShowDebugBouncer; // field 33
+    */
+    int32_t mHealth;
+    int32_t mArmor;
+    //int32_t mSoundStartindex; // field 36
+
+    // Additionnal info
+    int32_t mNumSeats;
+
+public:
+    PDefVhc();
+    //~PDefVhc();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetModel() const { return mModel; }
+    inline const std::string &GetName() const { return mName; }
+    inline int32_t GetSeatId( int32_t nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < 8 ) ) ? mSeatId[nIdx] : -1) ; }
+    inline int32_t GetHealth() const { return mHealth; }
+    inline int32_t GetArmor() const { return mArmor; }
+    inline int32_t GetNumSeats() const { return mNumSeats; }
+};
similarity index 78%
rename from server/src/game/def/def_weapons.cpp
rename to TinNS/Source/GameServer/Definitions/Weapons.cxx
index afb3f2e..4e5ea64 100644 (file)
@@ -1,40 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 29 Mar 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_weapons.h"
-
+#include "GameServer/Definitions/Includes.hxx"
 
 PDefWeapon::PDefWeapon()
 {
diff --git a/TinNS/Source/GameServer/Definitions/Weapons.hxx b/TinNS/Source/GameServer/Definitions/Weapons.hxx
new file mode 100644 (file)
index 0000000..f33126e
--- /dev/null
@@ -0,0 +1,78 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "GameServer/Definitions/Definition.hxx"
+
+class PDefWeapon : public PDef {
+private:
+    //int32_t mIndex;
+    std::string mName;
+    //int32_t mFpsmodel;
+    //int32_t mAttachmodel;
+    //int32_t mMunactor;
+    //float mDroptime; // useful ?
+    int32_t mItemIndex;
+    //int32_t effectcolor[3]; // R,G,B
+    //int32_t dynamiclight;
+    //float lighttime;
+    //int32_t soundindex;
+    //float mShotTime; // useful ?
+    int32_t mAmmoUse;
+    int32_t mPSIuse;
+    float mStaminaUse;
+    //float upthrow;
+    //int32_t weaponHold; // ???
+    int32_t mWeaponType;
+    int32_t mDiscardable;
+    float mSkillFactor;
+    //int32_t mint32_tgtRad;
+    //int32_t maxtgtRad;
+    int32_t mMaxRange;
+    int32_t mAggressiveWeapon;
+    float mDamageMultiplicator;
+    int32_t mAmmoTypes[8];
+    int32_t mAmmoStartFlags; // ???
+    //int32_t customclasstype; // ?
+    //int32_t unknown // ?
+    int32_t mShotCnt;
+    //float shotduration; // maybe useful later ?
+    //std::string shotfx;
+    //float attachposx;
+    //float attachposy;
+    //float attachposz;
+    //float fpposx;
+    //float fpposy;
+    //float fpposz;
+    int32_t mBaseWeaponId;
+    //int32_t weaponcolor;
+    //int32_t reloadsound;
+    int32_t mItemModGroup;
+    int32_t mItemModGroupFlags;
+    int32_t mRareWeaponFx;
+
+public:
+    PDefWeapon();
+    //~PDefWeapon();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline const std::string &GetName() const { return mName; }
+    inline int32_t GetItemID() const { return mItemIndex; }
+    inline int32_t GetAmmoUse() const { return mAmmoUse; }
+    inline int32_t GetPsiUse() const { return mPSIuse; }
+    inline float GetStaminaUse() const { return mStaminaUse; }
+    inline int32_t GetWeaponType() const { return mWeaponType; }
+    inline bool IsDiscardable() const { return mDiscardable; }
+    inline float GetSkillFactor() const { return mSkillFactor; }
+    inline int32_t GetMaxRange() const { return mMaxRange; }
+    inline bool IsAggressiveWeapon() const { return mAggressiveWeapon; }
+    inline float GetDamageMultiplicator() const { return mDamageMultiplicator; }
+    inline int32_t GetAmmoType(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < 8)) ? mAmmoTypes[nIdx] : 0) ; }
+    inline int32_t GetAmmoStartFlags() const { return mAmmoStartFlags; }
+    inline int32_t GetShotCnt() const { return mShotCnt; }
+    inline int32_t GetBaseWeaponId() const { return mBaseWeaponId; }
+    inline int32_t GetItemModGroup() const { return mItemModGroup; }
+    inline int32_t GetItemModGroupFlags() const { return mItemModGroupFlags; }
+    inline int32_t GetRareWeaponFx() const { return mRareWeaponFx; }
+};
diff --git a/TinNS/Source/GameServer/Definitions/Weather.cxx b/TinNS/Source/GameServer/Definitions/Weather.cxx
new file mode 100644 (file)
index 0000000..151b28c
--- /dev/null
@@ -0,0 +1,45 @@
+#include "GameServer/Definitions/Includes.hxx"
+
+PDefWeather::PDefWeather()
+{
+  mNumWeathers = mSectionId = 0;
+  for(int i=0; i<8; ++i)
+      mDuration[i] = mWeatherId[i] = 0;
+}
+
+bool PDefWeather::LoadFromDef( PTokenList *Tokens )
+{
+  int Idx = 0;
+  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
+  {
+    switch ( Idx )
+    {
+      case 0 : // setentry
+        break;
+      case 1 :
+        mIndex = atoi( i->c_str() ); break;
+      case 2 :
+        mSectionId = atoi( i->c_str() ); break;
+      case 3 :
+        mNumWeathers = atoi( i->c_str() ); break;
+      default :
+        if( (Idx >= 4) && (Idx <= (3 + 2*mNumWeathers))  && (Idx <= 19) )
+        {
+          if(Idx & 1)
+          {
+            mDuration[int((Idx - 4)/2)] = atoi( i->c_str() );
+          }
+          else
+          {
+            mWeatherId[int((Idx - 4)/2)] = atoi( i->c_str() );
+          }
+        }
+        break;
+    }
+
+    if ( Idx >= 19 )
+      break;
+  }
+
+  return ((Idx >= (3 + 2*mNumWeathers)));
+}
diff --git a/TinNS/Source/GameServer/Definitions/Weather.hxx b/TinNS/Source/GameServer/Definitions/Weather.hxx
new file mode 100644 (file)
index 0000000..fa82531
--- /dev/null
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <cstdint>
+#include "GameServer/Definitions/Definition.hxx"
+
+//weathersectionid weathercnt weatherid length end
+class PDefWeather : public PDef {
+private:
+    //int32_t mIndex;
+    int32_t mSectionId;
+    int32_t mNumWeathers;
+    int32_t mWeatherId[8];
+    int32_t mDuration[8];
+
+public:
+    PDefWeather();
+    //~PDefWeather();
+
+    bool LoadFromDef( PTokenList *Tokens );
+
+    inline int32_t GetSectionId() const { return mSectionId; }
+    inline int32_t GetNumWeathers() const { return mNumWeathers; }
+    inline int32_t GetWeatherId(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumWeathers)) ? mWeatherId[nIdx] : 0 ) ; }
+    inline int32_t GetDuration(int32_t nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumWeathers)) ? mDuration[nIdx] : 0 ) ; }
+};
+
+/* mWeatherId
+//BRIGHTSKY     (1)
+//SINGLECLOUDS      (2)
+//CLOUDY        (3)
+
+//LIGHTRAIN     (4)
+//HEAVYRAIN     (5)
+//THUNDERSTORM      (6)
+
+//SNOW          (7)
+//SANDSTORM     (8)
+//FALLOUT       (9)
+
+//SEA_BRIGHTSKY     (100)
+*/
@@ -1,52 +1,9 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
+#include <cmath>\r
+#include <cstring>\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
 \r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
- world_datparser.h\r
- Class to parse .dat world files\r
-\r
- MODIFIED: 29 Sep 2006 Hammag\r
- REASON: - Creation\r
-\r
-MODIFIED: 21 Jun 2009 Namikon\r
-REASON: - Added NPC Template stuff\r
-        - reformatted for better reading\r
-\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "include/world_datparser.h"\r
-#include "def/world_datstruct.h"\r
-\r
-#include "include/worlddatatemplate.h"\r
-#include "include/furnituretemplate.h"\r
-#include "include/doortemplate.h"\r
-#include "include/npctemplate.h"\r
-\r
-#include <math.h>\r
-\r
-const u16 nonDiscardUseFlags = ufTouchable | ufUsable | ufChair | ufToolTarget ; // furniture always to keep even if function type = 0\r
+const uint16_t nonDiscardUseFlags = ufTouchable | ufUsable | ufChair | ufToolTarget ; // furniture always to keep even if function type = 0\r
 \r
 PWorldDatParser::PWorldDatParser()\r
 {\r
@@ -64,9 +21,9 @@ int PWorldDatParser::LoadDatFile( const std::string& nFilename, PWorldDataTempla
     PSectionHeader SectionHeader;\r
     PSec2ElemHeader Sec2ElemHeader;\r
 \r
-    u32 FileLen;\r
-    u32 NextSectionOffset = 0;\r
-    u32 NextElementOffset;\r
+    uint32_t FileLen;\r
+    uint32_t NextSectionOffset = 0;\r
+    uint32_t NextElementOffset;\r
     bool ProcessOK;\r
 \r
     mWorld = nWorld;\r
@@ -114,7 +71,7 @@ int PWorldDatParser::LoadDatFile( const std::string& nFilename, PWorldDataTempla
             f->Seek( NextSectionOffset ); // Make sure we are at the computed offset\r
             if (gDevDebug)\r
                 Console->Print( "Reading next section header ... " );\r
-            if (( u32 )( f->Read( &SectionHeader, sizeof( PSectionHeader ) ) ) < sizeof( PSectionHeader ) )\r
+            if (( uint32_t )( f->Read( &SectionHeader, sizeof( PSectionHeader ) ) ) < sizeof( PSectionHeader ) )\r
             {\r
                 Filesystem->Close( f );\r
                 return -3;\r
@@ -149,7 +106,7 @@ int PWorldDatParser::LoadDatFile( const std::string& nFilename, PWorldDataTempla
 \r
                     //if ( gDevDebug )\r
                     //    Console->Print( "Reading next element header ... " );\r
-                    if (( u32 )( f->Read( &Sec2ElemHeader, sizeof( PSec2ElemHeader ) ) ) < sizeof( PSec2ElemHeader ) )\r
+                    if (( uint32_t )( f->Read( &Sec2ElemHeader, sizeof( PSec2ElemHeader ) ) ) < sizeof( PSec2ElemHeader ) )\r
                     {\r
                         Filesystem->Close( f );\r
                         return -3;\r
@@ -209,28 +166,28 @@ int PWorldDatParser::LoadDatFile( const std::string& nFilename, PWorldDataTempla
     return 0;\r
 }\r
 \r
-bool PWorldDatParser::ProcessSec2ElemType3( u32 nSize ) // furniture\r
+bool PWorldDatParser::ProcessSec2ElemType3( uint32_t nSize ) // furniture\r
 {\r
     PSec2ElemType3a DataA;\r
     PSec2ElemType3b DataB;\r
     const PDefWorldModel* nWorldModel;\r
     std::string nName;\r
-    const u32 sza = sizeof( PSec2ElemType3a );\r
-    const u32 szb = sizeof( PSec2ElemType3a ) + sizeof( PSec2ElemType3b );\r
+    const uint32_t sza = sizeof( PSec2ElemType3a );\r
+    const uint32_t szb = sizeof( PSec2ElemType3a ) + sizeof( PSec2ElemType3b );\r
 \r
     if (( nSize != szb ) && ( nSize != sza ) )\r
     {\r
         Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType3 (%d read vs %d or %d needed", nSize, sza, szb );\r
         return false;\r
     }\r
-    if (( u32 )( f->Read( &DataA, sza ) ) < sza )\r
+    if (( uint32_t )( f->Read( &DataA, sza ) ) < sza )\r
     {\r
         Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType3a" );\r
         return false;\r
     }\r
     if ( nSize == szb )\r
     {\r
-        if (( u32 )( f->Read( &DataB, sizeof( PSec2ElemType3b ) ) ) < sizeof( PSec2ElemType3b ) )\r
+        if (( uint32_t )( f->Read( &DataB, sizeof( PSec2ElemType3b ) ) ) < sizeof( PSec2ElemType3b ) )\r
         {\r
             Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType3b" );\r
             return false;\r
@@ -299,7 +256,7 @@ bool PWorldDatParser::ProcessSec2ElemType3( u32 nSize ) // furniture
 //  nItem->mBoxUpperX = DataB.mBoxUpperX;\r
 \r
     nItem->mDefWorldModel = nWorldModel;\r
-    /*u16 func=nWorldModel->GetFunctionType();\r
+    /*uint16_t func=nWorldModel->GetFunctionType();\r
     if((func==18) || (func==20) || (func==29))\r
     Console->Print("gate model: %d", DataA.mWorldmodelID);*/\r
 \r
@@ -313,17 +270,17 @@ bool PWorldDatParser::ProcessSec2ElemType3( u32 nSize ) // furniture
     Radius += 5;\r
 \r
     // int pos values are change to match char pos scale (32000 centered)\r
-    nItem->mFrontPosY = ( u16 )( 32000 + DataA.mPosY + Radius * sinf( Angle ) );\r
-    nItem->mFrontPosZ = ( u16 )( 32000 + DataA.mPosZ );\r
-    nItem->mFrontPosX = ( u16 )( 32000 + DataA.mPosX + Radius * cosf( Angle ) );\r
-    nItem->mFrontLR = ( u8 )( 0.5 * ( DataA.mRotZ + ( DataA.mRotZ < 0 ? 360 : 0 ) ) );\r
+    nItem->mFrontPosY = ( uint16_t )( 32000 + DataA.mPosY + Radius * sinf( Angle ) );\r
+    nItem->mFrontPosZ = ( uint16_t )( 32000 + DataA.mPosZ );\r
+    nItem->mFrontPosX = ( uint16_t )( 32000 + DataA.mPosX + Radius * cosf( Angle ) );\r
+    nItem->mFrontLR = ( uint8_t )( 0.5 * ( DataA.mRotZ + ( DataA.mRotZ < 0 ? 360 : 0 ) ) );\r
 \r
     mWorld->AddFurnitureItem( nItem );\r
 \r
     return true;\r
 }\r
 \r
-bool PWorldDatParser::ProcessSec2ElemType5( u32 nSize ) // doors\r
+bool PWorldDatParser::ProcessSec2ElemType5( uint32_t nSize ) // doors\r
 {\r
     PSec2ElemType5Start Data;\r
     char StringData[64];\r
@@ -333,19 +290,19 @@ bool PWorldDatParser::ProcessSec2ElemType5( u32 nSize ) // doors
     char* ActorString;\r
     char* ParamString;\r
 \r
-    const u32 sza = sizeof( PSec2ElemType5Start );\r
+    const uint32_t sza = sizeof( PSec2ElemType5Start );\r
 \r
     if (( nSize < sza ) )\r
     {\r
         Console->Print( RED, BLACK, "[ERROR] Wrong size for Sec2ElemType5 (%d read vs %d needed", nSize, sza );\r
         return false;\r
     }\r
-    if (( u32 )( f->Read( &Data, sza ) ) < sza )\r
+    if (( uint32_t )( f->Read( &Data, sza ) ) < sza )\r
     {\r
         Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType5start" );\r
         return false;\r
     }\r
-    u32 szb = Data.mActorStringSize  + Data.mParamStringSize;\r
+    uint32_t szb = Data.mActorStringSize  + Data.mParamStringSize;\r
 \r
     if ( nSize != ( sza + szb ) )\r
     {\r
@@ -359,7 +316,7 @@ bool PWorldDatParser::ProcessSec2ElemType5( u32 nSize ) // doors
             Console->Print( RED, BLACK, "[Warning] String data too long in Sec2ElemType5 End String. End will be ignored" );\r
             szb = 64;\r
         }\r
-        if (( u32 )( f->Read( StringData, szb ) ) < szb )\r
+        if (( uint32_t )( f->Read( StringData, szb ) ) < szb )\r
         {\r
             Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in Sec2ElemType5 End Strings" );\r
             return false;\r
@@ -426,7 +383,7 @@ bool PWorldDatParser::ProcessSec2ElemType5( u32 nSize ) // doors
     return true;\r
 }\r
 \r
-bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize )\r
+bool PWorldDatParser::ProcessSec2NPCEntry( uint32_t nSize )\r
 {\r
     PSec2NPC_EntryPart1         tNPCPartA;\r
     PSec2NPC_EntryPart2         tNPCPartB;\r
@@ -434,8 +391,8 @@ bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize )
     std::string                 tAngle;\r
     char                        tStrBuffer[64];\r
 \r
-    u32 tSizeOfA = sizeof(tNPCPartA);\r
-    u32 tSizeOfB = sizeof(tNPCPartB);\r
+    uint32_t tSizeOfA = sizeof(tNPCPartA);\r
+    uint32_t tSizeOfB = sizeof(tNPCPartB);\r
 \r
     // Are we able to read enough bytes from the file? means: CAN we safely read our entire struct from the file?\r
     if ( nSize < tSizeOfA )\r
@@ -444,14 +401,14 @@ bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize )
         return false;\r
     }\r
     // yes we can! So read it now. If we reach EOF, break\r
-    if (( u32 )( f->Read( &tNPCPartA, tSizeOfA ) ) < tSizeOfA )\r
+    if (( uint32_t )( f->Read( &tNPCPartA, tSizeOfA ) ) < tSizeOfA )\r
     {\r
         Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry" );\r
         return false;\r
     }\r
     // Now we have the header. lets check if we have some waypoints for this NPC\r
     // Size of entire NPC entry in file\r
-    u32 tCompleteNPCSize = tSizeOfA + tNPCPartA.mActorStringSize + tNPCPartA.mAngleStringSize;\r
+    uint32_t tCompleteNPCSize = tSizeOfA + tNPCPartA.mActorStringSize + tNPCPartA.mAngleStringSize;\r
     if ( tNPCPartA.mHasAdditionalCoords > 0 )\r
     {\r
         // It has additional coords, add 'em\r
@@ -468,7 +425,7 @@ bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize )
     // We are. Continue reading!\r
     // Assign the 2 strings and watch out for EOF!\r
     memset(tStrBuffer, 0, 64);\r
-    if (( u32 )( f->Read( tStrBuffer, tNPCPartA.mActorStringSize ) ) < tNPCPartA.mActorStringSize )\r
+    if (( uint32_t )( f->Read( tStrBuffer, tNPCPartA.mActorStringSize ) ) < tNPCPartA.mActorStringSize )\r
     {\r
         Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry mActorStringSize" );\r
         return false;\r
@@ -476,7 +433,7 @@ bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize )
     tActorName = tStrBuffer;\r
 \r
     memset(tStrBuffer, 0, 64);\r
-    if (( u32 )( f->Read( tStrBuffer, tNPCPartA.mAngleStringSize ) ) < tNPCPartA.mAngleStringSize )\r
+    if (( uint32_t )( f->Read( tStrBuffer, tNPCPartA.mAngleStringSize ) ) < tNPCPartA.mAngleStringSize )\r
     {\r
         Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry mAngleStringSize" );\r
         return false;\r
@@ -505,13 +462,13 @@ bool PWorldDatParser::ProcessSec2NPCEntry( u32 nSize )
     tNPC->SetAngle(tAngle);\r
 \r
     // Read additional Waypoints if available\r
-    u8 tCurrWayP = 0;\r
+    uint8_t tCurrWayP = 0;\r
     if ( tNPCPartA.mHasAdditionalCoords > 0 )\r
     {\r
         while ( tCurrWayP < tNPCPartA.mHasAdditionalCoords )\r
         {\r
             memset(&tNPCPartB, 0, tSizeOfB);\r
-            if (( u32 )( f->Read( &tNPCPartB, tSizeOfB ) ) < tSizeOfB )\r
+            if (( uint32_t )( f->Read( &tNPCPartB, tSizeOfB ) ) < tSizeOfB )\r
             {\r
                 Console->Print( RED, BLACK, "[ERROR] Unexpected end of file in ProcessSec2NPCEntry while reading WayPoints" );\r
                 return false;\r
diff --git a/TinNS/Source/GameServer/Definitions/WorldDatParser.hxx b/TinNS/Source/GameServer/Definitions/WorldDatParser.hxx
new file mode 100644 (file)
index 0000000..dfe60bd
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+\r
+class PFile;\r
+class PWorldDataTemplate;\r
+\r
+class PWorldDatParser {\r
+private:\r
+    PFile* f;\r
+    std::string mNCDataPath;\r
+\r
+    PWorldDataTemplate* mWorld;\r
+    bool mDiscardPassiveObjects;\r
+\r
+    bool ProcessSec2ElemType3(uint32_t nSize);\r
+    bool ProcessSec2ElemType5(uint32_t nSize);\r
+    bool ProcessSec2NPCEntry(uint32_t nSize);\r
+\r
+public:\r
+    PWorldDatParser();\r
+    ~PWorldDatParser();\r
+\r
+    int32_t LoadDatFile(const std::string& nFilename, PWorldDataTemplate* nWorld, const bool nDiscardPassiveObjects = true, const bool nTestAccesOnly = false);\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/WorldDatStruct.hxx b/TinNS/Source/GameServer/Definitions/WorldDatStruct.hxx
new file mode 100644 (file)
index 0000000..0d1d4a1
--- /dev/null
@@ -0,0 +1,128 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+struct PWorldFileHeader {\r
+    uint32_t mHeaderSize; // must be 08 00 00 00, = header size after this field\r
+    uint32_t mHeaderSig; // must be CF CF 0F 00\r
+    uint32_t mSection; // must be 01 00 00 00\r
+};\r
+\r
+struct PSectionHeader {\r
+    uint32_t mHeaderSize; // must be 0C 00 00 00\r
+    uint32_t mHeaderSig; // must be CF FF 00 00\r
+    uint32_t mSection; // 00 00 00 00 means end\r
+    uint32_t mDataSize;\r
+};\r
+\r
+struct PSec2ElemHeader {\r
+    uint32_t mHeaderSize; // must be 0C 00 00 00\r
+    uint32_t mHeaderSig; // must be F1 FE FE 0F\r
+    uint32_t mElementType; // 1000003, 1000005 or 1000014\r
+    uint32_t mDataSize;\r
+};\r
+\r
+struct PSec2ElemType3a { //static object ?\r
+    float mPosY; //= uint32_t16_t PosY - 32000\r
+    float mPosZ;\r
+    float mPosX;\r
+    float mRotY;\r
+    float mRotZ;\r
+    float mRotX;\r
+    float mScale; //00 00 80 3F ? = float(1.000000) !!! => scale factor ?????\r
+    uint32_t mUnknown2; //01 00 00 00 ?\r
+    uint16_t mModelID; // point32_ts to models.ini\r
+    uint32_t mUnknown3; //00 00 00 00 ?\r
+    uint32_t mUnknown4; //00 00 00 00 ?\r
+    uint16_t mWorldmodelID; // point32_ts to worldmodel.def\r
+    uint16_t mUnknown5; //12 00 ?\r
+    uint32_t mObjectID;\r
+};\r
+\r
+struct PSec2ElemType3b { //this part is optional\r
+    float mBoxLowerY; //Bounding box, for useflag "64 - selfconstructing colisionbox"\r
+    float mBoxLowerZ; // int32_t32_t or uint32_t32_t ?\r
+    float mBoxLowerX;\r
+    float mBoxUpperY;\r
+    float mBoxUpperZ;\r
+    float mBoxUpperX;\r
+};\r
+\r
+struct PSec2ElemType5Start { //door\r
+    uint16_t mUnknown1; //18 00\r
+    uint16_t mUnknown1bis; //00 00 ? varies\r
+    float mPosY;\r
+    float mPosZ;\r
+    float mPosX;\r
+    uint8_t mActorStringSize; //string size with ending 0\r
+    uint8_t mParamStringSize; //string size with ending 0\r
+    uint16_t mUnknown5; //00 00 ? second byte varies\r
+    uint16_t mDoorID; // but what is the link with ObjectID sent in Use message (can't find the base offset .. or 0x80 for doors ???)\r
+    uint16_t mWorldmodelID; //door type from worldmodel.def\r
+};\r
+//Actor As String //null terminated string\r
+//Params As String //null terminated string - for DDOOR, 2nd param is the ID of the other (half)door (*)\r
+//param1 = 2 => simple lateral move ?, 3 => door frontal+lateral move (as at Typherra memorial) ?\r
+//last param = 0/1 for lateral move direction ? no ...\r
+//(*) here is the bug(?) that makes open only one half of a double door\r
+\r
+/*\r
+struct PSec2ElemType6Start //npc\r
+{\r
+  uint16_t mUnknown1; //20 00 ?\r
+  uint16_t mUnknown2; //12 00 ?\r
+  float mPosY;\r
+  float mPosZ;\r
+  float mPosX;\r
+  uint32_t mNPCTypeID; //npc type in npc.def\r
+  uint8_t mActorStringSize; //string size with ending 0\r
+  uint8_t mParamStringSize; //string size with ending 0\r
+  uint16_t mNpcID; // kind of ?\r
+  uint32_t mUnknown3; //01 00 00 00 ?\r
+  uint16_t mUnknown4; //00 00 ?\r
+  uint16_t mUnknown5; //04 00 ?\r
+};\r
+  //Actor As String //null terminated string\r
+  //Params As String //null terminated string - Seem to be the facing angle in degres\r
+struct PSec2ElemType6End\r
+{\r
+  float mPosY2; //second position for movement ?\r
+  float mPosZ2; //\r
+  float mPosX2; //\r
+};\r
+*/\r
+struct PSec2NPC_EntryPart1 {\r
+    uint32_t       mUnknown1; // Is always 0x20001200, in every log. maybe header for NPCs?\r
+    float       mPosY;\r
+    float       mPosZ;\r
+    float       mPosX;\r
+    uint32_t       mNPCTypeID; //npc type in npc.def\r
+    uint8_t        mActorStringSize; //string size with ending 0\r
+    uint8_t        mAngleStringSize; //string size with ending 0\r
+    uint16_t       mNpcID;\r
+    uint8_t        mHasAdditionalCoords;\r
+    uint8_t        mUnknown2a;\r
+    uint8_t        mUnknown2b;\r
+    uint8_t        mUnknown2c;\r
+    uint16_t       mTradeID; //mUnknown3; //00 00 ?\r
+    uint16_t       mUnknown4; //04 00 ?\r
+};\r
+\r
+//    uint32_t8_t    mActorName[mActorStringSize];\r
+//    uint32_t8_t    mAngle[mAngleStringSize];\r
+\r
+struct PSec2NPC_EntryPart2 { // Waypoint32_ts! or something like that...\r
+    float       mPosY;\r
+    float       mPosZ;\r
+    float       mPosX;\r
+};\r
+\r
+//  uint32_t16_t mStrSize; //non-zero terminated string size\r
+//  Name As String //non-zero terminated string\r
+struct PSec2ElemType15End { //area definition/sound ?\r
+    float mUnknown1;\r
+    float mUnknown2;\r
+    float mUnknown3;\r
+    float mUnknown4;\r
+    float mUnknown5;\r
+};\r
similarity index 50%
rename from server/src/game/def/def_worldfile.cpp
rename to TinNS/Source/GameServer/Definitions/WorldFile.cxx
index 75f4c68..66e1762 100644 (file)
@@ -1,95 +1,69 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "GameServer/Includes.hxx"\r
 \r
 /*\r
-       def_worldfile.cpp (infos from worlds/worlds.ini)\r
-\r
-       MODIFIED: 28 Sep 2007 Hammag\r
-       REASON: - Creation\r
-       \r
-       NOTA: Some entries in worlds.ini share the same Id ...\r
-             e.g: 505: techtown_enter 1/1a/1b/2\r
-             As we don't know what it means & how it is supposed to be handled,\r
-             we keep the first one for the moment. (this is managed in gamedef.cpp)\r
-       TODO: Add a config entry to select the Nth entry for each such case,\r
-             as well as a config entry to select the default entry to be kept (first/last)\r
+    NOTA: Some entries in worlds.ini share the same Id ...\r
+          e.g: 505: techtown_enter 1/1a/1b/2\r
+          As we don't know what it means & how it is supposed to be handled,\r
+          we keep the first one for the moment. (this is managed in gamedef.cpp)\r
+    TODO: Add a config entry to select the Nth entry for each such case,\r
+          as well as a config entry to select the default entry to be kept (first/last)\r
 */\r
 \r
-#include "main.h"\r
-\r
 PDefWorldFile::PDefWorldFile()\r
 {\r
-       mFileInWorldsDir = false;\r
+    mFileInWorldsDir = false;\r
 }\r
 \r
 bool PDefWorldFile::LoadFromDef(PTokenList *Tokens)\r
 {\r
-       int Idx=0;\r
-       int StartPos = 0;\r
-       int TailLen = 0;\r
-       int Len;\r
-       \r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0: // setentry\r
-                               continue;\r
-\r
-                       case 1: // index\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-                       case 2: // name\r
-                       {\r
-                         Len = (*i).length();\r
+    int Idx=0;\r
+    int StartPos = 0;\r
+    int TailLen = 0;\r
+    int Len;\r
+\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0: // setentry\r
+                continue;\r
+\r
+            case 1: // index\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+            case 2: // name\r
+            {\r
+              Len = (*i).length();\r
 \r
         while((StartPos = (*i).find("\\",StartPos))>-1)\r
           (*i)[StartPos]='/';\r
         StartPos = 0;\r
-        \r
+\r
         if ((*i)[0] == '\"')\r
           StartPos = 1;\r
-        \r
-                         if ( (*i).substr(StartPos,9) == "./worlds/" )\r
-                         {\r
-                           mFileInWorldsDir = true;\r
-                           StartPos += 9;\r
-                         }\r
-                         else if ( (*i).substr(StartPos,2) == "./" )\r
+\r
+              if ( (*i).substr(StartPos,9) == "./worlds/" )\r
+              {\r
+                mFileInWorldsDir = true;\r
+                StartPos += 9;\r
+              }\r
+              else if ( (*i).substr(StartPos,2) == "./" )\r
           StartPos += 2;\r
-        \r
+\r
         if ((*i)[Len-1] == '\"')\r
-          TailLen = 1;           \r
-                         if ( (Len > (StartPos+TailLen+4)) && ((*i)[Len-TailLen-4] == '.') )\r
-                           TailLen += 4;\r
-                           \r
-                         mName = (*i).substr(StartPos,Len-StartPos-TailLen); // remove prefix, extension and doublequotes                              \r
-                               \r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       return (Idx == 3);\r
+          TailLen = 1;\r
+              if ( (Len > (StartPos+TailLen+4)) && ((*i)[Len-TailLen-4] == '.') )\r
+                TailLen += 4;\r
+\r
+              mName = (*i).substr(StartPos,Len-StartPos-TailLen); // remove prefix, extension and doublequotes\r
+\r
+                break;\r
+            }\r
+        }\r
+    }\r
+\r
+    return (Idx == 3);\r
 }\r
 \r
 // class PDefWorldFileMap defined in gamedefs.h\r
@@ -101,7 +75,7 @@ bool PDefWorldFilesMap::Load(const char* nName, const char* nFilename)
     Console->Print( "%s Defs name not defined", Console->ColorText( RED, BLACK, "[ERROR]" ) );\r
     return (false);\r
   }\r
-  \r
+\r
   if(! *nFilename)\r
   {\r
     Console->Print( "%s Filename not defined for %s defs", Console->ColorText( RED, BLACK, "[ERROR]" ), mName.c_str() );\r
diff --git a/TinNS/Source/GameServer/Definitions/WorldFile.hxx b/TinNS/Source/GameServer/Definitions/WorldFile.hxx
new file mode 100644 (file)
index 0000000..ea2c788
--- /dev/null
@@ -0,0 +1,30 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefWorldFile : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    std::string mName; // dat filename with ending extension and starting ./ or ./worlds/ REMOVED\r
+    bool mFileInWorldsDir; // TRUE if worlds/ must be appendend before mName to get real file name (dat file at least)\r
+\r
+public:\r
+    PDefWorldFile();\r
+    //~PDefWorldFile();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline const std::string GetBasicFileName() const { return (mFileInWorldsDir ? (std::string("worlds/") + mName) : mName); };\r
+};\r
+\r
+\r
+class PDefWorldFilesMap : public PDefMap<PDefWorldFile> {\r
+public:\r
+    bool Load(const char* nName, const char* nFilename);\r
+    inline std::map<int32_t, PDefWorldFile*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }\r
+    inline std::map<int32_t, PDefWorldFile*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }\r
+};\r
diff --git a/TinNS/Source/GameServer/Definitions/WorldModels.cxx b/TinNS/Source/GameServer/Definitions/WorldModels.cxx
new file mode 100644 (file)
index 0000000..b57113d
--- /dev/null
@@ -0,0 +1,41 @@
+#include "GameServer/Definitions/Includes.hxx""\r
+\r
+PDefWorldModel::PDefWorldModel()\r
+{\r
+}\r
+\r
+bool PDefWorldModel::LoadFromDef(PTokenList *Tokens)\r
+{\r
+    int Idx=0;\r
+    for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
+    {\r
+        switch(Idx)\r
+        {\r
+            case 0: // setentry\r
+                    continue;\r
+\r
+            case 1: // index\r
+                mIndex = atoi(i->c_str()); break;\r
+\r
+            case 2: // name\r
+                mName = *i; break;\r
+\r
+            case 3: // use flag\r
+                mUseFlags = atoi(i->c_str()); break;\r
+\r
+            case 4: // function type\r
+                mFunctionType = atoi(i->c_str()); break;\r
+\r
+            case 5: // function value\r
+                mFunctionValue = atoi(i->c_str()); break;\r
\r
+            case 6: // hack difficulty\r
+                mHackDifficulty = atoi(i->c_str()); break;\r
+\r
+            case 7: // hack penalty\r
+                mHackPenalty = atoi(i->c_str()); break;\r
+        }\r
+    }\r
+\r
+    return true;\r
+}\r
diff --git a/TinNS/Source/GameServer/Definitions/WorldModels.hxx b/TinNS/Source/GameServer/Definitions/WorldModels.hxx
new file mode 100644 (file)
index 0000000..11cb111
--- /dev/null
@@ -0,0 +1,30 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefWorldModel : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    int32_t mUseFlags;\r
+    int32_t mFunctionType;\r
+    int32_t mFunctionValue;\r
+    int32_t mHackDifficulty;\r
+    int32_t mHackPenalty;\r
+\r
+public:\r
+    PDefWorldModel();\r
+    //~PDefWorldModel();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline int32_t GetID() const { return mIndex; }\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline int32_t GetUseFlags() const { return mUseFlags; }\r
+    inline int32_t GetFunctionType() const { return mFunctionType; }\r
+    inline int32_t GetFunctionValue() const { return mFunctionValue; }\r
+    inline int32_t GetHackDifficulty() const { return mHackDifficulty; }\r
+    inline int32_t GetHackPenalty() const { return mHackPenalty; }\r
+};\r
similarity index 56%
rename from server/src/game/def/def_worlds.cpp
rename to TinNS/Source/GameServer/Definitions/Worlds.cxx
index ff7c55a..fdb13eb 100644 (file)
@@ -1,44 +1,4 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_worlds.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-\r
-        MODIFIED: 07 Oct 2006 Hammag\r
-        REASON: - Added quotes and spaces trim to mName and mDatFile.\r
-*/\r
-\r
-#include "main.h"\r
+#include "GameServer/Definitions/Includes.hxx"\r
 \r
 PDefWorld::PDefWorld()\r
 {\r
diff --git a/TinNS/Source/GameServer/Definitions/Worlds.hxx b/TinNS/Source/GameServer/Definitions/Worlds.hxx
new file mode 100644 (file)
index 0000000..9129479
--- /dev/null
@@ -0,0 +1,23 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+#include "GameServer/Definitions/Definition.hxx"\r
+\r
+class PDefWorld : public PDef {\r
+private:\r
+    //int32_t mIndex;\r
+    std::string mName;\r
+    std::string mDatFile;\r
+    int32_t mFlags;\r
+\r
+public:\r
+    PDefWorld();\r
+    //~PDefWorld();\r
+\r
+    bool LoadFromDef(PTokenList *Tokens);\r
+\r
+    inline const std::string &GetName() const { return mName; }\r
+    inline const std::string &GetDatFile() const { return mDatFile; }\r
+    inline int32_t GetFlags() const { return mFlags; }\r
+};\r
diff --git a/TinNS/Source/GameServer/DoorTemplate.cxx b/TinNS/Source/GameServer/DoorTemplate.cxx
new file mode 100644 (file)
index 0000000..94aa485
--- /dev/null
@@ -0,0 +1,116 @@
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+//  TODO: - mem corruption occurs if mDoorParameters[] is given a size of 6, and that 6 max param can be accepted\r
+//          This bug occurs in world 105. Reason not found yet :-x\r
+\r
+const std::string EmptyString;\r
+\r
+PDoorTemplate::PDoorTemplate()\r
+{\r
+  mDoorID = 0;\r
+  mWorldmodelID = 0;\r
+  mDefWorldModel = NULL;\r
+  mIsDoubleDoor = false;\r
+  mIsTriggeredDoor = false;\r
+}\r
+\r
+PDoorTemplate::~PDoorTemplate()\r
+{\r
+}\r
+\r
+uint16_t PDoorTemplate::GetID()\r
+{\r
+    return mDoorID;\r
+}\r
+\r
+uint16_t PDoorTemplate::GetUseFlags()\r
+{\r
+    return (mDefWorldModel ? mDefWorldModel->GetUseFlags() : 0);\r
+}\r
+\r
+uint16_t PDoorTemplate::GetFunctionType()\r
+{\r
+    return (mDefWorldModel ? mDefWorldModel->GetFunctionType() : 0);\r
+}\r
+\r
+int PDoorTemplate::GetFunctionValue()\r
+{\r
+    return (mDefWorldModel ?  mDefWorldModel->GetFunctionValue() : 0);\r
+}\r
+\r
+const std::string& PDoorTemplate::GetName() const\r
+{\r
+    return (mDefWorldModel ?  mDefWorldModel->GetName() : EmptyString );\r
+}\r
+\r
+const PDefWorldModel *PDoorTemplate::GetDefWorldModel() const\r
+{\r
+    return mDefWorldModel;\r
+}\r
+\r
+void PDoorTemplate::GetPos(float *nPosX, float *nPosY, float *nPosZ) const\r
+{\r
+    *nPosY = mPosY;\r
+    *nPosZ = mPosZ;\r
+    *nPosX = mPosX;\r
+}\r
+\r
+uint16_t PDoorTemplate::GetOtherDoorID()\r
+{\r
+    return (mIsDoubleDoor ? mDoorParameters[1] : 0);\r
+}\r
+\r
+bool PDoorTemplate::IsDoubleDoor() const\r
+{\r
+    return mIsDoubleDoor;\r
+}\r
+\r
+bool PDoorTemplate::IsTriggeredDoor() const\r
+{\r
+    return mIsTriggeredDoor;\r
+}\r
+\r
+void PDoorTemplate::SetDoorParameters(char* nDoorParametersString)\r
+{\r
+  char* SepPos;\r
+  int ParamNum = 0;\r
+//Console->Print("door parameter: %s", nDoorParametersString);\r
+  while ( *nDoorParametersString && (SepPos = strchr(nDoorParametersString, ',')) && (ParamNum < 4))\r
+  {\r
+    *SepPos = 0;\r
+    mDoorParameters[ParamNum++] = atoi(nDoorParametersString);\r
+    nDoorParametersString = SepPos + 1;\r
+  }\r
+  if (*nDoorParametersString)\r
+  {\r
+    if (ParamNum < 4)\r
+      mDoorParameters[ParamNum] = atoi(nDoorParametersString);\r
+    //else\r
+    //  Console->Print(RED, BLACK, "[ERROR] More than 4 parameters in Sec2ElemType5 ParamString");\r
+  }\r
+}\r
+\r
+void PDoorTemplate::SetDoorTypeName(char* nDoorTypeName)\r
+{\r
+  mDoorTypeName = nDoorTypeName;\r
+\r
+  if (mDoorTypeName == "DDOOR")\r
+  {\r
+    mIsDoubleDoor = true;\r
+  }\r
+  else if (mDoorTypeName == "TRIGDD")\r
+  {\r
+    mIsDoubleDoor = true;\r
+    mIsTriggeredDoor = true;\r
+  }\r
+  else if (mDoorTypeName == "TRIGDOOR")\r
+  {\r
+    mIsTriggeredDoor = true;\r
+  }\r
+  else if (mDoorTypeName == "NBUTTON")\r
+  {\r
+    mIsTriggeredDoor = false;\r
+  }\r
+}\r
diff --git a/TinNS/Source/GameServer/DoorTemplate.hxx b/TinNS/Source/GameServer/DoorTemplate.hxx
new file mode 100644 (file)
index 0000000..e3bbd84
--- /dev/null
@@ -0,0 +1,47 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+class PDefWorldModel;\r
+\r
+class PDoorTemplate {\r
+    friend class PWorldDatParser;\r
+\r
+private:\r
+    uint16_t mDoorID;\r
+\r
+    // The commented out values are not loaded from dat file atm because they are not used yet.\r
+    //uint16_t mUnknown1; //18 00\r
+    //uint16_t mUnknown1bis; //00 00 ? varies\r
+    float mPosY;\r
+    float mPosZ;\r
+    float mPosX;\r
+    //uint16_t mUnknown5; //00 00 ? second byte varies\r
+    uint16_t mWorldmodelID; //door type from worldmodel.def\r
+\r
+    std::string mDoorTypeName;\r
+    int mDoorParameters[4];\r
+    bool mIsDoubleDoor;\r
+    bool mIsTriggeredDoor;\r
+\r
+    const PDefWorldModel* mDefWorldModel;\r
+\r
+public:\r
+    PDoorTemplate();\r
+    ~PDoorTemplate();\r
+\r
+    uint16_t GetID();\r
+    uint16_t GetUseFlags();\r
+    uint16_t GetFunctionType();\r
+    int GetFunctionValue();\r
+    const std::string& GetName() const; /// !!!!\r
+    const PDefWorldModel *GetDefWorldModel() const;\r
+\r
+    void GetPos(float *nPosX, float *nPosY, float *nPosZ) const;\r
+    uint16_t GetOtherDoorID();\r
+    bool IsDoubleDoor() const;\r
+    bool IsTriggeredDoor() const;\r
+\r
+    void SetDoorTypeName(char* nDoorTypeName);\r
+    void SetDoorParameters(char* nDoorParametersString);\r
+};\r
diff --git a/TinNS/Source/GameServer/FurnitureTemplate.cxx b/TinNS/Source/GameServer/FurnitureTemplate.cxx
new file mode 100644 (file)
index 0000000..bc29b37
--- /dev/null
@@ -0,0 +1,76 @@
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+const std::string EmptyString;\r
+\r
+PFurnitureItemTemplate::PFurnitureItemTemplate()\r
+{\r
+  mObjectID = 0;\r
+  mModelID = 0;\r
+  mWorldmodelID = 0;\r
+  mDefWorldModel = NULL;\r
+  mLinkedObjectID = 0;\r
+}\r
+\r
+PFurnitureItemTemplate::~PFurnitureItemTemplate()\r
+{\r
+}\r
+\r
+uint32_t PFurnitureItemTemplate::GetID() const\r
+{\r
+    return mObjectID;\r
+}\r
+\r
+uint16_t PFurnitureItemTemplate::GetUseFlags() const\r
+{\r
+    return (mDefWorldModel ? mDefWorldModel->GetUseFlags() : 0);\r
+}\r
+\r
+uint16_t PFurnitureItemTemplate::GetFunctionType() const\r
+{\r
+    return (mDefWorldModel ? mDefWorldModel->GetFunctionType() : 0);\r
+}\r
+\r
+int PFurnitureItemTemplate::GetFunctionValue() const\r
+{\r
+    return (mDefWorldModel ? mDefWorldModel->GetFunctionValue() : 0);\r
+}\r
+\r
+const std::string &PFurnitureItemTemplate::GetName() const\r
+{\r
+    return (mDefWorldModel ? mDefWorldModel->GetName() : EmptyString);\r
+}\r
+\r
+const PDefWorldModel *PFurnitureItemTemplate::GetDefWorldModel() const\r
+{\r
+    return mDefWorldModel;\r
+}\r
+\r
+uint8_t PFurnitureItemTemplate::GetFrontLR() const\r
+{\r
+    return mFrontLR;\r
+}\r
+\r
+void PFurnitureItemTemplate::GetFrontPos(uint16_t *nFrontPosX, uint16_t *nFrontPosY, uint16_t *nFrontPosZ) const\r
+{\r
+    *nFrontPosY = mFrontPosY;\r
+    *nFrontPosZ = mFrontPosZ;\r
+    *nFrontPosX = mFrontPosX;\r
+}\r
+\r
+void PFurnitureItemTemplate::GetPos(float *nPosX, float *nPosY, float *nPosZ) const\r
+{\r
+    *nPosY = mPosY;\r
+    *nPosZ = mPosZ;\r
+    *nPosX = mPosX;\r
+}\r
+\r
+void PFurnitureItemTemplate::SetLinkedObjectID(uint32_t nID)\r
+{\r
+    mLinkedObjectID = nID;\r
+}\r
+\r
+uint32_t PFurnitureItemTemplate::GetLinkedObjectID() const\r
+{\r
+    return mLinkedObjectID;\r
+}\r
diff --git a/TinNS/Source/GameServer/FurnitureTemplate.hxx b/TinNS/Source/GameServer/FurnitureTemplate.hxx
new file mode 100644 (file)
index 0000000..1e1abbb
--- /dev/null
@@ -0,0 +1,111 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+\r
+class PDefWorldModel;\r
+\r
+enum { // Furniture Use flags (cumlative)\r
+  ufTouchable = 1,\r
+  ufUsable = 2,\r
+  ufNoCollision = 4,\r
+  ufChair = 8,\r
+  ufToolTarget = 16,\r
+  ufSelfCollisionBox = 64,\r
+  ufGraphicalEffect = 128,\r
+  ufNoSelectionBox = 256\r
+};\r
+\r
+class PFurnitureItemTemplate {\r
+    friend class PWorldDatParser;\r
+\r
+private:\r
+    uint32_t mObjectID;\r
+\r
+    // The commented out values are not loaded from dat file atm because they are not used yet.\r
+    float mPosY; //= mPosY from dat file + 32000, to be coherent with char Pos scale\r
+    float mPosZ;\r
+    float mPosX;\r
+    //float mRotY;\r
+    float mRotZ;\r
+    //float mRotX;\r
+    //uint32_t mScale; //00 00 80 3F ?  = float(1.0000) scale factor ? // mostly used by holoscreens (passiv object)\r
+    //uint32_t mUnknown2; //01 00 00 00 ?\r
+    uint16_t mModelID; // points to models.ini\r
+    //uint32_t mUnknown3; //00 00 00 00 ?\r
+    //uint32_t mUnknown4; //00 00 00 00 ?\r
+    uint16_t mWorldmodelID; // points to worldmodel.def\r
+    //uint16_t mUnknown5; //12 00 ? // changes sometime (ex: c288 ...)\r
+\r
+    //float mBoxLowerY; //Bounding box, for use when ufSelfCollisionBox is set in mUseFlags.\r
+    //float mBoxLowerZ;\r
+    //float mBoxLowerX;\r
+    //float mBoxUpperY;\r
+    //float mBoxUpperZ;\r
+    //float mBoxUpperX;\r
+\r
+    uint16_t mFrontPosY;\r
+    uint16_t mFrontPosZ;\r
+    uint16_t mFrontPosX;\r
+    uint8_t mFrontLR;\r
+\r
+    const PDefWorldModel* mDefWorldModel;\r
+\r
+    uint32_t mLinkedObjectID; // for buttons, stores the corresponding triggered door\r
+    // fo GR, stores order of the GR entity (spawn point) to later choose from respawn.def data\r
+\r
+  public:\r
+    PFurnitureItemTemplate();\r
+    ~PFurnitureItemTemplate();\r
+\r
+    uint32_t GetID() const;\r
+    uint16_t GetUseFlags() const;\r
+    uint16_t GetFunctionType() const;\r
+    int GetFunctionValue() const;\r
+    const std::string &GetName() const; /// !!!!\r
+    const PDefWorldModel *GetDefWorldModel() const;\r
+    uint8_t GetFrontLR() const;\r
+    void GetFrontPos(uint16_t *nFrontPosX, uint16_t *nFrontPosY, uint16_t *nFrontPosZ) const;\r
+    void GetPos(float *nPosX, float *nPosY, float *nPosZ) const;\r
+\r
+    void SetLinkedObjectID(uint32_t nID);\r
+    uint32_t GetLinkedObjectID() const;\r
+};\r
+\r
+// *** from worldmodel.def ***\r
+\r
+//function Type\r
+// 0 - none\r
+//  1 - Itemcontainer\r
+// 2 - Terminal\r
+// 3 - Outfitter\r
+// 4 - Trader\r
+// 5 - Mineral\r
+// 6 - Respawn Station\r
+// 7 - GoGuardian\r
+// 8 - Hackterminal\r
+// 9 - Appartement Eingang\r
+// 10 - Appartement Ein/Ausgang\r
+// 11 - Appartement Klingel/�ffner\r
+// 12 - Standard Button\r
+// 13 - Hack Button\r
+// 14 - HOLOMATCH ENTRANCE\r
+// 15 - HOLOMATCH EXIT\r
+// 16 - HOLOMATCH REFRESH\r
+// 17 - HOLOMATCH HEAL\r
+// 18 - WORLDCHANGEACTOR\r
+// 19 - CLANTERMINAL\r
+// 20 - DATFILE WORLDCHANGE ACTOR\r
+// 21 - LOCATION FOR 20\r
+// 22 -\r
+// 23 - EINTRITTSGELD BUTTON\r
+// 24- TUTORIALEXIT\r
+// 25 - EXPLOSIVE\r
+// 26 - Outpost Switch\r
+// 27 - Old goguardian\r
+// 28 - Fahrzeug Depot Interface\r
+// 29 - Underground Exit\r
+// 30 - Static FX (Value=Type. 1=Fire 2=Smoke 3=Steam 4=Sparkle)\r
+// 31 - Venture Warp Station\r
+// 32 - functionvalue+100 gibt eine Meldung aus der Text.ini [MISC] an.\r
+//\r
similarity index 66%
rename from server/src/game/gamecommands/ban.cpp
rename to TinNS/Source/GameServer/GameCommands/Ban.cxx
index 97f103b..235aa0e 100644 (file)
@@ -1,24 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdban()\r
 {\r
@@ -45,7 +26,7 @@ void PCommands::doCmdban()
         target = GetClientByNick(tmp_destNick);\r
     }\r
 \r
-    if(target == NULL) // If victim isnt found, return error\r
+    if(target == nullptr) // If victim isnt found, return error\r
     {\r
         Chat->send(source, CHAT_DIRECT, "System", "No such player");\r
         return;\r
@@ -61,7 +42,7 @@ void PCommands::doCmdban()
     char tmpTimeVal[10];\r
     GetArgText(2, tmpTimeVal, 10);\r
 \r
-    int loop_i = 0;\r
+    int32_t loop_i = 0;\r
     char tmp_atoi[10];\r
 \r
     while(isdigit(tmpTimeVal[loop_i]) != 0 && loop_i < 10)\r
@@ -71,8 +52,8 @@ void PCommands::doCmdban()
     }\r
     char timefactor[1];\r
     timefactor[0] = tmpTimeVal[loop_i];\r
-    int timevalue = atoi(tmp_atoi);\r
-    int time_to_ban = 0;\r
+    int32_t timevalue = atoi(tmp_atoi);\r
+    int32_t time_to_ban = 0;\r
 \r
     if(strcasecmp(timefactor, "s") == 0 )\r
     {\r
@@ -95,8 +76,8 @@ void PCommands::doCmdban()
         Chat->send(source, CHAT_DIRECT, "Usage", "@ban <charID or nickname> <xS(econds)>/<xM(inutes)>/<xH(ours)>/<xD(ays)>");\r
         return;\r
     }\r
-    \r
-    int final_bantime = std::time(NULL) + time_to_ban;\r
+\r
+    int32_t final_bantime = std::time(nullptr) + time_to_ban;\r
     PAccount Acc(target->GetAccountID());\r
     Acc.SetBannedUntilTime(final_bantime);\r
     Acc.Save();\r
@@ -1,24 +1,4 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdbrightness()\r
 {\r
@@ -42,17 +22,17 @@ void PCommands::doCmdbrightness()
     GetArgText(2, tmp_v2, 30);\r
     GetArgText(3, tmp_v3, 30);\r
 \r
-    u8 val1, val2, val3, val4, val5, val6;\r
+    uint8_t val1, val2, val3, val4, val5, val6;\r
     char effStr[128];\r
     PMessage* tmpMsg;\r
 \r
     source->GetChar()->GetCurrentBodyColor(val1, val2, val3, val4, val5, val6);\r
     if(tmp_v1[0] != '-')\r
-    val4 = (u8)(atoi(tmp_v1) & 0xff);\r
+    val4 = (uint8_t)(atoi(tmp_v1) & 0xff);\r
     if((tmp_v2[0] != '-') && (tmp_v2[0] != '\0'))\r
-    val5 = (u8)(atoi(tmp_v2) & 0xff);\r
+    val5 = (uint8_t)(atoi(tmp_v2) & 0xff);\r
     if((tmp_v3[0] != '-') && (tmp_v3[0] != '\0'))\r
-    val6 = (u8)(atoi(tmp_v3) & 0xff);\r
+    val6 = (uint8_t)(atoi(tmp_v3) & 0xff);\r
     source->GetChar()->SetCurrentBodyColor(val1, val2, val3, val4, val5, val6);\r
 \r
     tmpMsg = MsgBuilder->BuildCharHelloMsg(source);\r
diff --git a/TinNS/Source/GameServer/GameCommands/Broadcast.cxx b/TinNS/Source/GameServer/GameCommands/Broadcast.cxx
new file mode 100644 (file)
index 0000000..2fcf278
--- /dev/null
@@ -0,0 +1,13 @@
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+void PCommands::doCmdbroadcast()\r
+{\r
+    if(DumbMade == false)\r
+    {\r
+        Console->Print("%s Missing packetdumb in PCommands::doCmdbroadcast for declared broadcast function!", Console->ColorText(RED, BLACK, "[PANIC]"));\r
+        return;\r
+    }\r
+\r
+    Chat->sendBroadcast(OrgPacketDumb+11);\r
+}\r
diff --git a/TinNS/Source/GameServer/GameCommands/CMakeLists.txt b/TinNS/Source/GameServer/GameCommands/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1834cce
--- /dev/null
@@ -0,0 +1,5 @@
+ADD_LIBRARY             (GameCommands Ban.cxx Brightness.cxx Broadcast.cxx Color.cxx Debug.cxx Effect.cxx GiveMoney.cxx
+                         H.cxx Info.cxx Jail.cxx Kick.cxx ListBans.cxx Npc.cxx NpcShop.cxx Online.cxx RawF.cxx
+                         Recall.cxx Remove.cxx SetLevel.cxx SetMainSkill.cxx SetSubSkill.cxx SetTime.cxx Shun.cxx
+                         Skin.cxx SpawnActor.cxx Speed.cxx T.cxx TakeMoney.cxx Teleport.cxx Test.cxx UnBan.cxx
+                         UnJail.cxx UnShun.cxx Uptime.cxx V.cxx Version.cxx Warp.cxx WarpTo.cxx Weather.cxx)
diff --git a/TinNS/Source/GameServer/GameCommands/Color.cxx b/TinNS/Source/GameServer/GameCommands/Color.cxx
new file mode 100644 (file)
index 0000000..f8bad49
--- /dev/null
@@ -0,0 +1,43 @@
+#include "GameServer/Includes.hxx"\r
+\r
+void PCommands::doCmdcolor()\r
+{\r
+    bool SyntaxError = false;\r
+    if(ArgC < 1)\r
+    {\r
+        SyntaxError = true;\r
+    }\r
+\r
+    if(SyntaxError == true)\r
+    {\r
+        Chat->send(source, CHAT_DIRECT, "Usage", "@color -|<head color: 0..255> [-|<torso color>]  [-|<legs color>]");\r
+        return;\r
+    }\r
+\r
+    char tmp_v1[30];\r
+    char tmp_v2[30];\r
+    char tmp_v3[30];\r
+\r
+    GetArgText(1, tmp_v1, 30);\r
+    GetArgText(2, tmp_v2, 30);\r
+    GetArgText(3, tmp_v3, 30);\r
+\r
+    uint8_t val1, val2, val3, val4, val5, val6;\r
+    char effStr[128];\r
+    PMessage* tmpMsg;\r
+\r
+    source->GetChar()->GetCurrentBodyColor(val1, val2, val3, val4, val5, val6);\r
+    if(tmp_v1[0] != '-')\r
+    val1 = (uint8_t)(atoi(tmp_v1) & 0xff);\r
+    if((tmp_v2[0] != '-') && (tmp_v2[0] != '\0'))\r
+    val2 = (uint8_t)(atoi(tmp_v2) & 0xff);\r
+    if((tmp_v3[0] != '-') && (tmp_v3[0] != '\0'))\r
+    val3 = (uint8_t)(atoi(tmp_v3) & 0xff);\r
+    source->GetChar()->SetCurrentBodyColor(val1, val2, val3, val4, val5, val6);\r
+\r
+    tmpMsg = MsgBuilder->BuildCharHelloMsg(source);\r
+    ClientManager->UDPBroadcast(tmpMsg, source);\r
+    snprintf(effStr, 127, "Body color set to values %d %d %d", val1, val2, val3);\r
+    effStr[127] = '\0';\r
+    Chat->send(source, CHAT_DIRECT, "System", effStr);\r
+}\r
similarity index 64%
rename from server/src/game/gamecommands/debug.cpp
rename to TinNS/Source/GameServer/GameCommands/Debug.cxx
index 6a63e3a..6b45f67 100644 (file)
@@ -1,24 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmddebug()\r
 {\r
@@ -27,7 +8,7 @@ void PCommands::doCmddebug()
     const char* DbgTarget = "all";\r
     char DbgMessage[80];\r
     const char* Usage = "@debug [loc[ation] | it[emid] | sub[way]] [0|1]";\r
-    \r
+\r
     if(ArgC > 0)\r
     {\r
       if(IsArgNumeric(1) == true)\r
@@ -63,7 +44,7 @@ void PCommands::doCmddebug()
               }\r
           }\r
       }\r
-  \r
+\r
       if (nWhat != DBG_ALL)\r
       {\r
           if(ArgC == 1)\r
@@ -80,7 +61,7 @@ void PCommands::doCmddebug()
           }\r
       }\r
     }\r
-    \r
+\r
     if (nHow != -1)\r
     {\r
         source->SetDebugMode(nWhat, nHow);\r
diff --git a/TinNS/Source/GameServer/GameCommands/Effect.cxx b/TinNS/Source/GameServer/GameCommands/Effect.cxx
new file mode 100644 (file)
index 0000000..926b92d
--- /dev/null
@@ -0,0 +1,36 @@
+#include <cstdint>\r
+#include <cstdio>\r
+#include "GameServer/Includes.hxx"\r
+\r
+void PCommands::doCmdeffect()\r
+{\r
+    bool SyntaxError = false;\r
+    if(ArgC < 1)\r
+    {\r
+        SyntaxError = true;\r
+    }\r
+\r
+    if(IsArgNumeric(1) == false)\r
+        SyntaxError = true;\r
+\r
+    if(SyntaxError == true)\r
+    {\r
+        Chat->send(source, CHAT_DIRECT, "Usage", "@effect <effect: 0=none, 1 .. 17> [<density: 0=max .. 255=min>]");\r
+        return;\r
+    }\r
+\r
+    uint8_t val1, val2;\r
+    char effStr[128];\r
+    PMessage* tmpMsg;\r
+\r
+    val1 = (uint8_t)(GetArgInt(1) & 0xff);\r
+    val2 = (uint8_t)(GetArgInt(2) & 0xff);\r
+\r
+    source->GetChar()->SetBodyEffect(val1, val2);\r
+\r
+    tmpMsg = MsgBuilder->BuildCharHelloMsg(source);\r
+    ClientManager->UDPBroadcast(tmpMsg, source);\r
+    snprintf(effStr, 127, "Body effect set to value %d with density %d (but you can see it yourself)", val1, val2);\r
+    effStr[127] = '\0';\r
+    Chat->send(source, CHAT_DIRECT, "System", effStr);\r
+}\r
@@ -1,28 +1,8 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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"
+#include "GameServer/Includes.hxx"
 
 void PCommands::doCmdgivemoney()
 {
-    u32 cashtoadd = 0;
+    uint32_t cashtoadd = 0;
     bool SyntaxError = false;
     if(ArgC < 1)
     {
@@ -35,7 +15,7 @@ void PCommands::doCmdgivemoney()
     }
     else
     {
-        cashtoadd = (u32)GetArgInt(1);
+        cashtoadd = (uint32_t)GetArgInt(1);
     }
     if(cashtoadd == 0)
         SyntaxError = true;
@@ -72,9 +52,9 @@ void PCommands::doCmdgivemoney()
             return;
         }
 
-        u32 oldcashval = target->GetChar()->GetCash();
-        u32 newcashvalue = target->GetChar()->SetCash(oldcashval + cashtoadd);
-        u32 diffcash = newcashvalue - oldcashval;
+        uint32_t oldcashval = target->GetChar()->GetCash();
+        uint32_t newcashvalue = target->GetChar()->SetCash(oldcashval + cashtoadd);
+        uint32_t diffcash = newcashvalue - oldcashval;
 
         PMessage* tmpMsg_cash = MsgBuilder->BuildCharMoneyUpdateMsg(target, newcashvalue);
         target->SendUDPMessage(tmpMsg_cash);
@@ -87,8 +67,8 @@ void PCommands::doCmdgivemoney()
     }
     else
     {
-        u32 oldcashval = source->GetChar()->GetCash();
-        u32 newcashvalue = source->GetChar()->SetCash(oldcashval + cashtoadd);
+        uint32_t oldcashval = source->GetChar()->GetCash();
+        uint32_t newcashvalue = source->GetChar()->SetCash(oldcashval + cashtoadd);
 
         PMessage* tmpMsg_cash = MsgBuilder->BuildCharMoneyUpdateMsg(source, newcashvalue);
         source->SendUDPMessage(tmpMsg_cash);
similarity index 59%
rename from server/src/game/gamecommands/h.cpp
rename to TinNS/Source/GameServer/GameCommands/H.cxx
index 3d4ccd9..c39272e 100644 (file)
@@ -1,24 +1,4 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmd_dev_h()\r
 {\r
@@ -35,7 +15,7 @@ void PCommands::doCmd_dev_h()
 /*\r
   u8 val1, val2, val3, val4;\r
   char tmpStr[128];\r
-  \r
+\r
   if(ArgC > 0)\r
   {\r
     val1 = (u8)(GetArgInt(1) & 0xff);\r
@@ -51,7 +31,7 @@ void PCommands::doCmd_dev_h()
     val4 = 0x01;\r
   }\r
 \r
-    PMessage* tmpMsg = new PMessage(14);  \r
+    PMessage* tmpMsg = new PMessage(14);\r
 \r
        *tmpMsg << (u8)0x13;\r
        *tmpMsg << (u16)0x0000; //source->GetUDP_ID(); // just placeholder, must be set outside\r
similarity index 78%
rename from server/src/game/gamecommands/info.cpp
rename to TinNS/Source/GameServer/GameCommands/Info.cxx
index b4f372b..c481ad7 100644 (file)
@@ -1,24 +1,4 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdinfo()\r
 {\r
@@ -66,9 +46,9 @@ void PCommands::doCmdinfo()
         DIRECT> Info: Cash         : %d     // Chars->GetChar(source->GetCharID())->GetCash();\r
         DIRECT> Info: Soullight    : %d     // Chars->GetChar(source->GetCharID())->GetSoullight();\r
     */\r
-    \r
+\r
     PAccount Acc(target->GetAccountID());\r
-    \r
+\r
     // If source != target\r
     if(source->GetAccountID() != target->GetAccountID())\r
     {\r
@@ -98,7 +78,7 @@ void PCommands::doCmdinfo()
     snprintf(tmpInfo_AxxLv, 150,    "AccessLevel: %d",  Acc.GetLevel());\r
     snprintf(tmpInfo_Loc, 150,      "Current Loc: %d",  Chars->GetChar(target->GetCharID())->GetLocation());\r
     snprintf(tmpInfo_IP, 150,       "IP address : %s",  target->GetAddress());\r
-    \r
+\r
     tmpInfo_head[150] = '\0';\r
     tmpInfo_cID[150] = '\0';\r
     tmpInfo_aID[150] = '\0';\r
similarity index 68%
rename from server/src/game/gamecommands/jail.cpp
rename to TinNS/Source/GameServer/GameCommands/Jail.cxx
index d3c60eb..3a715d8 100644 (file)
@@ -1,24 +1,5 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 void PCommands::doCmdjail()
 {
@@ -60,7 +41,7 @@ void PCommands::doCmdjail()
     return;
   }
 
-  u32 currLoc = target->GetChar()->GetLocation();
+  uint32_t currLoc = target->GetChar()->GetLocation();
   // Make sure that target player is not already in Regants
   if ( currLoc == 550 || currLoc == 551 )
   {
similarity index 67%
rename from server/src/game/gamecommands/kick.cpp
rename to TinNS/Source/GameServer/GameCommands/Kick.cxx
index 49edb01..ffa22d2 100644 (file)
@@ -1,24 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 void PCommands::doCmdkick()\r
 {\r
diff --git a/TinNS/Source/GameServer/GameCommands/ListBans.cxx b/TinNS/Source/GameServer/GameCommands/ListBans.cxx
new file mode 100644 (file)
index 0000000..88c5fa5
--- /dev/null
@@ -0,0 +1,8 @@
+#include "GameServer/Includes.hxx"\r
+\r
+void PCommands::doCmdlistbans()\r
+{\r
+    Chat->send(source, CHAT_DIRECT, "System", "Sorry, namikon was too lazy to code that ^^");\r
+    Chat->send(source, CHAT_DIRECT, "System", "Please wait until the ban is removed automaticly or edit your sqlDB");\r
+    return;\r
+}\r
similarity index 89%
rename from server/src/game/gamecommands/npc.cpp
rename to TinNS/Source/GameServer/GameCommands/Npc.cxx
index 847c4ca..8737347 100644 (file)
@@ -1,24 +1,7 @@
-/*
-   TinNS (TinNS is not a Neocron Server)
-   Copyright (C) 2005 Linux Addicted Community
-   maintainer Akiko <akiko@gmx.org>
-
-   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"
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "Common/Includes.hxx"
 
 void PCommands::doNPC()
 {
@@ -128,16 +111,16 @@ void PCommands::doNPC()
         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();
+        uint16_t tNPCPosX = source->GetChar()->Coords.mX + 768;
+        uint16_t tNPCPosY = source->GetChar()->Coords.mY + 768;
+        uint16_t tNPCPosZ = source->GetChar()->Coords.mZ + 768;
+        uint32_t tLocation = source->GetChar()->GetLocation();
 
-        u8 tAngle = source->GetChar()->Coords.mLR;
+        uint8_t tAngle = source->GetChar()->Coords.mLR;
         std::string tNPCAngle = Ssprintf( "%d", tAngle );
 
         std::string tNPCScript = t_defNpc->GetStandardScript();
-        u32 tNPCHealth = t_defNpc->GetHealth() * NPC_HEALTHFACTOR;
+        uint32_t tNPCHealth = t_defNpc->GetHealth() * NPC_HEALTHFACTOR;
 
         /*-------------------------------------------------------*/
         // Get the highest NPC Id for current zone
similarity index 89%
rename from server/src/game/gamecommands/npc_shop.cpp
rename to TinNS/Source/GameServer/GameCommands/NpcShop.cxx
index e7ffcf4..3224da5 100644 (file)
@@ -1,24 +1,6 @@
-/*
-   TinNS (TinNS is not a Neocron Server)
-   Copyright (C) 2005 Linux Addicted Community
-   maintainer Akiko <akiko@gmx.org>
-
-   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"
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
 
 void PCommands::doNPC_Shop()
 {
@@ -218,7 +200,7 @@ void PCommands::doNPC_Shop()
     }
     else if(strncmp(tmp_npccommand, "setquality", 10) == 0)
     {
-        u8 tNewLv = (u8)GetArgInt(3);
+        uint8_t tNewLv = (uint8_t)GetArgInt(3);
         if(targetNPC->IsSQLNPC() == true)
         {
             char sqlq[200];
diff --git a/TinNS/Source/GameServer/GameCommands/Online.cxx b/TinNS/Source/GameServer/GameCommands/Online.cxx
new file mode 100644 (file)
index 0000000..096d394
--- /dev/null
@@ -0,0 +1,8 @@
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+void PCommands::doCmdconlist()\r
+{\r
+    if (gDevDebug) Console->Print("IngameCommand: Sending connected-player-list to charID %d", source->GetCharID());\r
+    Chat->sendConnectedList(source, false);\r
+}\r
similarity index 69%
rename from server/src/game/gamecommands/rawf.cpp
rename to TinNS/Source/GameServer/GameCommands/RawF.cxx
index 917409d..0dab13a 100644 (file)
@@ -1,24 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 void PCommands::doCmdrawf()\r
 {\r
similarity index 71%
rename from server/src/game/gamecommands/recall.cpp
rename to TinNS/Source/GameServer/GameCommands/Recall.cxx
index 5a73f4d..f9a4751 100644 (file)
@@ -1,24 +1,5 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 void PCommands::doCmdrecall()
 {
@@ -75,7 +56,7 @@ void PCommands::doCmdrecall()
     target->SendUDPMessage( tmpMsg_zone );
     tmpMsg_zone = NULL;
 
-    u16 nNewX, nNewY, nNewZ;
+    uint16_t nNewX, nNewY, nNewZ;
     nNewX = source->GetChar()->Coords.mX;
     nNewY = source->GetChar()->Coords.mY;
     nNewZ = source->GetChar()->Coords.mZ;
similarity index 61%
rename from server/src/game/gamecommands/remove.cpp
rename to TinNS/Source/GameServer/GameCommands/Remove.cxx
index 4348b10..d52948a 100644 (file)
@@ -1,24 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdremove()\r
 {\r
@@ -53,17 +34,17 @@ void PCommands::doCmdremove()
 \r
     if(IsArgNumeric(1) == true)\r
     {\r
-        u32 tTest = GetArgInt(1);\r
+        uint32_t tTest = GetArgInt(1);\r
         if(WorldActors->IsDynamicActor(tTest) == true)\r
         {\r
             Chat->send(source, CHAT_DIRECT, "System", "You cannot remove dynamic actors over their ID!");\r
             return;\r
         }\r
-        u32 TargetID;\r
+        uint32_t TargetID;\r
         char delStr[128];\r
         PMessage* tmpMsg;\r
 \r
-        TargetID = (u32)(atoi(tmp_v1) & 0xffffffff);\r
+        TargetID = (uint32_t)(atoi(tmp_v1) & 0xffffffff);\r
         tmpMsg = MsgBuilder->BuildFurnitureActivateMsg(source, TargetID, 5);\r
 \r
         ClientManager->UDPBroadcast(tmpMsg, source);\r
@@ -1,24 +1,4 @@
-/*\r
-   TinNS (TinNS is not a Neocron Server)\r
-   Copyright (C) 2005 Linux Addicted Community\r
-   maintainer Akiko <akiko@gmx.org>\r
-\r
-   This program is free software; you can redistribute it and/or\r
-   modify it under the terms of the GNU General Public License\r
-   as published by the Free Software Foundation; either version 2\r
-   of the License, or (at your option) any later version.\r
-\r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-   GNU General Public License for more details.\r
-\r
-   You should have received a copy of the GNU General Public License\r
-   along with this program; if not, write to the Free Software\r
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-   02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdsetlevel()\r
 {\r
@@ -1,29 +1,9 @@
-/*
-   TinNS (TinNS is not a Neocron Server)
-   Copyright (C) 2005 Linux Addicted Community
-   maintainer Akiko <akiko@gmx.org>
-
-   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"
+#include "GameServer/Includes.hxx"
 
 void PCommands::doCmdSetMainSkill()
 {
-    u8 tNewLevel = 0;
-    u8 tMainSkill = 0;
+    uint8_t tNewLevel = 0;
+    uint8_t tMainSkill = 0;
 
     bool SyntaxError = false;
     if (ArgC < 2)
@@ -34,12 +14,12 @@ void PCommands::doCmdSetMainSkill()
     if (IsArgNumeric(1) == false)
         SyntaxError = true;
     else
-        tMainSkill = (u16)GetArgInt(1);
+        tMainSkill = (uint16_t)GetArgInt(1);
 
     if (IsArgNumeric(2) == false)
         SyntaxError = true;
     else
-        tNewLevel = (u8)GetArgInt(2);
+        tNewLevel = (uint8_t)GetArgInt(2);
 
     if (tNewLevel == 0)
         SyntaxError = true;
@@ -77,8 +57,8 @@ void PCommands::doCmdSetMainSkill()
         temp_target = source;
 
     // Now setting player's Skill tMainSkill to tNewLevel
-    u8 tOldLevel = 0;
-    u16 tNewSkillPoints = 0;
+    uint8_t tOldLevel = 0;
+    uint16_t tNewSkillPoints = 0;
     int tLevelDiff = 0;
 
     // Grab old Level
@@ -108,7 +88,7 @@ void PCommands::doCmdSetMainSkill()
     char tmp[50];
     snprintf(tmp, 50, "Setting Level to %d", tNewLevel);
     Chat->send(source, CHAT_DIRECT, "System", tmp);
-    //PMessage* PMsgBuilder::BuildLevelUpMessage( PClient* nClient, u8 nMainSkill, u8 nNewLevel, u16 nFreeSkillPoints)
+    //PMessage* PMsgBuilder::BuildLevelUpMessage( PClient* nClient, uint8_t nMainSkill, uint8_t nNewLevel, uint16_t nFreeSkillPoints)
     PMessage* tmpMsg_setLv = MsgBuilder->BuildLevelUpMessage(temp_target, tMainSkill, tNewLevel, tNewSkillPoints);
     temp_target->SendUDPMessage(tmpMsg_setLv);
     tmpMsg_setLv = NULL;
@@ -1,29 +1,9 @@
-/*
-   TinNS (TinNS is not a Neocron Server)
-   Copyright (C) 2005 Linux Addicted Community
-   maintainer Akiko <akiko@gmx.org>
-
-   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"
+#include "GameServer/Includes.hxx"
 
 void PCommands::doCmdSetSubSkill()
 {
-    u8 tNewLevel = 0;
-    u8 tSubSkill = 0;
+    uint8_t tNewLevel = 0;
+    uint8_t tSubSkill = 0;
 
     bool SyntaxError = false;
     if (ArgC < 2)
@@ -34,12 +14,12 @@ void PCommands::doCmdSetSubSkill()
     if (IsArgNumeric(1) == false)
         SyntaxError = true;
     else
-        tSubSkill = (u16)GetArgInt(1);
+        tSubSkill = (uint16_t)GetArgInt(1);
 
     if (IsArgNumeric(2) == false)
         SyntaxError = true;
     else
-        tNewLevel = (u8)GetArgInt(2);
+        tNewLevel = (uint8_t)GetArgInt(2);
 
     if (tNewLevel == 0)
         SyntaxError = true;
@@ -78,7 +58,7 @@ void PCommands::doCmdSetSubSkill()
 
 
     // Now setting player's Skill tMainSkill to tNewLevel
-    u8 tOldLevel = 0;
+    uint8_t tOldLevel = 0;
     int tLevelDiff = 0;
 
     // Grab old Level
diff --git a/TinNS/Source/GameServer/GameCommands/SetTime.cxx b/TinNS/Source/GameServer/GameCommands/SetTime.cxx
new file mode 100644 (file)
index 0000000..0b38078
--- /dev/null
@@ -0,0 +1,17 @@
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+void PCommands::doCmdsettime()\r
+{\r
+    if(ArgC < 1 && GetArgInt(1) == 0)\r
+    {\r
+       Chat->send(source, CHAT_DIRECT, "Usage", "@settime <raw timevalue>");\r
+       return;\r
+    }\r
+\r
+    int newtime = 0;\r
+    newtime = GetArgInt(1);\r
+\r
+    GameServer->SetGameTime(newtime);\r
+    Console->Print("IngameCommand: CharID %d set ingametime to %d", source->GetCharID(), newtime);\r
+}\r
similarity index 61%
rename from server/src/game/gamecommands/shun.cpp
rename to TinNS/Source/GameServer/GameCommands/Shun.cxx
index 8a39cc2..c899549 100644 (file)
@@ -1,24 +1,4 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdshun()\r
 {\r
similarity index 74%
rename from server/src/game/gamecommands/skin.cpp
rename to TinNS/Source/GameServer/GameCommands/Skin.cxx
index 64feec4..249fa29 100644 (file)
@@ -1,24 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include <sstream>\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdskin()\r
 {\r
@@ -38,7 +19,7 @@ Usage:  @skin #<chardef idx>
         SyntaxError = true;\r
     }\r
 \r
-    u32 Skinval1, Skinval2, Skinval3, Skinval4;\r
+    uint32_t Skinval1, Skinval2, Skinval3, Skinval4;\r
     PChar *SkinChar = Chars->GetChar(source->GetCharID());\r
     std::stringstream SkinChat;\r
     char SkinStr[128];\r
@@ -1,24 +1,4 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdspawnactor()\r
 {\r
@@ -33,11 +13,11 @@ void PCommands::doCmdspawnactor()
         SyntaxError = true;\r
     }\r
 \r
-    u16 tmpActorID = (u16)GetArgInt(1);\r
-    u16 tmpFunctionID = (u16)GetArgInt(2);\r
-    u16 tmpOption1 = 0;\r
-    u16 tmpOption2 = 0;\r
-    u16 tmpOption3 = 0;\r
+    uint16_t tmpActorID = (uint16_t)GetArgInt(1);\r
+    uint16_t tmpFunctionID = (uint16_t)GetArgInt(2);\r
+    uint16_t tmpOption1 = 0;\r
+    uint16_t tmpOption2 = 0;\r
+    uint16_t tmpOption3 = 0;\r
 \r
     if(ArgC > 2)\r
     {\r
@@ -47,7 +27,7 @@ void PCommands::doCmdspawnactor()
         }\r
         else\r
         {\r
-            tmpOption1 = (u16)GetArgInt(3);\r
+            tmpOption1 = (uint16_t)GetArgInt(3);\r
             if(ArgC > 3)\r
             {\r
                 if(IsArgNumeric(4) == false)\r
@@ -56,7 +36,7 @@ void PCommands::doCmdspawnactor()
                 }\r
                 else\r
                 {\r
-                    tmpOption1 = (u16)GetArgInt(4);\r
+                    tmpOption1 = (uint16_t)GetArgInt(4);\r
                     if(ArgC > 4)\r
                     {\r
                         if(IsArgNumeric(4) == false)\r
@@ -65,7 +45,7 @@ void PCommands::doCmdspawnactor()
                         }\r
                         else\r
                         {\r
-                            tmpOption1 = (u16)GetArgInt(5);\r
+                            tmpOption1 = (uint16_t)GetArgInt(5);\r
                         }\r
                     }\r
                 }\r
diff --git a/TinNS/Source/GameServer/GameCommands/Speed.cxx b/TinNS/Source/GameServer/GameCommands/Speed.cxx
new file mode 100644 (file)
index 0000000..8b86daa
--- /dev/null
@@ -0,0 +1,35 @@
+#include "GameServer/Includes.hxx"\r
+\r
+void PCommands::doCmdspeed()\r
+{\r
+// Speed override setting.\r
+// Usage: @speed <newspeed> | #\r
+//  with <speed> = 0 (no move).. 254 , 255 or # meaning "no speed override"\r
+\r
+    bool SyntaxError = false;\r
+    if(ArgC < 1)\r
+    {\r
+        SyntaxError = true;\r
+    }\r
+\r
+    if(SyntaxError == true)\r
+    {\r
+        Chat->send(source, CHAT_DIRECT, "Usage", "@speed <newspeed: 0 .. 254 > | 255 | #");\r
+        return;\r
+    }\r
+    char tmpval[30];\r
+    GetArgText(1, tmpval, 30);\r
+\r
+    uint8_t val1;\r
+    char effStr[128];\r
+    PMessage* tmpMsg;\r
+\r
+    val1 = ((tmpval[0] == '#') ? 255 : (uint8_t)(atoi(tmpval) & 0xff));\r
+    source->GetChar()->SetSpeedOverride(val1);\r
+\r
+    tmpMsg = MsgBuilder->BuildCharHelloMsg(source);\r
+    ClientManager->UDPBroadcast(tmpMsg, source);\r
+    snprintf(effStr, 127, "Speed override set to value %d ", val1);\r
+    effStr[127] = '\0';\r
+    Chat->send(source, CHAT_DIRECT, "System", effStr);\r
+}\r
similarity index 60%
rename from server/src/game/gamecommands/t.cpp
rename to TinNS/Source/GameServer/GameCommands/T.cxx
index a20da9b..49b70f4 100644 (file)
@@ -1,24 +1,7 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include <chrono>\r
+#include <thread>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 void PCommands::doCmd_dev_t()\r
 {\r
@@ -36,27 +19,27 @@ void PCommands::doCmd_dev_t()
   if ( ArgC >= 2 )\r
   {\r
     GetArgText( 1, Arg1, 30 );\r
-    u32 targetObjectId = GetArgInt( 2 ) & 0xffffffff;\r
+    uint32_t targetObjectId = GetArgInt( 2 ) & 0xffffffff;\r
     if ( Arg1[0] == 't' )\r
     {\r
-      u8 val1;\r
+      uint8_t val1;\r
       if ( ArgC >= 3 )\r
       {\r
         int val2 = GetArgInt( 3 );\r
         tmpMsg = new PMessage( 32 );\r
         source->IncreaseUDP_ID();\r
-        *tmpMsg << ( u8 )0x13;\r
-        *tmpMsg << ( u16 )source->GetUDP_ID();\r
-        *tmpMsg << ( u16 )source->GetSessionID();\r
-        *tmpMsg << ( u8 )0x00; // Message length\r
-        *tmpMsg << ( u8 )0x03;\r
-        *tmpMsg << ( u16 )source->GetUDP_ID();\r
-        *tmpMsg << ( u8 )0x2d;\r
-        *tmpMsg << ( u32 )targetObjectId;\r
-        *tmpMsg << ( u8 )0x01;\r
-        *tmpMsg << ( u32 )val2;\r
-  \r
-        ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
+        *tmpMsg << ( uint8_t )0x13;\r
+        *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+        *tmpMsg << ( uint16_t )source->GetSessionID();\r
+        *tmpMsg << ( uint8_t )0x00; // Message length\r
+        *tmpMsg << ( uint8_t )0x03;\r
+        *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+        *tmpMsg << ( uint8_t )0x2d;\r
+        *tmpMsg << ( uint32_t )targetObjectId;\r
+        *tmpMsg << ( uint8_t )0x01;\r
+        *tmpMsg << ( uint32_t )val2;\r
+\r
+        ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
         source->SendUDPMessage( tmpMsg );\r
         snprintf( tmpStr, 127, "Sent 13/03/2d msg to object id 0x%08x with values 6/%d", targetObjectId, val2 );\r
         textMsg = tmpStr;\r
@@ -66,17 +49,17 @@ void PCommands::doCmd_dev_t()
         if(val1 == 6) continue;\r
         tmpMsg = new PMessage( 15 );\r
         source->IncreaseUDP_ID();\r
-        *tmpMsg << ( u8 )0x13;\r
-        *tmpMsg << ( u16 )source->GetUDP_ID();\r
-        *tmpMsg << ( u16 )source->GetSessionID();\r
-        *tmpMsg << ( u8 )0x00; // Message length\r
-        *tmpMsg << ( u8 )0x03;\r
-        *tmpMsg << ( u16 )source->GetUDP_ID();\r
-        *tmpMsg << ( u8 )0x2d;\r
-        *tmpMsg << ( u32 )targetObjectId;\r
-        *tmpMsg << ( u8 )val1; \r
-  \r
-        ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
+        *tmpMsg << ( uint8_t )0x13;\r
+        *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+        *tmpMsg << ( uint16_t )source->GetSessionID();\r
+        *tmpMsg << ( uint8_t )0x00; // Message length\r
+        *tmpMsg << ( uint8_t )0x03;\r
+        *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+        *tmpMsg << ( uint8_t )0x2d;\r
+        *tmpMsg << ( uint32_t )targetObjectId;\r
+        *tmpMsg << ( uint8_t )val1;\r
+\r
+        ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
         source->SendUDPMessage( tmpMsg );\r
         snprintf( tmpStr, 127, "Sent 13/03/2d msg to object id 0x%08x with value %d", targetObjectId, val1 );\r
         textMsg = tmpStr;\r
@@ -84,14 +67,15 @@ void PCommands::doCmd_dev_t()
         Chat->send( source, CHAT_DIRECT, "System", textMsg );\r
         source->getUDPConn()->update();\r
         source->getTCPConn()->update();\r
-        sleep(1);\r
+        //sleep(1);\r
+        std::this_thread::sleep_for(std::chrono::seconds(1));\r
       }\r
       tmpMsg = NULL;\r
     }\r
     else if ( Arg1[0] == 'd' )\r
     {\r
-      u8 val1 = 0x4a; // default values\r
-      u8 val2 = 0x1e;\r
+      uint8_t val1 = 0x4a; // default values\r
+      uint8_t val2 = 0x1e;\r
 \r
       if ( ArgC >= 3 )\r
         val1 = GetArgInt( 3 ) & 0xff;\r
@@ -103,9 +87,9 @@ void PCommands::doCmd_dev_t()
     }\r
     else if ( Arg1[0] == 'm' )\r
     {\r
-      u8 nTxtGroupID = targetObjectId & 0xff;\r
-      u16 nTxtID = 10;\r
-      //u32 nVal = 0;\r
+      uint8_t nTxtGroupID = targetObjectId & 0xff;\r
+      uint16_t nTxtID = 10;\r
+      //uint32_t nVal = 0;\r
       if ( ArgC >= 3 )\r
         nTxtID = GetArgInt( 3 ) & 0xffff;\r
       //if(ArgC >= 4)\r
@@ -114,27 +98,27 @@ void PCommands::doCmd_dev_t()
       tmpMsg = new PMessage( 20 );\r
 \r
       source->IncreaseUDP_ID();\r
-      *tmpMsg << ( u8 )0x13;\r
-      *tmpMsg << ( u16 )source->GetUDP_ID();\r
-      *tmpMsg << ( u16 )source->GetSessionID();\r
-      *tmpMsg << ( u8 )0x0e; // Message length\r
-      *tmpMsg << ( u8 )0x03;\r
-      *tmpMsg << ( u16 )source->GetUDP_ID();\r
-      *tmpMsg << ( u8 )0x1f;\r
-      *tmpMsg << ( u16 )source->GetLocalID();\r
-      *tmpMsg << ( u8 )0x25; // ??\r
-      *tmpMsg << ( u8 )0x15; // ??\r
+      *tmpMsg << ( uint8_t )0x13;\r
+      *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+      *tmpMsg << ( uint16_t )source->GetSessionID();\r
+      *tmpMsg << ( uint8_t )0x0e; // Message length\r
+      *tmpMsg << ( uint8_t )0x03;\r
+      *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+      *tmpMsg << ( uint8_t )0x1f;\r
+      *tmpMsg << ( uint16_t )source->GetLocalID();\r
+      *tmpMsg << ( uint8_t )0x25; // ??\r
+      *tmpMsg << ( uint8_t )0x15; // ??\r
       *tmpMsg << nTxtGroupID;\r
       *tmpMsg << nTxtID;\r
-      *tmpMsg << ( u16 )0x00; // ??\r
-      *tmpMsg << ( u8 )0x01;\r
-      *tmpMsg << ( u8 )0x04;\r
-      *tmpMsg << ( u32 )0x00;\r
-      //*tmpMsg << (u8)0x00; // ??\r
-      //*tmpMsg << (u8)0x00; // ??\r
-      //*tmpMsg << (u32)nVal;\r
-\r
-      ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
+      *tmpMsg << ( uint16_t )0x00; // ??\r
+      *tmpMsg << ( uint8_t )0x01;\r
+      *tmpMsg << ( uint8_t )0x04;\r
+      *tmpMsg << ( uint32_t )0x00;\r
+      //*tmpMsg << (uint8_t)0x00; // ??\r
+      //*tmpMsg << (uint8_t)0x00; // ??\r
+      //*tmpMsg << (uint32_t)nVal;\r
+\r
+      ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
       snprintf( tmpStr, 127, "Using msg n %d from group %d", nTxtID, nTxtGroupID );\r
       textMsg = tmpStr;\r
 \r
@@ -144,36 +128,36 @@ void PCommands::doCmd_dev_t()
     else if ( Arg1[0] == 'e' )\r
     {\r
       targetObjectId = 1004; //target=int\r
-      u16 nval = 5;\r
-      u8 nType = 1; // 1=+ 2=-\r
-      u16 nDur = 20;\r
-      u8 nparam = 1;\r
+      uint16_t nval = 5;\r
+      uint8_t nType = 1; // 1=+ 2=-\r
+      uint16_t nDur = 20;\r
+      uint8_t nparam = 1;\r
 \r
         nparam = GetArgInt( 2 ) && 0xff;\r
 \r
         tmpMsg = new PMessage( 32 );\r
 \r
         source->IncreaseUDP_ID();\r
-        *tmpMsg << ( u8 )0x13;\r
-        *tmpMsg << ( u16 )source->GetUDP_ID();\r
-        *tmpMsg << ( u16 )source->GetSessionID();\r
-        *tmpMsg << ( u8 )0x0e; // Message length\r
-        *tmpMsg << ( u8 )0x03;\r
-        *tmpMsg << ( u16 )source->GetUDP_ID();\r
-        *tmpMsg << ( u8 )0x1f;\r
-        *tmpMsg << ( u16 )source->GetLocalID();\r
-        *tmpMsg << ( u8 )0x25; // ??\r
-        *tmpMsg << ( u8 )0x06; // ??\r
-        *tmpMsg << ( u8 )0x01; // 1 effect\r
-        *tmpMsg << ( u8 )0x01; // effect on intox level ????\r
-        *tmpMsg << ( u16 )nDur;\r
-        *tmpMsg << ( u16 )(700+(targetObjectId % 100)); //item id Thyronol\r
-        *tmpMsg << ( u8 )nType;\r
-        *tmpMsg << ( u16 )(nval*100); //u32 in nc2.2\r
-        *tmpMsg << ( u16 )targetObjectId;\r
-\r
-\r
-        ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
+        *tmpMsg << ( uint8_t )0x13;\r
+        *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+        *tmpMsg << ( uint16_t )source->GetSessionID();\r
+        *tmpMsg << ( uint8_t )0x0e; // Message length\r
+        *tmpMsg << ( uint8_t )0x03;\r
+        *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+        *tmpMsg << ( uint8_t )0x1f;\r
+        *tmpMsg << ( uint16_t )source->GetLocalID();\r
+        *tmpMsg << ( uint8_t )0x25; // ??\r
+        *tmpMsg << ( uint8_t )0x06; // ??\r
+        *tmpMsg << ( uint8_t )0x01; // 1 effect\r
+        *tmpMsg << ( uint8_t )0x01; // effect on intox level ????\r
+        *tmpMsg << ( uint16_t )nDur;\r
+        *tmpMsg << ( uint16_t )(700+(targetObjectId % 100)); //item id Thyronol\r
+        *tmpMsg << ( uint8_t )nType;\r
+        *tmpMsg << ( uint16_t )(nval*100); //uint32_t in nc2.2\r
+        *tmpMsg << ( uint16_t )targetObjectId;\r
+\r
+\r
+        ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
         snprintf( tmpStr, 127, "Sendind drug mod to stat %d, %s %d", targetObjectId, (nType == 1 ? "inc" : "dec"), nval );\r
         textMsg = tmpStr;\r
 \r
@@ -183,7 +167,7 @@ void PCommands::doCmd_dev_t()
     else if ( Arg1[0] == 'w' )\r
     {\r
       /*targetObjectId &= 0xffff;\r
-      u16 val1 = 0;\r
+      uint16_t val1 = 0;\r
       if ( ArgC >= 3 )\r
         val1 = GetArgInt( 3 ) & 0xffff;\r
 */\r
@@ -191,18 +175,18 @@ void PCommands::doCmd_dev_t()
 \r
       source->IncreaseUDP_ID();\r
 \r
-      *tmpMsg << ( u8 )0x13;\r
-      *tmpMsg << ( u16 )source->GetUDP_ID();\r
-      *tmpMsg << ( u16 )source->GetSessionID();\r
-      *tmpMsg << ( u8 )0x0a; // Message length place;\r
-      *tmpMsg << ( u8 )0x03;\r
-      *tmpMsg << ( u16 )source->GetUDP_ID();\r
-      *tmpMsg << ( u8 )0x23;\r
-      *tmpMsg << ( u16 )0x0012; // cmd = ?\r
-      *tmpMsg << ( u16 )0x0007;\r
-      *tmpMsg << ( u32 )0x00000000;\r
+      *tmpMsg << ( uint8_t )0x13;\r
+      *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+      *tmpMsg << ( uint16_t )source->GetSessionID();\r
+      *tmpMsg << ( uint8_t )0x0a; // Message length place;\r
+      *tmpMsg << ( uint8_t )0x03;\r
+      *tmpMsg << ( uint16_t )source->GetUDP_ID();\r
+      *tmpMsg << ( uint8_t )0x23;\r
+      *tmpMsg << ( uint16_t )0x0012; // cmd = ?\r
+      *tmpMsg << ( uint16_t )0x0007;\r
+      *tmpMsg << ( uint32_t )0x00000000;\r
 \r
-      ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
+      ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
 \r
       snprintf( tmpStr, 127, "Sending w msg " );\r
       textMsg = tmpStr;\r
@@ -212,7 +196,7 @@ void PCommands::doCmd_dev_t()
     }\r
     else if ( Arg1[0] == 'x' )\r
     {\r
-      u8 val1 = targetObjectId &= 0xff;\r
+      uint8_t val1 = targetObjectId &= 0xff;\r
 \r
       tmpMsg = MsgBuilder->BuildUndefineduseMsg( source, val1 );\r
 \r
@@ -251,8 +235,8 @@ void PCommands::doCmd_dev_t()
         }\r
     }\r
 \r
-    u32 val1;\r
-    u8 val2;\r
+    uint32_t val1;\r
+    uint8_t val2;\r
     char tmpStr[128];\r
     static PMessage* tmpMsg = NULL;\r
     bool SetUDP_IDNeeded = true;\r
@@ -271,7 +255,7 @@ void PCommands::doCmd_dev_t()
     if(Arg1[0] != '\0' && Arg2[0] != '\0')\r
     {\r
         val1 = atoi(Arg1);\r
-        val2 = (u8)(atoi(Arg2) & 0xff);\r
+        val2 = (uint8_t)(atoi(Arg2) & 0xff);\r
         //tmpMsg->U8Data(16 + val1) = val2;\r
         tmpMsg->U8Data(10 + val1) = val2;\r
         snprintf(tmpStr, 127, "Data #%d set to value 0x%02x", val1, val2);\r
@@ -306,7 +290,7 @@ void PCommands::doCmd_dev_t()
       return;\r
 \r
   char tmpStr[128];\r
- u8 SubWay[] = {0x13, 0x71, 0x00, 0x9b, 0xde,\r
+ uint8_t SubWay[] = {0x13, 0x71, 0x00, 0x9b, 0xde,\r
   //Subway 1 (fc 03)\r
   0x11,\r
   0x03, 0x6d, 0x00, 0x28, 0x27, 0x00, 0xfc, 0x03, 0x00, 0x00,\r
@@ -350,7 +334,7 @@ void PCommands::doCmd_dev_t()
   0x03, 0x71, 0x00, 0x2d, 0xf7, 0x03, 0x00, 0x00, 0x0a, 0x00,\r
   0x00, 0x00, 0x00};\r
 \r
- u8 SubWay2[] = {0x13, 0x71, 0x00, 0x9b, 0xde,\r
+ uint8_t SubWay2[] = {0x13, 0x71, 0x00, 0x9b, 0xde,\r
   //Subway 7 (f6 03)\r
   0x11,\r
   0x03, 0x6d, 0x00, 0x28, 0x27, 0x00, 0xf6, 0x03, 0x00, 0x00,\r
@@ -393,72 +377,72 @@ void PCommands::doCmd_dev_t()
  //SubWay List\r
  //Subway 1\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[7] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[7] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[25] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[25] = source->GetUDP_ID();\r
 \r
  //Subway 2\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[39] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[39] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[57] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[57] = source->GetUDP_ID();\r
 \r
  //Subway 3\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[71] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[71] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[89] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[89] = source->GetUDP_ID();\r
 \r
  //Subway 4\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[103] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[103] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[121] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[121] = source->GetUDP_ID();\r
 \r
  //Subway 5\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[135] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[135] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[153] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[153] = source->GetUDP_ID();\r
 \r
  //Subway 6\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[167] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[167] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay[185] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[185] = source->GetUDP_ID();\r
 \r
  //Subway 7\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[7] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[7] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[25] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[25] = source->GetUDP_ID();\r
 \r
  //Subway 8\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[39] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[39] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[57] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[57] = source->GetUDP_ID();\r
 \r
  //Subway 9\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[71] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[71] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[89] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[89] = source->GetUDP_ID();\r
 \r
  //Subway 10\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[103] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[103] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[121] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[121] = source->GetUDP_ID();\r
 \r
  //Subway 11\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[135] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[135] = source->GetUDP_ID();\r
  source->IncreaseUDP_ID();\r
- *(u16*)&SubWay2[153] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[153] = source->GetUDP_ID();\r
 \r
- *(u16*)&SubWay[1] = source->GetUDP_ID();\r
- *(u16*)&SubWay[3] = source->GetSessionID();\r
+ *(uint16_t*)&SubWay[1] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay[3] = source->GetSessionID();\r
 \r
  PMessage* msg;\r
  msg = new PMessage(197);\r
@@ -471,8 +455,8 @@ Console->Print("---- Not Working 1 ----");
 msg->Dump();\r
 source->SendUDPMessage(msg);\r
 \r
- *(u16*)&SubWay2[1] = source->GetUDP_ID();\r
- *(u16*)&SubWay2[3] = source->GetSessionID();\r
+ *(uint16_t*)&SubWay2[1] = source->GetUDP_ID();\r
+ *(uint16_t*)&SubWay2[3] = source->GetSessionID();\r
 \r
  msg = new PMessage(197);\r
  msg->Write(SubWay2, sizeof(SubWay2));\r
@@ -1,28 +1,8 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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"
+#include "GameServer/Includes.hxx"
 
 void PCommands::doCmdtakemoney()
 {
-    u32 cashtodel = 0;
+    uint32_t cashtodel = 0;
     bool SyntaxError = false;
     if(ArgC < 1)
     {
@@ -35,7 +15,7 @@ void PCommands::doCmdtakemoney()
     }
     else
     {
-        cashtodel = (u32)GetArgInt(1);
+        cashtodel = (uint32_t)GetArgInt(1);
     }
     if(cashtodel == 0)
         return;
@@ -72,13 +52,13 @@ void PCommands::doCmdtakemoney()
             return;
         }
 
-        u32 newcashvalue = 0;
-        u32 oldcashval = target->GetChar()->GetCash();
+        uint32_t newcashvalue = 0;
+        uint32_t oldcashval = target->GetChar()->GetCash();
 
         if(oldcashval >= cashtodel)
             newcashvalue = target->GetChar()->SetCash(oldcashval - cashtodel);
 
-        u32 diffcash = newcashvalue + oldcashval;
+        uint32_t diffcash = newcashvalue + oldcashval;
 
         PMessage* tmpMsg_cash = MsgBuilder->BuildCharMoneyUpdateMsg(target, newcashvalue);
         target->SendUDPMessage(tmpMsg_cash);
@@ -91,8 +71,8 @@ void PCommands::doCmdtakemoney()
     }
     else
     {
-        u32 newcashvalue = 0;
-        u32 oldcashval = source->GetChar()->GetCash();
+        uint32_t newcashvalue = 0;
+        uint32_t oldcashval = source->GetChar()->GetCash();
 
         if(oldcashval >= cashtodel)
             newcashvalue = source->GetChar()->SetCash(oldcashval - cashtodel);
@@ -1,24 +1,5 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 void PCommands::doCmdteleport()
 {
similarity index 57%
rename from server/src/game/gamecommands/test.cpp
rename to TinNS/Source/GameServer/GameCommands/Test.cxx
index ec04531..beaf4fe 100644 (file)
@@ -1,24 +1,5 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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"
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
 
 void PCommands::doCmdtest()
 {
@@ -35,8 +16,8 @@ void PCommands::doCmdtest()
             targetNPC = currentNPCWorld->GetNPC( GetArgInt(2) );\r
             if(!targetNPC)\r
                 return;\r
-            // @test 15 <npcID> <target_to_attack> <unknown u8 value>\r
-            targetNPC->Attack(GetArgInt(3), (u8)GetArgInt(5), (u8)GetArgInt(4));\r
+            // @test 15 <npcID> <target_to_attack> <unknown uint8_t value>\r
+            targetNPC->Attack(GetArgInt(3), (uint8_t)GetArgInt(5), (uint8_t)GetArgInt(4));\r
         }\r
     }\r
     else if (GetArgInt(1) == 2)\r
@@ -82,13 +63,13 @@ void PCommands::doCmdtest()
 
 
     /*
-        u8 val1 = 0;
-        u8 val2 = 0;
-        u8 val3 = 0;
-        u16 val4 = 0;
-        u16 val5 = 0;
-    //    u16 val6 = 0;
-    //    u8 val7 = 0;
+        uint8_t val1 = 0;
+        uint8_t val2 = 0;
+        uint8_t val3 = 0;
+        uint16_t val4 = 0;
+        uint16_t val5 = 0;
+    //    uint16_t val6 = 0;
+    //    uint8_t val7 = 0;
 
         bool SyntaxError = false;
         if(ArgC < 5)
@@ -115,57 +96,57 @@ void PCommands::doCmdtest()
         {
             PMessage* tmpMsg1 = new PMessage(14);
 
-            *tmpMsg1 << (u8)0x13;
-            *tmpMsg1 << (u16)0x0000; // UDP ID placeholder
-            *tmpMsg1 << (u16)0x0000; // SessionID placeholder
-            *tmpMsg1 << (u8)0x08;    // Len (static, always 0x08
-            *tmpMsg1 << (u8)0x03;
-            *tmpMsg1 << (u16)0x0000; // Sub UDP ID placeholder
-            *tmpMsg1 << (u8)0x26;    // Command FADE AWAY CHAR (kinda ^^)
-            *tmpMsg1 << (u8)0x00;
-            *tmpMsg1 << (u8)0x10;
-            *tmpMsg1 << (u8)0x00;
-            *tmpMsg1 << (u8)0x80;
+            *tmpMsg1 << (uint8_t)0x13;
+            *tmpMsg1 << (uint16_t)0x0000; // UDP ID placeholder
+            *tmpMsg1 << (uint16_t)0x0000; // SessionID placeholder
+            *tmpMsg1 << (uint8_t)0x08;    // Len (static, always 0x08
+            *tmpMsg1 << (uint8_t)0x03;
+            *tmpMsg1 << (uint16_t)0x0000; // Sub UDP ID placeholder
+            *tmpMsg1 << (uint8_t)0x26;    // Command FADE AWAY CHAR (kinda ^^)
+            *tmpMsg1 << (uint8_t)0x00;
+            *tmpMsg1 << (uint8_t)0x10;
+            *tmpMsg1 << (uint8_t)0x00;
+            *tmpMsg1 << (uint8_t)0x80;
             ClientManager->UDPBroadcast(tmpMsg1, source);
         }
 
-        val1 = (u8)GetArgInt(1);
-        val2 = (u8)GetArgInt(2);
-        val3 = (u8)GetArgInt(3);
-        val4 = (u16)GetArgInt(4);
-        val5 = (u16)GetArgInt(5);
-    //    val7 = (u16)GetArgInt(7);
+        val1 = (uint8_t)GetArgInt(1);
+        val2 = (uint8_t)GetArgInt(2);
+        val3 = (uint8_t)GetArgInt(3);
+        val4 = (uint16_t)GetArgInt(4);
+        val5 = (uint16_t)GetArgInt(5);
+    //    val7 = (uint16_t)GetArgInt(7);
 
         //tmpMsg = MsgBuilder->BuildCharUseQBSlotMsg1(source, 59);
         //source->SendUDPMessage(tmpMsg);
         //tmpMsg = NULL;
 
         PMessage* tmpMsg = new PMessage(29);
-        *tmpMsg << (u8)0x13;
-       *tmpMsg << (u16)0x0000;
-       *tmpMsg << (u16)0x0000;
-       *tmpMsg << (u8)0x16; // Message length
-       *tmpMsg << (u8)0x03;
-       *tmpMsg << (u16)0x0000;
-       *tmpMsg << (u8)0x1b;
-       *tmpMsg << (u8)0x00;
-       *tmpMsg << (u8)0x10;
-       *tmpMsg << (u8)0x00;
-       *tmpMsg << (u8)0x80;
-       *tmpMsg << (u8)0x19;
-       *tmpMsg << (u8)0x55;
-       *tmpMsg << (u8)0x74;
-       *tmpMsg << (u8)0x80;
-       *tmpMsg << (u8)0x82;
-       *tmpMsg << (u8)0xc2;
-       *tmpMsg << (u8)0x84;
-       *tmpMsg << (u8)val1;
-       *tmpMsg << (u8)val2;
-       *tmpMsg << (u8)val3;
-       *tmpMsg << (u16)val4;
-       *tmpMsg << (u16)val5;
-    // *tmpMsg << (u8)0x69;
-    // *tmpMsg << (u8)0x00;
+        *tmpMsg << (uint8_t)0x13;
+       *tmpMsg << (uint16_t)0x0000;
+       *tmpMsg << (uint16_t)0x0000;
+       *tmpMsg << (uint8_t)0x16; // Message length
+       *tmpMsg << (uint8_t)0x03;
+       *tmpMsg << (uint16_t)0x0000;
+       *tmpMsg << (uint8_t)0x1b;
+       *tmpMsg << (uint8_t)0x00;
+       *tmpMsg << (uint8_t)0x10;
+       *tmpMsg << (uint8_t)0x00;
+       *tmpMsg << (uint8_t)0x80;
+       *tmpMsg << (uint8_t)0x19;
+       *tmpMsg << (uint8_t)0x55;
+       *tmpMsg << (uint8_t)0x74;
+       *tmpMsg << (uint8_t)0x80;
+       *tmpMsg << (uint8_t)0x82;
+       *tmpMsg << (uint8_t)0xc2;
+       *tmpMsg << (uint8_t)0x84;
+       *tmpMsg << (uint8_t)val1;
+       *tmpMsg << (uint8_t)val2;
+       *tmpMsg << (uint8_t)val3;
+       *tmpMsg << (uint16_t)val4;
+       *tmpMsg << (uint16_t)val5;
+    // *tmpMsg << (uint8_t)0x69;
+    // *tmpMsg << (uint8_t)0x00;
 
         ClientManager->UDPBroadcast(tmpMsg, source);
 
@@ -185,11 +166,11 @@ void PCommands::doCmdtest()
             return;
         }
 
-        u16 itemID;
+        uint16_t itemID;
         char effStr[128];
         PMessage* tmpMsg;
 
-        itemID = (u16)GetArgInt(1);
+        itemID = (uint16_t)GetArgInt(1);
 
         source->GetChar()->SetItemInHand(itemID);
 
@@ -199,9 +180,9 @@ void PCommands::doCmdtest()
         effStr[127] = '\0';
         Chat->send(source, CHAT_DIRECT, "System", effStr);
     ===========================================================================
-        u16 ItemToSpawn = 0;
-        u8 Quality = 0;
-        u8 Stack = 0;
+        uint16_t ItemToSpawn = 0;
+        uint8_t Quality = 0;
+        uint8_t Stack = 0;
 
         bool SyntaxError = false;
         if(ArgC < 3)
@@ -212,7 +193,7 @@ void PCommands::doCmdtest()
         {
             if(IsArgNumeric(1) == true)
             {
-                ItemToSpawn = (u16)GetArgInt(1);
+                ItemToSpawn = (uint16_t)GetArgInt(1);
                 if(ItemToSpawn == 0)
                 {
                     SyntaxError = true;
@@ -225,7 +206,7 @@ void PCommands::doCmdtest()
 
             if(IsArgNumeric(2) == true)
             {
-                Quality = (u8)GetArgInt(2);
+                Quality = (uint8_t)GetArgInt(2);
                 if(Quality == 0)
                 {
                     SyntaxError = true;
@@ -238,7 +219,7 @@ void PCommands::doCmdtest()
 
             if(IsArgNumeric(3) == true)
             {
-                Stack = (u8)GetArgInt(3);
+                Stack = (uint8_t)GetArgInt(3);
                 if(Stack == 0)
                 {
                     SyntaxError = true;
@@ -258,26 +239,26 @@ void PCommands::doCmdtest()
         source->IncreaseUDP_ID();
         source->IncreaseTransactionID();
 
-        *tmpMsg << (u8)0x13;
-       *tmpMsg << (u16)source->GetUDP_ID();
-       *tmpMsg << (u16)source->GetSessionID();
-       *tmpMsg << (u8)0x16; // Message length
-       *tmpMsg << (u8)0x03;
-       *tmpMsg << (u16)source->GetUDP_ID();
-       *tmpMsg << (u8)0x1f;
-       *tmpMsg << (u16)source->GetLocalID();
-       *tmpMsg << (u8)0x25; // ??
-       *tmpMsg << (u8)0x13; // ??
-        *tmpMsg << (u16)source->GetTransactionID();
-       *tmpMsg << (u8)0x18; // ??
-       *tmpMsg << (u8)0x03; // ??
-       *tmpMsg << (u8)0x01; // ??
-       *tmpMsg << (u8)0x00; // ??
-       *tmpMsg << (u8)0x05; // ??
-       *tmpMsg << (u8)0x00; // ??
+        *tmpMsg << (uint8_t)0x13;
+       *tmpMsg << (uint16_t)source->GetUDP_ID();
+       *tmpMsg << (uint16_t)source->GetSessionID();
+       *tmpMsg << (uint8_t)0x16; // Message length
+       *tmpMsg << (uint8_t)0x03;
+       *tmpMsg << (uint16_t)source->GetUDP_ID();
+       *tmpMsg << (uint8_t)0x1f;
+       *tmpMsg << (uint16_t)source->GetLocalID();
+       *tmpMsg << (uint8_t)0x25; // ??
+       *tmpMsg << (uint8_t)0x13; // ??
+        *tmpMsg << (uint16_t)source->GetTransactionID();
+       *tmpMsg << (uint8_t)0x18; // ??
+       *tmpMsg << (uint8_t)0x03; // ??
+       *tmpMsg << (uint8_t)0x01; // ??
+       *tmpMsg << (uint8_t)0x00; // ??
+       *tmpMsg << (uint8_t)0x05; // ??
+       *tmpMsg << (uint8_t)0x00; // ??
        *tmpMsg << ItemToSpawn;
-       *tmpMsg << (u8)0x02; // ??
-       *tmpMsg << (u8)0x01; // ??
+       *tmpMsg << (uint8_t)0x02; // ??
+       *tmpMsg << (uint8_t)0x01; // ??
        *tmpMsg << Quality;
        *tmpMsg << Stack;
 
diff --git a/TinNS/Source/GameServer/GameCommands/UnBan.cxx b/TinNS/Source/GameServer/GameCommands/UnBan.cxx
new file mode 100644 (file)
index 0000000..4b83971
--- /dev/null
@@ -0,0 +1,6 @@
+#include "GameServer/Includes.hxx"\r
+\r
+void PCommands::doCmdunban()\r
+{\r
+    Chat->send(source, CHAT_DIRECT, "System", "Unban is not yet possible, sorry.");\r
+}\r
similarity index 68%
rename from server/src/game/gamecommands/unjail.cpp
rename to TinNS/Source/GameServer/GameCommands/UnJail.cxx
index 86b5b04..18e4c95 100644 (file)
@@ -1,24 +1,5 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 void PCommands::doCmdunjail()
 {
@@ -60,7 +41,7 @@ void PCommands::doCmdunjail()
     return;
   }
 
-  u32 currLoc = target->GetChar()->GetLocation();
+  uint32_t currLoc = target->GetChar()->GetLocation();
   // Make sure that target player is really in Regants
   if ( currLoc != 550 && currLoc != 551 )
   {
similarity index 61%
rename from server/src/game/gamecommands/unshun.cpp
rename to TinNS/Source/GameServer/GameCommands/UnShun.cxx
index a397541..1754aeb 100644 (file)
@@ -1,24 +1,4 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmdunshun()\r
 {\r
similarity index 72%
rename from server/src/game/gamecommands/uptime.cpp
rename to TinNS/Source/GameServer/GameCommands/Uptime.cxx
index f3a2dbb..281e369 100644 (file)
@@ -1,31 +1,11 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
 \r
 void PCommands::doCmduptime()\r
 {\r
     // get difference between var uptime and current time\r
-    std::time_t Uptime = GameServer->GetStartTime();\r
-    u32 TimeDiff = std::time(NULL) - Uptime;\r
-    u32 UpYears = 0, UpMonths = 0, UpWeeks = 0, UpDays = 0, UpHours = 0, UpMinutes = 0, UpSeconds = 0;\r
+    time_t Uptime = GameServer->GetStartTime();\r
+    uint32_t TimeDiff = std::time(NULL) - Uptime;\r
+    uint32_t UpYears = 0, UpMonths = 0, UpWeeks = 0, UpDays = 0, UpHours = 0, UpMinutes = 0, UpSeconds = 0;\r
     char tmpY[21], tmpM[21], tmpW[21], tmpD[21], tmpH[21], tmpMi[21], tmpS[21];\r
 \r
     // 1 min = 60 sec                           = 60\r
diff --git a/TinNS/Source/GameServer/GameCommands/V.cxx b/TinNS/Source/GameServer/GameCommands/V.cxx
new file mode 100644 (file)
index 0000000..4eea77b
--- /dev/null
@@ -0,0 +1,46 @@
+#include "GameServer/Includes.hxx"\r
+\r
+void PCommands::doCmd_dev_v()\r
+{\r
+    if(IsAdmin() == false)\r
+      return;\r
+\r
+    char Arg1[30];\r
+\r
+    Arg1[0] = '\0';\r
+\r
+    if(ArgC > 0)\r
+    {\r
+        GetArgText(1, Arg1, 30);\r
+    }\r
+\r
+    char tmpStr[128];\r
+    int testmode = 1; // change here only for uint8_t/uint16_t/uint32_t testvalue use\r
+\r
+    if(Arg1[0] != '\0')\r
+    {\r
+        switch(testmode)\r
+        {\r
+            case 0: source->testval8 = (uint8_t)(atoi(Arg1) & 0xff); break;\r
+            case 1: source->testval16 = (uint16_t)(atoi(Arg1) & 0xffff); break;\r
+            case 2: source->testval32 = (uint32_t)(atoi(Arg1) & 0xffffffff); break;\r
+        }\r
+    }\r
+    else\r
+    {\r
+        source->testval8 = 0;\r
+        source->testval16 = 0;\r
+        source->testval32 = 0;\r
+    }\r
+\r
+    switch(testmode)\r
+    {\r
+        case 0: snprintf(tmpStr, 127, "Test value uint8_t set to 0x%02x (%d)", source->testval8, source->testval8); break;\r
+        case 1: snprintf(tmpStr, 127, "Test value uint16_t set to 0x%04x (%d)", source->testval16, source->testval16); break;\r
+        case 2: snprintf(tmpStr, 127, "Test value uint32_t set to 0x%08x (%d)", source->testval32, source->testval32); break;\r
+        default: tmpStr[0] = '\0';\r
+    }\r
+    tmpStr[127] = '\0';\r
+    Chat->send(source, CHAT_DIRECT, "System", tmpStr);\r
+\r
+}\r
diff --git a/TinNS/Source/GameServer/GameCommands/Version.cxx b/TinNS/Source/GameServer/GameCommands/Version.cxx
new file mode 100644 (file)
index 0000000..c694545
--- /dev/null
@@ -0,0 +1,11 @@
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+void PCommands::doCmdversion()\r
+{\r
+    char tmpChatMsg[300];\r
+    snprintf(tmpChatMsg, 299, "You are on TinNS server %s runnig version %s - SVN Rev. %s", Config->GetOption("server_name").c_str(), ServerVersion, SVNRevision);\r
+    tmpChatMsg[299] = '\0';\r
+\r
+    Chat->send(source, CHAT_DIRECT, "System", tmpChatMsg);\r
+}\r
similarity index 63%
rename from server/src/game/gamecommands/warp.cpp
rename to TinNS/Source/GameServer/GameCommands/Warp.cxx
index edc0ef5..06086b1 100644 (file)
@@ -1,24 +1,5 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 void PCommands::doCmdwarp()
 {
similarity index 69%
rename from server/src/game/gamecommands/warpto.cpp
rename to TinNS/Source/GameServer/GameCommands/WarpTo.cxx
index a668124..cc3e864 100644 (file)
@@ -1,24 +1,5 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 void PCommands::doCmdwarpto()
 {
similarity index 57%
rename from server/src/game/gamecommands/weather.cpp
rename to TinNS/Source/GameServer/GameCommands/Weather.cxx
index 0aded50..9a4b675 100644 (file)
@@ -1,24 +1,4 @@
-/*
-  TinNS (TinNS is not a Neocron Server)
-  Copyright (C) 2005 Linux Addicted Community
-  maintainer Akiko <akiko@gmx.org>
-
-  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"
+#include "GameServer/Includes.hxx"
 
 void PCommands::doCmdweather()
 {
@@ -54,7 +34,7 @@ void PCommands::doCmdweather()
       else
         target = source;
 
-      PMessage* tmpMsg = MsgBuilder->BuildWeatherControlMsg(( u16 )wId );
+      PMessage* tmpMsg = MsgBuilder->BuildWeatherControlMsg(( uint16_t )wId );
       ClientManager->UDPBroadcast( tmpMsg, target );
 
       char effStr[128];
similarity index 59%
rename from server/src/game/gamescript.cpp.inhib
rename to TinNS/Source/GameServer/GameScript.cxx
index 96a056f..e16caa7 100644 (file)
@@ -1,34 +1,15 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#include "main.h"\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
+#if 0\r
 PGameScript::PGameScript()\r
 {\r
 }\r
 \r
 PGameScript::~PGameScript()\r
 {\r
-       for(HookMap::iterator it = mHooks.begin(); it != mHooks.end(); it++)\r
-               delete it->second;\r
+    for(HookMap::iterator it = mHooks.begin(); it != mHooks.end(); it++)\r
+        delete it->second;\r
 }\r
 \r
 bool PGameScript::LoadScripts()\r
@@ -38,7 +19,7 @@ bool PGameScript::LoadScripts()
 bool PGameScript::Rehash()\r
 {\r
     Console->LPrint("Rehashing GameMonkey Scripts...");\r
-       for(HookMap::iterator it = mHooks.end(); it != mHooks.begin(); it--)\r
+    for(HookMap::iterator it = mHooks.end(); it != mHooks.begin(); it--)\r
         mHooks.erase(it);\r
 \r
     if(LoadScripts() == true)\r
@@ -60,7 +41,7 @@ void PGameScript::TriggerHook(PHookTypes hook)
 }\r
 \r
 \r
-bool ScriptSys::ExecuteFile(const char* a_fileName)\r
+bool PGameScript::ExecuteFile(const char* a_fileName)\r
 {\r
   FILE* scriptFile = NULL;\r
   char* fileString = NULL;\r
@@ -120,4 +101,5 @@ int PGameScript::AddTwoIntegers(int valueA, int valueB)
   }\r
 \r
   return resultInt;\r
-}
\ No newline at end of file
+}\r
+#endif\r
diff --git a/TinNS/Source/GameServer/GameScript.hxx b/TinNS/Source/GameServer/GameScript.hxx
new file mode 100644 (file)
index 0000000..7df8946
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+\r
+#if 0\r
+#include <map>\r
+#include <string>\r
+\r
+enum PHookTypes {\r
+    HOOK_CHAT,\r
+    HOOK_TRADE,\r
+    HOOK_ZONE\r
+};\r
+\r
+class PGameScript {\r
+private:\r
+    typedef std::map<PHookTypes, std::string> HookMap;\r
+    HookMap mHooks;\r
+\r
+public:\r
+    PGameScript();\r
+    ~PGameScript();\r
+\r
+    bool LoadScripts();\r
+    bool Rehash();\r
+    void TriggerHook(PHookTypes hook);\r
+    bool ExecuteFile(const char* a_fileName);\r
+};\r
+#endif\r
similarity index 73%
rename from server/src/game/gameserver.cpp
rename to TinNS/Source/GameServer/GameServer.cxx
index d83c47e..9fbc426 100644 (file)
@@ -1,99 +1,16 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       gameserver.cpp - main file of the gameserver\r
-\r
-       MODIFIED: 31 Aug 2005 Akiko\r
-       REASON: - added modifications by "Sting" to get a running gameserver again\r
-               - added this header\r
-       MODIFIED: 28 Sep 2005 Akiko\r
-       REASON: - define for game server port\r
-       MODIFIED: 29 Sep 2005 Sting (modified by Akiko)\r
-       REASON: - configurable UDP port for testing\r
-               - tidied up/corrected packet sent with most character stats (character now has monk stats for testing)\r
-       MODIFIED: 27 Nov 2005 Akiko\r
-       REASON: - added Namikons fix (IPStringToDWord)\r
-               - added bluehrs packet fix\r
-       MODIFIED: 17 Dec 2005 bakkdoor\r
-       REASON: - Due the new structure for chatsystem, changed HandleGameChat(Client, Packet);\r
-                 to Chat->HandleGameChat(Client, Packet);\r
-               - Also added ClientManager->addClientToList and ClientManager->deleteClientFromList()\r
-                 (check Update() & FinalizeClient())\r
-       MODIFIED: 18 Dec 2005 Namikon\r
-       REASON: - Fixed several small issues in the main-packet if-clause (sizeof(<char>), etc)\r
-       MODIFIED: 21 Dec 2005 Namikon\r
-       REASON: - Fixed zoning (for now). The basic packet is broken somehow, still working on that\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Basepacket 1 and 2 fixed. (Thanks to MaxxJag!)\r
-               - Zoning still works, same goes for skills/factions.\r
-               - Not sure about quickbelt and inventory, but it seems to be ok\r
-       MODIFIED: 26 Dec 2005 Namikon\r
-       REASON: - Added doors\r
-               - Added support for Worlditem usage (Gogo/Genrep/Appitem/...)\r
-       MODIFIED: 01 Jan 2006 Namikon\r
-       REASON: - Changed FmtTxt() to sprintf(). It does... uhm, the same :D\r
-               - Added SetOnlineStatus to do instand updates when char is logging in\r
-       MODIFIED: 02 Jan 2006 Namikon\r
-       REASON: - Added debug output function\r
-       MODIFIED: 06 Jan 2006 Namikon\r
-       REASON: - Added color to console outputs\r
-       MODIFIED: 01 Jul 2006 hammag\r
-       REASON: - added set timeout to 10 msec (for ReadSetTCP select) in Start() to avoid useless 100% CPU use\r
-       MODIFIED: 30 Jul 2006 hammag\r
-       REASON: - Fixed 0x13 0x03 0x1F message filters to enable other char than ID 1 to play ... :P\r
-       MODIFIED: 12 Aug 2006 hammag\r
-       REASON: - Fixed BuildCharPosUpdateMsg() to send correct characters orientation to other characters\r
-       MODIFIED: 26 Aug 2006 hammag\r
-       REASON: - removed use of GAME_PORT define as this info is available in Config object with a default value\r
-       MODIFIED: 17 Sep 2006 hammag\r
-       REASON: - Moved all UDP message management code to decoder classes\r
-               - Removed corresponding code from gameserver.cpp & .h\r
-       MODIFIED: 03 Oct 2006 hammag\r
-       REASON: - Added some more DB cleanup when a char is deleted (still incomplete and will later be done in PChar::SQLDelete() )\r
-       MODIFIED: 10 Dec 2006 Namikon\r
-       REASON: - Added new variable "mServerStartupTime". Holds the unix timestamp uppon startup. Required for @uptime\r
-                 and other time-based stuff\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - clean ups\r
-\r
-       TODO:\r
-       - Deny login if char is already online (More information about the login procedure is necessary to do that)\r
-       - Take main loop timeout setting from config file\r
-       - Add Regex control to new char name validation\r
-       - Add Check of Char offline (and unloaded) before deleting (from the char choosing i/f) if multiple login\r
-          allowed for the same account\r
-       - Check if adding to Client to Client manager shouldn't be done only one UDP connection done ?\r
-        => Risk of sending UDP chat on non-socket ????\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/msgdecoder.h"\r
-#include "include/msgbuilder.h"\r
-#include "include/appartements.h"\r
-\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Decoder/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+// TODO:\r
+// - Deny login if char is already online (More information about the login procedure is necessary to do that)\r
+// - Take main loop timeout setting from config file\r
+// - Add Regex control to new char name validation\r
+// - Add Check of Char offline (and unloaded) before deleting (from the char choosing i/f) if multiple login\r
+//   allowed for the same account\r
+//  - Check if adding to Client to Client manager shouldn't be done only one UDP connection done ?\r
+//    => Risk of sending UDP chat on non-socket ????\r
 \r
 PGameServer::PGameServer()\r
 {\r
@@ -110,7 +27,7 @@ PGameServer::~PGameServer()
 \r
 void PGameServer::Start()\r
 {\r
-  u16 Port = Config->GetOptionInt( "gameserver_port" );\r
+  uint16_t Port = Config->GetOptionInt( "gameserver_port" );\r
   Console->LPrint( "Starting gameserver on port %i...", Port );\r
 \r
   if ( ServerSock->open( Port ) )\r
@@ -130,7 +47,7 @@ void PGameServer::Start()
   struct timespec tmpTime;\r
   if ( !clock_gettime( CLOCK_REALTIME, &tmpTime ) )\r
   {\r
-    srandom(( u32 )tmpTime.tv_sec );\r
+    srandom(( uint32_t )tmpTime.tv_sec );\r
     InitRandom( tmpTime.tv_sec );\r
 //Console->Print("Initializing random generator. First value is %d", random());\r
   }\r
@@ -142,7 +59,7 @@ void PGameServer::Start()
 \r
 }\r
 \r
-void PGameServer::SetGameTime( u32 newtime )\r
+void PGameServer::SetGameTime( uint32_t newtime )\r
 {\r
   if ( clock_gettime( CLOCK_REALTIME, &mStartTime ) )\r
   {\r
@@ -154,11 +71,11 @@ void PGameServer::SetGameTime( u32 newtime )
   mBaseGameTime = newtime;\r
 }\r
 \r
-u32 PGameServer::GetGameTime()\r
+uint32_t PGameServer::GetGameTime()\r
 {\r
-  //const u32 TimeFactor = 375;\r
-  const u32 TimeFactor = 1000;\r
-  const u32 nsTimeFactor = 1000000000 / TimeFactor;\r
+  //const uint32_t TimeFactor = 375;\r
+  const uint32_t TimeFactor = 1000;\r
+  const uint32_t nsTimeFactor = 1000000000 / TimeFactor;\r
 \r
   struct timespec tmpTime;\r
 \r
@@ -224,16 +141,16 @@ void PGameServer::Update()
   }\r
 }\r
 \r
-bool PGameServer::HandleHandshake( PGameState *State, const u8 *Packet, int PacketSize )\r
+bool PGameServer::HandleHandshake( PGameState *State, const uint8_t *Packet, int PacketSize )\r
 {\r
-  //static const u8 HANDSHAKE1A[6]={0xfe, 0x03, 0x00, 0x80, 0x03, 0x68};\r
+  //static const uint8_t HANDSHAKE1A[6]={0xfe, 0x03, 0x00, 0x80, 0x03, 0x68};\r
   //PGameSocket *Socket = Client->GetGameSocket();\r
 \r
   switch ( State->TCP.mState )\r
   {\r
     case PGameState::TCP::GS_HANDSHAKE0 :\r
     {\r
-      if ( PacketSize == 6 && *( u16* )&Packet[3] == 0x0080 && Packet[5] == 0x78 )\r
+      if ( PacketSize == 6 && *( uint16_t* )&Packet[3] == 0x0080 && Packet[5] == 0x78 )\r
       {\r
         //FIXME: this packet seems to be unnecessary,\r
         // although it appears in traffic dumps\r
@@ -244,7 +161,7 @@ bool PGameServer::HandleHandshake( PGameState *State, const u8 *Packet, int Pack
       }\r
       else\r
       {\r
-        Console->Print( YELLOW, BLACK, "[Notice] Gameserver protocol error (GS_HANDSHAKE0): invalid packet [%04x]", *( u16* )&Packet[3] );\r
+        Console->Print( YELLOW, BLACK, "[Notice] Gameserver protocol error (GS_HANDSHAKE0): invalid packet [%04x]", *( uint16_t* )&Packet[3] );\r
         return ( false );\r
       }\r
 \r
@@ -259,18 +176,18 @@ bool PGameServer::HandleHandshake( PGameState *State, const u8 *Packet, int Pack
   return true;\r
 }\r
 \r
-bool PGameServer::HandleAuthenticate( PClient *Client, PGameState *State, const u8 *Packet, int PacketSize )\r
+bool PGameServer::HandleAuthenticate( PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize )\r
 {\r
   ConnectionTCP *Socket = Client->getTCPConn();\r
 \r
-  if ( PacketSize > 20 && *( u16* )&Packet[3] == 0x8084 )\r
+  if ( PacketSize > 20 && *( uint16_t* )&Packet[3] == 0x8084 )\r
   {\r
     // authentication method #1\r
-    const u8 *Key = &Packet[5];  // password key\r
-    u16 ULen = *( u16* ) & Packet[16];  // username length\r
-    u16 PLen = *( u16* ) & Packet[18];  // password length\r
+    const uint8_t *Key = &Packet[5];  // password key\r
+    uint16_t ULen = *( uint16_t* ) & Packet[16];  // username length\r
+    uint16_t PLen = *( uint16_t* ) & Packet[18];  // password length\r
     char *UserName = ( char* ) & Packet[20]; // account name\r
-    const u8 *PW = &Packet[20+ULen]; // encoded password\r
+    const uint8_t *PW = &Packet[20+ULen]; // encoded password\r
 \r
     // Safety controls\r
     if ( 15 + ULen + PLen > PacketSize )\r
@@ -321,7 +238,7 @@ bool PGameServer::HandleAuthenticate( PClient *Client, PGameState *State, const
     if ( Failed )\r
     {\r
       // TODO: is this packet correct here?\r
-      u8 AUTHFAILED[15] = {0xfe, 0x0c, 0x00, 0x83, 0x86, 0x05, 0x00, 0x06, 0x00, 'E', 'R',\r
+      uint8_t AUTHFAILED[15] = {0xfe, 0x0c, 0x00, 0x83, 0x86, 0x05, 0x00, 0x06, 0x00, 'E', 'R',\r
                            'R', 'O', 'R', 0\r
                           };\r
       // TODO: send actual reason instead of ERROR\r
@@ -333,24 +250,24 @@ bool PGameServer::HandleAuthenticate( PClient *Client, PGameState *State, const
     else\r
     {\r
       Client->LoggedIn( &Account );\r
-      u8 AUTHOK[28] = {0xfe, 0x19, 0x00, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\r
+      uint8_t AUTHOK[28] = {0xfe, 0x19, 0x00, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\r
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00\r
                       };\r
-      *( u32* )&AUTHOK[5] = Account.GetID();\r
+      *( uint32_t* )&AUTHOK[5] = Account.GetID();\r
       Socket->write( AUTHOK, 28 );\r
       State->TCP.mState = PGameState::TCP::GS_GAMEDATA;\r
       Console->Print( GREEN, BLACK, "[Info] Gameserver: User '%s' logged in", UserName );\r
     }\r
   }\r
-  else if ( PacketSize > 29 && *( u16* )&Packet[3] == 0x0183 )\r
+  else if ( PacketSize > 29 && *( uint16_t* )&Packet[3] == 0x0183 )\r
   {\r
     // authentication method #2, sent when game starts\r
-    const u8 *Key = &Packet[13];  // password key\r
-    u16 PLen = *( u16* ) & Packet[25];  // password length\r
-    u16 ULen = *( u16* ) & Packet[27];  // username length\r
+    const uint8_t *Key = &Packet[13];  // password key\r
+    uint16_t PLen = *( uint16_t* ) & Packet[25];  // password length\r
+    uint16_t ULen = *( uint16_t* ) & Packet[27];  // username length\r
     char *UserName = ( char* ) & Packet[29]; // account name\r
-    const u8 *PW = &Packet[29+ULen]; // encoded password\r
+    const uint8_t *PW = &Packet[29+ULen]; // encoded password\r
 \r
     // Safety controls\r
     if ( 24 + ULen + PLen > PacketSize )\r
@@ -415,8 +332,8 @@ bool PGameServer::HandleAuthenticate( PClient *Client, PGameState *State, const
 \r
     if ( !Failed )\r
     {\r
-      int value = *( u32* ) & Packet[21];//i think here we must read u32 instead of u8\r
-      u32 CharID = Account.GetCharIdBySlot( value );\r
+      int value = *( uint32_t* ) & Packet[21];//i think here we must read uint32_t instead of uint8_t\r
+      uint32_t CharID = Account.GetCharIdBySlot( value );\r
 \r
       if ( Chars->LoadChar( CharID ) )\r
       {\r
@@ -433,46 +350,46 @@ bool PGameServer::HandleAuthenticate( PClient *Client, PGameState *State, const
     else\r
     {\r
       Client->LoggedIn( &Account );\r
-      /*u8 AUTHOK[28]={0xfe, 0x19, 0x00, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\r
+      /*uint8_t AUTHOK[28]={0xfe, 0x19, 0x00, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\r
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
-      *(u32*)&AUTHOK[5]=Account->GetID();\r
+      *(uint32_t*)&AUTHOK[5]=Account->GetID();\r
       Socket->Write(AUTHOK, 28);*/\r
-      //Client->SetRemoteUDPAddr(*(u32*)&Packet[5], *(u16*)&Packet[9]);\r
+      //Client->SetRemoteUDPAddr(*(uint32_t*)&Packet[5], *(uint16_t*)&Packet[9]);\r
       State->TCP.mState = PGameState::TCP::GS_GETSTATUS;\r
-      Console->Print( "Gameserver: User '%s' entered game (%08x:%04x)", UserName, *( u32* )&Packet[5], *( u16* )&Packet[9] );\r
+      Console->Print( "Gameserver: User '%s' entered game (%08x:%04x)", UserName, *( uint32_t* )&Packet[5], *( uint16_t* )&Packet[9] );\r
       Client->SetRemoteUDPPort( *( int* )&Packet[9] );\r
     }\r
   }\r
   else\r
   {\r
-    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_AUTHENTICATE): invalid packet [%04x]", *( u16* )&Packet[3] );\r
+    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_AUTHENTICATE): invalid packet [%04x]", *( uint16_t* )&Packet[3] );\r
     return ( false );\r
   }\r
 \r
   return ( true );\r
 }\r
 \r
-bool PGameServer::HandleGameData( PClient *Client, PGameState *State, const u8 *Packet )\r
+bool PGameServer::HandleGameData( PClient *Client, PGameState *State, const uint8_t *Packet )\r
 {\r
-  static const u8 GAMEDATA[5] = {0xfe, 0x02, 0x00, 0x87, 0x3a};\r
+  static const uint8_t GAMEDATA[5] = {0xfe, 0x02, 0x00, 0x87, 0x3a};\r
   ConnectionTCP *Socket = Client->getTCPConn();\r
 \r
-  if ( *( u16* )&Packet[3] == 0x3787 )\r
+  if ( *( uint16_t* )&Packet[3] == 0x3787 )\r
   {\r
     Socket->write( GAMEDATA, 5 );\r
     State->TCP.mState = PGameState::TCP::GS_REQUESTCHARS;\r
   }\r
   else\r
   {\r
-    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_GAMEDATA): invalid packet [%04x]", *( u16* )&Packet[3] );\r
+    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_GAMEDATA): invalid packet [%04x]", *( uint16_t* )&Packet[3] );\r
     return ( false );\r
   }\r
 \r
   return ( true );\r
 }\r
 \r
-bool PGameServer::HandleRequestChars( PClient *Client, PGameState *State, const u8 *Packet )\r
+bool PGameServer::HandleRequestChars( PClient *Client, PGameState *State, const uint8_t *Packet )\r
 {\r
   PAccount Account( Client->GetAccountID() );\r
 \r
@@ -483,16 +400,16 @@ bool PGameServer::HandleRequestChars( PClient *Client, PGameState *State, const
 \r
   struct PCharList\r
   {\r
-    u16 Unknown1;\r
-    u16 NumSlots;\r
-    u16 Unknown2;\r
+    uint16_t Unknown1;\r
+    uint16_t NumSlots;\r
+    uint16_t Unknown2;\r
   } CharList;\r
 \r
   PCharProfile CharEntry[MAX_CHARS_PER_ACCOUNT];\r
 \r
   const int CHARBASESIZE = 28;\r
 \r
-  if ( *( u16* )&Packet[3] == 0x8284 )\r
+  if ( *( uint16_t* )&Packet[3] == 0x8284 )\r
   {\r
     CharList.NumSlots = MAX_CHARS_PER_ACCOUNT;\r
     int NameLengths = 0;\r
@@ -536,8 +453,8 @@ bool PGameServer::HandleRequestChars( PClient *Client, PGameState *State, const
       }\r
     }\r
 \r
-    u8 PacketHeader[5] = {0xfe, 0x00, 0x00, 0x83, 0x85};\r
-    *( u16* )&PacketHeader[1] = sizeof( u16 ) * 3 + ( MAX_CHARS_PER_ACCOUNT * CHARBASESIZE ) + NameLengths + 2;\r
+    uint8_t PacketHeader[5] = {0xfe, 0x00, 0x00, 0x83, 0x85};\r
+    *( uint16_t* )&PacketHeader[1] = sizeof( uint16_t ) * 3 + ( MAX_CHARS_PER_ACCOUNT * CHARBASESIZE ) + NameLengths + 2;\r
     Socket->write( PacketHeader, 5 );\r
 \r
     CharList.Unknown1 = 0x0000;\r
@@ -571,7 +488,7 @@ bool PGameServer::HandleRequestChars( PClient *Client, PGameState *State, const
       if ( CharEntry[i].Name.length() > 0 )\r
       {\r
         Socket->write( CharEntry[i].Name.c_str() );\r
-        Socket->write(( u8 )0 );\r
+        Socket->write(( uint8_t )0 );\r
       }\r
     }\r
 \r
@@ -579,21 +496,21 @@ bool PGameServer::HandleRequestChars( PClient *Client, PGameState *State, const
   }\r
   else\r
   {\r
-    Console->Print( RED, BLACK, "Gameserver protocol error (GS_REQUESTCHARS): invalid packet [%04x]", *( u16* )&Packet[3] );\r
+    Console->Print( RED, BLACK, "Gameserver protocol error (GS_REQUESTCHARS): invalid packet [%04x]", *( uint16_t* )&Packet[3] );\r
     return ( false );\r
   }\r
 \r
   return ( true );\r
 }\r
 \r
-bool PGameServer::HandleCharList( PClient *Client, PGameState *State, const u8 *Packet, int PacketSize )\r
+bool PGameServer::HandleCharList( PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize )\r
 {\r
-  static u8 Answer[10] = {0xfe, 0x07, 0x00, 0x83, 0x86, 0, 0, 0, 0, 0};\r
+  static uint8_t Answer[10] = {0xfe, 0x07, 0x00, 0x83, 0x86, 0, 0, 0, 0, 0};\r
   ConnectionTCP *Socket = Client->getTCPConn();\r
 \r
-  if ( PacketSize > 9 && *( u16* )&Packet[3] == 0x8284 )\r
+  if ( PacketSize > 9 && *( uint16_t* )&Packet[3] == 0x8284 )\r
   {\r
-    u8 Mode = Packet[9];\r
+    uint8_t Mode = Packet[9];\r
 \r
     switch ( Mode )\r
     {\r
@@ -642,11 +559,11 @@ bool PGameServer::HandleCharList( PClient *Client, PGameState *State, const u8 *
       case 3: // delete char\r
       {\r
         PAccount Acc( Client->GetAccountID() );\r
-        u8 Num = Packet[PacketSize-1];\r
+        uint8_t Num = Packet[PacketSize-1];\r
 \r
         if ( Acc.GetID() )\r
         {\r
-          u32 CharID = Acc.GetCharIdBySlot( Num );\r
+          uint32_t CharID = Acc.GetCharIdBySlot( Num );\r
 \r
           // Also check that char is out of game\r
           if (( CharID != 0 ) && ( Chars->GetChar( CharID ) == NULL ) )\r
@@ -685,16 +602,16 @@ bool PGameServer::HandleCharList( PClient *Client, PGameState *State, const u8 *
         if ( PacketSize < 64 )\r
           return ( false );\r
 \r
-        u32 Slot = * ( u32* ) & Packet[30];\r
-        //u32 nClass =* (u32*)&Packet[34]; // Not used - indirectly redundant with Profession\r
-        u32 Profession = * ( u32* ) & Packet[38];\r
-        u32 Gender = * ( u32* ) & Packet[42];\r
-        u32 Head = * ( u32* ) & Packet[46];\r
-        u32 Torso = * ( u32* ) & Packet[50];\r
-        u32 Legs = * ( u32* ) & Packet[54];\r
-        u32 Faction = * ( u32* ) & Packet[58];\r
-        u8 NameLen = Packet[62];\r
-        u8 NZSNb = Packet[63];\r
+        uint32_t Slot = * ( uint32_t* ) & Packet[30];\r
+        //uint32_t nClass =* (uint32_t*)&Packet[34]; // Not used - indirectly redundant with Profession\r
+        uint32_t Profession = * ( uint32_t* ) & Packet[38];\r
+        uint32_t Gender = * ( uint32_t* ) & Packet[42];\r
+        uint32_t Head = * ( uint32_t* ) & Packet[46];\r
+        uint32_t Torso = * ( uint32_t* ) & Packet[50];\r
+        uint32_t Legs = * ( uint32_t* ) & Packet[54];\r
+        uint32_t Faction = * ( uint32_t* ) & Packet[58];\r
+        uint8_t NameLen = Packet[62];\r
+        uint8_t NZSNb = Packet[63];\r
 \r
         char TempName[256];\r
         std::strncpy( TempName, ( const char* )&Packet[64], NameLen );\r
@@ -726,7 +643,7 @@ bool PGameServer::HandleCharList( PClient *Client, PGameState *State, const u8 *
   }\r
   else\r
   {\r
-    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_CHARLIST): invalid packet [%04x]", *( u16* )&Packet[3] );\r
+    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_CHARLIST): invalid packet [%04x]", *( uint16_t* )&Packet[3] );\r
 \r
     return ( false );\r
   }\r
@@ -734,20 +651,20 @@ bool PGameServer::HandleCharList( PClient *Client, PGameState *State, const u8 *
   return true;\r
 }\r
 \r
-bool PGameServer::HandleGetStatus( PClient *Client, PGameState *State, const u8 *Packet )\r
+bool PGameServer::HandleGetStatus( PClient *Client, PGameState *State, const uint8_t *Packet )\r
 {\r
   ConnectionTCP *Socket = Client->getTCPConn();\r
 \r
-  if ( *( u16* )&Packet[3] == 0x3787 )\r
+  if ( *( uint16_t* )&Packet[3] == 0x3787 )\r
   {\r
-    static const u8 STATUS[9] = {0xfe, 0x06, 0x00, 0x87, 0x3a, 0x11, 0x00, 0x00, 0x00};\r
+    static const uint8_t STATUS[9] = {0xfe, 0x06, 0x00, 0x87, 0x3a, 0x11, 0x00, 0x00, 0x00};\r
 \r
     Socket->write( STATUS, 9 );\r
     State->TCP.mState = PGameState::TCP::GS_GAMEINFO;\r
   }\r
   else\r
   {\r
-    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_GETSTATUS): invalid packet [%04x]", *( u16* )&Packet[3] );\r
+    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_GETSTATUS): invalid packet [%04x]", *( uint16_t* )&Packet[3] );\r
 \r
     return ( false );\r
   }\r
@@ -755,11 +672,11 @@ bool PGameServer::HandleGetStatus( PClient *Client, PGameState *State, const u8
   return ( true );\r
 }\r
 \r
-bool PGameServer::HandleGameInfo( PClient *Client, PGameState *State, const u8 *Packet )\r
+bool PGameServer::HandleGameInfo( PClient *Client, PGameState *State, const uint8_t *Packet )\r
 {\r
 // Console->Print("Inside HandleGameInfo");//NEW added\r
 \r
-  static u8 GameInfo[31] = {0xfe, 0x1c, 0x00, 0x83, 0x05, // header\r
+  static uint8_t GameInfo[31] = {0xfe, 0x1c, 0x00, 0x83, 0x05, // header\r
                             0x00, 0x00, 0x00, 0x00, // account id\r
                             0x00, 0x00, 0x00, 0x00, // char id\r
                             0x00, 0x00, 0x00, 0x00, // udp ip\r
@@ -771,7 +688,7 @@ bool PGameServer::HandleGameInfo( PClient *Client, PGameState *State, const u8 *
 \r
   ConnectionTCP *Socket = Client->getTCPConn();\r
 \r
-  if ( *( u16* )&Packet[3] == 0x3c87 )\r
+  if ( *( uint16_t* )&Packet[3] == 0x3c87 )\r
   {\r
     //int PortFix = Config->GetOptionInt("debug_mode");\r
 \r
@@ -783,7 +700,7 @@ bool PGameServer::HandleGameInfo( PClient *Client, PGameState *State, const u8 *
       ClientDisconnected( Client );\r
     }\r
 \r
-    u16 Port = Client->getUDPConn()->getPort();\r
+    uint16_t Port = Client->getUDPConn()->getPort();\r
 \r
     if ( Port == 0 )\r
       Console->Print( RED, BLACK, "Client->OpenUDP() failed" );\r
@@ -795,7 +712,7 @@ bool PGameServer::HandleGameInfo( PClient *Client, PGameState *State, const u8 *
      Console->Print(YELLOW, BLACK, "UDP Port set to non-standard for debugging!");\r
     }; */\r
 \r
-    u32 IP;\r
+    uint32_t IP;\r
     std::string IPServerString;\r
 // use [server_nat_ip] for server if client is NOT on [no_nat_net] (and [no_nat_net]!=0)\r
     if ( strcmp( Config->GetOption( "no_nat_net" ).c_str(), "0" ) && strncmp( Client->GetAddress(), Config->GetOption( "no_nat_net" ).c_str(), strlen( Config->GetOption( "no_nat_net" ).c_str() ) ) )\r
@@ -811,18 +728,18 @@ bool PGameServer::HandleGameInfo( PClient *Client, PGameState *State, const u8 *
     if ( IP == 0 )\r
       IP = 0x0100007f;\r
 //Console->Print("IP-2 %d", IP);\r
-    *( u32* )&GameInfo[13] = IP;\r
-    *( u16* )&GameInfo[17] = Port;\r
+    *( uint32_t* )&GameInfo[13] = IP;\r
+    *( uint16_t* )&GameInfo[17] = Port;\r
     Console->Print( GREEN, BLACK, "[Info] Using UDP %s:%d on server", IPServerString.c_str(), Port );\r
 \r
-    *( u32* )&GameInfo[5] = Client->GetAccountID();\r
-    *( u32* )&GameInfo[9] = Client->GetCharID();\r
+    *( uint32_t* )&GameInfo[5] = Client->GetAccountID();\r
+    *( uint32_t* )&GameInfo[9] = Client->GetCharID();\r
     Console->Print( GREEN, BLACK, "[Info] Serving char id :%d", Client->GetCharID() );\r
 \r
     Socket->write( GameInfo, 31 );\r
     Socket->flushSendBuffer();\r
 \r
-    static const u8 READY[7] = {0xfe, 0x04, 0x00, 0x83, 0x0d, 0x00, 0x00};\r
+    static const uint8_t READY[7] = {0xfe, 0x04, 0x00, 0x83, 0x0d, 0x00, 0x00};\r
     Socket->write( READY, 7 );\r
 \r
     State->TCP.mState = PGameState::TCP::GS_INGAME;\r
@@ -871,7 +788,7 @@ bool PGameServer::HandleGameInfo( PClient *Client, PGameState *State, const u8 *
   }\r
   else\r
   {\r
-    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_GAMEINFO): invalid packet [%04x]", *( u16* )&Packet[3] );\r
+    Console->Print( RED, BLACK, "[Notice] Gameserver protocol error (GS_GAMEINFO): invalid packet [%04x]", *( uint16_t* )&Packet[3] );\r
     return ( false );\r
   }\r
 \r
@@ -932,7 +849,7 @@ bool PGameServer::HandleGame( PClient *Client, PGameState *State )
 \r
 bool PGameServer::ProcessClient( PClient *Client, PGameState *State )\r
 {\r
-  static const u8 HANDSHAKE0A[6] = {0xfe, 0x03, 0x00, 0x80, 0x01, 0x66};\r
+  static const uint8_t HANDSHAKE0A[6] = {0xfe, 0x03, 0x00, 0x80, 0x01, 0x66};\r
 \r
   if ( !State )\r
   {\r
@@ -961,7 +878,7 @@ bool PGameServer::ProcessClient( PClient *Client, PGameState *State )
   else\r
   {\r
     int PacketSize = 0;\r
-    const u8 *Packet = Socket->read( &PacketSize );\r
+    const uint8_t *Packet = Socket->read( &PacketSize );\r
 \r
     if ( PacketSize > 0 )\r
     {\r
similarity index 55%
rename from server/src/game/include/gameserver.h
rename to TinNS/Source/GameServer/GameServer.hxx
index f45511b..177c1da 100644 (file)
@@ -1,39 +1,8 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
+#pragma once\r
 \r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
- gameserver.h\r
-\r
- Authors:\r
- - v00d00\r
- - Akiko\r
-\r
- MODIFIED: 30 Nov 2005 Akiko\r
- REASON: - added GPL\r
-*/\r
-\r
-#ifndef GAMESERVER_H\r
-#define GAMESERVER_H\r
+#include <chrono>\r
+#include <cstdint>\r
+#include <map>\r
 \r
 struct PGameState\r
 {\r
@@ -68,9 +37,9 @@ struct PGameState
     } mState;\r
 \r
     bool mSynced;\r
-    u16 mServerPacketNum;\r
-    u16 mSequence;\r
-    //u16 mClientPacketNum;\r
+    uint16_t mServerPacketNum;\r
+    uint16_t mSequence;\r
+    //uint16_t mClientPacketNum;\r
   } UDP;\r
 \r
   PGameState()\r
@@ -91,9 +60,9 @@ class PUdpMsgDecoder;
 class PGameServer\r
 {\r
   private :\r
-    std::time_t mServerStartupTime;\r
+    time_t mServerStartupTime;\r
     int mNumClients;\r
-    u32 mBaseGameTime;\r
+    uint32_t mBaseGameTime;\r
     struct timespec mStartTime;\r
 \r
     typedef std::map<PClient*, struct PGameState*> GameStateMap;\r
@@ -105,22 +74,22 @@ class PGameServer
     void FinalizeClient( PClient *Client, PGameState *State );\r
     void FinalizeClientDelayed( PClient *Client, PGameState *State );\r
 \r
-//  bool HandleHandshake(PClient *Client, PGameState *State, const u8 *Packet, int PacketSize);\r
-    bool HandleHandshake( PGameState *State, const u8 *Packet, int PacketSize );\r
+//  bool HandleHandshake(PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize);\r
+    bool HandleHandshake( PGameState *State, const uint8_t *Packet, int PacketSize );\r
 \r
-    bool HandleAuthenticate( PClient *Client, PGameState *State, const u8 *Packet, int PacketSize );\r
-//  bool HandleGameData(PClient *Client, PGameState *State, const u8 *Packet, int PacketSize);\r
-    bool HandleGameData( PClient *Client, PGameState *State, const u8 *Packet );\r
+    bool HandleAuthenticate( PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize );\r
+//  bool HandleGameData(PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize);\r
+    bool HandleGameData( PClient *Client, PGameState *State, const uint8_t *Packet );\r
 \r
-//  bool HandleRequestChars(PClient *Client, PGameState *State, const u8 *Packet, int PacketSize);\r
-    bool HandleRequestChars( PClient *Client, PGameState *State, const u8 *Packet );\r
+//  bool HandleRequestChars(PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize);\r
+    bool HandleRequestChars( PClient *Client, PGameState *State, const uint8_t *Packet );\r
 \r
-    bool HandleCharList( PClient *Client, PGameState *State, const u8 *Packet, int PacketSize );\r
-//  bool HandleGetStatus(PClient *Client, PGameState *State, const u8 *Packet, int PacketSize);\r
-    bool HandleGetStatus( PClient *Client, PGameState *State, const u8 *Packet );\r
+    bool HandleCharList( PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize );\r
+//  bool HandleGetStatus(PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize);\r
+    bool HandleGetStatus( PClient *Client, PGameState *State, const uint8_t *Packet );\r
 \r
-//  bool HandleGameInfo(PClient *Client, PGameState *State, const u8 *Packet, int PacketSize);\r
-    bool HandleGameInfo( PClient *Client, PGameState *State, const u8 *Packet );\r
+//  bool HandleGameInfo(PClient *Client, PGameState *State, const uint8_t *Packet, int PacketSize);\r
+    bool HandleGameInfo( PClient *Client, PGameState *State, const uint8_t *Packet );\r
 \r
     bool HandleGame( PClient *Client, PGameState *State );\r
 \r
@@ -132,13 +101,10 @@ class PGameServer
     void Update();\r
     void ClientDisconnected( PClient *Client );\r
     void UDPStreamClosed( PClient *Client );\r
-    void SetGameTime( u32 newtime );\r
-    u32 GetGameTime();\r
+    void SetGameTime( uint32_t newtime );\r
+    uint32_t GetGameTime();\r
 \r
-    inline std::time_t GetStartTime() const { return mServerStartupTime; };\r
+    inline time_t GetStartTime() const { return mServerStartupTime; };\r
 \r
     PGameState* GetClientState( PClient* nClient );\r
 };\r
-\r
-#endif\r
-\r
similarity index 70%
rename from server/src/game/genreplist.cpp
rename to TinNS/Source/GameServer/GenrepList.cxx
index 956bb88..743d979 100644 (file)
@@ -1,40 +1,8 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       genreplist.cpp - classe for character genrep list\r
-\r
-       MODIFIED: 20 Sep 2006 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - clean ups\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "include/genreplist.h"\r
-\r
-PGenrepList::PGenrepList(u32 nOwnerCharID)\r
+PGenrepList::PGenrepList(uint32_t nOwnerCharID)\r
 {\r
     mOwnerCharID = nOwnerCharID;\r
     mListMaxSize = mListSize = 0;\r
@@ -47,7 +15,7 @@ PGenrepList::~PGenrepList()
         delete[] mGenrepList;\r
 }\r
 \r
-bool PGenrepList::AddGenrep(u16 nWorldID, u16 nStationID)\r
+bool PGenrepList::AddGenrep(uint16_t nWorldID, uint16_t nStationID)\r
 {\r
     char query[256];\r
 \r
@@ -76,10 +44,10 @@ bool PGenrepList::AddGenrep(u16 nWorldID, u16 nStationID)
         return false;\r
 }\r
 \r
-/*bool PGenrepList::RemoveChar(u32 nBuddyCharID)\r
+/*bool PGenrepList::RemoveChar(uint32_t nBuddyCharID)\r
 {\r
   char query[256];\r
-  u8 rEntry, i;\r
+  uint8_t rEntry, i;\r
 \r
   if ((rEntry = FindEntry(nBuddyCharID)) < mListSize)\r
   {\r
@@ -110,7 +78,7 @@ bool PGenrepList::SQLLoad()
     char query[256];\r
     MYSQL_RES *result;\r
     MYSQL_ROW row;\r
-    u8 EntriesNum;\r
+    uint8_t EntriesNum;\r
 \r
     snprintf(query, 256, "SELECT * FROM genrep WHERE (g_charid='%u')", mOwnerCharID);\r
     result = MySQL->GameResQuery(query);\r
@@ -139,9 +107,9 @@ bool PGenrepList::SQLLoad()
     return true;\r
 }\r
 \r
-void PGenrepList::IncreaseMaxSize(u8 nNewMax)\r
+void PGenrepList::IncreaseMaxSize(uint8_t nNewMax)\r
 {\r
-    u16 tmpSize;\r
+    uint16_t tmpSize;\r
 \r
     if (!nNewMax)\r
     {\r
@@ -171,9 +139,9 @@ void PGenrepList::IncreaseMaxSize(u8 nNewMax)
     mGenrepList = tmpList;\r
 }\r
 \r
-u8 PGenrepList::FindEntry(u16 nWorldID, u16 nStationID)\r
+uint8_t PGenrepList::FindEntry(uint16_t nWorldID, uint16_t nStationID)\r
 {\r
-    u8 i = 255;\r
+    uint8_t i = 255;\r
 \r
     if (mGenrepList)\r
     {\r
diff --git a/TinNS/Source/GameServer/GenrepList.hxx b/TinNS/Source/GameServer/GenrepList.hxx
new file mode 100644 (file)
index 0000000..ea47372
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+#define GENREPLIST_ALLOC_SIZE 4 // atomicity of list entries allocation\r
+\r
+class PGenrepList {\r
+private:\r
+    enum { // genrep DB Table fields\r
+        g_id = 0,\r
+        g_worldid,\r
+        g_stationid,\r
+        g_charid\r
+    };\r
+    struct PGenrepEntry\r
+    {\r
+      uint16_t mWorldID;\r
+      uint16_t mStationID;\r
+    };\r
+\r
+    uint32_t mOwnerCharID;\r
+    uint8_t mListMaxSize;\r
+    uint8_t mListSize;\r
+    PGenrepEntry* mGenrepList;\r
+\r
+    void IncreaseMaxSize(uint8_t nNewMax = 0);\r
+    uint8_t FindEntry(uint16_t nWorldID, uint16_t nStationID);\r
+\r
+  public:\r
+    PGenrepList(uint32_t nOwnerCharID);\r
+    ~PGenrepList();\r
+    bool AddGenrep(uint16_t nWorldID, uint16_t nStationID);\r
+    //bool RemoveChar(uint32_t nBuddyCharID);\r
+    inline uint8_t Count() { return mListSize; }\r
+    uint16_t GetListDataSize() { return (sizeof(PGenrepEntry) * mListSize); }\r
+    const void* GetListData() { return (const void*)mGenrepList; }\r
+    bool SQLLoad();\r
+//    bool SQLSave();\r
+};\r
similarity index 70%
rename from server/src/game/globals.cpp
rename to TinNS/Source/GameServer/Includes.cxx
index 4e28699..28f3f3d 100644 (file)
@@ -1,70 +1,9 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-       globals.cpp\r
-\r
-       MODIFIED: 12 September 2005 Akiko\r
-       REASON: - exchanged Pretender strings by TinNS\r
-       MODIFIED: 16 Dec 2005 bakkdoor\r
-       REASON: - Added global ClientManager and Chat Interface\r
-       MODIFIED: 22 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added MySQL Support\r
-               - Fixed ShutdownTinns (Wont cause segmentation fault anymore)\r
-       MODIFIED: 06 Jan 2006 Namikon\r
-       REASON: - Added color to console outputs\r
-               - Added shiny and colored copyright box :D\r
-       MODIFIED: 22 Jul 2006 Hammag\r
-       REASON: - Added Server NOT NULL check to avoid segfault when shuting down during startup\r
-       MODIFIED: 27 Aug 2006 Hammag\r
-       REASON: - Implemented shared Config class use and config template to load conf.\r
-               - Added gameserver configtemplate.h include,\r
-               - Added new required parameters to Config->LoadOptions()\r
-       MODIFIED: 02 Oct 2006 Hammag\r
-       REASON: - Added gDevDebug global flag to control development debug outputs (flagged messaged,\r
-                 dump-flagged messes, dev console->print)\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for buildsystem\r
-               - clean ups\r
-\r
-       TODO:   - Get logfile name from config file\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "configtemplate.h"\r
-#include "include/isc.h"\r
-\r
-#include "include/msgbuilder.h"\r
-#include "include/worlds.h"\r
-#include "include/appartements.h"\r
-#include "include/npc.h"\r
-#include "include/subway.h"\r
-#include "include/terminal.h"\r
-\r
-#include "include/version.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
+// TODO:   - Get logfile name from config file\r
 \r
 const char ServerVersion[] = TINNS_GAME_VERSION;\r
 const char SVNRevision[] = TINNS_SVN_REVISION;\r
@@ -161,7 +100,7 @@ bool InitTinNS()
     Worlds->LoadWorlds();\r
 \r
     WorldActors = new PWorldActors();\r
-       LuaEngine = new PLuaEngine();\r
+    LuaEngine = new PLuaEngine();\r
 \r
     NPCManager = new PNPCManager();\r
     Appartements = new PAppartements;\r
@@ -177,14 +116,14 @@ bool InitTinNS()
       Console->Print("%s Could not creat password_filter PCRE '%s'", Console->ColorText(RED, BLACK, "[Error]"), Config->GetOption("password_filter").c_str());\r
       return false;\r
     }\r
-    \r
+\r
     if (!PChar::SetCharnameRegexFilter(Config->GetOption("charname_filter").c_str()))\r
     {\r
       Console->Print("%s Could not creat charname_filter PCRE '%s'", Console->ColorText(RED, BLACK, "[Error]"), Config->GetOption("charname_filter").c_str());\r
       return false;\r
     }\r
     Chars = new PChars();\r
-       \r
+\r
     ServerSock = new ServerSocket();\r
     Server = new PServer();\r
     GameServer = new PGameServer();\r
@@ -199,9 +138,9 @@ bool InitTinNS()
     ISC = new PISC();\r
     Terminal = new PTerminal();\r
 \r
-       Outposts = new POutpost();\r
+    Outposts = new POutpost();\r
 \r
-       MultiPartHandler = new PMultiPart();\r
+    MultiPartHandler = new PMultiPart();\r
 \r
     return true;\r
 }\r
@@ -257,4 +196,3 @@ void Shutdown()
 \r
     exit(0);\r
 }\r
-\r
diff --git a/TinNS/Source/GameServer/Includes.hxx b/TinNS/Source/GameServer/Includes.hxx
new file mode 100644 (file)
index 0000000..e35b5f2
--- /dev/null
@@ -0,0 +1,89 @@
+#pragma once\r
+\r
+#include "GameServer/Accounts.hxx"\r
+#include "GameServer/Appartements.hxx"\r
+#include "GameServer/BuddyList.hxx"\r
+#include "GameServer/Chars.hxx"\r
+#include "GameServer/Chat.hxx"\r
+#include "GameServer/Client.hxx"\r
+#include "GameServer/ClientManager.hxx"\r
+#include "GameServer/Commands.hxx"\r
+#include "GameServer/ConfigTemplate.hxx"\r
+#include "GameServer/Container.hxx"\r
+#include "GameServer/DoorTemplate.hxx"\r
+#include "GameServer/FurnitureTemplate.hxx"\r
+#include "GameServer/GameScript.hxx"\r
+#include "GameServer/GameServer.hxx"\r
+#include "GameServer/GenrepList.hxx"\r
+#include "GameServer/Inventory.hxx"\r
+#include "GameServer/Isc.hxx"\r
+#include "GameServer/Item.hxx"\r
+#include "GameServer/LuaEngine.hxx"\r
+#include "GameServer/Main.hxx"\r
+#include "GameServer/MessageBuilder.hxx"\r
+#include "GameServer/MultiPart.hxx"\r
+#include "GameServer/Npc.hxx"\r
+#include "GameServer/NpcTemplate.hxx"\r
+#include "GameServer/Outpost.hxx"\r
+#include "GameServer/RemoteConsole.hxx"\r
+#include "GameServer/Server.hxx"\r
+#include "GameServer/Skill.hxx"\r
+#include "GameServer/Sql.hxx"\r
+#include "GameServer/Subway.hxx"\r
+#include "GameServer/Terminal.hxx"\r
+#include "GameServer/Vehicle.hxx"\r
+#include "GameServer/VehicleAccessRequest.hxx"\r
+#include "GameServer/WorldActors.hxx"\r
+#include "GameServer/WorldDataTemplate.hxx"\r
+#include "GameServer/Worlds.hxx"\r
+#include "GameServer/Zoning.hxx"\r
+\r
+extern class PLuaEngine *LuaEngine;\r
+\r
+extern class ServerSocket *ServerSock;\r
+extern class PConsole *Console;\r
+//extern class PRConsole *RemoteConsole;\r
+extern class PConfig *Config;\r
+extern class PConfig *CmdAccess;\r
+\r
+extern class PGameDefs *GameDefs;\r
+extern class PFileSystem *Filesystem;\r
+extern class PServer *Server;\r
+\r
+extern class PGameServer *GameServer;\r
+extern class PChars *Chars;\r
+\r
+extern class PMsgBuilder *MsgBuilder;\r
+extern class PWorlds *Worlds;\r
+extern class PAppartements* Appartements;\r
+extern class PWorldActors* WorldActors;\r
+extern class PTerminal* Terminal;\r
+//extern class gmMachine machine;   // Virtual Machine instance\r
+\r
+//multiuser chat\r
+extern class PClientManager *ClientManager;\r
+extern class PNPCManager* NPCManager;\r
+extern class PChat *Chat;\r
+extern class PCommands *GameCommands;\r
+\r
+extern class POutpost *Outposts;\r
+extern class PMultiPart *MultiPartHandler;\r
+\r
+// Development debug output control\r
+extern bool gDevDebug;\r
+\r
+//MySQL-Support\r
+extern class PMySQL* MySQL;\r
+\r
+//Vehicles\r
+extern class PVehicles *Vehicles;\r
+extern class PSubway* Subway;\r
+\r
+//Infoserver update\r
+extern class PISC *ISC;\r
+\r
+extern const char ServerVersion[];\r
+extern const char SVNRevision[];\r
+\r
+bool InitTinNS();\r
+void Shutdown();\r
similarity index 62%
rename from server/src/game/inventory.cpp
rename to TinNS/Source/GameServer/Inventory.cxx
index fac330c..9d82354 100644 (file)
@@ -1,42 +1,4 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       inventory.cpp - classes for inventories\r
-                       (inventory, belt, armor, implants, gogo, processor(?), maybe other containers(?) )\r
-\r
-       MODIFIED: 10 Jul 2006 Hammag\r
-       REASON: - creation : Quick and dirty main inventory (backpack) management\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - clean ups\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/inventory.h"\r
-#include "include/container.h"\r
-\r
+#include "GameServer/Includes.hxx"\r
 \r
 /* --- PInventory class --- */\r
 \r
@@ -56,7 +18,7 @@ PInventory::~PInventory ()
   delete mGogo;\r
 }\r
 \r
-void PInventory::SetCharId(u32 CharID)\r
+void PInventory::SetCharId(uint32_t CharID)\r
 {\r
   mWorn->SetInfo(CharID, INV_DB_LOC_WORN);\r
   mBackpack->SetInfo(CharID, INV_DB_LOC_BACKPACK);\r
@@ -66,7 +28,7 @@ void PInventory::SetCharId(u32 CharID)
 bool PInventory::SQLLoad()\r
 {\r
   return ( mWorn->SQLLoad() && mBackpack->SQLLoad() && mGogo->SQLLoad() );\r
-  \r
+\r
 /*bool ret = mWorn->SQLLoad() && mBackpack->SQLLoad() && mGogo->SQLLoad();\r
 Console->Print(YELLOW, BLACK, "--- Worn Inventory ---");\r
 mWorn->Dump();\r
@@ -88,7 +50,7 @@ bool PInventory::IsDirty() const
   return (mWorn && mWorn->IsDirty()) || (mBackpack && mBackpack->IsDirty()) || (mGogo && mGogo->IsDirty());\r
 }\r
 \r
-PContainer* PInventory::GetContainer(u8 nInvLoc)\r
+PContainer* PInventory::GetContainer(uint8_t nInvLoc)\r
 {\r
   PContainer* tContainer;\r
   switch(nInvLoc)\r
@@ -108,14 +70,14 @@ PContainer* PInventory::GetContainer(u8 nInvLoc)
   return tContainer;\r
 }\r
 \r
-bool PInventory::AddItem(PItem *NewItem, u8 nInvLoc, u32 nInvID, u8 nPosX, u8 nPosY, bool SetDirty)\r
+bool PInventory::AddItem(PItem *NewItem, uint8_t nInvLoc, uint32_t nInvID, uint8_t nPosX, uint8_t nPosY, bool SetDirty)\r
 {\r
   PContainer* destContainer = GetContainer(nInvLoc);\r
   return(destContainer ? destContainer->AddItem(NewItem, nInvID, nPosX, nPosY, SetDirty) : false);\r
 }\r
 \r
 /*\r
-bool PInventory::QB_IsFree(u8 nSlot)\r
+bool PInventory::QB_IsFree(uint8_t nSlot)\r
 {\r
     if(nSlot > 9)\r
         return false;\r
@@ -127,7 +89,7 @@ bool PInventory::QB_IsFree(u8 nSlot)
         return false;\r
 }\r
 \r
-void PInventory::QB_SetSlot(u8 nSlot, u16 nItemID)\r
+void PInventory::QB_SetSlot(uint8_t nSlot, uint16_t nItemID)\r
 {\r
     if(nSlot > 9)\r
         return;\r
@@ -135,7 +97,7 @@ void PInventory::QB_SetSlot(u8 nSlot, u16 nItemID)
     mQuickAccessBelt[nSlot] = nItemID;\r
 }\r
 \r
-u16 PInventory::QB_GetSlot(u8 nSlot)\r
+uint16_t PInventory::QB_GetSlot(uint8_t nSlot)\r
 {\r
     if(nSlot > 9)\r
         return 0;\r
@@ -143,7 +105,7 @@ u16 PInventory::QB_GetSlot(u8 nSlot)
     return mQuickAccessBelt[nSlot];\r
 }\r
 \r
-void PInventory::QB_Move(u8 nSlotSRC, u8 nSlotDST)\r
+void PInventory::QB_Move(uint8_t nSlotSRC, uint8_t nSlotDST)\r
 {\r
     if(nSlotSRC > 9 || nSlotDST > 9)\r
         return;\r
diff --git a/TinNS/Source/GameServer/Inventory.hxx b/TinNS/Source/GameServer/Inventory.hxx
new file mode 100644 (file)
index 0000000..2218a5c
--- /dev/null
@@ -0,0 +1,83 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+//NC containers message locations\r
+#define INV_LOC_GROUND 1\r
+#define INV_LOC_WORN 2\r
+#define INV_LOC_BACKPACK 3\r
+#define INV_LOC_BOX 4\r
+#define INV_LOC_NPCTRADE 5\r
+#define INV_LOC_GOGO 18\r
+#define INV_LOC_BOX2 255\r
+//PC-Trade window = ?\r
+\r
+//Inventory containers info\r
+#define INV_WORN_QB_START 0\r
+#define INV_WORN_QB_END 9\r
+#define INV_WORN_QB_NONE 99\r
+#define INV_WORN_QB_HAND 11\r
+\r
+#define INV_WORN_PROC_START 12\r
+#define INV_WORN_PROC_END 24\r
+\r
+#define INV_WORN_IMP_START 26\r
+#define INV_WORN_IMP_END 38\r
+\r
+#define INV_WORN_ARMOR_START 39\r
+#define INV_WORN_ARMOR_END 43\r
+\r
+#define INV_WORN_COLS 44\r
+#define INV_WORN_MAXSLOTS 44\r
+\r
+\r
+#define INV_BACKPACK_COLS 10\r
+\r
+#define INV_GOGO_COLS 5\r
+#define INV_GOGO_MAXSLOTS 50\r
+\r
+#define INV_CABINET_COLS 5\r
+#define INV_CABINET_MAXSLOTS 33\r
+\r
+// inv_loc values in database\r
+#define INV_DB_LOC_GOGO 1\r
+#define INV_DB_LOC_WORN 2\r
+#define INV_DB_LOC_BACKPACK 3\r
+\r
+class PItem;\r
+class PContainer;\r
+class PContainerWithHoles;\r
+class PContainer2DWorkaround;\r
+class PContainerAutoFindFree;\r
+\r
+class PInventory\r
+{\r
+  private:\r
+    PContainerWithHoles* mWorn; // PContainerLinearSlots\r
+    PContainer2DWorkaround* mBackpack; // PContainer2DAreas\r
+    PContainerAutoFindFree* mGogo; // PContainerLinearSlots\r
+\r
+  public:\r
+\r
+    PInventory();\r
+    ~PInventory();\r
+\r
+    void SetCharId(uint32_t CharID);\r
+    bool SQLLoad();\r
+    bool SQLSave();\r
+    PContainer* GetContainer(uint8_t nInvLoc);\r
+    inline PContainer2DWorkaround* GetBackpackContainer() { return mBackpack; }\r
+\r
+    bool IsDirty() const;\r
+\r
+    bool AddItem(PItem* NewItem, uint8_t nInvLoc = INV_LOC_BACKPACK, uint32_t nInvID = 0, uint8_t nPosX = 0, uint8_t nPosY = 0, bool SetDirty = true);\r
+    //bool CheckItem(uint32_t ItemID, uint8_t StackSize = 1);\r
+    //PItem *GetItem(uint32_t ItemID, uint8_t StackSize = 1);\r
+    //PItem *GetItemByPos(uint8_t nPosX, uint8_t nPosY, uint8_t StackSize = 1);\r
+    //bool MoveItem(uint8_t oPosX, uint8_t oPosY, uint8_t dPosX, uint8_t dPosY);\r
+\r
+    //bool QB_IsFree(uint8_t nSlot);\r
+    //void QB_SetSlot(uint8_t nSlot, uint16_t nItemID);\r
+    //uint16_t QB_GetSlot(uint8_t nSlot);\r
+    //void QB_Move(uint8_t nSlotSRC, uint8_t nSlotDST);\r
+};\r
similarity index 71%
rename from server/src/game/isc.cpp
rename to TinNS/Source/GameServer/Isc.cxx
index 8120de1..0fece43 100644 (file)
@@ -1,41 +1,7 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-       isc.cpp\r
-\r
-       MODIFIED: Unknown date / Namikon\r
-       REASON: - initial release by Namikon\r
-       MODIFIED: 13 Oct 2006 Hammag\r
-       REASON: - Implemented MySQL isc method\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-\r
-       TODO:\r
-       - implement ISC protocol\r
-*/\r
-\r
-#include "main.h"\r
-\r
-#include "include/isc.h"\r
+// TODO: - implement ISC protocol\r
 \r
 PISC::PISC()\r
 {\r
@@ -70,7 +36,7 @@ void PISC::Start()
 \r
   if (use_isc)\r
     Start_isc();\r
-  \r
+\r
   if (use_mysql)\r
     Start_mysql();\r
 \r
@@ -80,9 +46,9 @@ void PISC::Update()
 {\r
   if (use_isc)\r
     Update_isc();\r
-  \r
+\r
   if (use_mysql)\r
-    Update_mysql();     \r
+    Update_mysql();\r
 }\r
 \r
 void PISC::Shutdown()\r
@@ -92,7 +58,7 @@ void PISC::Shutdown()
     use_isc = false;\r
     Shutdown_isc();\r
   }\r
-  \r
+\r
   if (use_mysql)\r
   {\r
     use_mysql = false;\r
@@ -104,28 +70,25 @@ void PISC::Shutdown()
 \r
 void PISC::Start_isc()\r
 {\r
-  u16 Port = Config->GetOptionInt("isc_infoserverport");\r
-       if (Port == 0)\r
-       {\r
-               Console->Print("%s Unable to start ISC, isc_infoserverport setting is invalid");\r
-               use_isc = false;\r
-               return;\r
-       }\r
-       Console->Print("Trying to connect to infoserver...", Port);\r
-       // Add function for initial connect here and store the connectioninfo somewhere\r
+  uint16_t Port = Config->GetOptionInt("isc_infoserverport");\r
+    if (Port == 0)\r
+    {\r
+        Console->Print("%s Unable to start ISC, isc_infoserverport setting is invalid");\r
+        use_isc = false;\r
+        return;\r
+    }\r
+    Console->Print("Trying to connect to infoserver...", Port);\r
+    // Add function for initial connect here and store the connectioninfo somewhere\r
 }\r
 \r
 void PISC::Update_isc()\r
 {\r
-  \r
 }\r
 \r
 void PISC::Shutdown_isc()\r
 {\r
-  \r
 }\r
 \r
-\r
 /*** IMySQL mode specific ***/\r
 \r
 void PISC::Start_mysql()\r
@@ -137,18 +100,18 @@ void PISC::Start_mysql()
     Console->Print("%s value for 'isc_update_intervall' too low (%d). Set to 10 sec.", Console->ColorText(YELLOW, BLACK, "[Notice]"), mysql_update_intervall);\r
     mysql_update_intervall = 10;\r
   }\r
-  \r
+\r
   mysql_delayed_update_intervall = Config->GetOptionInt("isc_delayed_update_intervall");\r
   if (mysql_delayed_update_intervall < 0)\r
   {\r
     Console->Print("%s value for 'isc_delayed_update_intervall' is invalid (%d). Set to 0 sec (immediate update)", Console->ColorText(YELLOW, BLACK, "[Notice]"), mysql_delayed_update_intervall);\r
     mysql_delayed_update_intervall = 0;\r
   }\r
-    \r
+\r
   mysql_last_update_time = 0;\r
   mysql_last_client_count = 0;\r
   mysql_last_count_decrease_time = 0;\r
-  \r
+\r
   Update_mysql();\r
 }\r
 \r
@@ -157,7 +120,7 @@ void PISC::Update_mysql()
   bool do_update = false;\r
   std::time_t t = std::time(NULL);\r
   int client_count = Server->GetNumClients();\r
-  \r
+\r
   if (((t - mysql_last_update_time) >= mysql_update_intervall) || (client_count > mysql_last_client_count))\r
   {\r
     do_update = true;\r
@@ -181,7 +144,7 @@ void PISC::Update_mysql()
     mysql_last_count_decrease_time = 0;\r
 //if(gDevDebug) Console->Print("%s ISC : Canceling less clients time count", Console->ColorText(GREEN, BLACK, "[Debug]"));    \r
   }\r
-  \r
+\r
   if (do_update)\r
   {\r
     do_mysql_db_update(client_count);\r
@@ -189,7 +152,6 @@ void PISC::Update_mysql()
     mysql_last_count_decrease_time = 0;\r
     mysql_last_update_time = std::time(NULL);\r
   }\r
-  \r
 }\r
 \r
 void PISC::Shutdown_mysql()\r
similarity index 53%
rename from server/src/game/include/isc.h
rename to TinNS/Source/GameServer/Isc.hxx
index abc8eb6..dc04f9e 100644 (file)
@@ -1,37 +1,7 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
+#pragma once\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-  isc.h\r
-\r
-  MODIFIED: Unknown date / Namikon\r
-  REASON: - initial release by Namikon\r
-       MODIFIED: 13 Oct 2006 Hammag\r
-       REASON: - Implemented MySQL isc method\r
-\r
-*/\r
-\r
-#ifndef ISC_H\r
-#define ISC_H\r
+#include <chrono>\r
+#include <cstdint>\r
 \r
 #define ISC_VER 2\r
 \r
@@ -39,10 +9,8 @@
 #define ISC_CONNECTED 1\r
 #define ISC_ADMIN 2\r
 \r
-\r
-class PISC\r
-{\r
-       private:\r
+class PISC {\r
+    private:\r
         enum PISC_Status\r
         {\r
             ISC_NOTCONNECTED,\r
@@ -62,7 +30,7 @@ class PISC
             ISC_IDLE          // Updateloop running\r
         } mLinkStatus;\r
 \r
-        u16 mConStatus;     // Bitmask of Connection status\r
+        uint16_t mConStatus;     // Bitmask of Connection status\r
 \r
         int isc_method;\r
 \r
@@ -71,11 +39,11 @@ class PISC
 \r
         bool use_mysql;\r
         int m_server_id;\r
-        std::time_t mysql_update_intervall;\r
-        std::time_t mysql_delayed_update_intervall;\r
-        std::time_t mysql_last_update_time;\r
+        time_t mysql_update_intervall;\r
+        time_t mysql_delayed_update_intervall;\r
+        time_t mysql_last_update_time;\r
         int mysql_last_client_count;\r
-        std::time_t mysql_last_count_decrease_time;\r
+        time_t mysql_last_count_decrease_time;\r
 \r
         void Start_isc();\r
         void Update_isc();\r
@@ -86,13 +54,11 @@ class PISC
         bool do_mysql_db_update(int players, bool shutdown = false);\r
         void Shutdown_mysql();\r
 \r
-       public:\r
-               PISC();\r
-               ~PISC();\r
+    public:\r
+        PISC();\r
+        ~PISC();\r
 \r
-               void Start();\r
-               void Update();\r
-               void Shutdown();\r
+        void Start();\r
+        void Update();\r
+        void Shutdown();\r
 };\r
-\r
-#endif\r
diff --git a/TinNS/Source/GameServer/Item.cxx b/TinNS/Source/GameServer/Item.cxx
new file mode 100644 (file)
index 0000000..ce2b4b1
--- /dev/null
@@ -0,0 +1,180 @@
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+\r
+PItem::PItem(uint32_t ItemID, uint8_t nStackSize, uint8_t CurDur, uint8_t MaxDur, uint8_t Dmg, uint8_t Freq, uint8_t Hand, uint8_t Rng)\r
+{\r
+  mDefItem = GameDefs->Items()->GetDef(ItemID);\r
+  if (mDefItem) {\r
+    mItemID = ItemID;\r
+    mStackable = mDefItem->IsStackable();\r
+    mStackSize = mStackable ? nStackSize : 1;\r
+\r
+    mLoadedAmmoId = 0;\r
+    mLoadedAmmoNb = 0;\r
+\r
+    mPropertiesFlags = 0;\r
+\r
+    mUsedSlots = mMaxSlots = 0;\r
+    mModificators = 0;\r
+\r
+    mConstructorId = 0;\r
+    //mType = mDefItem->GetType();\r
+    //mValue1 = mDefItem->GetValue1();\r
+    //mValue2 = mDefItem->GetValue2();\r
+    //mValue3 = mDefItem->GetValue3();\r
+    //mSizeX = mDefItem->GetSizeX();\r
+    //mSizeY = mDefItem->GetSizeY();\r
+    //mWeight = mDefItem->GetWeight();\r
+    //mFillWeight = mDefItem->GetFillWeight();\r
+    //mQualifier = mDefItem->GetQualifier();\r
+    //mItemGroupID = mDefItem->GetItemGroupID();\r
+    //mBasePrice = mDefItem->GetBasePrice();\r
+    //mTechlevel = mDefItem->GetTechlevel();\r
+    //mItemflags = mDefItem->GetItemflags();\r
+\r
+    //if (!mStackable) // only non-stackable items can have quality stats (?)\r
+    //{\r
+    //  mStackSize = 1;\r
+      mCurDuration = CurDur;\r
+      mMaxDuration = MaxDur;\r
+      mDamages = Dmg;\r
+      mFrequency = Freq;\r
+      mHandling = Hand;\r
+      mRange = Rng;\r
+    //}\r
+  }\r
+  else\r
+  {\r
+    mItemID = 0;\r
+    Console->Print(YELLOW, BLACK, "PItem::PItem: Invalid item ID %d", ItemID);\r
+  }\r
+}\r
+\r
+void PItem::MakeItemStandard(uint8_t GlobalQualityMin, uint8_t GlobalQualityMax)\r
+{\r
+  if(GlobalQualityMin > GlobalQualityMax) GlobalQualityMin = GlobalQualityMax;\r
+\r
+  mCurDuration = 255;\r
+  mMaxDuration = 255;\r
+  if(GlobalQualityMin == GlobalQualityMax)\r
+  {\r
+    mDamages = GlobalQualityMin;\r
+    mFrequency = GlobalQualityMin;\r
+    mHandling = GlobalQualityMin;\r
+    mRange = GlobalQualityMin;\r
+  }\r
+  else\r
+  {\r
+    mDamages = (uint8_t) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
+    mFrequency = (uint8_t) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
+    mHandling = (uint8_t) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
+    mRange = (uint8_t) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
+  }\r
+}\r
+\r
+uint32_t PItem::GetItemID()\r
+{\r
+    return mItemID;\r
+}\r
+\r
+int PItem::GetType()\r
+{\r
+    return mDefItem->GetType();\r
+}\r
+\r
+uint8_t PItem::GetItemflags()\r
+{\r
+    return mDefItem->GetItemflags();\r
+}\r
+\r
+const std::string &PItem::GetName() const\r
+{\r
+    return mDefItem->GetName();\r
+}\r
+\r
+uint8_t PItem::GetSizeX()\r
+{\r
+    return mDefItem->GetSizeX();\r
+}\r
+\r
+uint8_t PItem::GetSizeY()\r
+{\r
+    return mDefItem->GetSizeY();\r
+}\r
+\r
+float PItem::GetWeight()\r
+{\r
+    return mStackSize * mDefItem->GetWeight();\r
+}\r
+\r
+float PItem::GetSingleUnitWeight()\r
+{\r
+    return mDefItem->GetWeight();\r
+}\r
+\r
+float PItem::GetFillWeight()\r
+{\r
+    return mDefItem->GetFillWeight();\r
+}\r
+\r
+uint32_t PItem::GetBasePrice()\r
+{\r
+    return mDefItem->GetBasePrice();\r
+}\r
+\r
+uint16_t PItem::GetTechlevel()\r
+{\r
+    return mDefItem->GetTechlevel();\r
+}\r
+\r
+int PItem::GetValue1()\r
+{\r
+    return mDefItem->GetValue1();\r
+}\r
+\r
+int PItem::GetValue2()\r
+{\r
+    return mDefItem->GetValue2();\r
+}\r
+\r
+int PItem::GetValue3()\r
+{\r
+    return mDefItem->GetValue3();\r
+}\r
+\r
+int PItem::GetQualifier()\r
+{\r
+    return mDefItem->GetQualifier();\r
+}\r
+\r
+bool PItem::IsStackable()\r
+{\r
+    return mDefItem->IsStackable();\r
+}\r
+\r
+uint8_t PItem::GetStackSize()\r
+{\r
+    return mStackSize;\r
+}\r
+\r
+uint8_t PItem::AddToStack(uint8_t ItemNb) // returns nb of items not added\r
+{\r
+  uint8_t addedItems = 0;\r
+  if (mStackable)\r
+  {\r
+    addedItems = (ItemNb <= (MAX_ITEMSTACK_SIZE - mStackSize)) ? ItemNb : (MAX_ITEMSTACK_SIZE - mStackSize);\r
+    mStackSize += addedItems;\r
+  }\r
+  return (ItemNb - addedItems);\r
+}\r
+\r
+uint8_t PItem::TakeFromStack(uint8_t ItemNb)\r
+{\r
+  uint8_t retreivedItems = 0;\r
+  if (mStackable)\r
+  {\r
+    retreivedItems = std::min(mStackSize, ItemNb);\r
+    mStackSize -= retreivedItems;\r
+  }\r
+  return retreivedItems;\r
+}\r
diff --git a/TinNS/Source/GameServer/Item.hxx b/TinNS/Source/GameServer/Item.hxx
new file mode 100644 (file)
index 0000000..fbe9668
--- /dev/null
@@ -0,0 +1,112 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+\r
+class PDefItems;\r
+\r
+// TODO: Add CreatorID (for "named" item), CurrentMunitionID, CurrentMunitionNb (for weapons & charge-items: muns,\r
+//        medkit, etc.) to DB, equipped/free slots, & corresponding code\r
+\r
+#define MAX_ITEMSTACK_SIZE 250\r
+\r
+//Type\r
+#define ITEM_TYPE_VARIOUS 0\r
+#define ITEM_TYPE_WEAPON 1\r
+#define ITEM_TYPE_AMMO 2\r
+#define ITEM_TYPE_HEALTH 3\r
+#define ITEM_TYPE_IMPLANT 4\r
+#define ITEM_TYPE_DRUG 5\r
+#define ITEM_TYPE_MOD 6\r
+#define ITEM_TYPE_GFXMOD 7\r
+#define ITEM_TYPE_BLUEPRINT 8\r
+#define ITEM_TYPE_ARMOR 9\r
+#define ITEM_TYPE_PSIMOD 10\r
+#define ITEM_TYPE_PSIMODREADY 11\r
+#define ITEM_TYPE_REPAIR 12\r
+#define ITEM_TYPE_RECYCLER 13\r
+#define ITEM_TYPE_DATACUBE 14\r
+#define ITEM_TYPE_CONSTRUCTOR 15\r
+#define ITEM_TYPE_RESEARCHER 16\r
+#define ITEM_TYPE_IMPLANTER 17\r
+#define ITEM_TYPE_APARTMENTKEY 18\r
+#define ITEM_TYPE_CLANKEY 19\r
+#define ITEM_TYPE_CASHCUBE 20\r
+#define ITEM_TYPE_AUTOWEAPON 21\r
+#define ITEM_TYPE_VHCKEY 22\r
+#define ITEM_TYPE_UNIDENTPART 24\r
+#define ITEM_TYPE_WRECKEDPART 25\r
+#define ITEM_TYPE_SALVAGE 26\r
+#define ITEM_TYPE_VHCCOMPONENT 27\r
+#define ITEM_TYPE_RECORDABLE 28\r
+\r
+// gfxmodflags\r
+#define ITEM_MOD_FLASHLIGHT 1\r
+#define ITEM_MOD_SCOP 2\r
+#define ITEM_MOD_SILENCER 4\r
+#define ITEM_MOD_LASERPOINTER 8\r
+\r
+// itemflags:\r
+#define ITEM_FLAG_RESEARCHABLE 1\r
+#define ITEM_FLAG_NO_DROP 2\r
+#define ITEM_FLAG_NO_MAX_REPAIRE_DECAY 4\r
+#define ITEM_FLAG_AMMO 8 // for loadable ammo\r
+// not sure for ITEM_FLAG_AMMO\r
+\r
+class PItem {\r
+  friend class PContainerEntry;\r
+  friend class PMsgBuilder;\r
+\r
+  private:\r
+    uint32_t mItemID;\r
+    const PDefItems* mDefItem;\r
+\r
+    bool mStackable;\r
+    uint8_t mStackSize;\r
+\r
+    uint32_t mLoadedAmmoId;\r
+    uint8_t mLoadedAmmoNb;\r
+\r
+    uint8_t mPropertiesFlags;\r
+\r
+    uint8_t mCurDuration;\r
+    uint8_t mMaxDuration;\r
+    uint8_t mDamages;\r
+    uint8_t mFrequency;\r
+    uint8_t mHandling;\r
+    uint8_t mRange;\r
+\r
+    uint8_t mUsedSlots;\r
+    uint8_t mMaxSlots;\r
+    uint8_t mSlot[5];\r
+    uint8_t mModificators;\r
+\r
+    uint32_t mConstructorId;\r
+\r
+  public:\r
+    PItem(uint32_t ItemID, uint8_t nStackSize = 1, uint8_t CurDur = 0, uint8_t MaxDur = 0, uint8_t Dmg = 0, uint8_t Freq = 0, uint8_t Hand = 0, uint8_t Rng = 0);\r
+    //~PItem();\r
+    void MakeItemStandard(uint8_t GlobalQualityMin = 120, uint8_t GlobalQualityMax = 180);\r
+\r
+    uint32_t GetItemID();\r
+    int GetType();\r
+    uint8_t GetItemflags();\r
+    const std::string &GetName() const;\r
+    uint8_t GetSizeX();\r
+    uint8_t GetSizeY();\r
+    float GetWeight();\r
+    float GetSingleUnitWeight();\r
+    float GetFillWeight();\r
+    uint32_t GetBasePrice();\r
+    uint16_t GetTechlevel();\r
+    int GetValue1();\r
+    int GetValue2();\r
+    int GetValue3();\r
+    int GetQualifier();\r
+    bool IsStackable();\r
+    uint8_t GetStackSize();\r
+    uint8_t AddToStack(uint8_t ItemNb); // return the nb of items NOT added\r
+    uint8_t TakeFromStack(uint8_t ItemNb); // return the nb of retreived items\r
+\r
+    //mItemGroupID = def->GetItemGroupID();\r
+};\r
similarity index 90%
rename from server/src/game/lua_engine.cpp
rename to TinNS/Source/GameServer/LuaEngine.cxx
index 7e2afd3..bbce3c3 100644 (file)
@@ -1,34 +1,5 @@
-/*
-TinNS (TinNS is not a Neocron Server)
-Copyright (C) 2005 Linux Addicted Community
-maintainer Akiko <akiko@gmx.org>
-
-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"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 // ******************************************************************
 // ATTENTION  ATTENTION  ATTENTION  ATTENTION  ATTENTION  ATTENTION
@@ -109,7 +80,7 @@ int npcscript_callback(lua_State *nLua)
         int tAmount = lua_tointeger(nLua, 3);
         if (gDevDebug) Console->Print("TAKEMONEY from script");
 
-        if(tClient->GetChar()->GetCash() < (u32)tAmount)
+        if(tClient->GetChar()->GetCash() < (uint32_t)tAmount)
         {
             // Cannot take cash, player has less than amount required
             LuaEngine->AddScriptResult(0);
@@ -214,7 +185,7 @@ void PLuaEngine::ProcessDialogScript(PClient* nClient, std::string nLUAFile, int
     PChar* tChar = nClient->GetChar();
 
     // Get current node ID the player is on
-    u16 tNodeID = tChar->GetDialogNode();
+    uint16_t 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
@@ -230,7 +201,7 @@ void PLuaEngine::ProcessDialogScript(PClient* nClient, std::string nLUAFile, int
     else
     {
         // Set the new node in client
-        tChar->SetDialogNode((u16)mReturn_INT);
+        tChar->SetDialogNode((uint16_t)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);
@@ -265,7 +236,7 @@ void PLuaEngine::AddScriptResult(int nResult)
 
 PLuaEngine::PLuaEngine()
 {
-       // New lua function 
+    // New lua function
     mLua = luaL_newstate();
     mRunning = false;
 }
diff --git a/TinNS/Source/GameServer/LuaEngine.hxx b/TinNS/Source/GameServer/LuaEngine.hxx
new file mode 100644 (file)
index 0000000..3b1c36c
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <lua.hpp>
+
+#define PLUAENGINE_DEFAULT      0
+#define PLUAENGINE_GETANSWER    4096
+#define PLUAENGINE_EXECUTENODE  8192
+
+class PLuaEngine {
+private:
+    PClient* mTargetClient;
+
+    bool mRunning;
+    lua_State *mLua;
+
+    std::vector<int> 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; };
+};
diff --git a/TinNS/Source/GameServer/Main.cxx b/TinNS/Source/GameServer/Main.cxx
new file mode 100644 (file)
index 0000000..4a93545
--- /dev/null
@@ -0,0 +1,57 @@
+#include <csignal>
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
+
+// 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;
+}
diff --git a/TinNS/Source/GameServer/Main.hxx b/TinNS/Source/GameServer/Main.hxx
new file mode 100644 (file)
index 0000000..c5b65d7
--- /dev/null
@@ -0,0 +1,52 @@
+#pragma once\r
+\r
+//#include "version.h"\r
+\r
+//basic includes\r
+//#include "include/external.h"\r
+\r
+//tinns includes\r
+//#include "include/types.h"\r
+//#include "common/netcode.h"\r
+/*\r
+#include "../gamemonkey/gmMachine.h"\r
+#include "../gamemonkey/gmCall.h"\r
+*/\r
+//#include "common/console.h"\r
+//#include "common/misc.h"\r
+\r
+// MySQL Support\r
+/*\r
+#ifdef MYSQL_INC_DIR\r
+#include <mysql/mysql.h>\r
+#else\r
+#include <mysql.h>\r
+#endif\r
+\r
+#include "include/sql.h"\r
+\r
+#include "common/config.h"\r
+#include "common/filesystem.h"\r
+#include "include/defparser.h"\r
+\r
+#include "include/skill.h"\r
+#include "include/chars.h"\r
+#include "include/accounts.h"\r
+#include "include/client.h"\r
+#include "include/server.h"\r
+#include "include/gameserver.h"\r
+#include "include/globals.h"\r
+#include "include/defs.h"\r
+#include "include/zoning.h"\r
+#include "include/item.h"\r
+#include "include/inventory.h"\r
+#include "include/worldactors.h"\r
+#include "include/npc.h"\r
+#include "include/outpost.h"\r
+#include "include/multipart.h"\r
+#include "include/terminal.h"\r
+\r
+#include "include/lua_engine.h"\r
+#include "include/chat.h"\r
+#include "include/commands.h"\r
+#include "include/clientmanager.h" */\r
diff --git a/TinNS/Source/GameServer/MessageBuilder.cxx b/TinNS/Source/GameServer/MessageBuilder.cxx
new file mode 100644 (file)
index 0000000..c9cd3f9
--- /dev/null
@@ -0,0 +1,3664 @@
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "Common/Includes.hxx"
+
+PMessage* PMsgBuilder::BuildOutpostClanInfoMsg( PClient* nClient, uint32_t nClanID, uint8_t nFaction )
+{
+    PMessage* tmpMsg = new PMessage();
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << (uint8_t)0x13;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint16_t)nClient->GetSessionID();
+    *tmpMsg << (uint8_t)0x13; // Message length
+    *tmpMsg << (uint8_t)0x03;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint8_t)0x23;
+
+    //*tmpMsg << (uint16_t)GetArgInt(2);
+    *tmpMsg << (uint16_t)14;
+    *tmpMsg << (uint8_t)0x00;
+    *tmpMsg << (float)nClanID; // ClanID float
+    *tmpMsg << (uint8_t)nFaction;  // Faction
+    // The next 3 bytes are unknown.
+    // However, with this combination, the OP and its bonuses are
+    // set correctly; eg Own clan full bonus, friend clan 75%, etc
+    *tmpMsg << (uint8_t)0x06; // 6? 0x06
+    *tmpMsg << (uint8_t)0x14; // 0? 0x14
+    *tmpMsg << (uint8_t)0x0b; // 11? 0x0b
+    *tmpMsg << (uint32_t)nClanID; // ClanID uint32_t
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharHelloMsg( PClient* nClient )
+{
+    PChar *nChar = nClient->GetChar();
+    uint32_t nSkin, nHead, nTorso, nLegs;
+    uint8_t nHeadColor, nTorsoColor, nLegsColor, nHeadDarkness, nTorsoDarkness, nLegsDarkness;
+
+    nChar->GetCurrentLook( nSkin, nHead, nTorso, nLegs );
+    nChar->GetCurrentBodyColor( nHeadColor, nTorsoColor, nLegsColor, nHeadDarkness, nTorsoDarkness, nLegsDarkness );
+
+    PMessage* tmpMsg = new PMessage( );
+
+    uint8_t currentActiveSlot = nChar->GetQuickBeltActiveSlot();
+    uint16_t weaponId = 0;
+    switch ( currentActiveSlot )
+    {
+    case INV_WORN_QB_NONE:
+        //weaponId = 0;
+        break;
+    case INV_WORN_QB_HAND:
+        weaponId = 5; // <= TODO: set it somewhere
+        break;
+    default:
+        PItem* currentItem = nChar->GetInventory()->GetContainer( INV_LOC_WORN )->GetItem( INV_WORN_QB_START + currentActiveSlot );
+        //Todo : item addons & effects
+        //ItemInHandID = currentItem->GetItemID():
+        if ( currentItem )
+            weaponId = currentItem->GetValue1();
+        //else
+        //ItemInHandID = 0;
+        break;
+    }
+
+    //nClient->IncreaseUDP_ID(); // This must be done outside
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x00; // size placeholder, set later in the function
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x25;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint32_t )nChar->GetID();
+
+    *tmpMsg << ( uint8_t )0x60; // 0x40 if current faction epic done (master), | 0x80 to display [afk] | 0x20 if LE in
+    *tmpMsg << ( uint8_t )(( nChar->GetSpeedOverride() == 255 ) ? 10 : nChar->GetSpeedOverride() ); // move speed, reset by client (and for him only) when getting fall damage
+    *tmpMsg << ( uint8_t )0x08; // ??? something to do with speed ?
+    *tmpMsg << ( uint16_t )weaponId; // WeaponID of the weapon in hand
+    *tmpMsg << ( uint8_t )0x01; // ???
+    *tmpMsg << ( uint8_t )0x01; // ???
+    *tmpMsg << ( uint8_t )( 128 + nChar->GetSoullight() );
+
+    *tmpMsg << ( uint8_t )nChar->GetMainRank(); // in fact, Ranks are of type int8_t, but it doesn't matter much
+    *tmpMsg << ( uint8_t )nChar->GetCombatRank();
+    *tmpMsg << ( uint8_t )nChar->GetFaction();
+
+    *tmpMsg << ( uint8_t )0x00; // This was 0x21 for an GM, with faction 0x00. However, no visible change when set...
+    *tmpMsg << ( uint8_t )0x0f; // size of the next bloc (skin + ?clan?)
+    // Current skin
+    *tmpMsg << ( uint16_t )nSkin;
+    *tmpMsg << ( uint8_t )nHead;
+    *tmpMsg << ( uint8_t )nTorso;
+    *tmpMsg << ( uint8_t )nLegs;
+    // Skin colors
+    *tmpMsg << ( uint8_t )nHeadColor;
+    *tmpMsg << ( uint8_t )nTorsoColor;
+    *tmpMsg << ( uint8_t )nLegsColor;
+    *tmpMsg << ( uint8_t )nHeadDarkness; // (0=bright 255=dark)
+    *tmpMsg << ( uint8_t )nTorsoDarkness;
+    *tmpMsg << ( uint8_t )nLegsDarkness;
+    *tmpMsg << ( uint8_t )0x00; // ??? << not sure at all // eg: 0x3e
+    *tmpMsg << ( uint8_t )0x00; // eg: 0x03
+    *tmpMsg << ( uint8_t )0x00; // eg: 0xa3
+    *tmpMsg << ( uint8_t )0x00; // eg: 0x03
+
+    //Name
+    *tmpMsg << ( uint8_t )(( nChar->GetName() ).length() + 1 );
+    *tmpMsg << ( nChar->GetName() ).c_str();
+    //Body effects
+    uint8_t cBodyEffect, cEffectDensity;
+    nChar->GetBodyEffect( cBodyEffect, cEffectDensity );
+    if ( cBodyEffect )
+    {
+        *tmpMsg << ( uint8_t )0x06; // size of effect list : 6 bytes/effect. Only one supported atm
+        *tmpMsg << ( uint8_t )cBodyEffect; // effect type (0=none, effecive values 1 - 17)
+        *tmpMsg << ( uint8_t )cEffectDensity; // density: 0=max, 0xff=min (for some effects only)
+        *tmpMsg << ( uint8_t )0x00; // ???
+        *tmpMsg << ( uint8_t )0x00; // ???
+        *tmpMsg << ( uint8_t )0x00; // ???
+        *tmpMsg << ( uint8_t )0x00; // ???
+    }
+    else
+    {
+        *tmpMsg << ( uint8_t )0x00; // size of empty effect list
+    }
+
+    // Clans working, yeah :D
+    uint16_t tClanVal = nChar->GetClan();
+    if(tClanVal > 0)
+    {
+        uint8_t tClanLevel = nChar->GetClanLevel();
+        uint32_t tmpVal;
+        tmpVal = tClanVal << 4;
+        tmpVal |= tClanLevel;
+        *tmpMsg << ( uint8_t )0x04;
+        *tmpMsg << ( uint32_t )tmpVal;
+    }
+    else
+        *tmpMsg << ( uint8_t )0x00; // ending null
+    // alternate interpretation to this "ending null"/optional bloc:
+    /* *tmpMsg << (uint8_t)0x04; // size of unknown bloc ... 0x00 when empty (aka the "ending null")
+     *tmpMsg << (uint8_t)0x0b; // vary ... ??? 0b, eb, ee, ...
+     *tmpMsg << (uint8_t)0x44; // vary ... ???
+     *tmpMsg << (uint8_t)0x00; // these two seem always null
+     *tmpMsg << (uint8_t)0x00; */
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildReqNPCScriptAnswerMsg( uint32_t nInfoId, std::string *nNPCScript )\r
+ {\r
+    PMessage* tmpMsg;\r
\r
+    tmpMsg = new PMessage();\r
\r
+    *tmpMsg << ( uint8_t )0x19;\r
+    *tmpMsg << ( uint16_t )0x0006; // InfoQuery\r
+    *tmpMsg << ( uint16_t )0x0003; // NPC Script\r
+    *tmpMsg << ( uint32_t )nInfoId;\r
+    *tmpMsg << nNPCScript->c_str();\r
\r
+    return tmpMsg;\r
\r
+ }\r
\r
+PMessage* PMsgBuilder::BuildYouGotEmailsMsg( PClient* nClient, uint8_t nMailCount )\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();\r
+    *tmpMsg << ( uint8_t )0x0c;\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint8_t )0x1f;\r
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();\r
+    *tmpMsg << ( uint8_t )0x3d;\r
+    *tmpMsg << ( uint8_t )0x0c;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )nMailCount;\r
\r
+    return tmpMsg;\r
+ }\r
\r
+PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nResultBuffer, std::string *nCommandName, uint16_t nNumRows, uint16_t nNumFields)\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
+/*    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint8_t )0x2b;\r
+    *tmpMsg << ( uint8_t )0x1a;\r
+    if(nCommandName->length() > 0)\r
+        *tmpMsg << ( uint8_t )0x01;\r
+    else\r
+        *tmpMsg << ( uint8_t )0x00;\r
\r
+     *tmpMsg << ( uint8_t )0x00;\r
+     *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << *nCommandName;\r
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
\r
+    // 2nd message\r
+    *tmpMsg << ( uint16_t )(13 + nCommandName->length() + nResultBuffer->GetSize()); // ??\r
+ */\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint8_t )0x2b;\r
+    *tmpMsg << ( uint8_t )0x17;\r
+    *tmpMsg << ( uint16_t )(nCommandName->length()+1);\r
+    *tmpMsg << ( uint16_t )nNumRows;\r
+    *tmpMsg << ( uint16_t )nNumFields;\r
+    *tmpMsg << *nCommandName;\r
+    *tmpMsg << *nResultBuffer;\r
\r
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
\r
\r
+    return tmpMsg;\r
+            //len = (unsigned int)strlen(DB);\r
+            //SendBuffer[0] = 0x13;\r
+            //SendBuffer[5] = 11 + len;\r
+            //SendBuffer[6] = 0x03;\r
+            //Network_IncrementUDP (ClientNum);\r
+            //*(unsigned short*)&SendBuffer[7] = Client_Sockets[ClientNum].UDP_ID;\r
+    //      SendBuffer[9] = 0x2b;\r
+    //      SendBuffer[10] = 0x1a;\r
+    //      *(unsigned short*)&SendBuffer[11] = len;\r
+    //      if (num == 0)\r
+    //          SendBuffer[13] = 0x00;\r
+    //      else\r
+    //          SendBuffer[13] = 0x01;\r
+    //      SendBuffer[14] = 0x00;\r
+    //      SendBuffer[15] = 0x00;\r
+    //      strcpy (SendBuffer+16, DB);\r
+    //      plen = 17+len;\r
\r
+    //      SendBuffer[plen] = 13+len+slen;\r
+    //      SendBuffer[plen+1] = 0x03;\r
+    //      Network_IncrementUDP (ClientNum);\r
+    //      *(unsigned short*)&SendBuffer[plen+2] = Client_Sockets[ClientNum].UDP_ID;\r
+    //      *(unsigned short*)&SendBuffer[1] = Client_Sockets[ClientNum].UDP_ID;\r
+    //      *(unsigned short*)&SendBuffer[3] = Client_Sockets[ClientNum].UDP_ID_HIGH;\r
+    //      SendBuffer[plen+4] = 0x2b;\r
+    //      SendBuffer[plen+5] = 0x17;\r
+    //      *(unsigned short*)&SendBuffer[plen+6] = len+1;\r
+    //      *(unsigned short*)&SendBuffer[plen+8] = num;\r
+    //      *(unsigned short*)&SendBuffer[plen+10] = Fields;\r
+    //      //Fieldnum is defined in each DB below\r
+    //      strcpy (SendBuffer+plen+12, DB);\r
+    //      plen += 13+len;\r
\r
+    //      for (i=0;i<slen;i++)\r
+    //          SendBuffer[plen+i] = TempBuffer[i];\r
\r
\r
+ }\r
\r
\r
+PMessage* PMsgBuilder::BuildTryAccessAnswerMsg(PClient* nClient, char *nArea, bool nAllowed)\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
+    //uint8_t i = (uint8_t)strlen(nArea);\r
\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << (uint8_t)0x13;\r
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();\r
+    *tmpMsg << (uint16_t)nClient->GetSessionID();\r
+    *tmpMsg << (uint8_t)0x00;\r
+    *tmpMsg << (uint8_t)0x03;\r
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();\r
+    *tmpMsg << (uint8_t)0x2b;\r
+    *tmpMsg << (uint8_t)0x1a;\r
+    *tmpMsg << (uint16_t)(strlen(nArea)+1);\r
\r
+    if(nAllowed)\r
+        *tmpMsg << (uint8_t)0x01;\r
+    else\r
+        *tmpMsg << (uint8_t)0x00;\r
\r
+    *tmpMsg << (uint8_t)0x00;\r
+    *tmpMsg << (uint8_t)0x00;\r
+    *tmpMsg << nArea;\r
\r
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
+    return tmpMsg;\r
+ }\r
+
+PMessage* PMsgBuilder::BuildReqInfoAnswerMsg( PClient* nClient, uint16_t nReqType, uint32_t nInfoId, void* nResponse, uint16_t nResponseLength )
+{
+    PMessage* tmpMsg;
+
+    tmpMsg = new PMessage( 18 + nResponseLength );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x23;
+    *tmpMsg << ( uint16_t )0x0006; // cmd
+    *tmpMsg << ( uint16_t )nReqType; // wrong size here (uint32_t) for buffer size uint16_t in NeoX
+    *tmpMsg << ( uint32_t )nInfoId;
+    tmpMsg->Write( nResponse, nResponseLength );
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharHealthUpdateMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 14 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x30;
+    *tmpMsg << ( uint8_t )0x64; //Head Heath =Head HP/(3 *0.45)(with max Head HP = 45% of total)
+    *tmpMsg << ( uint8_t )0x64; //Body Heath =Body HP/(3 *0.35)(for max 35% of total)
+    *tmpMsg << ( uint8_t )0x64; //Feet Heath =Feet HP/(3 *0.20)(for max 20% of total)
+    *tmpMsg << ( uint8_t )0x01; // Sta/Mana ?
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharDeathMsg( PClient* nClient, uint32_t nKillerCharId )
+{
+    PMessage* tmpMsg = new PMessage( 17 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x16;
+    *tmpMsg << ( uint32_t )nKillerCharId;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharPosUpdateMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 32 );
+    PChar* nChar = nClient->GetChar();
+
+    uint32_t cSeatObjectId;
+    uint8_t cSeatId;
+    PSeatType cSeatType = nChar->GetSeatInUse( &cSeatObjectId, &cSeatId );
+    if ( cSeatType == seat_chair )   // temp ! Must migrate to RAW
+    {
+        cSeatObjectId = ( cSeatObjectId + 1 ) * 1024;
+    }
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x1b;
+    *tmpMsg << ( uint32_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x03;
+    if ( cSeatType )
+    {
+        *tmpMsg << ( uint32_t )cSeatObjectId;
+        *tmpMsg << ( uint16_t )cSeatId; // testing... else 0x0000
+    }
+    else
+    {
+        *tmpMsg << ( uint16_t )(( nChar->Coords ).mY );
+        *tmpMsg << ( uint16_t )(( nChar->Coords ).mZ );
+        *tmpMsg << ( uint16_t )(( nChar->Coords ).mX );
+    }
+    *tmpMsg << ( uint16_t )( 31910 + ( nChar->Coords ).mUD - 50 );  // Up - Mid - Down  mUD=(d6 - 80 - 2a) NeoX original offset: 31910
+    *tmpMsg << ( uint16_t )( 31820 + ( nChar->Coords ).mLR*2 - 179 ); // Compass direction mLR=(S..E..N..W..S [0-45-90-135-179]) There still is a small buggy movement when slowly crossing the South axis from the right
+    if ( cSeatType )
+    {
+        *tmpMsg << ( uint8_t )0x00;
+        *tmpMsg << ( uint8_t )0x10;
+    }
+    else
+    {
+        *tmpMsg << ( uint8_t )(( nChar->Coords ).mAct );
+        *tmpMsg << ( uint8_t )0x00;
+    }
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharPosUpdate2Msg( PClient* nClient, uint8_t InfoBitfield )
+{
+    PMessage* tmpMsg = new PMessage( 32 );
+    PChar* nChar = nClient->GetChar();
+
+    if ( InfoBitfield == 0x80 )
+    {
+        Console->Print( RED, BLACK, "[ERROR] PMsgBuilder::BuildCharPosUpdate2Msg : using InfoBitfield=0x80 forbidden. Using 0x7f instead." );
+        InfoBitfield = 0x7f;
+    }
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x20;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )InfoBitfield;
+
+    if ( InfoBitfield & 0x01 )
+    {
+        *tmpMsg << ( uint16_t )(( nChar->Coords ).mY );
+    }
+    if ( InfoBitfield & 0x02 )
+    {
+        *tmpMsg << ( uint16_t )(( nChar->Coords ).mZ );
+    }
+    if ( InfoBitfield & 0x04 )
+    {
+        *tmpMsg << ( uint16_t )(( nChar->Coords ).mX );
+    }
+    if ( InfoBitfield & 0x08 )
+    {
+        *tmpMsg << ( uint8_t )(( nChar->Coords ).mUD );
+    }
+    if ( InfoBitfield & 0x10 )
+    {
+        *tmpMsg << ( uint8_t )(( nChar->Coords ).mLR );
+    }
+    if ( InfoBitfield & 0x20 )
+    {
+        *tmpMsg << ( uint8_t )(( nChar->Coords ).mAct );
+    }
+    /*if(InfoBitfield & 0x40) // Not used (?)
+    {
+      *tmpMsg << (uint8_t)((nChar->Coords).mUnknown);
+    }*/
+    /*if(InfoBitfield & 0x80) // mRoll ????
+    {
+      *tmpMsg << (uint8_t)((nChar->Coords).mUnknown);
+    }*/
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+/*
+PMessage* PMsgBuilder::BuildCharSittingMsg( PClient* nClient )
+{
+  PMessage* tmpMsg = new PMessage( 24 );
+  PChar* nChar = nClient->GetChar();
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+  *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+  *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+  *tmpMsg << ( uint8_t )0x32;
+  *tmpMsg << ( uint16_t )nClient->GetLocalID();
+  *tmpMsg << ( uint8_t )0x00; // Type = chair/subway ???
+  *tmpMsg << ( uint8_t )0x00;
+  *tmpMsg << ( uint8_t )0x03; // Type = chair ???
+  *tmpMsg << ( uint16_t )(( nChar->Coords ).mY );
+  *tmpMsg << ( uint16_t )(( nChar->Coords ).mZ );
+  *tmpMsg << ( uint16_t )(( nChar->Coords ).mX );
+  *tmpMsg << ( uint16_t )( 31910 + ( nChar->Coords ).mUD - 50 );  // Up - Mid - Down  mUD=(d6 - 80 - 2a) NeoX original offset: 31910
+  *tmpMsg << ( uint16_t )( 31820 + ( nChar->Coords ).mLR*2 - 179 ); // Compass direction mLR=(S..E..N..W..S [0-45-90-135-179]) There still is a small buggy movement when slowly crossing the South axis from the right
+  *tmpMsg << ( uint8_t )(( nChar->Coords ).mAct );
+  *tmpMsg << ( uint8_t )0x00;
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+  return tmpMsg;
+}
+*/
+
+PMessage* PMsgBuilder::BuildCharUseSeatMsg( PClient* nClient, uint32_t nRawObjectId, uint8_t nSeatId )
+{
+    PMessage* tmpMsg = new PMessage( 18 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // nClient->GetUDP_ID() placeholder
+    *tmpMsg << ( uint16_t )0x0000; // nClient->GetSessionID()placeholder
+
+    *tmpMsg << ( uint8_t )0x0c; // Sub message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // ++ nClient->GetUDP_ID() placeholder
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x21;
+    *tmpMsg << ( uint32_t )nRawObjectId;
+    *tmpMsg << ( uint8_t )nSeatId; // 0x00 for real chair, 1+ for subway cab
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharExitSeatMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 22 );
+    PChar* nChar = nClient->GetChar();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // nClient->GetUDP_ID() placeholder
+    *tmpMsg << ( uint16_t )0x0000; // nClient->GetSessionID()placeholder
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // nClient->GetUDP_ID() placeholder
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x22;
+    *tmpMsg << ( uint16_t )(( nChar->Coords ).mY + 768 ) ;
+    *tmpMsg << ( uint16_t )(( nChar->Coords ).mZ + 768 ) ;
+    *tmpMsg << ( uint16_t )(( nChar->Coords ).mX + 768 ) ;
+    *tmpMsg << ( uint8_t )( nChar->Coords ).mUD;
+    *tmpMsg << ( uint8_t )( nChar->Coords ).mLR;
+    *tmpMsg << ( uint8_t )( nChar->Coords ).mAct;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildPacket0Msg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 70 );
+    PChar* nChar = nClient->GetChar();
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x2c;
+    *tmpMsg << ( uint8_t )0x01; // ??
+    *tmpMsg << ( uint8_t )0x01; // ??
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( float )(( nChar->Coords ).mY - 32000 );
+    *tmpMsg << ( float )(( nChar->Coords ).mZ - 32000 );
+    *tmpMsg << ( float )(( nChar->Coords ).mX - 32000 );
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint8_t )0x01; // ????
+    *tmpMsg << ( uint8_t )0x00;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint8_t )0x07;
+    *tmpMsg << ( uint8_t )0x02;
+    *tmpMsg << ( uint8_t )0x00;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint32_t )0x00000000;
+
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildPingMsg( PClient* nClient, uint32_t nClientTime )
+{
+    PMessage* tmpMsg = new PMessage( 15 );
+    uint32_t LocalTime = GameServer->GetGameTime();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x0b;
+    *tmpMsg << ( uint32_t )LocalTime;
+    *tmpMsg << ( uint32_t )nClientTime;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildBaselineMsg( PClient* nClient )
+{
+    PMessage* BaselineMsg = new PMessage( 512 );
+    PMessage SectionMsg( 256 );
+
+    PChar *nChar = nClient->GetChar();
+    const PDefCharKind *def = GameDefs->CharKinds()->GetDef( nChar->GetProfession() );
+    PSkillHandler *Skill = nChar->Skill;
+
+    nClient->IncreaseTransactionID( 3 );
+
+    // Head
+    *BaselineMsg << ( uint8_t )0x22;
+    *BaselineMsg << ( uint8_t )0x02; // ?
+    *BaselineMsg << ( uint8_t )0x01; // ?
+
+    // ---- Section 1 ----
+    *BaselineMsg << ( uint8_t )0x01; // section id
+
+    SectionMsg << ( uint8_t )0xfa; // ?  // // section content at offset 3
+    SectionMsg << ( uint8_t )nChar->GetProfession();
+    SectionMsg << ( uint16_t )nClient->GetTransactionID(); // Transaction ID ? 0x8aa0
+    SectionMsg << ( uint32_t )nChar->GetID();
+    SectionMsg << ( uint8_t )0x0e; // ? 0x0e in NeoX, 0x10 in Tinns ... doesn't seem to matter
+    SectionMsg << ( uint8_t )0x00; // ?
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 2 ----
+    *BaselineMsg << ( uint8_t )0x02; // section id
+    SectionMsg << ( uint8_t )0x04; // ?  // section content at offset 3
+    SectionMsg << ( uint8_t )0x50; // ?
+    SectionMsg << ( uint16_t )500; // nChar->GetHealth();
+    SectionMsg << ( uint16_t )500; // nChar->GetMaxHealth();
+    SectionMsg << ( uint16_t )500; // nChar->GetMana();
+    SectionMsg << ( uint16_t )500; // nChar->GetMaxMana();
+    SectionMsg << ( uint16_t )500; // nChar->GetStamina();
+    SectionMsg << ( uint16_t )500; // nChar->GetMaxStamina();
+    SectionMsg << ( uint16_t )0x00ff; // ?
+    SectionMsg << ( uint16_t )0x00ff; // ?
+    SectionMsg << ( uint16_t )0x00e1; // (nChar->GetHealth() + 1); // ? Probably Head Health (45% of total) 0x0065
+    SectionMsg << ( uint16_t )0x0147; // (nChar->GetHealth() + 1); // ? Torso Health (35% of total)
+    SectionMsg << ( uint16_t )0x0147; // (nChar->GetHealth() + 1); // ? Legs Health (20% of total)
+    SectionMsg << ( uint8_t )100; // 100 - SI
+    SectionMsg << ( uint8_t )0x80; // The lower this value is, the more your char has a "drug effect" on it 0x00 = unmoveable
+    SectionMsg << ( uint16_t )0x0000;
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 3 ----
+    *BaselineMsg << ( uint8_t )0x03; // section id
+
+    SectionMsg << ( uint8_t )0x06; // ?  // section content at offset 3
+    SectionMsg << ( uint8_t )0x09; // ?
+    SectionMsg << ( uint32_t )0x00000000; // ?
+    SectionMsg << ( uint32_t )0x00000000; // ?
+    SectionMsg << ( uint8_t )0x01; // ?
+
+    SectionMsg << ( uint8_t )Skill->GetMainSkill( MS_STR );
+    SectionMsg << ( uint16_t )Skill->GetSP( MS_STR );
+    SectionMsg << ( uint32_t )Skill->GetXP( MS_STR );
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_STR ).mGrow;
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_STR ).mMax;
+
+    SectionMsg << ( uint8_t )Skill->GetMainSkill( MS_DEX );
+    SectionMsg << ( uint16_t )Skill->GetSP( MS_DEX );
+    SectionMsg << ( uint32_t )Skill->GetXP( MS_DEX );
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_DEX ).mGrow;
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_DEX ).mMax;
+
+    SectionMsg << ( uint8_t )Skill->GetMainSkill( MS_CON );
+    SectionMsg << ( uint16_t )Skill->GetSP( MS_CON );
+    SectionMsg << ( uint32_t )Skill->GetXP( MS_CON );
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_CON ).mGrow;
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_CON ).mMax;
+
+    SectionMsg << ( uint8_t )Skill->GetMainSkill( MS_INT );
+    SectionMsg << ( uint16_t )Skill->GetSP( MS_INT );
+    SectionMsg << ( uint32_t )Skill->GetXP( MS_INT );
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_INT ).mGrow;
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_INT ).mMax;
+
+    SectionMsg << ( uint8_t )Skill->GetMainSkill( MS_PSI );
+    SectionMsg << ( uint16_t )Skill->GetSP( MS_PSI );
+    SectionMsg << ( uint32_t )Skill->GetXP( MS_PSI );
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_PSI ).mGrow;
+    SectionMsg << ( uint8_t )def->GetSkillInfo( MS_PSI ).mMax;
+
+    SectionMsg << ( uint16_t )0x0000; // ?
+    SectionMsg << ( uint8_t )0x00; // ?
+    SectionMsg << ( uint8_t )0x08; // ?
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 4 ----
+    *BaselineMsg << ( uint8_t )0x04; // section id
+
+    SectionMsg << ( uint8_t )0x2e; // ?  // section content at offset 3
+    SectionMsg << ( uint8_t )0x02; // ?
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_MC );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_MC );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_HC );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_HC );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_TRA );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_TRA );
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_PC );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_PC );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_RC );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_RC );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_TC );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_TC );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_VHC );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_VHC );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_AGL );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_AGL );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_REP );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_REP );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_REC );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_REC );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_RCL );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_RCL );
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_ATL );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_ATL );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_END );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_END );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_FOR );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_FOR );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_FIR );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_FIR );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_ENR );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_ENR );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_XRR );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_XRR );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_POR );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_POR );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_HLT );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_HLT );
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_HCK );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_HCK );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_BRT );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_BRT );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_PSU );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_PSU );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_WEP );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_WEP );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_CST );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_CST );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_RES );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_RES );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_IMP );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_IMP );
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )0x00; // spare
+    SectionMsg << ( uint8_t )0x01; // cost
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_PPU );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_PPU );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_APU );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_APU );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_MST );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_MST );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_PPW );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_PPW );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_PSR );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_PSR );
+    SectionMsg << ( uint8_t )Skill->GetSubSkill( SK_WPW );
+    SectionMsg << ( uint8_t )Skill->GetSKPCost( SK_WPW );
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 5 ----
+    *BaselineMsg << ( uint8_t )0x05; // section id
+
+    PMessage* ContentList = BuildContainerContentList( nChar->GetInventory()->GetContainer( INV_LOC_BACKPACK ), INV_LOC_BACKPACK );
+    SectionMsg << *ContentList;
+    delete ContentList;
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 6 ----
+    *BaselineMsg << ( uint8_t )0x06; // section id
+
+    ContentList = BuildContainerContentList( nChar->GetInventory()->GetContainer( INV_LOC_WORN ), INV_LOC_WORN );
+    SectionMsg << *ContentList;
+    delete ContentList;
+
+    /*    SectionMsg << (uint8_t)0x04; // QB/Armor/Implants items nb  // section content at offset 3
+
+        // THIS IS A TEMP SOLUTION UNTIL WE HAVE ITEM STUFF WORKING ===== BEGIN
+        SectionMsg << (uint16_t)0x06;     // Size of item
+        SectionMsg << (uint16_t)0x00;     // Location: Quickbelt slot 0
+        SectionMsg << (uint16_t)0x0051;   // ItemID: 81, Flashlight
+        SectionMsg << (uint8_t)0x01;      // Datatype
+        SectionMsg << (uint8_t)0x00;      // Data
+    */
+
+    /****
+    SectionMsg << (uint8_t)0x04; // QB/Armor/Implants items nb  // section content at offset 3
+
+    // THIS IS A TEMP SOLUTION UNTIL WE HAVE ITEM STUFF WORKING ===== BEGIN
+    SectionMsg << (uint16_t)0x001b;     // Size of item
+    SectionMsg << (uint8_t)0x00;     // Location: Quickbelt slot 0
+    SectionMsg << (uint8_t)0x00; // nop (Y)
+    SectionMsg << (uint16_t)0x0003;   // ItemID: 3, assault riffle
+    SectionMsg << (uint8_t)(0x01|0x02|0x10|0x40);      // Datatype
+
+    //SectionMsg << (uint8_t)0x01; // for 0x80. Use ???
+
+    SectionMsg << (uint8_t)0x00; // Qty / remaining ammos
+
+    SectionMsg << (uint8_t)0x06; // Qual entries
+    SectionMsg << (uint8_t)0x40; // current qual
+    SectionMsg << (uint8_t)0x80; // dmg
+    SectionMsg << (uint8_t)0xc0; // freq
+    SectionMsg << (uint8_t)0xa0; // handl
+    SectionMsg << (uint8_t)0xb0; // range
+    SectionMsg << (uint8_t)0xff; // max qual <= always last
+
+    SectionMsg << (uint8_t)0x07; // addons bitflag: flashlight=1, scope, silencer, laserpointer
+
+    SectionMsg << (uint8_t)0x02; // used slots
+    SectionMsg << (uint8_t)0x05; // max slots
+    SectionMsg << (uint16_t)1526; // slots / explo ammo
+    SectionMsg << (uint16_t)21; // riffle-barrel
+    SectionMsg << (uint16_t)0x0000;
+    SectionMsg << (uint16_t)0x0000;
+    SectionMsg << (uint16_t)0x0000;
+    *****/
+    /*
+    SectionMsg << (uint16_t)0x06;     // Size of item
+    SectionMsg << (uint8_t)0x01;     // Location: Quickbelt slot 1
+    SectionMsg << (uint8_t)0x00; // nop (Y)
+    SectionMsg << (uint16_t)0x0023;   // ItemID: 35, Med Kit
+    SectionMsg << (uint8_t)0x01;      // Data=ammo count
+    SectionMsg << (uint8_t)0x03;      // Data
+    */
+    /*
+        SectionMsg << (uint16_t)0x06;     // Size of item
+        SectionMsg << (uint16_t)0x01;     // Location: Quickbelt slot 0
+        SectionMsg << (uint16_t)0x0055;   // ItemID: 81, Flashlight
+        SectionMsg << (uint8_t)0x01;      // Datatype
+        SectionMsg << (uint8_t)0x00;      // Data
+
+        SectionMsg << (uint16_t)0x06;     // Size of item
+        SectionMsg << (uint16_t)0x02;     // Location: Quickbelt slot 0
+        SectionMsg << (uint16_t)0x176F;   // ItemID: 81, Flashlight
+        SectionMsg << (uint8_t)0x01;      // Datatype
+        SectionMsg << (uint8_t)0x00;      // Data
+
+
+        SectionMsg << (uint16_t)0x08;      // Size of item
+        SectionMsg << (uint16_t)0x1a;      // Location: Brain #1
+        SectionMsg << (uint16_t)0x08fc;    // ItemID: Law enforcer
+        SectionMsg << (uint8_t)0x02;       // Datatype. 02: Item Duration information follows
+        SectionMsg << (uint8_t)0x02;       // SubDatatype02: Full itemdetails follow
+        SectionMsg << (uint8_t)0x2a;       // Current duration
+        SectionMsg << (uint8_t)0x2a;       // Max duration
+    */
+//    nChar->GetInventory()->QB_SetSlot(0, 81); // Add Flashlight to QB slot 1
+//    nChar->GetInventory()->QB_SetSlot(1, 85); // Add Flashlight to QB slot 1
+//    nChar->GetInventory()->QB_SetSlot(2, 5999); // Add Flashlight to QB slot 1
+    // THIS IS A TEMP SOLUTION UNTIL WE HAVE ITEM STUFF WORKING ===== END
+    /*
+     StatsBuffer[len+3] = 0; //Number of items
+     plen = 4;
+     for (i=0;i<MAX_INVENTORY;i++)
+     {
+      for (t=0;t<128;t++)
+      {
+       if (CurrentChar.QuickBelt[t]-1 != i)
+        continue;
+       *(unsigned short*)&StatsBuffer[len+plen] = 6;    //Data size of item
+       *(unsigned short*)&StatsBuffer[len+plen+2] = t;  //X position in Inventory
+       *(unsigned short*)&StatsBuffer[len+plen+4] = CurrentChar.ItemList[CurrentChar.QuickBelt[t]-1].ItemID; //Item ID
+       *(unsigned short*)&StatsBuffer[len+plen+6] = CurrentChar.ItemList[CurrentChar.QuickBelt[t]-1].Qty;   //Quantity
+       plen += 8;
+       *(unsigned short*)&StatsBuffer[len+3] += 1;      //Add to item
+       break;
+      }
+    */
+    /*if (CurrentChar.Inventory[i].ItemID == 0)     //Last Item
+     break;
+    if (CurrentChar.Inventory[i].Location != 2)     //Not Quickbelt, skip it
+     continue;
+    if (Def_GetItemType(CurrentChar.Inventory[i].ItemID) == 1)
+    {
+     //18 00 01 00 08 00 63 00 06 ff c8 c8 c8 c8 ff 00 01 00 28 04 00 01 04 ff 01
+     //12 00 11    5f 07 23 00 06 eb a4 99 a3 a5 ff 04 00 01 04 ff 01
+     //13 00 05 00 03 02 23 00 06 6d c4 c4 c4 c4 ff 04 00 01 04 ff 00
+     //17 00 05    9d 01 73 28 06 13 c1 c1 c1 c1 ff 00 01 01 f1 05 04
+     //|Size|Slot|ItemID|???  |? |Du|    Stats  |MD|?????????????????|
+     *(unsigned short*)&StatsBuffer[len+plen] = 19; //Size
+     *(unsigned short*)&StatsBuffer[len+plen+2] = CurrentChar.Inventory[i].LocX; //Slot
+     *(unsigned short*)&StatsBuffer[len+plen+4] = CurrentChar.Inventory[i].ItemID;//Item ID
+     StatsBuffer[len+plen+6] = 0x23;            //0x73 = Ranged, 0x63 = close/spell
+     StatsBuffer[len+plen+7] = CurrentChar.Inventory[i].Qty;      //Quantity
+     StatsBuffer[len+plen+8] = 0x06;            //0x06
+     StatsBuffer[len+plen+9] = CurrentChar.Inventory[i].CurDur;     //Current Durability
+     StatsBuffer[len+plen+10] = CurrentChar.Inventory[i].Damage;     //Stats
+     StatsBuffer[len+plen+11] = CurrentChar.Inventory[i].Freq;     //Stats
+     StatsBuffer[len+plen+12] = CurrentChar.Inventory[i].Hand;     //Stats
+     StatsBuffer[len+plen+13] = CurrentChar.Inventory[i].Rng;     //Stats
+     StatsBuffer[len+plen+14] = CurrentChar.Inventory[i].MaxDur;     //Max Durability
+     StatsBuffer[len+plen+15] = 0x04;           //Size or part
+     StatsBuffer[len+plen+16] = 0x00;           //follow or ?
+     StatsBuffer[len+plen+17] = 0x01;           //Ammo loaded?
+     StatsBuffer[len+plen+18] = 0x04;           //0x04 if not named, 0x0a if named
+     StatsBuffer[len+plen+19] = 0x05;           //0x06 if named, 0xff for no ammo needed, no idea otherwise
+     StatsBuffer[len+plen+20] = 0x0f;           //Binary representation of ammo allowed 0x01 = normal
+     plen+=21;
+    }
+    else
+    {
+     *(unsigned short*)&StatsBuffer[len+plen] = 6;         //Size of Item Data
+     *(unsigned short*)&StatsBuffer[len+plen+2] = CurrentChar.Inventory[i].LocX;  //Slot
+     *(unsigned short*)&StatsBuffer[len+plen+4] = CurrentChar.Inventory[i].ItemID; //Item ID
+     *(unsigned short*)&StatsBuffer[len+plen+6] = CurrentChar.Inventory[i].Qty;  //Quantity
+     plen+= 8;
+    }
+    StatsBuffer[len+3] += 1;*/
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 7 ----
+    *BaselineMsg << ( uint8_t )0x07; // section id
+
+    SectionMsg << ( uint8_t )0x00; // ?? // section content at offset 3
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 0c ----
+    *BaselineMsg << ( uint8_t )0x0c; // section id
+
+    ContentList = BuildContainerContentList( nChar->GetInventory()->GetContainer( INV_LOC_GOGO ), INV_LOC_GOGO );
+    SectionMsg << *ContentList;
+
+    delete ContentList;
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 8 ----
+    *BaselineMsg << ( uint8_t )0x08; // section id
+
+    uint32_t nSkin, nHead, nTorso, nLegs;
+    nChar->GetRealLook( nSkin, nHead, nTorso, nLegs );
+
+    SectionMsg << ( uint8_t )0x0a; // ? // section content at offset 3
+    SectionMsg << ( uint32_t )nChar->GetCash();
+
+    // Genrep list
+    SectionMsg << ( uint16_t )nChar->GetGenrepCount(); //Number of GR tagged (Tinns value on uint8_t only)
+    SectionMsg << ( uint8_t )0x04;
+    if ( nChar->GetGenrepCount() ) // For each entry : (uint16_t)genrep.g_worldid, (uint16_t)genrep.g_stationid
+    {
+        SectionMsg.Write( nChar->GetGenrepListData(), nChar->GetGenrepListDataSize() );
+    }
+
+    SectionMsg << ( uint8_t )0x04;
+    SectionMsg << ( uint8_t )0x04;
+    SectionMsg << ( uint8_t )0x00;
+
+    // Direct chat
+    if ( nChar->GetDirectChat() )
+    {
+        SectionMsg << ( uint8_t )1;
+        SectionMsg << ( uint32_t )nChar->GetDirectChat();
+    }
+    else
+    {
+        SectionMsg << ( uint8_t )0;
+    }
+
+    // Buddy Chat
+    SectionMsg << ( uint8_t )nChar->GetBuddyCount(); //Number of Buddies
+    if ( nChar->GetBuddyCount() ) // For each buddy (uint32_t)buddy CharID
+    {
+        SectionMsg.Write( nChar->GetBuddyListData(), nChar->GetBuddyListDataSize() );
+    }
+    SectionMsg << ( uint8_t )0x00;
+
+    SectionMsg << ( uint16_t )nClient->GetTransactionID(); // ??
+    //SectionMsg << (uint32_t)0x00000000;
+    SectionMsg << ( uint32_t )0x00000000;
+    SectionMsg << ( uint32_t )0x00000000; // Epic status ?
+    SectionMsg << ( uint16_t )nSkin;
+    SectionMsg << ( uint8_t )nHead;
+    SectionMsg << ( uint8_t )nTorso;
+    SectionMsg << ( uint8_t )nLegs;
+    SectionMsg << ( uint8_t )0x00; // Rank
+    SectionMsg << ( uint32_t )( nChar->GetBaseApartment() + PWorlds::mAptBaseWorldId ); // 0x22, 0x00, 0x00, 0x00, //Primary Apartment (GR activated) ???
+    SectionMsg << ( uint8_t )0x01; // ?
+    SectionMsg << ( uint8_t )0x00; // ?
+    SectionMsg << ( uint8_t )0x00; // ?
+    SectionMsg << ( uint8_t )0x00; // ?
+    SectionMsg << ( uint8_t )0x00; // ?
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 9 ----
+    *BaselineMsg << ( uint8_t )0x09; // section id
+
+    SectionMsg << ( uint16_t )0x15; // Nb of factions // section content at offset 3
+    SectionMsg << ( uint16_t )nChar->GetFaction();
+    SectionMsg << ( uint8_t )0x04; // ?
+    SectionMsg << ( float ) 1000.0f*1000.0f; // 96.0f*9000.0f; // SL
+    // Faction Sympathies Points effective sympathie is Square root of these points, abs value rounded down (beware of the sign ! :p)
+    SectionMsg << ( float ) 1000.0f*1250.0f; // City Admin => 111
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Diamond => 100
+    SectionMsg << ( float ) 1000.0f* -750.0f; // Next => -86
+    SectionMsg << ( float ) 1000.0f*500.0f; // Tangent => 70
+    SectionMsg << ( float ) 1000.0f* -250.0f; // Biotech => -50
+    SectionMsg << ( float ) 1000.0f*0.0f; // ProtoPharm => 0
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Trader's Union
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Tsunami
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Black Dragons
+    SectionMsg << ( float ) 1000.0f*1000.0f; // City Mercs
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Crahn Sect
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Dome Of York
+    SectionMsg << ( float ) 1000.0f* -1000.0f; // Anarchy Breed
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Fallen Angels
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Twilight Guardian
+    SectionMsg << ( float ) 1000.0f* -1000.0f; // Regeant's Legacy
+    SectionMsg << ( float ) 1000.0f* -1000.0f; // Regeant's Mutants
+    SectionMsg << ( float ) 1000.0f* -1000.0f; // Insects
+    SectionMsg << ( float ) 1000.0f* -1000.0f; // Monsters
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Unknown
+    SectionMsg << ( float ) 1000.0f*1000.0f; // Highest SL?
+
+    SectionMsg << ( uint32_t )0x00000000; // Epic done Data : bit 2^FactionID set <=> Epic done
+    SectionMsg << ( uint8_t )nChar->GetFaction(); // Faction ??? wrong size ...
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 0a ----
+    *BaselineMsg << ( uint8_t )0x0a; // section id
+
+    // Clan data ?
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 0b ----
+    *BaselineMsg << ( uint8_t )0x0b; // section id
+
+    SectionMsg << ( uint8_t )0x00; // ?? // section content at offset 3
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    // ---- Section 0d ----
+    *BaselineMsg << ( uint8_t )0x0d; // section id
+
+    SectionMsg << ( uint8_t )0xfa; // ?? // section content at offset 3
+    SectionMsg << ( uint8_t )nChar->GetProfession();
+    SectionMsg << ( uint16_t )nClient->GetTransactionID(); // ?? TransactionID ? 0x8aa0
+    SectionMsg << ( uint32_t )nChar->GetID();
+
+    *BaselineMsg << ( uint16_t )SectionMsg.GetSize();
+    *BaselineMsg << SectionMsg;
+    SectionMsg.Reset();
+
+    return BaselineMsg;
+}
+
+PMessage* PMsgBuilder::BuildAliveRepMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 7 );
+
+    // uint8_t up[] = {0x04, 0x01, 0x00, 0xe3, 0x6b, 0xe6, 0xee};
+    *tmpMsg << ( uint8_t )0x04;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0xe3; // ? not always...
+    *tmpMsg << ( uint8_t )0x6b; // ? not always...
+    *tmpMsg << ( uint16_t )( nClient->getUDPConn()->getPort() ); // really ?
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildZoning1Msg( PClient* nClient, uint16_t nEntity, uint8_t nUnknown )
+{
+    PMessage* tmpMsg = new PMessage( 42 );
+
+    nClient->IncreaseUDP_ID();
+    nClient->IncreaseTransactionID(); // from NeoX
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x0c; // Message length place;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID(); // from NeoX
+    *tmpMsg << ( uint8_t )0x25; // ??
+    *tmpMsg << ( uint8_t )0x13; // ??
+    *tmpMsg << ( uint16_t )nClient->GetTransactionID(); // from NeoX / ?? right ???
+    // In case of apt GR or NC2.2 ?
+    // *tmpMsg << (uint8_t)0x04; // len ?
+    // *tmpMsg << (uint32_t)AptWorldID; // len ?
+    // nClient->IncreaseTransactionID();
+    // *tmpMsg << (uint16_t)nClient->GetTransactionID();
+    *tmpMsg << ( uint8_t )0x0e; // cmd => but not for zoning, because used in non-zoning situation
+    *tmpMsg << ( uint8_t )0x02; // ?? from NeoX
+    //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x17; // Message length place;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x23;
+    *tmpMsg << ( uint16_t )0x0004; // cmd
+    *tmpMsg << ( uint32_t )0x00000000; // from NeoX
+    *tmpMsg << ( uint32_t )0x00000000; // from NeoX
+    *tmpMsg << ( uint8_t )nUnknown;
+    *tmpMsg << ( uint16_t )nEntity;
+    *tmpMsg << ( uint16_t )0x0000; // from NeoX
+    *tmpMsg << ( uint16_t )nClient->GetTransactionID(); // from NeoX
+    *tmpMsg << ( uint16_t )0x0000; // from NeoX
+
+    // We DO need this! This is a multiframe packet, and the first UDP/SessionID set *HAS* to be
+    // as high as the last UDP/SessionID set in the frame!
+    tmpMsg->U16Data( 1 ) = nClient->GetUDP_ID();
+    tmpMsg->U16Data( 3 ) = nClient->GetSessionID();
+
+    //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildZoningTCPReadyMsg()
+{
+    PMessage* tmpMsg = new PMessage( 7 );
+
+    //static const uint8_t READY[7] = {0xfe, 0x04, 0x00, 0x83, 0x0d, 0x00, 0x00};
+    *tmpMsg << ( uint8_t )0xfe;
+    *tmpMsg << ( uint16_t )0x0004; //length
+    *tmpMsg << ( uint8_t )0x83; //cmd
+    *tmpMsg << ( uint8_t )0x0d; // sub-cmd
+    *tmpMsg << ( uint16_t )0x0000;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildSendZoneTCPMsg( uint32_t nLocation, std::string *nWorldName )
+{
+    PMessage* tmpMsg = new PMessage( 14 + nWorldName->size() );
+
+    *tmpMsg << ( uint8_t )0xfe;
+    *tmpMsg << ( uint16_t )0x0000; // size placeholder
+    *tmpMsg << ( uint8_t )0x83;
+    *tmpMsg << ( uint8_t )0x0c;
+    *tmpMsg << ( uint32_t )nLocation;
+    *tmpMsg << ( uint32_t )0x00000000;
+    tmpMsg->Write( nWorldName->c_str(), nWorldName->size() + 1 );
+
+    tmpMsg->U16Data( 1 ) = ( uint16_t )( tmpMsg->GetSize() - 3 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildZoning2Msg( PClient* nClient, uint32_t nClientTime )
+{
+    PMessage* tmpMsg = new PMessage( 22 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x0d;
+    *tmpMsg << ( uint32_t )GameServer->GetGameTime();
+
+    *tmpMsg << ( uint32_t )nClientTime;
+
+    *tmpMsg << ( uint8_t )0xe5; // ??? varies
+    *tmpMsg << ( uint8_t )0x0a; // ??? varies
+    *tmpMsg << ( uint8_t )0xbb; // ??? varies
+    *tmpMsg << ( uint8_t )0x00; // ??? usually 0
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildGenrepZoningMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity )
+{
+    PMessage* tmpMsg = new PMessage( 50 );
+
+    nClient->IncreaseUDP_ID();
+
+    tmpMsg->Fill( 0 );
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x23;
+    *tmpMsg << ( uint16_t )0x000c; // cmd
+    tmpMsg->SetNextByteOffset( 38 );
+    *tmpMsg << ( uint32_t )0xffffffff;
+    *tmpMsg << ( uint32_t )nLocation;
+    *tmpMsg << ( uint16_t )nEntity;
+    *tmpMsg << ( uint16_t )0x0000;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildGenrepAddToListMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity )
+{
+    PMessage* tmpMsg = new PMessage( 23 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x3d;
+    *tmpMsg << ( uint32_t )0x00000002;
+    *tmpMsg << ( uint32_t )nLocation;
+    *tmpMsg << ( uint16_t )nEntity;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildAptLiftUseMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity, uint8_t nEntityType )
+{
+    PMessage* tmpMsg = new PMessage( 43 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x0f; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x38;
+    *tmpMsg << ( uint8_t )0x04; // Accepted (?)
+    *tmpMsg << ( uint8_t )nEntityType; // "Sewer Level"
+    *tmpMsg << ( uint32_t )nLocation;
+    *tmpMsg << ( uint16_t )nEntity;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildAptLiftFailedMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 14 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x08; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x38;
+    *tmpMsg << ( uint8_t )0x03; // Refused
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildChangeLocationMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity, uint8_t nEntityType, uint32_t nRawItemID )
+{
+    PMessage* tmpMsg = new PMessage( 28 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    if ( nRawItemID )
+    {
+        *tmpMsg << ( uint8_t )0x06; // Sub message length;
+        *tmpMsg << ( uint8_t )0x2d; // Item use response;
+        *tmpMsg << ( uint32_t )nRawItemID;
+        *tmpMsg << ( uint8_t )0x0a; // Use allowed
+    }
+
+    *tmpMsg << ( uint8_t )0x0f; // Sub message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x38;
+    *tmpMsg << ( uint8_t )0x04; // Accepted (?)
+    *tmpMsg << ( uint8_t )nEntityType;
+    *tmpMsg << ( uint32_t )nLocation;
+    *tmpMsg << ( uint16_t )nEntity;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildEntityPositionMsg( PClient* nClient, uint16_t pX, uint16_t pY, uint16_t pZ )
+{
+    PMessage* tmpMsg = new PMessage( 18 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x23;
+    *tmpMsg << ( uint16_t )0x000a;
+    *tmpMsg << ( uint16_t )( pY + 768 );
+    *tmpMsg << ( uint16_t )( pZ + 768 );
+    *tmpMsg << ( uint16_t )( pX + 768 );
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharAptLocInfoMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 21 );
+    nClient->IncreaseUDP_ID();
+
+    int BaseAppId = nClient->GetChar()->GetBaseApartment();
+    uint32_t AptLocation = ( uint32_t )Appartements->GetAptLocation( BaseAppId );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x0f;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x3d;
+    *tmpMsg << ( uint32_t )0x0000000b;
+    *tmpMsg << ( uint32_t )AptLocation;
+
+    return tmpMsg;
+}
+
+// OLD FUNCTION, REWRITTEN BELOW
+/*
+PMessage* PMsgBuilder::BuildSubskillIncMsg( PClient* nClient, uint8_t nSubskill, uint16_t nSkillPoints )
+{
+  PMessage* tmpMsg = new PMessage( 33 );
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+  nClient->IncreaseUDP_ID();
+  *tmpMsg << ( uint8_t )0x09; // SubMessage length;
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nClient->GetLocalID();
+  *tmpMsg << ( uint8_t )0x25;
+  *tmpMsg << ( uint8_t )0x23;
+  *tmpMsg << ( uint8_t )0x41; // 0x28 ?? // 0x 18 // 0x2c
+
+  nClient->IncreaseUDP_ID();
+  nClient->IncreaseTransactionID(); // testing ...
+  *tmpMsg << ( uint8_t )0x11; // SubMessage length;
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nClient->GetLocalID();
+  *tmpMsg << ( uint8_t )0x25;
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )nClient->GetTransactionID(); // testing / 0x0000 ????
+  *tmpMsg << ( uint8_t )0x09; // ?
+  *tmpMsg << ( uint16_t )nSubskill;
+  *tmpMsg << ( uint16_t )nClient->GetChar()->Skill->GetSubSkill( nSubskill ); // nSubskill ?
+  *tmpMsg << ( uint16_t )nSkillPoints;
+
+  //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+  return tmpMsg;
+}
+ */\r
+// NPC Dialog. Start dialog with NPC\r
+PMessage* PMsgBuilder::BuildNPCStartDialogMsg( PClient* nClient, uint32_t nNPCWorldID, std::string *nDialogScript  )\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
+    nClient->IncreaseUDP_ID();\r
\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t ) 0x0000; // UDP Placeholder\r
+    *tmpMsg << ( uint16_t ) 0x0000; // UDP Placeholder\r
+    *tmpMsg << ( uint8_t )0x00; // Message length\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint8_t )0x1f;\r
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();\r
+    *tmpMsg << ( uint8_t )0x18;\r
+    *tmpMsg << ( uint32_t ) nNPCWorldID;\r
\r
+    // Todo: is this correct? random uint32_t value??\r
+    *tmpMsg << ( uint16_t ) GetRandom( 65535, 4369 );\r
+    *tmpMsg << ( uint16_t ) GetRandom( 65535, 4369 );\r
+    *tmpMsg << ( uint32_t ) 0x0000;\r
+    *tmpMsg << nDialogScript->c_str();\r
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x0a;\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint8_t )0x1f;\r
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();\r
+    *tmpMsg << ( uint8_t )0x1a;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x00;\r
\r
+    tmpMsg->U16Data( 1 ) = nClient->GetUDP_ID();\r
+    tmpMsg->U16Data( 3 ) = nClient->GetSessionID();\r
\r
+    return tmpMsg;\r
+ }\r
+// NPC Dialog. Send next node number in lua script to client\r
+PMessage* PMsgBuilder::BuildNPCDialogReplyMsg( PClient* nClient, uint16_t nNextNode, std::vector<int>*nResultBuffer)\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();;\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();;\r
+    *tmpMsg << ( uint8_t )0x00; // SubMessage length;\r
\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();;\r
+    *tmpMsg << ( uint8_t )0x1f;\r
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();\r
+    *tmpMsg << ( uint8_t )0x1a;\r
+    *tmpMsg << ( uint16_t )nNextNode;\r
+    //*tmpMsg << ( uint8_t )nNumResults;\r
+    *tmpMsg << ( uint8_t )nResultBuffer->size();\r
\r
+    std::vector<int>::const_iterator it;\r
\r
+    for(it = nResultBuffer->begin(); it != nResultBuffer->end(); it++)\r
+     {\r
+        *tmpMsg << ( float )*(it);\r
+     }\r
\r
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
\r
+    return tmpMsg;\r
+ }\r
+
+PMessage* PMsgBuilder::BuildNPCBeginAllBuyerTradeMsg( PClient* nClient, int nWorldID )\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();\r
+    *tmpMsg << ( uint8_t )0x00; // Message length\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint8_t )0x1f;\r
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();\r
+    *tmpMsg << ( uint8_t )0x26;\r
+    *tmpMsg << ( uint32_t ) nWorldID;\r
+    *tmpMsg << ( uint8_t )0x01; // Traders inventory\r
+    *tmpMsg << ( uint16_t )0xFFFF; // Traders inventory\r
\r
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
\r
+    return tmpMsg;\r
+ }\r
\r
+PMessage* PMsgBuilder::BuildNPCShoppingListMsg( PClient* nClient, PMessage* nContentList, int nWorldID, uint8_t nItemQuality)\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();\r
+    *tmpMsg << ( uint8_t )0x00; // Message length\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint8_t )0x1f;\r
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();\r
+    *tmpMsg << ( uint8_t )0x26;\r
+    *tmpMsg << ( uint32_t ) nWorldID;\r
+    *tmpMsg << ( uint8_t )0x01; // Traders inventory\r
+    *tmpMsg << ( uint16_t )( nContentList->GetSize() / 6 ); // List entries\r
+    *tmpMsg << ( uint8_t )nItemQuality; // Items quality\r
+    *tmpMsg << *nContentList;\r
\r
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );\r
\r
+    return tmpMsg;\r
+ }\r
\r
+// ==========================\r
+PMessage* PMsgBuilder::BuildNPCSingleInfoMsg( PClient* nClient, uint32_t nWorldID, uint16_t nTypeID, uint16_t nClothing,\r
+uint16_t nNameID, uint16_t nPosY, uint16_t nPosZ, uint16_t nPosX, uint16_t nUnknown,\r
+uint16_t nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName)\r
+// Initial NPC Packet that defines how the NPC look, etc\r
+ {\r
+//    uint8_t tMsgLen = 29 + nNpcName->size() + nAngleStr->size() + nCustomName->size();\r
\r
+    PMessage* tmpMsg = new PMessage();\r
+    nClient->IncreaseUDP_ID();\r
\r
+    *tmpMsg << ( uint8_t )0x13; // Begin UDP message\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();\r
+    *tmpMsg << ( uint8_t )0x00;\r
+     *tmpMsg << ( uint8_t )0x03;\r
+     *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+     *tmpMsg << ( uint8_t )0x28;\r
+     *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x01;\r
+    *tmpMsg << ( uint32_t )nWorldID;\r
+    *tmpMsg << ( uint16_t )nTypeID;\r
+    *tmpMsg << ( uint16_t )nClothing;\r
+    *tmpMsg << ( uint16_t )nNameID;\r
+    *tmpMsg << ( uint16_t )nPosY;\r
+    *tmpMsg << ( uint16_t )nPosZ;\r
+    *tmpMsg << ( uint16_t )nPosX;\r
+     *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint16_t )nUnknown;\r
+    *tmpMsg << ( uint16_t )nTraderID;\r
+    *tmpMsg << nNpcName->c_str();\r
+    *tmpMsg << nAngleStr->c_str();\r
+    if(nCustomName->length() > 1)\r
+        *tmpMsg << nCustomName->c_str();\r
\r
+    (*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);\r
+    return tmpMsg;\r
+ }\r
\r
+PMessage* PMsgBuilder::BuildNPCMassInfoMsg( uint32_t nWorldID, uint16_t nTypeID, uint16_t nClothing,\r
+uint16_t nNameID, uint16_t nPosY, uint16_t nPosZ, uint16_t nPosX, uint16_t nHealth,\r
+uint16_t nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName)\r
+// Initial NPC Packet that defines how the NPC look, etc\r
+ {\r
+//    uint8_t tMsgLen = 29 + nNpcName->size() + nAngleStr->size() + nCustomName->size();\r
\r
+    PMessage* tmpMsg = new PMessage();\r
\r
+    *tmpMsg << ( uint8_t )0x13; // Begin UDP message\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x03;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint8_t )0x28;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )0x01;\r
+    *tmpMsg << ( uint32_t )nWorldID;\r
+    *tmpMsg << ( uint16_t )nTypeID;\r
+    *tmpMsg << ( uint16_t )nClothing;\r
+    *tmpMsg << ( uint16_t )nNameID;\r
+    *tmpMsg << ( uint16_t )nPosY;\r
+    *tmpMsg << ( uint16_t )nPosZ;\r
+    *tmpMsg << ( uint16_t )nPosX;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint16_t )nHealth;\r
+    *tmpMsg << ( uint16_t )nTraderID;\r
+    *tmpMsg << nNpcName->c_str();\r
+    *tmpMsg << nAngleStr->c_str();\r
+    if(nCustomName->length() > 1)\r
+        *tmpMsg << nCustomName->c_str();\r
\r
+    (*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);\r
+     return tmpMsg;\r
+ }\r
\r
+// **************\r
+PMessage* PMsgBuilder::BuildNPCUpdateMsg(uint32_t nWorldID, uint16_t nPosY, uint16_t nPosZ, uint16_t nPosX, uint8_t nActionBM, uint16_t nHealth, uint8_t nWeaponState, uint8_t nUnknown, uint32_t nTargetID)\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
\r
+    *tmpMsg << ( uint8_t )0x13;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint8_t )0x00;      // len\r
+    *tmpMsg << ( uint8_t )0x1b;      // NPC Update\r
+    *tmpMsg << ( uint32_t )nWorldID; // NPCs world ID\r
+    *tmpMsg << ( uint8_t )0x1f;      // Parameters\r
+    *tmpMsg << ( uint16_t )nPosY;    // Position Y\r
+    *tmpMsg << ( uint16_t )nPosZ;    // Position Z\r
+    *tmpMsg << ( uint16_t )nPosX;    // Position X\r
+    *tmpMsg << ( uint8_t )nActionBM; // NPCs current action-bitmask\r
+    *tmpMsg << ( uint16_t )nHealth;   // Health value\r
+    if(nTargetID > 0)\r
+        *tmpMsg << ( uint32_t )nTargetID; // WorldID of NPCs target (if any)\r
+    *tmpMsg << ( uint8_t )nUnknown;\r
+    *tmpMsg << ( uint8_t )nWeaponState;\r
\r
+    (*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);\r
\r
+    return tmpMsg;\r
+ }\r
+// **************\r
\r
+PMessage* PMsgBuilder::BuildNPCSingleAliveMsg( PClient* nClient, uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint8_t nAction )\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
\r
+    *tmpMsg << ( uint8_t )0x13; // Begin UDP message\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();\r
+    *tmpMsg << ( uint8_t )0x11;\r
+    *tmpMsg << ( uint8_t )0x1B;\r
+    *tmpMsg << ( uint32_t )nWorldID;\r
+    *tmpMsg << ( uint8_t )0x1F;\r
+    *tmpMsg << ( uint16_t )nY;\r
+    *tmpMsg << ( uint16_t )nZ;\r
+    *tmpMsg << ( uint16_t )nX;\r
+    *tmpMsg << ( uint8_t )nActionStatus;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )nHealth;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )nAction;\r
\r
+    return tmpMsg;\r
+ }\r
\r
+PMessage* PMsgBuilder::BuildNPCMassAliveMsg( uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint8_t nAction )\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
\r
+    *tmpMsg << ( uint8_t )0x13; // Begin UDP message\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint8_t )0x11;\r
+    *tmpMsg << ( uint8_t )0x1B;\r
+    *tmpMsg << ( uint32_t )nWorldID;\r
+    *tmpMsg << ( uint8_t )0x1F;\r
+    *tmpMsg << ( uint16_t )nY;\r
+    *tmpMsg << ( uint16_t )nZ;\r
+    *tmpMsg << ( uint16_t )nX;\r
+    *tmpMsg << ( uint8_t )nActionStatus;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )nHealth;\r
+    *tmpMsg << ( uint8_t )0x00;\r
+    *tmpMsg << ( uint8_t )nAction;\r
\r
+    return tmpMsg;\r
+ }\r
\r
+PMessage* PMsgBuilder::BuildNPCMassUpdateMsg( uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint16_t nTarget, uint8_t nAction )\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
\r
+    *tmpMsg << ( uint8_t )0x13; // Begin UDP message\r
+     *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint16_t )0x0000;\r
+    *tmpMsg << ( uint8_t )0x15; // Message length\r
+    *tmpMsg << ( uint8_t )0x1b;\r
+    *tmpMsg << ( uint32_t )nWorldID;\r
+    *tmpMsg << ( uint8_t )0x1F;\r
+    *tmpMsg << ( uint16_t )nY;\r
+    *tmpMsg << ( uint16_t )nZ;\r
+    *tmpMsg << ( uint16_t )nX;\r
+    *tmpMsg << ( uint8_t )nActionStatus;\r
+    *tmpMsg << ( uint8_t )0x77; // ?\r
+    *tmpMsg << ( uint8_t )nHealth;\r
+    *tmpMsg << ( uint16_t )nTarget;\r
+    *tmpMsg << ( uint8_t )0x00; // ?\r
+    *tmpMsg << ( uint8_t )0x00; // ?\r
+    *tmpMsg << ( uint8_t )0x00; // ?\r
+    *tmpMsg << ( uint8_t )nAction;\r
\r
+    return tmpMsg;\r
+ }\r
\r
+// ==========================\r
\r
+PMessage* PMsgBuilder::BuildNPCSingleUpdateMsg( PClient* nClient, uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint16_t nTarget, uint8_t nAction )\r
+ {\r
+    PMessage* tmpMsg = new PMessage();\r
\r
+    *tmpMsg << ( uint8_t )0x13; // Begin UDP message\r
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();\r
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();\r
+    *tmpMsg << ( uint8_t )0x15; // Message length\r
+    *tmpMsg << ( uint8_t )0x1b;\r
+    *tmpMsg << ( uint32_t )nWorldID;\r
+    *tmpMsg << ( uint8_t )0x1F;\r
+    *tmpMsg << ( uint16_t )nY;\r
+    *tmpMsg << ( uint16_t )nZ;\r
+    *tmpMsg << ( uint16_t )nX;\r
+    *tmpMsg << ( uint8_t )nActionStatus;\r
+    *tmpMsg << ( uint8_t )0x77; // ?\r
+    *tmpMsg << ( uint8_t )nHealth;\r
+    *tmpMsg << ( uint16_t )nTarget;\r
+    *tmpMsg << ( uint8_t )0x00; // ?\r
+    *tmpMsg << ( uint8_t )0x00; // ?\r
+    *tmpMsg << ( uint8_t )0x00; // ?\r
+    *tmpMsg << ( uint8_t )nAction;\r
\r
+    return tmpMsg;\r
+ }\r
+// ==========================\r
+PMessage* PMsgBuilder::BuildSubskillIncMsg( PClient* nClient, uint8_t nSubskill, uint16_t nSkillPoints )
+{
+    PMessage* tmpMsg = new PMessage( 33 );
+
+    nClient->IncreaseUDP_ID();
+    uint16_t tFirstUDPID = nClient->GetUDP_ID();
+
+    nClient->IncreaseUDP_ID();
+    uint16_t tSecondUDPID = nClient->GetUDP_ID();
+    uint16_t tSecondSessionID = nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )tSecondUDPID;
+    *tmpMsg << ( uint16_t )tSecondSessionID;
+
+    *tmpMsg << ( uint8_t )0x09; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )tFirstUDPID;
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25;
+    *tmpMsg << ( uint8_t )0x23;
+    *tmpMsg << ( uint8_t )0x27;
+
+    nClient->IncreaseTransactionID();
+    *tmpMsg << ( uint8_t )0x11; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )tSecondUDPID;
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25;
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetTransactionID(); // testing / 0x0000 ????
+    *tmpMsg << ( uint8_t )0x09; // ?
+    *tmpMsg << ( uint16_t )nSubskill;
+    *tmpMsg << ( uint16_t )nClient->GetChar()->Skill->GetSubSkill( nSubskill ); // nSubskill ?
+    *tmpMsg << ( uint16_t )nSkillPoints;
+
+    //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildLevelUpMessage( PClient* nClient, uint8_t nMainSkill, uint8_t nNewLevel, uint16_t nFreeSkillPoints)
+{
+    PMessage* tmpMsg = new PMessage(21);
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << (uint8_t)0x13;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint16_t)nClient->GetSessionID();
+    *tmpMsg << (uint8_t)0x0F;
+    *tmpMsg << (uint8_t)0x03;
+    *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+    *tmpMsg << (uint8_t)0x1F;
+    *tmpMsg << (uint16_t)nClient->GetLocalID();
+    *tmpMsg << (uint8_t)0x25;
+    *tmpMsg << (uint8_t)0x0B;
+    *tmpMsg << (uint16_t)nMainSkill;
+    *tmpMsg << (uint8_t)nNewLevel;
+    *tmpMsg << (uint16_t)nFreeSkillPoints;
+    *tmpMsg << (uint8_t)0x00;
+    *tmpMsg << (uint8_t)0x00;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildChatAddMsg( PClient* nClient, uint32_t nAddedCharID, uint8_t nMode )
+{
+    PMessage* tmpMsg = new PMessage( 18 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x32;
+    *tmpMsg << ( uint8_t )nMode;
+    *tmpMsg << ( uint32_t )nAddedCharID;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildDoorOpenMsg( uint32_t nRawItemID, bool nDoubleDoor )
+{
+    //PMessage* tmpMsg = new PMessage(37);
+    PMessage* tmpMsg = new PMessage( 21 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+
+    *tmpMsg << ( uint8_t )0x0f; // Sub-message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; //++Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint8_t )0x1b;
+    *tmpMsg << ( uint32_t )nRawItemID;
+    *tmpMsg << ( uint8_t )0x20; //?
+    if ( nDoubleDoor )
+    {
+        *tmpMsg << ( uint16_t )0x0005; //?
+        *tmpMsg << ( uint16_t )0x0000; //?
+        *tmpMsg << ( uint16_t )0x1500; //?
+    }
+    else
+    {
+        *tmpMsg << ( uint16_t )0x0000; //?
+        *tmpMsg << ( uint16_t )0x00c8; //? or 0x64 ?
+        *tmpMsg << ( uint16_t )0x10ff; //?
+    }
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+// Message from text.ini, section [MISC], id = 100+nTxtMsgId
+PMessage* PMsgBuilder::BuildText100Msg( PClient* nClient, uint8_t nTxtMsgId, uint32_t nRawObjectID )
+{
+    PMessage* tmpMsg = new PMessage( 17 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x0c; // Message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x31;
+    *tmpMsg << ( uint8_t )nTxtMsgId;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+
+    //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+    return tmpMsg;
+}
+
+// Same as BuildText100Msg, but here we can specify *ANY* text from text.ini, not limited to section [MISC]
+// 1: [DIALOG]
+// 2: [STATEMENT]
+// 3: [GUI] + [playertextures]
+// 4: [TERMINAL]
+// 5: [MENU]
+// 6: [MISC]
+// 7: [ITEMDESC]
+// 8: [HELPTEXT]
+PMessage* PMsgBuilder::BuildTextIniMsg( PClient* nClient, uint8_t nTxtGroupID, uint16_t nTxtID )
+{
+    PMessage* tmpMsg = new PMessage( 20 );
+
+    nClient->IncreaseUDP_ID();
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x0e; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25; // ??
+    *tmpMsg << ( uint8_t )0x15; // ??
+    *tmpMsg << nTxtGroupID;
+    *tmpMsg << nTxtID;
+    *tmpMsg << ( uint8_t )0x00; // ??
+    *tmpMsg << ( uint8_t )0x00; // ??
+    *tmpMsg << ( uint8_t )0x00; // ??
+
+    //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharInteractionMenuMsg( PClient* nClient, uint32_t nRawTargetID )
+{
+    PMessage* tmpMsg = new PMessage( 17 );
+
+    nClient->IncreaseUDP_ID();
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x0b; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x4d;
+    *tmpMsg << ( uint32_t )nRawTargetID;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildFurnitureActivateMsg( PClient* nClient, uint32_t nRawObjectID, uint8_t nActionValue )
+{
+    PMessage* tmpMsg = new PMessage( 12 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x06; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+    *tmpMsg << ( uint8_t )nActionValue; // known valid are 5 (ring), 9 (remove) and 10 (clic)
+
+    //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseFurnitureMsg( PClient* nClient, uint32_t nRawObjectID )
+{
+    PMessage* tmpMsg = new PMessage( 24 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x06; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+    *tmpMsg << ( uint8_t )0x0a;
+
+    *tmpMsg << ( uint8_t )0x0b; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x17;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseVhcTerminalMsg( PClient* nClient, uint32_t nRawObjectID )
+{
+    PMessage* tmpMsg = new PMessage( 24 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x06; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+    *tmpMsg << ( uint8_t )0x0a;
+
+    *tmpMsg << ( uint8_t )0x07; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x4a;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseGogoMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 17 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x0b; // Message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x3d;
+    *tmpMsg << ( uint32_t )0x0000000d; // cmd
+
+    //(*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseVentureWarpMsg( PClient* nClient, uint32_t nRawObjectID )
+{
+    PMessage* tmpMsg = new PMessage( 17 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x0b; // Message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x3d;
+    *tmpMsg << ( uint32_t )0x00000008; // cmd
+    *tmpMsg << ( uint32_t )0x00000007; // cmd ?
+    *tmpMsg << ( uint32_t )0x00000002; // ?
+    *tmpMsg << ( uint16_t )0x0004; // ?
+    *tmpMsg << nRawObjectID;
+    // *tmpMsg << (uint8_t)0x13; // ? Seems we can do without...
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildVhcAccessRequestMsg( PClient* nClient, uint32_t nRequestId, uint32_t nRequesterCharId, uint32_t nRequesterLocalId, uint32_t nVhcRawObjectID )
+{
+    PMessage* tmpMsg = new PMessage( 40 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x22; // Message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x3d;
+    *tmpMsg << ( uint32_t )0x00000008; // cmd
+    *tmpMsg << ( uint32_t )0x00000005; // cmd ?
+    *tmpMsg << ( uint32_t )nRequestId;
+    *tmpMsg << ( uint16_t )0x000c; // ? length ?
+    *tmpMsg << nRequesterCharId; //uint32_t
+    *tmpMsg << nRequesterLocalId; // ? uint32_t
+    *tmpMsg << nVhcRawObjectID;
+    *tmpMsg << ( uint8_t )0x08; // ?
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+/* S->C
+13:ff:00:72:d6:22:
+03:ff:00:1f:03:00:
+3d:
+08:00:00:00:
+05:00:00:00:
+01:00:00:00:
+0c:00:
+2f:d8:01:00:
+02:00:00:00:
+5d:03:00:00:
+08:
+*/
+
+/* C->S RESP: OK
+13:79:00:ec:d5:17:
+03:79:00:1f:03:00:
+3d:
+09:00:00:00:
+06:00:00:00:
+02:00:00:00:
+01:00:
+01:00
+*/
+/* C->S RESP: NOK
+13:74:00:e7:d5:17:
+03:74:00:1f:03:00:
+3d:
+09:00:00:00:
+06:00:00:00:
+01:00:00:00:
+01:00:
+00:00
+
+*/
+
+PMessage* PMsgBuilder::BuildCharUseGenrepMsg( PClient* nClient, uint32_t nRawObjectID, uint32_t nLocation, uint16_t nEntity )
+{
+    PMessage* tmpMsg = new PMessage( 24 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x06; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+    *tmpMsg << ( uint8_t )0x0a;
+
+    // this submessage is only needed to set to location/entity of the GR for a potential record in the char's GR list
+    *tmpMsg << ( uint8_t )0x0d; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nLocation;
+    *tmpMsg << ( uint16_t )nEntity;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseLiftMsg( PClient* nClient, uint32_t nRawObjectID, uint16_t nAptPlace )
+{
+    PMessage* tmpMsg = new PMessage( 29 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x06; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+    *tmpMsg << ( uint8_t )0x0a;
+
+    *tmpMsg << ( uint8_t )0x11; // SubMessage length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x38;
+    *tmpMsg << ( uint8_t )0x01;
+    *tmpMsg << ( uint32_t )nRawObjectID;
+    *tmpMsg << ( uint16_t )nAptPlace;
+    *tmpMsg << ( uint16_t )0x0000;
+    *tmpMsg << ( uint8_t )0x00;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharShowGlowCircleMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 14 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // UDP ID placeholder
+    *tmpMsg << ( uint16_t )0x0000; // SessionID placeholder
+    *tmpMsg << ( uint8_t )0x08;  // Len (static, always 0x08
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // Sub UDP ID placeholder
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x3c; // Command SHOW GLOWING CIRCLE (kinda ^^)
+    *tmpMsg << ( uint8_t )0x01; // "on" ?
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharMoneyUpdateMsg( PClient* nClient, uint32_t nCredits )
+{
+    PMessage* tmpMsg = new PMessage( 21 );
+    nClient->IncreaseUDP_ID();
+    nClient->IncreaseTransactionID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x0f; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25; // cmd
+    *tmpMsg << ( uint8_t )0x13; // cmd
+    *tmpMsg << ( uint16_t )nClient->GetTransactionID();
+    *tmpMsg << ( uint8_t )0x04; // cmd
+    *tmpMsg << nCredits;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildUndefineduseMsg( PClient* nClient, uint8_t nValue )
+{
+    PMessage* tmpMsg = new PMessage( 15 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x09; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25;
+    *tmpMsg << ( uint8_t )0x23;
+    *tmpMsg << nValue;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseQBSlotMsg2( PClient* nClient, uint16_t nV1, uint16_t nV2, uint16_t nV3, uint16_t nV4, uint16_t nV5, uint16_t nV6, uint16_t nV7 )
+{
+    // lol? Whats this?
+    PMessage* tmpMsg = new PMessage( 28 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x16; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25; // cmd
+    *tmpMsg << ( uint8_t )0x22; // cmd
+    *tmpMsg << nV1;
+    *tmpMsg << nV2;
+    *tmpMsg << nV3;
+    *tmpMsg << nV4;
+    *tmpMsg << nV5;
+    *tmpMsg << nV6;
+    *tmpMsg << nV7;
+    /* *tmpMsg << (uint8_t)0x64; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+     *tmpMsg << (uint8_t)0x64; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+     *tmpMsg << (uint8_t)0x64; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+     *tmpMsg << (uint8_t)0x64; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+     *tmpMsg << (uint8_t)0x64; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+     *tmpMsg << (uint8_t)0x64; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+     *tmpMsg << (uint8_t)0x00; // ??
+    */
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseQBSlotMsg3( PClient* nClient, uint8_t nSlot )
+{
+    PMessage* tmpMsg = new PMessage( 19 );
+    nClient->IncreaseUDP_ID();
+    nClient->IncreaseTransactionID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x0d; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25; // cmd
+    *tmpMsg << ( uint8_t )0x13; // cmd
+    *tmpMsg << ( uint16_t )nClient->GetTransactionID();
+    *tmpMsg << ( uint8_t )0x0b; // cmd
+    *tmpMsg << nSlot; // ??
+    *tmpMsg << ( uint8_t )0x00; // ??
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseQBSlotMsg4( PClient* nClient, uint16_t nWeaponId )
+{
+    PMessage* tmpMsg = new PMessage( 16 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x0a; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x2f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x02; // ??
+    *tmpMsg << ( uint8_t )0x02; // ??
+    *tmpMsg << nWeaponId;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildContainerContentList( PContainer* nContainer, uint8_t nLocType )
+{
+    PMessage* tmpMsg = new PMessage( 256 );
+    std::vector< PContainerEntry* >* Entries = nContainer->GetEntries();
+    PContainerEntry* tEntry;
+    PMessage* entryMsg;
+
+//Console->Print(YELLOW, BLACK, "BuildContainerContentList for loc %d", nLocType);
+    if ( nLocType != INV_LOC_BOX )
+    {
+        if ( nLocType == INV_LOC_BACKPACK )
+            *tmpMsg << ( uint16_t )Entries->size(); // items nb
+        else
+            *tmpMsg << ( uint8_t )Entries->size(); // items nb
+    }
+
+    for ( uint16_t i = 0; i < Entries->size(); ++i )
+    {
+        tEntry = Entries->at( i );
+        entryMsg = BuildContainerContentEntry( tEntry, nLocType );
+//if(tEntry->mItem->mItemID == 390)
+//{
+//Console->Print(YELLOW, BLACK, "BuildContainerContentList entry %d - size %d", i, entryMsg->GetSize());
+//entryMsg->Dump();
+//}
+        *tmpMsg << *entryMsg;
+        delete entryMsg;
+    }
+
+    delete Entries;
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildContainerContentEntry( PContainerEntry* nEntry, uint8_t nLocType )
+{
+    PMessage* tmpMsg = new PMessage( 16 );
+    PItem* tItem;
+    uint8_t dataFlags, Qualifier;
+
+    tItem = nEntry->mItem;
+    dataFlags = Qualifier = 0x00 ;
+
+    if (( tItem->mItemID == 390 ) /* testing */ || tItem->mLoadedAmmoNb )
+    {
+        dataFlags |= 0x01;
+    }
+    if (( tItem->GetType() == ITEM_TYPE_WEAPON ) || ( tItem->GetType() == ITEM_TYPE_BLUEPRINT ) || ( tItem->GetType() == ITEM_TYPE_WRECKEDPART )/*|| (tItem->GetType() == ITEM_TYPE_APARTMENTKEY) || (tItem->GetType() == ITEM_TYPE_CLANKEY) || (tItem->GetType() == ITEM_TYPE_VHCKEY) */ ) // testing loaded ammo type & BP attributes
+    {
+        dataFlags |= 0x20;
+    }
+
+    switch ( tItem->GetType() )
+    {
+    case ITEM_TYPE_WEAPON:
+    case ITEM_TYPE_AUTOWEAPON:
+        Qualifier = 6;
+        dataFlags |= 0x02;
+        break;
+    case ITEM_TYPE_IMPLANT:
+    case ITEM_TYPE_ARMOR:
+        Qualifier = 2;
+        dataFlags |= 0x02;
+        break;
+    default:
+        Qualifier = 0;
+        break;
+    }
+
+    if ( tItem->IsStackable() && tItem->mStackSize )
+    {
+        dataFlags |= 0x04;
+    }
+
+    if (( tItem->mModificators ) || ( tItem->mItemID == 390 ) ) // TEST
+        dataFlags |= 0x10;
+
+    if ( tItem->mMaxSlots || ( tItem->mItemID == 390 ) ) // TEST
+        dataFlags |= 0x40;
+
+
+
+    if ( nLocType == INV_LOC_BOX )
+        *tmpMsg << ( uint8_t )0x00;   // Size of item placeholder
+    else
+        *tmpMsg << ( uint16_t )0x0000;   // Size of item placeholder
+
+    switch ( nLocType )
+    {
+    case INV_LOC_WORN:
+        *tmpMsg << ( uint8_t )nEntry->mPosX; // X Location
+        *tmpMsg << ( uint8_t )0x00; // just nothing
+        break;
+    case INV_LOC_BACKPACK:
+        *tmpMsg << ( uint8_t )0x00; // just nothing again
+        *tmpMsg << ( uint8_t )nEntry->mPosX; // X Location
+        *tmpMsg << ( uint8_t )nEntry->mPosY; // Y Location
+        break;
+    case INV_LOC_GOGO:
+        *tmpMsg << ( uint8_t )nEntry->mPosX;
+        break;
+    case INV_LOC_BOX:
+    case INV_LOC_BOX2:
+        break;
+    default:
+        break;
+    }
+
+    *tmpMsg << ( uint16_t )tItem->mItemID; // ItemID
+    *tmpMsg << ( uint8_t )dataFlags; // (0x01|0x02|0x04|0x10|0x20|0x40|0x80); // Datatypes
+
+    if ( dataFlags & 0x01 )
+    {
+        if ( tItem->GetType() == ITEM_TYPE_WEAPON ) // TESTING
+            *tmpMsg << ( uint8_t )6; // Remaining ammos
+        else
+            *tmpMsg << ( uint8_t )tItem->mLoadedAmmoNb; // Remaining ammos
+    }
+
+    if ( dataFlags & 0x02 )
+    {
+        *tmpMsg << ( uint8_t )Qualifier; // Qual entries
+        if ( Qualifier >= 2 )
+        {
+            *tmpMsg << ( uint8_t )tItem->mCurDuration; // current qual
+            if ( Qualifier == 6 )
+            {
+                *tmpMsg << ( uint8_t )tItem->mDamages; // dmg
+                *tmpMsg << ( uint8_t )tItem->mFrequency; // freq
+                *tmpMsg << ( uint8_t )tItem->mHandling; // handl
+                *tmpMsg << ( uint8_t )tItem->mRange; // range
+            }
+            *tmpMsg << ( uint8_t )tItem->mMaxDuration; // max qual
+        }
+    }
+
+    if ( dataFlags & 0x10 )
+    {
+        if ( tItem->mItemID == 390 ) // test
+            *tmpMsg << ( uint8_t )4;
+        else
+            *tmpMsg << ( uint8_t )tItem->mModificators; // addons bitflag: flashlight=1, scope, silencer, laserpointer
+    }
+
+    if ( dataFlags & 0x40 )
+    {
+        if ( tItem->mItemID == 390 ) // test
+        {
+            *tmpMsg << ( uint8_t )3;
+            *tmpMsg << ( uint8_t )3;
+            *tmpMsg << ( uint16_t )0x000b; // enlarged
+            *tmpMsg << ( uint16_t )0x05de; // phosophore
+            *tmpMsg << ( uint16_t )( -3 ); // silencer
+        }
+        else
+        {
+
+            *tmpMsg << ( uint8_t )tItem->mUsedSlots; // used slots
+            *tmpMsg << ( uint8_t )tItem->mMaxSlots; // max slots
+            for ( uint8_t j = 0; j < tItem->mMaxSlots; ++j )
+                *tmpMsg << ( uint16_t )(( j < tItem->mUsedSlots ) ? tItem->mSlot[j] : 0 ); // mod in slot
+        }
+    }
+
+    if ( dataFlags & 0x20 ) // loaded ammo type ????
+    {
+        uint16_t lengthFieldOffset = tmpMsg->GetNextByteOffset();
+        *tmpMsg << ( uint16_t )0x0000; // length placeholder
+
+        if ( tItem->GetType() == ITEM_TYPE_WEAPON )
+        {
+            *tmpMsg << ( uint8_t )0x01; // ammo info
+            *tmpMsg << ( uint8_t )0x04; // total length ?
+            *tmpMsg << ( uint8_t )0x00; // + baseammo => current ammoId. 0xff => undefined
+            *tmpMsg << ( uint8_t )0xff; // supported ammos bitmap (all here)
+        }
+
+        if ( false && ( tItem->GetType() == ITEM_TYPE_APARTMENTKEY ) ) // activated Apartment key
+        {
+            *tmpMsg << ( uint8_t )0x02; // ammo info
+            *tmpMsg << ( uint8_t )0x06; // total length
+            *tmpMsg << ( uint32_t )123456; // apartmentObjectID ?
+        }
+
+        if ( false && ( tItem->GetType() == ITEM_TYPE_CLANKEY ) ) // activated ClanKey
+        {
+            *tmpMsg << ( uint8_t )0x04; // BP of... info
+            *tmpMsg << ( uint8_t )0x0a; // total length
+            *tmpMsg << ( uint32_t )1234; // ClanID ?
+            *tmpMsg << ( uint32_t )123456; // apartmentObjectID ?
+        }
+
+        if ( tItem->GetType() == ITEM_TYPE_BLUEPRINT ) // BP
+        {
+            *tmpMsg << ( uint8_t )0x05; // BP of... info
+            *tmpMsg << ( uint8_t )0x06; // total length
+            *tmpMsg << ( uint32_t )486; // ItemID ("Tangent Sniper Rifle")
+        }
+
+        if ( false && ( tItem->GetType() == ITEM_TYPE_VHCKEY ) ) // activated VHC Key
+        {
+            *tmpMsg << ( uint8_t )0x08; // VHC Key
+            *tmpMsg << ( uint8_t )0x0a; // total length
+            *tmpMsg << ( uint32_t )654321; // vhcObjectID ?
+            *tmpMsg << ( uint32_t )123456; // Owner CharID ?
+        }
+
+        if ( false && ( tItem->GetType() == ITEM_TYPE_WRECKEDPART ) ) // Identified rare part
+        {
+            *tmpMsg << ( uint8_t )0x09; // Rare part
+            *tmpMsg << ( uint8_t )0x05; // total length
+            *tmpMsg << ( uint16_t )453; // Rare Item ID ? REDEEMER
+            *tmpMsg << ( uint8_t )0; // ??
+        }
+
+        if (( tItem->mConstructorId ) || ( tItem->mItemID == 390 ) ) // Named item /itemId 390: test
+        {
+            *tmpMsg << ( uint8_t )0x0a; // constructor info
+            *tmpMsg << ( uint8_t )0x06; // total length
+            //*tmpMsg << (uint32_t)tItem->mConstructorId; // charID
+            *tmpMsg << ( uint32_t )2;
+        }
+
+        tmpMsg->U16Data( lengthFieldOffset ) = tmpMsg->GetNextByteOffset() - lengthFieldOffset - 2;
+    }
+
+    if ( dataFlags & 0x04 )
+    {
+        *tmpMsg << ( uint32_t )tItem->mStackSize;
+    }
+
+
+    if ( nLocType == INV_LOC_BOX )
+        tmpMsg->U8Data( 0 ) = tmpMsg->GetSize() - 1;
+    else
+        tmpMsg->U16Data( 0 ) = tmpMsg->GetSize() - 2;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharOpenContainerMsg( PClient* nClient, uint32_t nContainerID, PContainer* nContainer )
+{
+    PMessage* ContentList = BuildContainerContentList( nContainer, INV_LOC_BOX );
+
+    PMessage* tmpMsg = new PMessage();
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x26;
+    *tmpMsg << nContainerID;
+    *tmpMsg << ( uint8_t )0x00; // Always the same on item containers? // 0x01 for Trader (NeoX gameclient 3608)
+    *tmpMsg << ( uint8_t )0x64; // Always the same on item containers?
+    *tmpMsg << ( uint8_t )0x00; // Always the same on item containers?
+    *tmpMsg << ( uint8_t )0x08; // 0x08 when container is filled, 0x00 when not? At least it works..
+
+    *tmpMsg << ( uint16_t )( ContentList->GetSize() );
+    *tmpMsg << *ContentList;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    delete ContentList;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildItemMoveMsg( PClient* nClient, uint8_t nSource, uint8_t nSrcX, uint8_t nSrcY, uint8_t nDestination, uint8_t nDestX, uint8_t nDestY, uint8_t nItemCnt )
+{
+    PMessage* tmpMsg = new PMessage( 26 );
+    nClient->IncreaseUDP_ID();
+    nClient->IncreaseTransactionID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x14; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25;
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetTransactionID();
+    *tmpMsg << ( uint8_t )0x14; // ItemMove Answer
+    *tmpMsg << nSource;
+    *tmpMsg << nSrcX;
+    *tmpMsg << nSrcY;
+    *tmpMsg << nDestination;
+    *tmpMsg << nDestX;
+    *tmpMsg << nDestY;
+    *tmpMsg << nItemCnt;
+    *tmpMsg << ( uint8_t )0x00; // ??
+    *tmpMsg << ( uint8_t )0x00; // ??
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildBoxItemMoveMsg( PClient* nClient, PContainerEntry* nEntry, uint8_t nSrcX, uint8_t nSrcY, uint8_t nDestination, uint8_t nDestX, uint8_t nDestY, uint8_t nItemCnt )
+{
+    PMessage* tmpMsg = new PMessage( 64 );
+    PMessage* entryMsg = BuildContainerContentEntry( nEntry, INV_LOC_BOX2 );
+
+    nClient->IncreaseUDP_ID();
+    nClient->IncreaseTransactionID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x09; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25;
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetTransactionID();
+    *tmpMsg << ( uint8_t )0x17; // BoxItemMove Answer Src
+    *tmpMsg << ( uint8_t )INV_LOC_BOX; // Src = Box
+    *tmpMsg << nSrcX;
+    *tmpMsg << nSrcY;
+    *tmpMsg << nItemCnt;
+    *tmpMsg << ( uint8_t )0x00; // Qty high
+    *tmpMsg << ( uint8_t )0x18; // BoxItemMove Answer Dst
+    *tmpMsg << nDestination;
+    *tmpMsg << nDestX;
+    *tmpMsg << nDestY;
+    *tmpMsg << *entryMsg;
+    *tmpMsg << ( uint8_t )0x12; // ? vary ...
+    *tmpMsg << ( uint8_t )0x00;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    delete entryMsg;
+    return tmpMsg;
+}
+
+/*PMessage* PMsgBuilder::BuildItemAmmoUpdateMsg (PClient* nClient, PContainerEntry* nEntry, uint8_t nSrcX, uint8_t nSrcY, uint8_t nDestination, uint8_t nDestX, uint8_t nDestY, uint8_t nItemCnt)
+{
+  PMessage* tmpMsg = new PMessage(64);
+  PMessage* entryMsg = BuildContainerContentEntry(nEntry, INV_LOC_BOX2);
+
+  nClient->IncreaseUDP_ID();
+  nClient->IncreaseTransactionID();
+
+  *tmpMsg << (uint8_t)0x13;
+  *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+  *tmpMsg << (uint16_t)nClient->GetSessionID();
+
+  *tmpMsg << (uint8_t)0x09; // Message length
+  *tmpMsg << (uint8_t)0x03;
+  *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+  *tmpMsg << (uint8_t)0x1f;
+  *tmpMsg << (uint16_t)nClient->GetLocalID();
+  *tmpMsg << (uint8_t)0x25;
+  *tmpMsg << (uint8_t)0x13;
+  *tmpMsg << (uint16_t)nClient->GetTransactionID();
+  *tmpMsg << (uint8_t)0x17; // BoxItemMove Answer Src
+  *tmpMsg << (uint8_t)INV_LOC_BOX; // Src = Box
+  *tmpMsg << nSrcX;
+  *tmpMsg << nSrcY;
+  *tmpMsg << nItemCnt;
+  *tmpMsg << (uint8_t)0x00; // Qty high
+  *tmpMsg << (uint8_t)0x18; // BoxItemMove Answer Dst
+  *tmpMsg << nDestination;
+  *tmpMsg << nDestX;
+  *tmpMsg << nDestY;
+  *tmpMsg << *entryMsg;
+  *tmpMsg << (uint8_t)0x12; // ? vary ...
+  *tmpMsg << (uint8_t)0x00;
+
+  (*tmpMsg)[5] = (uint8_t)(tmpMsg->GetSize() - 6);
+
+  delete entryMsg;
+  return tmpMsg;
+}*/
+/* Resp:
+03:33:00:1f:01:00:25:13
+c2:01:0a:00:02:00:00:00 ??
+c3:01:05:03:00:00:12 Update ammo left
+c4:01:05:02:00:00:0c Update ammo left
+*/
+
+PMessage* PMsgBuilder::BuildStartHackGameMsg( PClient* nClient, uint32_t nWorldObjID, uint8_t nHackDifficult )
+{
+    PMessage* tmpMsg = new PMessage( 22 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x10;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x28;
+    *tmpMsg << nWorldObjID;
+    *tmpMsg << nHackDifficult;
+    *tmpMsg << ( uint8_t )0x28;
+    *tmpMsg << ( uint8_t )0x5c;
+    *tmpMsg << ( uint8_t )0xcf;
+    *tmpMsg << ( uint8_t )0x3e;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildSubwaySpawnMsg( PClient* nClient, bool IsSecondMessage )
+{
+    PMessage* tmpMsg = new PMessage( 197 );
+    uint16_t First = IsSecondMessage ? 6 : 0;
+    uint16_t Last = IsSecondMessage ? 10 : 5;
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    for ( uint16_t i = First; ( i <= Last ); i++ )
+    {
+        nClient->IncreaseUDP_ID();
+        *tmpMsg << ( uint8_t )0x11; //msg size
+        *tmpMsg << ( uint8_t )0x03;
+        *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+        *tmpMsg << ( uint8_t )0x28;
+        *tmpMsg << ( uint16_t )0x0027;
+        *tmpMsg << ( uint32_t )( PSubway::mCabsBaseId + i );
+        *tmpMsg << ( uint16_t )0x0000;
+        *tmpMsg << ( uint8_t )0x00;
+        *tmpMsg << ( uint16_t )Subway->mSubways[i].mPosition;
+        *tmpMsg << ( uint8_t )0x00;
+        *tmpMsg << ( uint8_t )Subway->mSubways[i].mDoorOpened;;
+
+        nClient->IncreaseUDP_ID(); // vhc health update
+        *tmpMsg << ( uint8_t )0x0d; //msg size
+        *tmpMsg << ( uint8_t )0x03;
+        *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+        *tmpMsg << ( uint8_t )0x2d;
+        *tmpMsg << ( uint32_t )( PSubway::mCabsBaseId + i );
+        *tmpMsg << ( uint8_t )0x0a;
+        *tmpMsg << ( uint32_t )PSubway::mCabsBaseHealth;
+    }
+
+    tmpMsg->U16Data( 1 ) = nClient->GetUDP_ID();
+    tmpMsg->U16Data( 3 ) = nClient->GetSessionID();
+
+    return tmpMsg;
+}
+
+/*
+PMessage* PMsgBuilder::BuildSubwayFullUpdateMsg(PClient* nClient)
+{
+    PMessage* tmpMsg = new PMessage(148);
+    *tmpMsg << (uint8_t)0x13;
+    *tmpMsg << (uint16_t)0x0000; // placeholder for UDP_ID;
+    *tmpMsg << (uint16_t)0x0000; // placeholder for SessionID();
+
+    for(uint8_t i=0; i<PSubway::mCabsNumber; i++)
+    {
+      nClient->IncreaseUDP_ID();
+      *tmpMsg << (uint8_t)0x0c; //msg size
+      *tmpMsg << (uint8_t)0x03;
+      *tmpMsg << (uint16_t)nClient->GetUDP_ID();
+      *tmpMsg << (uint8_t)0x32;
+      *tmpMsg << (uint32_t)(PSubway::mCabsBaseId + i);
+      *tmpMsg << (uint8_t)0x00;
+      *tmpMsg << (uint16_t)Subway->mSubways[i].mPosition;
+      *tmpMsg << (uint8_t)Subway->mSubways[i].mDoorOpened;;
+  }
+
+    tmpMsg->U16Data(1) = nClient->GetUDP_ID();
+    tmpMsg->U16Data(3) = nClient->GetSessionID();
+
+    return tmpMsg;
+}
+*/
+
+PMessage* PMsgBuilder::BuildSubwaySingleUpdateMsg( uint32_t nVehicleID, uint16_t nPosition, uint8_t nDoorOpened )
+{
+    PMessage* tmpMsg = new PMessage( 18 );
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x0c; //msg size
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // ++UDP_ID placeholder
+    *tmpMsg << ( uint8_t )0x32;
+    *tmpMsg << ( uint32_t )nVehicleID;
+    *tmpMsg << ( uint8_t )0x00;
+    *tmpMsg << ( uint16_t )nPosition;
+    *tmpMsg << ( uint8_t )nDoorOpened;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildSpawnWorldObjectMsg( uint16_t nModelID, uint16_t nFunctionID, uint32_t nWOID, uint16_t nPosX, uint16_t nPosY, uint16_t nPosZ, uint8_t nRotX, uint8_t nRotY, uint8_t nRotZ )
+{
+    PMessage* tmpMsg = new PMessage( 31 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // UDP placeholder
+    *tmpMsg << ( uint16_t )0x0000; // Session placeholder
+    *tmpMsg << ( uint8_t )0x16;  // Message length
+    *tmpMsg << ( uint8_t )0x03;  // 0x03 commandset
+    *tmpMsg << ( uint16_t )0x0000; // UDP placeholder
+    *tmpMsg << ( uint8_t )0x1b;  // Subcommandset
+    *tmpMsg << ( uint32_t )nWOID;  // WorldobjectID
+
+    *tmpMsg << ( uint8_t )0x19;  // Positiondata follows
+    *tmpMsg << ( uint16_t )nPosY;
+    *tmpMsg << ( uint16_t )nPosZ;
+    *tmpMsg << ( uint16_t )nPosX;
+    *tmpMsg << ( uint8_t )nRotY;  // Rotation X
+    *tmpMsg << ( uint8_t )nRotZ;  // Rotation Y
+    *tmpMsg << ( uint8_t )nRotX;  // Rotation Z
+    *tmpMsg << ( uint16_t )nModelID;
+    *tmpMsg << ( uint16_t )nFunctionID;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildRemoveWorldObjectMsg( uint32_t nWOID )
+{
+    PMessage* tmpMsg = new PMessage( 14 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // UDP ID placeholder
+    *tmpMsg << ( uint16_t )0x0000; // SessionID placeholder
+    *tmpMsg << ( uint8_t )0x08;  // Len (static, always 0x08
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // Sub UDP ID placeholder
+    *tmpMsg << ( uint8_t )0x26;  // Command FADE AWAY CHAR (kinda ^^)
+    *tmpMsg << ( uint32_t )nWOID;  // WorldobjectID
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildDBRequestStatusMsg( PClient* nClient, std::string *nCommandName, uint8_t nStatus, uint16_t nErrCode )
+{
+    PMessage* tmpMsg = new PMessage( 32 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x14; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x2b;
+    *tmpMsg << ( uint8_t )0x1a;
+    *tmpMsg << ( uint16_t )( nCommandName->size() + 1 );
+    *tmpMsg << ( uint8_t )nStatus;
+    *tmpMsg << ( uint16_t )nErrCode;
+    *tmpMsg << ( *nCommandName );
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildDBAnswerMsg( PClient* nClient, std::string *nCommandName, std::string *nAnswerData, uint16_t nRows, uint16_t nCols )
+{
+    uint8_t i, j, k;
+    PMessage* tmpMsg = new PMessage( 32 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x14; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x2b;
+    *tmpMsg << ( uint8_t )0x17;
+    *tmpMsg << ( uint16_t )( nCommandName->size() + 1 );
+    *tmpMsg << ( uint16_t )nRows;
+    *tmpMsg << ( uint16_t )nCols;
+    *tmpMsg << ( *nCommandName );
+
+    for ( i = 0, k = 0; i < nRows; ++i )
+    {
+        for ( j = 0; j < nCols; ++j, ++k )
+        {
+            *tmpMsg << ( uint16_t )( nAnswerData[k].size() + 1 );
+            *tmpMsg << nAnswerData[k];
+        }
+    }
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseVhcMsg( PClient* nClient, uint32_t nRawObjectID, uint16_t nVhcType, uint16_t nAvailableSeats )
+{
+    PMessage* tmpMsg = new PMessage( 24 );
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x13; // Message length;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x3d;
+    *tmpMsg << ( uint32_t )0x0000000e; // cmd
+    *tmpMsg << nRawObjectID;
+    *tmpMsg << nVhcType;
+    *tmpMsg << nAvailableSeats; // Bit flags
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildVhcInfoMsg( PClient* nClient, PSpawnedVehicle* nVehicle )
+{
+    PMessage* tmpMsg = new PMessage( 32 );
+    PVhcCoordinates VhcPos = nVehicle->GetPosition();
+    PVehicleInformation VhcInfo = nVehicle->GetInformation();
+
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x28;
+    *tmpMsg << ( uint16_t )0x0031;
+    *tmpMsg << ( uint32_t )nVehicle->GetLocalId();
+    *tmpMsg << ( uint8_t )0x02;
+    *tmpMsg << ( uint16_t )( VhcPos.GetY() + 768 );
+    *tmpMsg << ( uint16_t )( VhcPos.GetZ() + 768 );
+    *tmpMsg << ( uint16_t )( VhcPos.GetX() + 768 );
+    *tmpMsg << ( uint8_t )VhcPos.GetUD();
+    *tmpMsg << ( uint16_t )VhcPos.GetLR();
+    *tmpMsg << ( uint16_t )VhcPos.GetRoll();
+    *tmpMsg << ( uint8_t )VhcInfo.GetVehicleType();
+    *tmpMsg << ( uint8_t )0xff;
+    *tmpMsg << ( uint32_t )0x00000000;
+    *tmpMsg << ( uint16_t )0x0000;
+    *tmpMsg << ( uint8_t )0x00;
+    *tmpMsg << ( uint8_t )0x01; // ? changes
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+/*PMessage* PMsgBuilder::BuildVhcInfoMsg( PClient* nClient, PSpawnedVehicle* nVehicle )
+{
+  PMessage* tmpMsg = new PMessage( 32 );
+  PVhcCoordinates VhcPos = nVehicle->GetPosition();
+  PVehicleInformation VhcInfo = nVehicle->GetInformation();
+
+  nClient->IncreaseUDP_ID();
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint16_t )nClient->GetSessionID();
+
+  *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint8_t )0x28;
+  *tmpMsg << ( uint16_t )0x0031;
+  *tmpMsg << ( uint32_t )nVehicle->GetLocalId();
+  *tmpMsg << ( uint8_t )0x02;
+  *tmpMsg << ( uint16_t )( VhcPos.GetY() + 768 );
+  *tmpMsg << ( uint16_t )( VhcPos.GetZ() + 768 );
+  *tmpMsg << ( uint16_t )( VhcPos.GetX() + 768 );
+  *tmpMsg << ( uint8_t )VhcPos.GetUD();
+  *tmpMsg << ( uint16_t )VhcPos.GetLR();
+  *tmpMsg << ( uint16_t )VhcPos.GetRoll();
+  *tmpMsg << ( uint8_t )VhcInfo.GetVehicleType();
+  *tmpMsg << ( uint32_t )0x00000000;
+  *tmpMsg << ( uint32_t )0x00000000;
+  *tmpMsg << ( uint32_t )0x00000000;
+  *tmpMsg << ( uint16_t )0x0000;
+  uint32_t tCharId;
+  for(uint8_t i = 0; i < 8; ++i)
+  {
+    if( (tCharId = nVehicle->GetSeatUser(i)) )
+    {
+      *tmpMsg << tCharId;
+    }
+    else
+    {
+      *tmpMsg << ( uint32_t )0xffffffff;
+    }
+    *tmpMsg << i;
+    *tmpMsg << ( uint16_t )0x0000;
+  }
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+  return tmpMsg;
+}*/
+/* ????
+13 f7 00 49 bf
+5d
+03 f7 00
+28 31 00
+c9 03 00 00 = Object ID
+02
+47 ff
+00 cd
+c3 c3
+d7
+d7 ec
+00 00
+29
+2b 65 35 8b 8c 6c 7f 80 96
+5f 26 00 80 00
+ff ff ff ff 00 00 00
+ff ff ff ff 01 00 00
+ff ff ff ff 02 00 00
+ff ff ff ff 03 00 00
+ff ff ff ff 04 00 00
+ff ff ff ff 05 00 00
+ff ff ff ff 06 00 00
+ff ff ff ff 07 00 00
+
+*/
+
+PMessage* PMsgBuilder::BuildVhcHealthUpdateMsg( PSpawnedVehicle* nVehicle )
+{
+    PMessage* tmpMsg = new PMessage( 19 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x0d; //msg size
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for ++UDP_ID
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nVehicle->GetLocalId();
+    *tmpMsg << ( uint8_t )0x0a; // Health update
+    *tmpMsg << ( float )( nVehicle->GetInformation().GetHealth() );
+
+    return tmpMsg;
+}
+
+// NB: same as BuildCharSittingMsg. To be merged later when classes are adapted
+PMessage* PMsgBuilder::BuildVhcPosUpdateMsg( PSpawnedVehicle* nVehicle )
+{
+    PMessage* tmpMsg = new PMessage( 33 );
+    PVhcCoordinates VhcPos = nVehicle->GetPosition();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
+    *tmpMsg << ( uint16_t )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
+
+    *tmpMsg << ( uint8_t )0x00; // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x32;
+    *tmpMsg << ( uint16_t )( nVehicle->GetLocalId() & 0xffff );
+    *tmpMsg << ( uint8_t )0x03; // We suppose we use move type 3, as in client message
+    *tmpMsg << ( uint16_t )( VhcPos.GetY() + 768 ); // +768 or +0 ??? All Char/Vhc/NPC/Objet offset to clean up...
+    *tmpMsg << ( uint16_t )( VhcPos.GetZ() + 768 );
+    *tmpMsg << ( uint16_t )( VhcPos.GetX() + 768 );
+    *tmpMsg << ( uint8_t )VhcPos.GetUD();
+    *tmpMsg << ( uint16_t )VhcPos.GetLR();
+    *tmpMsg << ( uint16_t )VhcPos.GetRoll();
+    *tmpMsg << ( uint16_t )VhcPos.GetUnknown();
+    *tmpMsg << ( uint8_t )0x00;
+    *tmpMsg << ( uint8_t )VhcPos.GetAct();
+    /* What is that for ????
+    *tmpMsg << ( uint8_t )0x02; // <= these two uint8_t corresond to mUnknown... = additionnal data ?
+    *tmpMsg << ( uint8_t )0x00; // maybe weapon related ?
+    *tmpMsg << ( uint16_t )0x0000;
+    *tmpMsg << ( uint16_t )0x0001;
+    *tmpMsg << ( uint16_t )0x8000;
+    *tmpMsg << ( uint16_t )0x8000;
+    */
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildVhcPosUpdate2Msg( PSpawnedVehicle* nVehicle )
+{
+    PMessage* tmpMsg = new PMessage( 28 );
+    PVhcCoordinates VhcPos = nVehicle->GetPosition();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x00; //msg size
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // ++UDP_ID placeholder
+    *tmpMsg << ( uint8_t )0x32;
+    *tmpMsg << ( uint16_t )( nVehicle->GetLocalId() & 0xffff );
+    *tmpMsg << ( uint8_t )0x03; // 0x07 in nc2.2, and one more field (same a received msg)
+    *tmpMsg << ( uint16_t )( VhcPos.GetY() + 768 ); // +768 or +0 ??? All Char/Vhc/NPC/Objet offset to clean up...
+    *tmpMsg << ( uint16_t )( VhcPos.GetZ() + 768 );
+    *tmpMsg << ( uint16_t )( VhcPos.GetX() + 768 );
+    *tmpMsg << ( uint8_t )VhcPos.GetUD();
+    *tmpMsg << ( uint16_t )VhcPos.GetLR();
+    *tmpMsg << ( uint16_t )VhcPos.GetRoll();
+    *tmpMsg << ( uint16_t )VhcPos.GetUnknown();
+    *tmpMsg << ( uint8_t )VhcPos.GetFF();
+    *tmpMsg << ( uint8_t )VhcPos.GetAct();
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+/*
+ground vhc in NC1
+C->S
+[...] 32:fb:03:03:d4:8c:2f:84:a0:7b:7b:bf:c6:53:28:01:00:ff:05
+S->C
+[...] 32: fb:03: 03: d4:8c: 2f:84: a0:7b: 7b: bf:c6: 53:28: 01:00:ff:05
+
+  *nMsg >> mVhcLocalId;
+  *nMsg >> mMoveType; // 0 for subway, 3 for nc1 vhc, 7 for nc2 vhc // uint8_t
+  *nMsg >> mNewY;
+  *nMsg >> mNewZ;
+  *nMsg >> mNewX;
+  *nMsg >> mNewUD; // uint8_t
+  *nMsg >> mNewLR;
+  *nMsg >> mNewRoll;
+  *nMsg >> mUnk1;
+  *nMsg >> mFF; // uint8_t
+  *nMsg >> mAction; // uint8_t
+
+quad in NC2.2
+C->S
+[...] 32:c9:03:07:28:65:35:8b:8c:6c:7f:09:99:45:26:10:80:01:00:ff:05
+S->C
+[...] 32:c9:03:07:28:65:35:8b:8c:6c:7f:09:99:45:26:10:80:01:00:ff:05
+
+glider in NC2.2
+C->S
+[...] 32:4b:03:07:13:57:a9:88:89:af:86:c1:89:ec:81:64:82:01:00:ff:00
+S->C
+[...] 32:4b:03:07:98:57:c8:88:59:b0:83:5c:88:13:81:64:82:01:00:ff:00:
+[...] 32:4b:03:07:13:57:a9:88:89:af:86:c1:89:ec:81:64:82:01:00:ff:00:
+
+
+*/
+PMessage* PMsgBuilder::BuildTraderItemListMsg( PClient* nClient, uint32_t nTraderNpcID ) //, PContainer* nContainer)
+{
+//    PMessage* ContentList = BuildContainerContentList(nContainer, INV_LOC_BOX);
+// Tmp manual content list:
+    PMessage* ContentList = new PMessage();
+    float PriceCoef = 1 / 1.379942;
+    uint8_t Quality = 255; // Range 0 - 255
+
+    //Item 1:
+    *ContentList << ( uint16_t )0x05e6; // Item Id "Clan key for CityAdmin"
+    *ContentList << ( uint32_t )304567; // Base (?) Item price = item.def price / 1.97
+    // Displayed price is this price * 1.38 . Is this faction/barter factor ?
+    //Item 2:
+    *ContentList << ( uint16_t )0x05e7; // Item Id "Clan key for Diamond Real Estate"
+    *ContentList << ( uint32_t )( 420285 * PriceCoef );
+    //Item 3:
+    *ContentList << ( uint16_t )0x05e8; // Item Id "Clan key for N.E.X.T."
+    *ContentList << ( uint32_t )( 420285 * PriceCoef );
+    //Item 4:
+    *ContentList << ( uint16_t )0x060f; // Item Id "PLAZA - 2nd Lev. Apartment"
+    *ContentList << ( uint32_t )( 245166 * PriceCoef );
+    //Item 5:
+    *ContentList << ( uint16_t )0x065c; // Item Id "Normal Viarosso Apartment Alamo Living"
+    *ContentList << ( uint32_t )( 840571 * PriceCoef );
+    //Item 6:
+    *ContentList << ( uint16_t )0x065d; // Item Id "Luxus Viarosso Apartment Alamo Living"
+    *ContentList << ( uint32_t )( 1260856 * PriceCoef );
+
+    //Item 7:
+    *ContentList << ( uint16_t )355; // Item Id "HEW ï¿½Liquid Fire� Rifle"
+    *ContentList << ( uint32_t )( 1260856 * PriceCoef );
+
+    PMessage* tmpMsg = new PMessage();
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x26;
+    *tmpMsg << nTraderNpcID;
+    *tmpMsg << ( uint8_t )0x01; // Traders inventory
+    *tmpMsg << ( uint16_t )( ContentList->GetSize() / 6 ); // List entries
+    *tmpMsg << ( uint8_t )Quality; // Items quality
+    *tmpMsg << *ContentList;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    delete ContentList;
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildStartWeaponReloadMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 16 );
+    nClient->IncreaseUDP_ID();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint16_t )nClient->GetSessionID();
+    *tmpMsg << ( uint8_t )0x00; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x25; // cmd
+    *tmpMsg << ( uint8_t )0x16; // cmd
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildStartWeaponReloadAnimMsg( PClient* nClient )
+{
+    PMessage* tmpMsg = new PMessage( 13 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x00;  // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint8_t )0x15; // cmd
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildHeldItemUseMsg( uint16_t nUserCharLocalId, uint16_t nWeaponId, uint32_t nTargetRawItemID, uint8_t nAiming, uint8_t nTargetedHeight, uint8_t nScore )
+{
+    PMessage* tmpMsg = new PMessage( 22 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x00;  // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )nUserCharLocalId;
+    *tmpMsg << ( uint8_t )0x01; // cmd
+    *tmpMsg << ( uint16_t )nWeaponId;
+    *tmpMsg << ( uint32_t )nTargetRawItemID;
+    *tmpMsg << ( uint8_t )nAiming;
+    *tmpMsg << ( uint8_t )nTargetedHeight;
+    *tmpMsg << ( uint8_t )nScore;
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildHeldItemUse2Msg( uint16_t nUserCharLocalId, uint32_t nTargetRawItemID )
+{
+  PMessage* tmpMsg = new PMessage( 18 );
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+  *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+  *tmpMsg << ( uint8_t )0x00;  // Message length placeholder;
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nUserCharLocalId;
+  *tmpMsg << ( uint8_t )0x2c; // cmd
+  *tmpMsg << ( uint8_t )0x09; // cmd
+  *tmpMsg << ( uint32_t )nTargetRawItemID;
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+  return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildHeldItemUse3Msg(  PClient* nClient, uint16_t nUnknown1, uint16_t nUnknown2, uint16_t nUnknown3, uint16_t nUnknown4 )
+{
+  PMessage* tmpMsg = new PMessage( 22 );
+  nClient->IncreaseUDP_ID();
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint16_t )nClient->GetSessionID();
+  *tmpMsg << ( uint8_t )0x00; // Message length
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nClient->GetLocalID();
+  *tmpMsg << ( uint8_t )0x25; // cmd
+  *tmpMsg << ( uint8_t )0x1a; // cmd
+  *tmpMsg << ( uint16_t )nUnknown1;
+  *tmpMsg << ( uint16_t )nUnknown2;
+  *tmpMsg << ( uint16_t )nUnknown3;
+  *tmpMsg << ( uint16_t )nUnknown4;
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+  return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildHeldItemUse4Msg( uint16_t nUserCharLocalId, uint32_t nTargetRawItemID, uint16_t nUnknown1, uint16_t nUnknown2, uint8_t nTargetedHeight )
+{
+  PMessage* tmpMsg = new PMessage( 23 );
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+  *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+  *tmpMsg << ( uint8_t )0x00;  // Message length placeholder;
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nUserCharLocalId;
+  *tmpMsg << ( uint8_t )0x2c; // cmd
+  *tmpMsg << ( uint8_t )0x01; // cmd
+  *tmpMsg << ( uint16_t )nUnknown1;
+  *tmpMsg << ( uint16_t )nUnknown2;
+  *tmpMsg << ( uint32_t )nTargetRawItemID;
+  *tmpMsg << ( uint8_t )nTargetedHeight;
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+  return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildHeldItemAddonActivationMsg( PClient* nClient, uint8_t nState )
+{
+    PMessage* tmpMsg = new PMessage( 15 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x00;  // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint8_t )0x2f;
+    *tmpMsg << ( uint16_t )nClient->GetLocalID();
+    *tmpMsg << ( uint16_t )0x0001; // cmd ?
+    *tmpMsg << ( uint8_t )( 0x60 | nState );
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildWeatherControlMsg( uint16_t nWeatherId )
+{
+    PMessage* tmpMsg = new PMessage( 13 );
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x00;  // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint8_t )0x2e;
+    *tmpMsg << ( uint8_t )0x01; // cmd
+    *tmpMsg << ( uint16_t )nWeatherId; //see at bottom of weather.def
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseTimedDrugMsg( PClient* nClient, const PDefDrug* nDrugDef, uint16_t nItemId )
+{
+  PMessage* tmpMsg = new PMessage( 60 );
+  nClient->IncreaseUDP_ID();
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint16_t )nClient->GetSessionID();
+  *tmpMsg << ( uint8_t )0x00; // Message length
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nClient->GetLocalID();
+  *tmpMsg << ( uint8_t )0x25; // cmd
+  *tmpMsg << ( uint8_t )0x06; // cmd
+  *tmpMsg << ( uint8_t )nDrugDef->GetChangeNum();
+  *tmpMsg << ( uint8_t )0x01; // ??? not working if 0, no apparent change if > 1
+  *tmpMsg << ( uint16_t )nDrugDef->GetDuration();
+  *tmpMsg << ( uint16_t )nItemId;
+  for( uint8_t i = 0; i < nDrugDef->GetChangeNum(); ++i )
+  {
+    *tmpMsg << ( uint8_t )nDrugDef->GetChangeType( i );
+    *tmpMsg << ( uint16_t )( nDrugDef->GetChangeScale( i ) * 100 );
+    *tmpMsg << ( uint16_t )nDrugDef->GetChangeTarget( i );
+  }
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+  return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseInstantDrugMsg( PClient* nClient, const PDefDrug* nDrugDef )
+{
+  PMessage* tmpMsg = new PMessage( 60 );
+  nClient->IncreaseUDP_ID();
+
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint16_t )nClient->GetSessionID();
+  *tmpMsg << ( uint8_t )0x00; // Message length
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nClient->GetLocalID();
+  *tmpMsg << ( uint8_t )0x25; // cmd
+  *tmpMsg << ( uint8_t )0x07; // cmd
+  *tmpMsg << ( uint8_t )nDrugDef->GetChangeNum();
+  *tmpMsg << ( uint8_t )0x02; // ??? other values not tested
+  for( uint8_t i = 0; i < nDrugDef->GetChangeNum(); ++i )
+  {
+    *tmpMsg << ( uint8_t )nDrugDef->GetChangeType( i );
+    *tmpMsg << ( float )( nDrugDef->GetChangeScale( i ) * 100 ); // float in nc2.2 - uint16_t in nc1 ???
+    *tmpMsg << ( uint16_t )nDrugDef->GetChangeTarget( i );
+  }
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+  Console->Print( "%s PMsgBuilder::BuildCharUseInstantDrugMsg : data format not tested", Console->ColorText( YELLOW, BLACK, "[WARNING]" ) );
+
+  return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildCharUseRecreationUnitMsg( PClient* nClient, uint32_t nObjectId )
+{
+  PMessage* tmpMsg = new PMessage( 16 );
+  nClient->IncreaseUDP_ID();
+/*
+  *tmpMsg << ( uint8_t )0x13;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint16_t )nClient->GetSessionID();
+  *tmpMsg << ( uint8_t )0x00; // Message length
+  *tmpMsg << ( uint8_t )0x03;
+  *tmpMsg << ( uint16_t )nClient->GetUDP_ID();
+  *tmpMsg << ( uint8_t )0x1f;
+  *tmpMsg << ( uint16_t )nClient->GetLocalID();
+  *tmpMsg << ( uint8_t )0x25; // cmd
+  *tmpMsg << ( uint8_t )0x16; // cmd
+
+  ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+*/
+  Console->Print( "%s PMsgBuilder::BuildCharUseRecreationUnitMsg : not implemented (target: 0x%08x)", Console->ColorText( YELLOW, BLACK,"[WARNING]" ), nObjectId );
+  return tmpMsg;
+}
+
+// For testing - packet to be broadcasted to zone
+PMessage* PMsgBuilder::BuildNpcDeathMsg( PClient* nClient, uint32_t nNpcId, uint8_t unknown1, uint8_t unknown2 )
+{
+    PMessage* tmpMsg = new PMessage( 19 );
+    PChar *nChar = nClient->GetChar();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for UDP_ID;
+    *tmpMsg << ( uint16_t )0x0000; // placeholder for SessionID();
+
+    *tmpMsg << ( uint8_t )0x00;  // Message length placeholder;
+    *tmpMsg << ( uint8_t )0x1b;
+    *tmpMsg << ( uint32_t )nNpcId;
+    *tmpMsg << ( uint8_t )0x1f;
+    *tmpMsg << ( uint16_t )( nChar->Coords.mY + 768 + 30 ); //move Npc near to char :p
+    *tmpMsg << ( uint16_t )( nChar->Coords.mZ + 768 + 0 );
+    *tmpMsg << ( uint16_t )( nChar->Coords.mX + 768 + 30 );
+    *tmpMsg << ( uint8_t )2; // ??? 0x01=look at target, 0x02=?, 0x10 = kneel, 0x80 = die
+    *tmpMsg << ( uint8_t )1; //0=> dead on health 0 / else alive on health 0. Changes in caps
+    *tmpMsg << ( uint8_t )96; // health => 0 alive if prec >0 1-127 alive, <0 dead (ie uint8_t 128-255 = neg signed values)
+    *tmpMsg << ( uint16_t )259; // targetId (N)PC - Here: left copbot at NC entrance (zone 2008)
+    *tmpMsg << ( uint8_t )0x00; // ? doesn't seem to change in caps
+    *tmpMsg << ( uint8_t )0x00; // ? doesn't seem to change in caps
+    *tmpMsg << ( uint8_t )0; // ? changes in caps
+    *tmpMsg << ( uint8_t )0; // ? changes in caps // moving speed somewhere ?
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    unknown2 = unknown1; // so that gcc doesn't complain if these vars are not used
+    return tmpMsg;
+}
+
+PMessage* PMsgBuilder::BuildNpcCleanupMsg( uint32_t nNpcId, uint8_t nCmd )
+{
+    PMessage* tmpMsg = new PMessage();
+
+    *tmpMsg << ( uint8_t )0x13;
+    *tmpMsg << ( uint16_t )0x0000;
+    *tmpMsg << ( uint16_t )0x0000;
+    *tmpMsg << ( uint8_t )0x00; // Message length
+    *tmpMsg << ( uint8_t )0x03;
+    *tmpMsg << ( uint16_t )0x0000;
+    *tmpMsg << ( uint8_t )0x2d;
+    *tmpMsg << ( uint32_t )nNpcId;
+    *tmpMsg << ( uint8_t )nCmd; // 6: npc/vhc "cleanup", 1: kill npc + msg "no reward, too small"
+
+    ( *tmpMsg )[5] = ( uint8_t )( tmpMsg->GetSize() - 6 );
+
+    return tmpMsg;
+ }\r
\r
+
+/*
+void Cmd_GiveItem (int ItemId, int Amount, int ClientNum)
+{
+ unsigned char SendBuffer[256];
+
+// Inventory_AddNewItem (&Client_Sockets[ClientNum].CharInfo, ItemId, Amount);
+ SendBuffer[0] = 0x13;
+ SendBuffer[5] = 0x1b;
+ SendBuffer[6] = 0x03;
+ Network_IncrementUDP (ClientNum);
+ *(unsigned short*)&SendBuffer[7] = Client_Sockets[ClientNum].UDP_ID;
+ SendBuffer[9] = 0x1f;
+ *(unsigned short*)&SendBuffer[10] = Client_Sockets[ClientNum].CharInfo.MapID;
+ SendBuffer[12] = 0x25;
+ SendBuffer[13] = 0x13;
+ Client_Sockets[ClientNum].TransactionID++;
+ *(unsigned short*)&SendBuffer[14] = Client_Sockets[ClientNum].TransactionID;//Transaction ID
+ SendBuffer[16] = 0x18;
+ SendBuffer[17] = 0x03; //Location
+ SendBuffer[18] = 0xff; // \/
+ SendBuffer[19] = 0xff; //Anywhere
+ SendBuffer[20] = 0x08;
+ SendBuffer[21] = 0x00;
+ *(unsigned short*)&SendBuffer[22] = ItemId; //Item Id
+ SendBuffer[24] = 0x05;
+ SendBuffer[25] = 0x01;
+ *(unsigned short*)&SendBuffer[26] = Amount; //Quantity
+ SendBuffer[28] = 0x00;
+ SendBuffer[29] = 0x00;
+ *(unsigned short*)&SendBuffer[30] = Client_Sockets[ClientNum].CharInfo.ItemTransactionID; //Id of Purchased Item (Client sends another packet for placement of new item)
+
+ *(unsigned short*)&SendBuffer[1] = Client_Sockets[ClientNum].UDP_ID;
+ *(unsigned short*)&SendBuffer[3] = Client_Sockets[ClientNum].UDP_ID_HIGH;
+
+ Network_SendUDP (SendBuffer, 32, ClientNum);
+}
+*/
+
+/* Unkown use packets (from nc2.2)
+13:81:00:81:e2: 0c: 03:81:00:23: 12:00: 07:00:00:00:00:00 // weather related ?
+
+13:56:00:56:e2: 40: 03:56:00:1f:01:00:25:13: f1:18:13:01:77:05:48:c7: f2:18:13:02:16:74:61:c7: f3:18:13:03:17:74:61:c7: f4:18:13:04:18:74:61:c7: f5:18:13:05:1f:2a:60:c7: f6:18:13:06:1f:2a:60:c7: f7:18:13:0b:3e:8f:6d:c7
+
+13:5c:00:5c:e2: 0c: 03:5c:00:1f:01:00:25:13: f8:18:0e:02
+
+13:xx:xx:xx:xx: 09: 03:68:00:2d: 6d:03:00:00: 06 // Action update ? other NPC update ? some vanish ?
+*/
diff --git a/TinNS/Source/GameServer/MessageBuilder.hxx b/TinNS/Source/GameServer/MessageBuilder.hxx
new file mode 100644 (file)
index 0000000..df307f5
--- /dev/null
@@ -0,0 +1,147 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include <vector>
+
+class PClient;
+class PDefDrug;
+class PMessage;
+class PContainerEntry;
+class PContainer;
+class PSpawnedVehicle;
+
+class PMsgBuilder {
+public:
+    PMsgBuilder() {};
+    ~PMsgBuilder() {};
+
+// Following methods for broadcasted messages do NOT include UDP_ID increment
+// when needed, nor UDP_ID / SessionID setting
+// as these must be set on a destination client basis
+    PMessage* BuildCharHelloMsg( PClient* nClient );
+    PMessage* BuildCharHealthUpdateMsg( PClient* nClient );
+    PMessage* BuildCharDeathMsg( PClient* nClient, uint32_t nKillerCharId = 0 );
+    PMessage* BuildCharPosUpdateMsg( PClient* nClient );
+    PMessage* BuildCharPosUpdate2Msg( PClient* nClient, uint8_t InfoBitfield = 0x7f );
+    //PMessage* BuildCharSittingMsg( PClient* nClient ); // Not used anymore, done by BuildCharPosUpdateMsg
+    PMessage* BuildCharExitSeatMsg( PClient* nClient );
+    PMessage* BuildDoorOpenMsg( uint32_t nRawItemID, bool nDoubleDoor = false );
+    PMessage* BuildCharUseSeatMsg( PClient* nClient, uint32_t nRawObjectId, uint8_t nSeatId = 0 );
+    PMessage* BuildCharShowGlowCircleMsg( PClient* nClient );
+
+    PMessage* BuildSpawnWorldObjectMsg( uint16_t nModelID, uint16_t nFunctionID, uint32_t nWOID, uint16_t nPosX, uint16_t nPosY, uint16_t nPosZ, uint8_t nRotX, uint8_t nRotY, uint8_t nRotZ );
+    PMessage* BuildRemoveWorldObjectMsg( uint32_t nWOID );
+    PMessage* BuildWeatherControlMsg( uint16_t nWeatherId );
+
+    PMessage* BuildSubwaySingleUpdateMsg( uint32_t nVehicleID, uint16_t nPosition, uint8_t nDoorOpened );
+    PMessage* BuildVhcHealthUpdateMsg( PSpawnedVehicle* nVehicle );
+    PMessage* BuildVhcPosUpdateMsg( PSpawnedVehicle* nVehicle );
+    PMessage* BuildVhcPosUpdate2Msg( PSpawnedVehicle* nVehicle );
+
+    PMessage* BuildStartWeaponReloadAnimMsg( PClient* nClient );
+    PMessage* BuildHeldItemUseMsg( uint16_t nUserCharLocalId, uint16_t nWeaponId, uint32_t nTargetRawItemID, uint8_t nAiming, uint8_t nTargetedHeight, uint8_t nScore = 0 );
+    PMessage* BuildHeldItemUse2Msg( uint16_t nUserCharLocalId, uint32_t nTargetRawItemID );
+    PMessage* BuildHeldItemUse4Msg( uint16_t nUserCharLocalId, uint32_t nTargetRawItemID, uint16_t nUnknown1, uint16_t nUnknown2, uint8_t nTargetedHeight );
+    PMessage* BuildHeldItemAddonActivationMsg( PClient* nClient, uint8_t nState );
+
+    // Temp. NPC update message for testing
+    PMessage* BuildNpcDeathMsg( PClient* nClient, uint32_t nNpcId, uint8_t unknown1 = 0x4a, uint8_t npcAction = 0x1e );
+
+    PMessage* BuildNPCMassInfoMsg( uint32_t nWorldID, uint16_t nTypeID, uint16_t nClothing, uint16_t nNameID, uint16_t nPosY, uint16_t nPosZ, uint16_t nPosX, uint16_t nHealth, uint16_t nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName);\r
+    PMessage* BuildNPCMassAliveMsg( uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint8_t nAction );\r
+    PMessage* BuildNPCMassUpdateMsg( uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint16_t nTarget, uint8_t nAction );\r
+    // Moved here since its a zone broadcast!\r
+    PMessage* BuildNpcCleanupMsg( uint32_t nNpcId, uint8_t nCmd = 6 ); // see implementation about nCmd\r
+
+// Following methods for unicast messages DO include UDP_ID increment and
+// UDP_ID / SessionID setting when needed (at least for now)
+    PMessage* BuildOutpostClanInfoMsg( PClient* nClient, uint32_t nClanID, uint8_t nFaction );\r
+    PMessage* BuildTryAccessAnswerMsg(PClient* nClient, char *nArea, bool nAllowed);\r
+    PMessage* BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nResultBuffer, std::string* nCommandName, uint16_t nNumRows, uint16_t nNumFields);\r
+    PMessage* BuildYouGotEmailsMsg( PClient* nClient, uint8_t nMailCount );\r
\r
+    PMessage* BuildNPCStartDialogMsg( PClient* nClient, uint32_t nNPCWorldID, std::string *nDialogScript  );\r
+    PMessage* BuildNPCDialogReplyMsg( PClient* nClient, uint16_t nNextNode, std::vector<int>*nResultBuffer);\r
+    PMessage* BuildReqNPCScriptAnswerMsg( uint32_t nInfoId, std::string *nNPCScript );\r
+    PMessage* BuildNPCShoppingListMsg( PClient* nClient, PMessage* nContentList, int nWorldID, uint8_t nItemQuality);\r
+    PMessage* BuildNPCBeginAllBuyerTradeMsg( PClient* nClient, int nWorldID );\r
\r
+    PMessage* BuildNPCSingleInfoMsg( PClient* nClient, uint32_t nWorldID, uint16_t nTypeID, uint16_t nClothing, uint16_t nNameID, uint16_t nPosY, uint16_t nPosZ, uint16_t nPosX, uint16_t nHealth, uint16_t nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName);\r
+    PMessage* BuildNPCSingleAliveMsg( PClient* nClient, uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint8_t nAction );\r
+    PMessage* BuildNPCSingleUpdateMsg( PClient* nClient, uint32_t nWorldID, uint16_t nX, uint16_t nY, uint16_t nZ, uint8_t nActionStatus, uint8_t nHealth, uint16_t nTarget, uint8_t nAction );\r
\r
+    // NEW for testing. Combined update message\r
+    PMessage* BuildNPCUpdateMsg(uint32_t nWorldID, uint16_t nPosY, uint16_t nPosZ, uint16_t nPosX, uint8_t nActionBM, uint16_t nHealth, uint8_t nWeaponState, uint8_t nUnknown, uint32_t nTargetID = 0);\r
\r
+    PMessage* BuildReqInfoAnswerMsg( PClient* nClient, uint16_t nReqType, uint32_t nInfoId, void* nResponse, uint16_t nResponseLength );
+
+    PMessage* BuildPacket0Msg( PClient* nClient );
+    PMessage* BuildPingMsg( PClient* nClient, uint32_t nClientTime );
+    PMessage* BuildBaselineMsg( PClient* nClient );
+    PMessage* BuildAliveRepMsg( PClient* nClient );
+
+    PMessage* BuildZoning1Msg( PClient* nClient, uint16_t nEntity, uint8_t nUnknown = 0 );
+    PMessage* BuildZoningTCPReadyMsg();
+    PMessage* BuildSendZoneTCPMsg( uint32_t nLocation, std::string* nWorldName );
+    PMessage* BuildZoning2Msg( PClient* nClient, uint32_t nClientTime );
+    PMessage* BuildGenrepZoningMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity );
+
+    PMessage* BuildGenrepAddToListMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity );
+
+    PMessage* BuildAptLiftUseMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity, uint8_t nEntityType = 0 );
+    PMessage* BuildAptLiftFailedMsg( PClient* nClient );
+    PMessage* BuildChangeLocationMsg( PClient* nClient, uint32_t nLocation, uint16_t nEntity, uint8_t nEntityType = 0, uint32_t nRawItemID = 0 );
+    PMessage* BuildEntityPositionMsg( PClient* nClient, uint16_t pX, uint16_t pY, uint16_t pZ );
+
+    PMessage* BuildCharAptLocInfoMsg( PClient* nClient );
+
+    PMessage* BuildLevelUpMessage( PClient* nClient, uint8_t nMainSkill, uint8_t nNewLevel, uint16_t nFreeSkillPoints);
+    PMessage* BuildSubskillIncMsg( PClient* nClient, uint8_t nSubskill, uint16_t nSkillPoints );
+    PMessage* BuildChatAddMsg( PClient* nClient, uint32_t nAddedCharID, uint8_t nMode ); // mode = 1 for Direct, 2 for Buddy
+
+    PMessage* BuildText100Msg( PClient* nClient, uint8_t nTxtMsgId, uint32_t nRawObjectID );
+    PMessage* BuildTextIniMsg( PClient* nClient, uint8_t nTxtGroupID, uint16_t nTxtID );
+
+    PMessage* BuildCharInteractionMenuMsg( PClient* nClient, uint32_t nRawTargetID );
+
+    PMessage* BuildFurnitureActivateMsg( PClient* nClient, uint32_t nRawObjectID, uint8_t nActionValue );
+    PMessage* BuildCharUseFurnitureMsg( PClient* nClient, uint32_t nRawObjectID );
+    PMessage* BuildCharUseVhcTerminalMsg( PClient* nClient, uint32_t nRawObjectID );
+    PMessage* BuildCharUseGogoMsg( PClient* nClient );
+    PMessage* BuildCharUseVentureWarpMsg( PClient* nClient, uint32_t nRawObjectID );
+    PMessage* BuildVhcAccessRequestMsg (PClient* nClient, uint32_t nRequestId, uint32_t nRequesterCharId, uint32_t nRequesterLocalId, uint32_t nVhcRawObjectID );
+    PMessage* BuildCharUseGenrepMsg( PClient* nClient, uint32_t nRawObjectID, uint32_t nLocation, uint16_t nEntity );
+    PMessage* BuildCharUseLiftMsg( PClient* nClient, uint32_t nRawObjectID, uint16_t nAptPlace );
+    PMessage* BuildCharUseVhcMsg( PClient* nClient, uint32_t nRawObjectID, uint16_t nVhcType, uint16_t nAvailableSeats );
+
+    PMessage* BuildCharMoneyUpdateMsg( PClient* nClient, uint32_t nCredits );
+    PMessage* BuildUndefineduseMsg( PClient* nClient, uint8_t nValue );
+    PMessage* BuildCharUseQBSlotMsg2( PClient* nClient, uint16_t nV1 = 100, uint16_t nV2 = 100, uint16_t nV3 = 100, uint16_t nV4 = 100, uint16_t nV5 = 100, uint16_t nV6 = 100, uint16_t nV7 = 0 );
+    PMessage* BuildCharUseQBSlotMsg3( PClient* nClient, uint8_t nSlot );
+    PMessage* BuildCharUseQBSlotMsg4( PClient* nClient, uint16_t nWeaponId );
+    PMessage* BuildContainerContentList( PContainer* nContainer, uint8_t nLocType );
+    PMessage* BuildContainerContentEntry( PContainerEntry* nEntry, uint8_t nLocType );
+
+    PMessage* BuildCharOpenContainerMsg( PClient* nClient, uint32_t nContainerID, PContainer* nContainer );
+    PMessage* BuildItemMoveMsg( PClient* nClient, uint8_t nSource, uint8_t nSrcX, uint8_t nSrcY, uint8_t nDestination, uint8_t nDestX, uint8_t nDestY, uint8_t nItemCnt );
+    PMessage* BuildBoxItemMoveMsg( PClient* nClient, PContainerEntry* nEntry, uint8_t nSrcX, uint8_t nSrcY, uint8_t nDestination, uint8_t nDestX, uint8_t nDestY, uint8_t nItemCnt );
+    PMessage* BuildStartWeaponReloadMsg( PClient* nClient );
+
+    PMessage* BuildStartHackGameMsg( PClient* nClient, uint32_t nWorldObjID, uint8_t nHackDifficult );
+
+    PMessage* BuildSubwaySpawnMsg( PClient* nClient, bool IsSecondMessage );
+    //PMessage* BuildSubwayFullUpdateMsg(PClient* nClient);
+    PMessage* BuildVhcInfoMsg( PClient* nClient, PSpawnedVehicle* nVehicle );
+
+    PMessage* BuildDBRequestStatusMsg( PClient* nClient, std::string* nCommandName, uint8_t nStatus, uint16_t nErrCode );
+    PMessage* BuildDBAnswerMsg( PClient* nClient, std::string* nCommandName, std::string* nAnswerData, uint16_t nRows, uint16_t nCols );
+
+    PMessage* BuildTraderItemListMsg( PClient* nClient, uint32_t nTraderNpcID );
+
+    PMessage* BuildHeldItemUse3Msg(  PClient* nClient, uint16_t nUnknown1, uint16_t nUnknown2, uint16_t nUnknown3, uint16_t nUnknown4  );
+
+    PMessage* BuildCharUseTimedDrugMsg( PClient* nClient, const PDefDrug* nDrugDef, uint16_t nItemId );
+    PMessage* BuildCharUseInstantDrugMsg( PClient* nClient, const PDefDrug* nDrugDef );
+    PMessage* BuildCharUseRecreationUnitMsg( PClient* nClient, uint32_t nObjectId );
+};
similarity index 82%
rename from server/src/game/multipart.cpp
rename to TinNS/Source/GameServer/MultiPart.cxx
index c5732ad..a3b23f7 100644 (file)
@@ -1,34 +1,5 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.
-*/
-
-/*
- multipart.cpp - Handling of incomming multipart messages
-
- CREATION: 31 Aug 2006 Hammag
-
- MODIFIED:
- REASON: -
-*/
-
-#include "main.h"
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 PMultiPart::PMultiPart()
 {
@@ -39,7 +10,7 @@ PMultiPart::~PMultiPart()
 
 }
 
-void PMultiPart::AssembleChunk(u16 nSequence)
+void PMultiPart::AssembleChunk(uint16_t nSequence)
 {
     // Get the sequence number
     PMultipartMap::iterator it;
@@ -87,7 +58,7 @@ void PMultiPart::AssembleChunk(u16 nSequence)
     it->second.smTimeStamp = 0;
     //tmpMsg->Dump();
 
-    // Note: At this point, the reassembled message should be pushed back to the messagedecoder. But since the size of the packets there is always u8
+    // Note: At this point, the reassembled message should be pushed back to the messagedecoder. But since the size of the packets there is always uint8_t
     // it wont work with these oversized packets.
     // I decided to process the Assembled packet right here, since the only function in clients known to send oversized frames is UpdateDB
     ProcessPacket(it->second.smClient, tmpMsg);
@@ -102,15 +73,15 @@ void PMultiPart::ProcessPacket(PClient *nClient, PMessage *tmpMsg)
     mDBId = 0;
 
     // Make sure we have an UpdateDB call, otherwise break and error
-    u8 MsgSubType = tmpMsg->U8Data(0);
-    u8 TerminalAction = tmpMsg->U8Data(1);
+    uint8_t MsgSubType = tmpMsg->U8Data(0);
+    uint8_t TerminalAction = tmpMsg->U8Data(1);
     if(MsgSubType != 0x21 || TerminalAction != 0x18)
     {
         Console->Print("%s [PMultiPart::ProcessPacket] Unsupportet multipart message. Type %02x", Console->ColorText(RED, BLACK, "ERROR"), MsgSubType);
         return;
     }
 
-    u16 tCmdLen, Unknown3, OptionSize;
+    uint16_t tCmdLen, Unknown3, OptionSize;
 
     tmpMsg->SetNextByteOffset( 14 );
     ( *tmpMsg ) >> tCmdLen;
@@ -136,7 +107,7 @@ void PMultiPart::ProcessPacket(PClient *nClient, PMessage *tmpMsg)
     {
         Console->Print( "%s Fragmented UpdateDB request from client; DBID: %d", Console->ColorText( YELLOW, BLACK, "[DEBUG]" ), mDBId );
         Console->Print( "%s Command: '%s'", Console->ColorText( YELLOW, BLACK, "[DEBUG]" ), mCommandName.c_str() );
-        for ( u8 i = 0; i < mOptionsCount; ++i )
+        for ( uint8_t i = 0; i < mOptionsCount; ++i )
             Console->Print( "%s Option %d: '%s'", Console->ColorText( YELLOW, BLACK, "[DEBUG]" ), i, mOptions[i].c_str() );
     }*/
     Terminal->HandleUpdateDB(nClient, 0, &mCommandName, mOptions, mOptionsCount, mDBId, 0);
@@ -163,7 +134,7 @@ void PMultiPart::Update()
 }
 
 // Adds an multipart frame
-void PMultiPart::AddMultiPartChunk(PClient *nClient, PMessage *nChunk, u16 nChunkNumber, u16 nChunkTotal, u8 nSequence)
+void PMultiPart::AddMultiPartChunk(PClient *nClient, PMessage *nChunk, uint16_t nChunkNumber, uint16_t nChunkTotal, uint8_t nSequence)
 {
     // Search for Sequence ID in our map
     PMultipartMap::iterator it;
diff --git a/TinNS/Source/GameServer/MultiPart.hxx b/TinNS/Source/GameServer/MultiPart.hxx
new file mode 100644 (file)
index 0000000..ef9bd29
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <cstdint>
+#include <map>
+#include <vector>
+
+#define MAX_SEQUENCE_LIFE   10 // In seconds
+
+typedef struct // A single chunk of any multipart sequence
+{
+    uint16_t smChunkNr;
+    //uint16_t smChunkTotal;
+    PMessage* smChunk;
+} s_MessageChunk;
+
+typedef std::vector<s_MessageChunk> vecMsgChunk; // The vector of an specific multipart sequence, containing all chunks
+typedef struct
+{
+    time_t smTimeStamp;      // To keep track of sequence's lifetimer
+    uint16_t smChunkTotal;       // Total amount of chunks for this sequence
+    vecMsgChunk smvChunk;       // The chunkvector
+    PClient *smClient;      // Required to call terminal class
+} s_SequenceEntry;
+
+typedef std::map<uint8_t, s_SequenceEntry> PMultipartMap; // Map of all vectors, indexed by sequencenumber <uint8_t>
+
+
+class PMultiPart
+{
+  private:
+    PMultipartMap MsgMap;
+    void AssembleChunk(uint16_t nSequence);
+    void ProcessPacket(PClient *nClient, PMessage *tmpMsg);
+
+// Required to process packets here
+    static const uint8_t mMaxOptions = 7;
+    std::string mCommandName;
+    std::string mOptions[mMaxOptions];
+    uint8_t mOptionsCount;
+    uint16_t mDBId;
+// ---------------------------------
+
+  public:
+    PMultiPart();
+    ~PMultiPart();
+
+    void Update(); // Check for complete/timed out sequences
+    // Adds an multipart frame
+    void AddMultiPartChunk(PClient *nClient, PMessage *nChunk, uint16_t nChunkNumber, uint16_t nChunkTotal, uint8_t nSequence);
+};
similarity index 91%
rename from server/src/game/npc.cpp
rename to TinNS/Source/GameServer/Npc.cxx
index f78a897..bf585b9 100644 (file)
@@ -1,45 +1,15 @@
- /*
-TinNS (TinNS is not a Neocron Server)
-Copyright (C) 2005 Linux Addicted Community
-maintainer Akiko <akiko@gmx.org>
-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 "include/npc.h"
-#include "include/worlds.h"
-#include "include/npctemplate.h"
-#include "include/worlddatatemplate.h"\r
-#include "include/msgbuilder.h"\r
- ///***********************************************************************
-\r
-// Reload LUA script while running, in case we modified it and dont want to restart the entire server\r
+#include <algorithm>
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "Common/Includes.hxx"
+
+void PNPC::PushUpdateTimer()
+{
+    mNextUpdate = std::time(nullptr) + GetRandom(NPC_HEARTBEAT_MAX, NPC_HEARTBEAT_MIN);
+};
+
+// Reload LUA script while running, in case we modified it and dont want to restart the entire server
 bool PNPC::ReloadLUAScript()\r
 {\r
     // Erase current LUA script\r
@@ -48,26 +18,26 @@ bool PNPC::ReloadLUAScript()
     // Reload it\r
     return LoadLUAScript();\r
 }\r
-bool PNPC::DEF_Load(u32 nWorldID)
+
+bool PNPC::DEF_Load(uint32_t 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??\r
+
+    mNameID = (uint16_t)t_defNPC->GetNPCTypeID(); // 16 or 32??\r
     const PDefNpc* t_NpcTypeDef = GameDefs->Npcs()->GetDef(mNameID);\r
     if(!t_NpcTypeDef)\r
     {\r
         Console->Print("%s [PNPC::DEF_Load()] Unknown NPC Type %d in .dat file found", Console->ColorText(RED,BLACK, "[Error]"), mNameID);\r
         return false;\r
     }
+
     // TODO: Find out what exactly these TypeID and ClothingID values do and where they are generated/read\r
     // 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 +49,7 @@ bool PNPC::DEF_Load(u32 nWorldID)
     mFaction = t_NpcTypeDef->GetFaction();
     // WorldID Fix 10.10.2009
     mFromDEF = true;
+
     mName = t_defNPC->GetActorName();
 \r
 \r
@@ -201,7 +171,7 @@ bool PNPC::SQL_Load()
 \r
 bool PNPC::LoadLUAScript()\r
 {\r
-    u32 tFileLen = 0;\r
+    uint32_t tFileLen = 0;\r
     PFile* fLua = NULL;\r
     std::string tLuaFile = "";\r
     std::string tHDRFile = "";\r
@@ -329,7 +299,7 @@ bool PNPC::LoadLUAScript()
         return false;\r
     }\r
 }\r
+
  void PNPC::Die()
  {
     if ( gDevDebug ) Console->Print( "[DEBUG] NPC dying now" );
@@ -338,7 +308,7 @@ bool PNPC::LoadLUAScript()
     mRespawn = std::time( NULL ) + NPC_RESPAWN_AFTER;
     mDirty = true;
  }
+
  void PNPC::Update()
 {\r
     // Has to be changed for mobs later
@@ -388,7 +358,7 @@ void PNPC::InitVars()
     mNextUpdate = std::time(NULL) + GetRandom(30, 10);
  }
 \r
-void PNPC::Attack( u32 nWorldID, u8 nType, u8 nUnknown )\r
+void PNPC::Attack( uint32_t nWorldID, uint8_t nType, uint8_t nUnknown )\r
 {\r
     mDirty = true;\r
     mTarget = nWorldID;\r
@@ -396,7 +366,7 @@ void PNPC::Attack( u32 nWorldID, u8 nType, u8 nUnknown )
     mWeaponStatus = nType;\r
     mUnknown = nUnknown;\r
 }\r
+
  PNPC::PNPC( int nSQLID )
  {
     InitVars();
@@ -407,8 +377,8 @@ void PNPC::Attack( u32 nWorldID, u8 nType, u8 nUnknown )
     else
         mSuccess = true;
 }
-PNPC::PNPC( int nDEFID, u32 nWorldID )
+
+PNPC::PNPC( int nDEFID, uint32_t nWorldID )
 {
     InitVars();
 //if(gDevDebug) Console->Print("[DEBUG] New NPC instance created. ID is %d", nSQLID);
@@ -418,13 +388,13 @@ PNPC::PNPC( int nDEFID, u32 nWorldID )
     else
         mSuccess = true;
  }
+
  PNPC::~PNPC()
  {
 //if(gDevDebug) Console->Print("[DEBUG] NPC ID %d terminated", mID);
  }
 /*
- u8 PNPC::GetActionStatus()
+ uint8_t PNPC::GetActionStatus()
  {
     if ( mDeath == true )
     {
@@ -451,7 +421,7 @@ void PNPCWorld::BroadcastNewNPC(PNPC* nNpc)
 }\r
 \r
 \r
-bool PNPCWorld::AddNPC(u32 nSQL_ID, u32 nRaw_ID)\r
+bool PNPCWorld::AddNPC(uint32_t nSQL_ID, uint32_t nRaw_ID)\r
 {\r
     PNPC* tmpNpc = new PNPC( nSQL_ID );\r
     if(tmpNpc->mSuccess == true)\r
@@ -472,7 +442,7 @@ bool PNPCWorld::AddNPC(u32 nSQL_ID, u32 nRaw_ID)
     return true;\r
 }\r
 \r
-void PNPCWorld::DelNPC(u32 nWorldID)\r
+void PNPCWorld::DelNPC(uint32_t nWorldID)\r
 {\r
     PNPCMap::iterator it = mNPCs.find( nWorldID );\r
     if ( it == mNPCs.end() )\r
@@ -498,7 +468,7 @@ void PNPCWorld::SendSingleNPCInfo( PClient* nClient, PNPC* nNpc )
     nClient->SendUDPMessage( tmpMsg );\r
     return;\r
 }\r
+
  void PNPCWorld::MSG_SendNPCs( PClient* nClient )
 {\r
     PNPC* nNpc = NULL;\r
@@ -523,7 +493,7 @@ bool PNPCWorld::LoadNPCfromSQL()
     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 );
@@ -543,7 +513,7 @@ bool PNPCWorld::LoadNPCfromSQL()
      }
 //if(gDevDebug) Console->Print("[DEBUG] Found NPCs, now adding!");
     PNPC* tmpNpc = NULL;
-    u32 tRawID = 0;
+    uint32_t tRawID = 0;
     int tSQLID = 0;
     while (( row = mysql_fetch_row( result ) ) )
      {
@@ -566,14 +536,14 @@ bool PNPCWorld::LoadNPCfromSQL()
     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;
+    uint32_t tDEFID = 0;
+
     for ( PNPCsMap::const_iterator i = tNPCmap->begin(); i != tNPCmap->end(); i++ )
      {
 // call PNPC with NPC ID and WorldID
@@ -592,11 +562,11 @@ bool PNPCWorld::LoadNPCfromDEF()
     if ( gDevDebug ) Console->Print( "[DEBUG] NPC Load from .def done" );
     return true;
  }
- PNPCWorld::PNPCWorld( u32 nWorldID )
+
+ PNPCWorld::PNPCWorld( uint32_t 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;
@@ -604,7 +574,7 @@ bool PNPCWorld::LoadNPCfromDEF()
     LoadNPCfromSQL();
     LoadNPCfromDEF();
  }
+
  PNPCWorld::~PNPCWorld()
  {
     if ( gDevDebug ) Console->Print( "[DEBUG] Erasing all NPCs" );
@@ -697,7 +667,7 @@ void PNPCWorld::Update()
     return;\r
 }
 */\r
- PNPC* PNPCWorld::GetNPC( u32 nNPCID )
+ PNPC* PNPCWorld::GetNPC( uint32_t nNPCID )
  {
     if ( gDevDebug ) Console->Print( "[DEBUG] Searching for NPC %d in list", nNPCID );
     PNPCMap::const_iterator it = mNPCs.find( nNPCID );
@@ -706,15 +676,15 @@ void PNPCWorld::Update()
     else
         return it->second;
  }
+
  ///***********************************************************************
+
  PNPCManager::PNPCManager()
  {
     if ( gDevDebug ) Console->Print( "[DEBUG] NPCManager wakeup!" );
 // Nothing yet
  }
+
  PNPCManager::~PNPCManager()
  {
     if ( gDevDebug ) Console->Print( "[DEBUG] NPCManager shutdown" );
@@ -724,16 +694,16 @@ void PNPCWorld::Update()
         mWorlds.erase( it );
     }
  }
+
  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();
+    uint32_t 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" );
@@ -756,8 +726,8 @@ void PNPCWorld::Update()
         //tmpWorld->MSG_SendAlive( nClient ); // Force instand-update of NPCs for this client
     }
  }
- PNPCWorld* PNPCManager::InitWorld( u32 nWorldID )
+
+ PNPCWorld* PNPCManager::InitWorld( uint32_t nWorldID )
  {
     if ( gDevDebug ) Console->Print( "[DEBUG] InitWorld triggered: ID %d", nWorldID );
     PNPCWorld* tmpWorld = NULL;
@@ -775,14 +745,14 @@ void PNPCWorld::Update()
         return NULL;
     }
  }
+
  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...");
+
     for ( PNPCWorldMap::iterator it = mWorlds.begin(); it != mWorlds.end(); it++ )
      {
 // Make sure target still exists
@@ -801,7 +771,7 @@ void PNPCWorld::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))
                 {
@@ -826,8 +796,8 @@ void PNPCWorld::Update()
 //if(gDevDebug) Console->Print("[DEBUG] next updateloopmsg in 3 seconds");
     }
  }
- PNPCWorld* PNPCManager::GetWorld( u32 nWorldID )
+
+ PNPCWorld* PNPCManager::GetWorld( uint32_t nWorldID )
  {
     if ( gDevDebug ) Console->Print( "[DEBUG] Trying to get instance for worldid %d", nWorldID );
     PNPCWorldMap::const_iterator it = mWorlds.find( nWorldID );
similarity index 59%
rename from server/src/game/include/npc.h
rename to TinNS/Source/GameServer/Npc.hxx
index 1f254c3..30835d2 100644 (file)
@@ -1,38 +1,11 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
+#pragma once
 
- 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 <chrono>
+#include <cstdint>
+#include <map>
+#include <vector>
+#include <string>
 
- 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.h - Management class for NPC worldactors
-
- CREATION: 04 Jan 2007 Namikon
-
- MODIFIED: 28 Apr 2009 Hammag
- REASON: changed worlds Id from u16 (wrong !!!) to u32
-
-*/
-
-#ifndef NPC_H
-#define NPC_H
\r
 // Healthfactor for NPCs (see old npc.def)\r
 #define NPC_HEALTHFACTOR 15\r
  \r
 class PNPC;
 class PNPCWorld;
 
-typedef std::map<u32, PNPC*> PNPCMap;
-typedef std::map<u32, PNPCWorld*> PNPCWorldMap;
+typedef std::map<uint32_t, PNPC*> PNPCMap;
+typedef std::map<uint32_t, PNPCWorld*> PNPCWorldMap;
  \r
 typedef struct
 {
-       u16 ItemID;\r
-       u32 Price;
+    uint16_t ItemID;\r
+    uint32_t Price;
 } stShopListEntry;
  \r
 class PNPC
@@ -113,31 +86,31 @@ private:
         npc_scripting
     };
  \r
-    std::time_t mNextUpdate;    // Timestamp for next heartbeat\r
-    std::time_t mNextEnemyCheck; // Timestamp for next enemycheck\r
-    inline void PushUpdateTimer() { mNextUpdate = std::time(NULL) + GetRandom(NPC_HEARTBEAT_MAX, NPC_HEARTBEAT_MIN); };\r
+    time_t mNextUpdate;    // Timestamp for next heartbeat\r
+    time_t mNextEnemyCheck; // Timestamp for next enemycheck\r
+    void PushUpdateTimer();
 
     // SQL values
-    u32 mID;
-    u32 mWorldID;
-    u16 mNameID;
-    u16 mTypeID;
-    u16 mClothing;
-    u16 mPosX;
-    u16 mPosY;
-    u16 mPosZ;
-    s8 mAngle;
-    u16 mLoot;
-    u16 mTrader;\r
-    u8 mItemQuality; // Used for Shopping stuff\r
-    u8 mUnknown;\r
+    uint32_t mID;
+    uint32_t mWorldID;
+    uint16_t mNameID;
+    uint16_t mTypeID;
+    uint16_t mClothing;
+    uint16_t mPosX;
+    uint16_t mPosY;
+    uint16_t mPosZ;
+    int8_t mAngle;
+    uint16_t mLoot;
+    uint16_t mTrader;\r
+    uint8_t mItemQuality; // Used for Shopping stuff\r
+    uint8_t mUnknown;\r
  \r
     std::string mDialogScript;\r
     std::string mLUAFile; // Load File; Preloaded uppon NPC creation\r
  \r
     std::vector<stShopListEntry> mVectItemsInShop;    // We need to keep track of the itemorder for shopping\r
-    void AddToVectorList(u16 nItemID, u32 nPrice);\r
-    inline const stShopListEntry* GetItemNum(u32 nIdx) const { if(nIdx > mVectItemsInShop.size()) { return NULL; } else { return &mVectItemsInShop[nIdx]; }};\r
+    void AddToVectorList(uint16_t nItemID, uint32_t nPrice);\r
+    inline const stShopListEntry* GetItemNum(uint32_t nIdx) const { if(nIdx > mVectItemsInShop.size()) { return NULL; } else { return &mVectItemsInShop[nIdx]; }};\r
  \r
     bool mScripting;    // Manual override to disable scripting for an NPC TRUE: Scripts will be executed FALSE: Scripts will be ignored\r
 
@@ -145,15 +118,15 @@ private:
     std::string mCustomName;
     std::string mCustomLua;
 
-    std::time_t mRespawn;    // Respawn timer
+    time_t mRespawn;    // Respawn timer
 
     // Runtime values
     //bool mDeath;        // Death...\r
-    u8 mFaction;        // NPC's faction\r
+    uint8_t mFaction;        // NPC's faction\r
 
-    u16 mHealth;         // NPC Current Health-Value\r
-    u16 mMaxHealth;      // NPC Max Health value\r
-    u32 mTarget;        // Current focused player
+    uint16_t mHealth;         // NPC Current Health-Value\r
+    uint16_t mMaxHealth;      // NPC Max Health value\r
+    uint32_t mTarget;        // Current focused player
     bool mDirty;        // Needs update to clients
 
     // WorldID Fix 10.10.2009
@@ -161,8 +134,8 @@ private:
     bool mSuccess;      // NPC load successfull?\r
  \r
 
-     u8 mAction;         // Current action\r
-    inline u8 GetActionStatus() const { return mAction; };\r
+     uint8_t mAction;         // Current action\r
+    inline uint8_t GetActionStatus() const { return mAction; };\r
     // 00000001 (  1) 0x01: Attack-Mode (Depends on WeaponStatus)\r
     // 00000010 (  2) 0x02: ?\r
     // 00000100 (  4) 0x04: ?\r
@@ -172,23 +145,23 @@ private:
     // 01000000 ( 64) 0x40: Idle\r
     // 10000000 (128) 0x80: Die\r
  \r
-    u8 mWeaponStatus;\r
-    inline u8 GetWeaponStatus() const { return mWeaponStatus; };\r
+    uint8_t mWeaponStatus;\r
+    inline uint8_t GetWeaponStatus() const { return mWeaponStatus; };\r
     // 00001111 (15) 0x0F: Follow given target with eyes / Put weapon away if pulled\r
     // 00010000 (16) 0x10: Pull weapon if not pulled / If pulled, attack\r
     // 00010001 (17) 0x11: Pull weapon and attack\r
 
  \r
     bool SQL_Load();
-    bool DEF_Load(u32 nWorldID);
+    bool DEF_Load(uint32_t nWorldID);
  \r
      PNPC( int nSQLID );\r
-    PNPC( int nDEFID, u32 nWorldID );\r
+    PNPC( int nDEFID, uint32_t nWorldID );\r
      ~PNPC();\r
  \r
     void InitVars();\r
-    void ContentListAddItem(PMessage* nContentList, u16 nItemID, u32 nBasePrice = 0, bool nAddToList = true);\r
-    void ContentListAddItemGroup(PMessage* nContentList, u32 nItemGroupID);\r
+    void ContentListAddItem(PMessage* nContentList, uint16_t nItemID, uint32_t nBasePrice = 0, bool nAddToList = true);\r
+    void ContentListAddItemGroup(PMessage* nContentList, uint32_t nItemGroupID);\r
     void StartDialog( PClient* nClient/*, string &nDialogscript */);\r
  \r
     bool DoSQLShoppingList( PClient* nClient, PMessage* nContentList );\r
@@ -196,16 +169,16 @@ private:
     bool IsAllbuyer( PClient* nClient );\r
     bool LoadLUAScript();\r
  \r
-    inline u32 GetRealWorldID() { if(mFromDEF == true) return mWorldID+255; else return mWorldID; };
+    inline uint32_t GetRealWorldID() { if(mFromDEF == true) return mWorldID+255; else return mWorldID; };
 
 public:
     friend class PNPCWorld;
  \r
     inline void StopAttack() { mDirty = true; mAction = NPC_ACTIONSTATE_IDLE; mWeaponStatus = NPC_SHOOT_IDLE; };\r
-    inline void Attack( PClient* nClient, u8 nType = NPC_SHOOT_SINGLE, u8 nUnknown = 90 ) { Attack(nClient->GetChar()->GetID(), nType, nUnknown); };\r
-    void Attack( u32 nWorldID, u8 nType = NPC_SHOOT_SINGLE, u8 nUnknown = 90 );\r
+    inline void Attack( PClient* nClient, uint8_t nType = NPC_SHOOT_SINGLE, uint8_t nUnknown = 90 ) { Attack(nClient->GetChar()->GetID(), nType, nUnknown); };\r
+    void Attack( uint32_t nWorldID, uint8_t nType = NPC_SHOOT_SINGLE, uint8_t nUnknown = 90 );\r
  \r
-    inline void Move( u16 nNewX, u16 nNewY, u16 nNewZ )
+    inline void Move( uint16_t nNewX, uint16_t nNewY, uint16_t nNewZ )
     {
         mPosX = nNewX;
         mPosY = nNewY;
@@ -216,27 +189,26 @@ public:
     void Die(); // ... die?
     void Update(); // Check respawn timer
     void StartConversation( PClient* nClient );\r
-    void DoConversation( PClient* nClient, u8 nAnswer ) ;\r
+    void DoConversation( PClient* nClient, uint8_t nAnswer ) ;\r
  \r
     // GameCommands\r
     bool ReloadLUAScript();\r
     bool ReloadShopList();\r
-    bool SetShopQuality(u8 nNewVal);\r
+    bool SetShopQuality(uint8_t nNewVal);\r
     inline bool IsSQLNPC() const { return !mFromDEF; };\r
     inline int GetNPCID() const { return mWorldID; };\r
     inline int GetNPCSQLID() const { return mID; };\r
-    inline void SetTrader( u16 nTraderDef ) { mTrader = nTraderDef; };\r
+    inline void SetTrader( uint16_t nTraderDef ) { mTrader = nTraderDef; };\r
     inline void SetScripting(bool nVal) { mScripting = nVal; };\r
-    inline u8 GetFaction() const { return mFaction; };\r
+    inline uint8_t GetFaction() const { return mFaction; };\r
 };
 
 // *****************************************
 
-class PNPCWorld
-{
+class PNPCWorld {
 private:
-    std::time_t mCreation;  // Creation time. (Required to check zone-reset timer
-    std::time_t mLastAliveMsg;  // Time of last "ping" message to keep NPCs in world
+    time_t mCreation;  // Creation time. (Required to check zone-reset timer
+    time_t mLastAliveMsg;  // Time of last "ping" message to keep NPCs in world
 
     PNPCMap mNPCs;
     PNPCMap::iterator GetNPCListBegin()
@@ -250,9 +222,9 @@ private:
 
     bool mSuccessfullInit;
 
-    u32 mWorldID;
+    uint32_t mWorldID;
 
-    PNPCWorld( u32 nWorldID );
+    PNPCWorld( uint32_t nWorldID );
     ~PNPCWorld();
 
     void Update();
@@ -271,12 +243,12 @@ private:
 
 public:
     friend class PNPCManager;
-     PNPC* GetNPC( u32 nNPCID );\r
+     PNPC* GetNPC( uint32_t nNPCID );\r
  \r
     // Functions to add/remove an NPC while server is running\r
     void SendSingleNPCInfo( PClient* nClient, PNPC* nNpc ); // Send\r
-    bool AddNPC(u32 nSQL_ID, u32 nRaw_ID); // Load single SQL NPC from given SQL ID\r
-    void DelNPC(u32 nWorldID); // Remove given NPC from list. Works for *all* npcs\r
+    bool AddNPC(uint32_t nSQL_ID, uint32_t nRaw_ID); // Load single SQL NPC from given SQL ID\r
+    void DelNPC(uint32_t nWorldID); // Remove given NPC from list. Works for *all* npcs\r
                                                      // but uppon zone reset they're back.
 };
 
@@ -300,10 +272,8 @@ public:
     ~PNPCManager();
 
     void Update();
-    PNPCWorld* InitWorld( u32 nWorldID );
+    PNPCWorld* InitWorld( uint32_t nWorldID );
 
-    PNPCWorld* GetWorld( u32 nWorldID );
+    PNPCWorld* GetWorld( uint32_t nWorldID );
     void InitPlayer( PClient* nClient ); // Player is entering zone
 };
-
-#endif
similarity index 92%
rename from server/src/game/npc_ai.cpp
rename to TinNS/Source/GameServer/NpcAi.cxx
index 501d45d..aa4606e 100644 (file)
@@ -1,11 +1,12 @@
-#include "main.h"
-#include "include/npc.h"
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "Common/Includes.hxx"
 
 // First try of an "AI" :P
 void PNPCWorld::CheckForEnemies(PNPC* nNPC)
 {
     //return;
-    std::time_t tNow = time(NULL);
+    time_t tNow = time(NULL);
     // Is it time for next enemy check?
 
     // Temp: Skip that for IDs below 1000
@@ -20,7 +21,7 @@ void PNPCWorld::CheckForEnemies(PNPC* nNPC)
         // Loop all NPCs in my world
 
         // tNearestEnemy[0] = WorldID | tNearestEnemy[1] = Distance to us
-        u32 tNearestEnemy[2] = {0,0};
+        uint32_t tNearestEnemy[2] = {0,0};
 
         for ( PNPCMap::iterator it = mNPCs.begin(); it != mNPCs.end(); it++ )
         {
@@ -31,7 +32,7 @@ void PNPCWorld::CheckForEnemies(PNPC* nNPC)
                 if(tNPC->GetRealWorldID() == nNPC->GetRealWorldID())
                     continue;
 
-                u16 tDistance = DistanceApprox(nNPC->mPosX, nNPC->mPosY, nNPC->mPosZ, tNPC->mPosX, tNPC->mPosY, tNPC->mPosZ);
+                uint16_t tDistance = DistanceApprox(nNPC->mPosX, nNPC->mPosY, nNPC->mPosZ, tNPC->mPosX, tNPC->mPosY, tNPC->mPosZ);
 
                 // Is NPC infight?
                 if(nNPC->GetActionStatus() == NPC_ACTIONSTATE_ATTACK)
similarity index 82%
rename from server/src/game/npc_conversation.cpp
rename to TinNS/Source/GameServer/NpcConversation.cxx
index 05a4c82..0528819 100644 (file)
@@ -1,42 +1,8 @@
-/*
-TinNS (TinNS is not a Neocron Server)
-Copyright (C) 2005 Linux Addicted Community
-maintainer Akiko <akiko@gmx.org>
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "Common/Includes.hxx"
 
-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)
+bool PNPC::SetShopQuality(uint8_t nNewVal)
 {
     // Ignore that setting if NPC is loaded from .def
     if(mFromDEF == true)
@@ -56,7 +22,7 @@ bool PNPC::ReloadShopList()
     return true;
 }
 
-void PNPC::AddToVectorList(u16 nItemID, u32 nPrice)
+void PNPC::AddToVectorList(uint16_t nItemID, uint32_t nPrice)
 {
     stShopListEntry tEntry;
     tEntry.ItemID = nItemID;
@@ -65,18 +31,18 @@ void PNPC::AddToVectorList(u16 nItemID, u32 nPrice)
     mVectItemsInShop.push_back(tEntry);
 }
 
-void PNPC::ContentListAddItem(PMessage* nContentList, u16 nItemID, u32 nBasePrice, bool nAddToList)
+void PNPC::ContentListAddItem(PMessage* nContentList, uint16_t nItemID, uint32_t nBasePrice, bool nAddToList)
 {
     // Items with baseprice = 0 are ignored!
     if(nBasePrice == 0)
         return;
 
     // Modify baseprice with Config value
-    f32 tPerCent = Config->GetOptionInt("item_price");
+    float tPerCent = Config->GetOptionInt("item_price");
     tPerCent = tPerCent / 100;
-    u32 tPrice = nBasePrice * tPerCent;
-    *nContentList << ( u16 ) nItemID;
-    *nContentList << ( u32 )( tPrice );
+    uint32_t tPrice = nBasePrice * tPerCent;
+    *nContentList << ( uint16_t ) nItemID;
+    *nContentList << ( uint32_t )( tPrice );
 
     if(nAddToList)
         AddToVectorList(nItemID, tPrice);
@@ -84,7 +50,7 @@ void PNPC::ContentListAddItem(PMessage* nContentList, u16 nItemID, u32 nBasePric
     if (gDevDebug) Console->Print("[PNPC::ContentListAddItem] Adding item: ID: %d Price: %u", nItemID, tPrice);
 }
 
-void PNPC::ContentListAddItemGroup(PMessage* nContentList, u32 nItemGroupID)
+void PNPC::ContentListAddItemGroup(PMessage* nContentList, uint32_t nItemGroupID)
 {
     const PDefItems* tDefItems = NULL;
     std::map<int, PDefItems*>::const_iterator itStart = GameDefs->Items()->ConstIteratorBegin();
@@ -92,11 +58,11 @@ void PNPC::ContentListAddItemGroup(PMessage* nContentList, u32 nItemGroupID)
     for ( std::map<int, PDefItems*>::const_iterator i = itStart; i != itEnd; i++ )
     {
         tDefItems = i->second;
-        if((u32)tDefItems->GetItemGroupID() == nItemGroupID)
+        if((uint32_t)tDefItems->GetItemGroupID() == nItemGroupID)
         {
             // Pricing: Use Baseprice
             // If Baseprice is 0, use Quality * Techlevel * 2
-            u32 tPrice = tDefItems->GetBasePrice();
+            uint32_t tPrice = tDefItems->GetBasePrice();
             if(tPrice == 0)
             {
                 tPrice = tDefItems->GetTechlevel() * mItemQuality * 2;
@@ -131,7 +97,7 @@ bool PNPC::DoSQLShoppingList( PClient* nClient, PMessage* nContentList )
         return false;
     }
 
-    f32 tPerCent = Config->GetOptionInt("item_price");
+    float tPerCent = Config->GetOptionInt("item_price");
     tPerCent = tPerCent / 100;
 
     while((row = mysql_fetch_row(result)))
@@ -141,7 +107,7 @@ bool PNPC::DoSQLShoppingList( PClient* nClient, PMessage* nContentList )
         {
             // Pricing: If no value in DB is set, use Baseprice
             // If Baseprice is 0, use Quality * Techlevel * 2
-            u32 tPrice = atoi(row[3]);
+            uint32_t tPrice = atoi(row[3]);
             if(tPrice == 0)
             {
                 tPrice = t_item->GetBasePrice();
@@ -153,10 +119,10 @@ bool PNPC::DoSQLShoppingList( PClient* nClient, PMessage* nContentList )
 
             // Modify price as told in config
             tPrice = tPrice * tPerCent;
-            u16 tItemID = atoi(row[2]);
+            uint16_t tItemID = atoi(row[2]);
 
-            *nContentList << ( u16 ) tItemID;
-            *nContentList << ( u32 ) tPrice;
+            *nContentList << ( uint16_t ) tItemID;
+            *nContentList << ( uint32_t ) tPrice;
 
             // Store item position in list for later trade stuff
             AddToVectorList(tItemID, tPrice);
@@ -230,7 +196,7 @@ void PNPC::StartDialog( PClient* nClient/*, string &nDialogscript*/ )
         t_ScriptName = mDialogScript;
     }
 
-    u32 tWorldID = GetRealWorldID();
+    uint32_t tWorldID = GetRealWorldID();
     // Starts dialog with NPC
     // First, set required values in client's char
     nClient->GetChar()->SetDialogNPC(mWorldID);
@@ -248,7 +214,7 @@ void PNPC::StartConversation( PClient* nClient )
 {
     // Set Offset to mWorldID
     // .def NPCs need this offset in order to work
-    u32 tRealID = GetRealWorldID();
+    uint32_t tRealID = GetRealWorldID();
 
     // Check if NPC has script for talking
     // OR
@@ -358,7 +324,7 @@ void PNPC::StartConversation( PClient* nClient )
 // 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 )
+void PNPC::DoConversation( PClient* nClient, uint8_t nAnswer )
 {
     // LUA Engine v3: Let the LuaEngine handle everything!
     LuaEngine->ProcessDialogScript(nClient, mLUAFile, nAnswer);
diff --git a/TinNS/Source/GameServer/NpcTemplate.cxx b/TinNS/Source/GameServer/NpcTemplate.cxx
new file mode 100644 (file)
index 0000000..565eeb8
--- /dev/null
@@ -0,0 +1,40 @@
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
+
+PNPCTemplate::PNPCTemplate()
+{
+    mUnknown1 = 0;
+    mPosY = 0.0f;
+    mPosZ = 0.0f;
+    mPosX = 0.0f;
+    mNPCTypeID = 0;
+    mActorStringSize = 0;
+    mAngleStringSize = 0;
+    mNpcID = 0;
+    mHasAdditionalCoords = 0;
+    mUnknown2a = 0;
+    mUnknown2b = 0;
+    mUnknown2c = 0;
+    /*mUnknown3*/mTradeID = 0;
+    mUnknown4 = 0;
+    mActorName = "";
+    mAngle = "";
+}
+
+PNPCTemplate::~PNPCTemplate()
+{
+    // Cleanup waypoints
+    for ( PWaypointMap::iterator i = mWayPoints.begin(); i != mWayPoints.end(); i++ )
+        delete i->second;
+}
+
+void PNPCTemplate::AddWayPoint(float nX, float nY, float nZ, uint8_t nID)
+{
+    struct s_floatcoords *tWayPoint = new s_floatcoords;
+    tWayPoint->mX = nX;
+    tWayPoint->mY = nY;
+    tWayPoint->mZ = nZ;
+
+    if ( mWayPoints.insert( std::make_pair( nID, tWayPoint)).second )
+        if ( gDevDebug ) Console->Print( "%s Waypoint %d (X %0.1f Y %0.1f Z %0.1f) added to NPC", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nID, nX, nY, nZ );
+}
diff --git a/TinNS/Source/GameServer/NpcTemplate.hxx b/TinNS/Source/GameServer/NpcTemplate.hxx
new file mode 100644 (file)
index 0000000..36af4d9
--- /dev/null
@@ -0,0 +1,192 @@
+#pragma once
+
+#include <cstdint>
+#include <map>
+
+struct s_floatcoords {
+    float mX;
+    float mY;
+    float mZ;
+};
+typedef std::map<uint32_t, s_floatcoords*> PWaypointMap;
+
+class PNPCTemplate {
+    friend class PWorldDatParser;
+
+private:
+
+    PWaypointMap mWayPoints;
+
+    uint32_t       mUnknown1; // Is always 0x20001200, in every log. maybe header for NPCs?
+    float       mPosY;
+    float       mPosZ;
+    float       mPosX;
+    uint32_t       mNPCTypeID; //npc type in npc.def
+    uint8_t        mActorStringSize; //string size with ending 0
+    uint8_t        mAngleStringSize; //string size with ending 0
+    uint16_t       mNpcID;
+    uint8_t        mHasAdditionalCoords; // Seems to be the NUMBER OF additional Coords for the NPC ("Coords" = X/Y/Z in float, not uint16_t!!)
+    uint8_t        mUnknown2a;
+    uint8_t        mUnknown2b;
+    uint8_t        mUnknown2c;
+    uint16_t       mTradeID;  //mUnknown3; //00 00 ?
+    uint16_t       mUnknown4; //04 00 ?
+    std::string    mActorName;
+    std::string    mAngle;
+
+    /* // Not sure about that. Commented out until someone finds out how to deal with those "extra" informations
+    float mWaypoint1_Y;
+    float mWaypoint1_Z;
+    float mWaypoint1_X;
+    float mWaypoint2_Y;
+    float mWaypoint2_Z;
+    float mWaypoint2_X;
+    float mWaypoint3_Y;
+    float mWaypoint3_Z;
+    float mWaypoint3_X;
+    float mWaypoint4_Y;
+    float mWaypoint4_Z;
+    float mWaypoint4_X;
+    float mWaypoint5_Y;
+    float mWaypoint5_Z;
+    float mWaypoint5_X;
+    */
+
+public:
+    PNPCTemplate();
+    ~PNPCTemplate();
+
+    void AddWayPoint(float nX, float nY, float nZ, uint8_t nID);
+    // TODO: Add GetWaypoint function
+
+    inline uint32_t GetUnknown1() const
+    {
+        return mUnknown1;
+    };
+    inline float GetPosX() const
+    {
+        return mPosY;
+    };
+    inline float GetPosY() const
+    {
+        return mPosZ;
+    };
+    inline float GetPosZ() const
+    {
+        return mPosX;
+    };
+    inline uint32_t GetNPCTypeID() const
+    {
+        return mNPCTypeID;
+    };
+    inline uint8_t GetActorStrSize() const
+    {
+        return mActorStringSize;
+    };
+    inline uint8_t GetAngleStrSize() const
+    {
+        return mAngleStringSize;
+    };
+    inline uint16_t GetNpcID() const
+    {
+        return mNpcID;
+    };
+    inline uint8_t GetHasAdditionalCoords() const
+    {
+        return mHasAdditionalCoords;
+    };
+    inline uint8_t GetUnknown2a() const
+    {
+        return mUnknown2a;
+    };
+    inline uint8_t GetUnknown2b() const
+    {
+        return mUnknown2b;
+    };
+    inline uint8_t GetUnknown2c() const
+    {
+        return mUnknown2c;
+    };
+    inline uint16_t /*GetUnknown3*/GetTradeID() const
+    {
+        return mTradeID;//mUnknown3;
+    };
+    inline uint16_t GetUnknown4() const
+    {
+        return mUnknown4;
+    };
+    inline std::string GetActorName() const
+    {
+        return mActorName;
+    };
+    inline std::string GetAngle() const
+    {
+        return mAngle;
+    };
+
+
+    inline void SetUnknown1( uint32_t nValue )
+    {
+        mUnknown1 = nValue;
+    };
+    inline void SetPosX( float nValue )
+    {
+        mPosY = nValue;
+    };
+    inline void SetPosY( float nValue )
+    {
+        mPosZ = nValue;
+    };
+    inline void SetPosZ( float nValue )
+    {
+        mPosX = nValue;
+    };
+    inline void SetNPCTypeID( uint32_t nValue )
+    {
+        mNPCTypeID = nValue;
+    };
+    inline void SetActorStrSize( uint8_t nValue )
+    {
+        mActorStringSize = nValue;
+    };
+    inline void SetAngleStrSize( uint8_t nValue )
+    {
+        mAngleStringSize = nValue;
+    };
+    inline void SetNpcID( uint16_t nValue )
+    {
+        mNpcID = nValue;
+    };
+    inline void SetHasAdditionalCoords( uint8_t nValue )
+    {
+        mHasAdditionalCoords = nValue;
+    };
+    inline void SetUnknown2a( uint8_t nValue )
+    {
+        mUnknown2a = nValue;
+    };
+    inline void SetUnknown2b( uint8_t nValue )
+    {
+        mUnknown2b = nValue;
+    };
+    inline void SetUnknown2c( uint8_t nValue )
+    {
+        mUnknown2c = nValue;
+    };
+    inline void /*SetUnknown3*/SetTradeID( uint16_t nValue )
+    {
+        /*mUnknown3*/mTradeID = nValue;
+    };
+    inline void SetUnknown4( uint16_t nValue )
+    {
+        mUnknown4 = nValue;
+    };
+    inline void SetActorName( std::string nValue )
+    {
+        mActorName = nValue;
+    };
+    inline void SetAngle( std::string nValue )
+    {
+        mAngle = nValue;
+    };
+};
similarity index 69%
rename from server/src/game/outpost.cpp
rename to TinNS/Source/GameServer/Outpost.cxx
index ae54c8c..2ed10e8 100644 (file)
@@ -1,34 +1,6 @@
-/*
-TinNS (TinNS is not a Neocron Server)
-Copyright (C) 2005 Linux Addicted Community
-maintainer Akiko <akiko@gmx.org>
-
-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.
-*/
-
-/*
-
-outpost.cpp - TinNS outpost handling
-
-CREATION: 24 Oct 2009 Namikon
-
-*/
-
-#include "main.h"
-#include "include/msgbuilder.h"
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "Common/Includes.hxx"
 
 POutpost::POutpost()
 {
@@ -38,7 +10,7 @@ POutpost::~POutpost()
 {
 }
 
-u32 POutpost::GetCurrentClan(u32 nOutpostID)
+uint32_t POutpost::GetCurrentClan(uint32_t nOutpostID)
 {
     MYSQL_RES *result = NULL;
     char tQuery[200];
@@ -59,14 +31,14 @@ u32 POutpost::GetCurrentClan(u32 nOutpostID)
         return 0;
     }
 
-    u32 tClanID = atoi(mysql_fetch_row(result)[0]);
+    uint32_t tClanID = atoi(mysql_fetch_row(result)[0]);
 
     MySQL->FreeGameSQLResult(result);
     return tClanID;
 }
 
 // Check if given nZoneID is an outpost area
-bool POutpost::IsZoneOPArea(u32 nZoneID)
+bool POutpost::IsZoneOPArea(uint32_t nZoneID)
 {
     // Outpost ID == WorldID
     // Outpost Underground = WorldID + 2000
@@ -119,8 +91,8 @@ void POutpost::SendOPAreaData(PClient* nClient)
 
     row = mysql_fetch_row(result);
 
-    u32 tClanID = atoi(row[0]);
-    u8 tFactionID = atoi(row[1]);
+    uint32_t tClanID = atoi(row[0]);
+    uint8_t tFactionID = atoi(row[1]);
 
     MySQL->FreeGameSQLResult(result);
 
diff --git a/TinNS/Source/GameServer/Outpost.hxx b/TinNS/Source/GameServer/Outpost.hxx
new file mode 100644 (file)
index 0000000..13d6415
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <cstdint>
+
+class POutpost {
+public:
+    POutpost();
+    ~POutpost();
+
+    bool IsZoneOPArea(uint32_t nZoneID);     // checks if given zoneID is either outpost zone or underground of OP
+    void SendOPAreaData(PClient* nClient); // Sends OP data to client (Owning clan/faction)
+    uint32_t GetCurrentClan(uint32_t nOutpostID); // Get current ClanID of given Outpost
+};
diff --git a/TinNS/Source/GameServer/RemoteConsole.cxx b/TinNS/Source/GameServer/RemoteConsole.cxx
new file mode 100644 (file)
index 0000000..3417479
--- /dev/null
@@ -0,0 +1,230 @@
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+#if 0\r
+static const int RCON_INPUTLEN = 512;\r
+\r
+struct PRConClient\r
+{\r
+    enum\r
+    {\r
+        RCCS_AUTH,\r
+        RCCS_AUTH_USER,\r
+        RCCS_AUTH_PASS,\r
+        RCCS_VALID,\r
+        RCCS_DISCONNECT\r
+    } mState;\r
+\r
+    PSocket *mSocket;\r
+    PAccount *mAccount;\r
+    char mInput[RCON_INPUTLEN];\r
+    int mInputLen;\r
+    bool mEcho;\r
+    std::clock_t mSleep, mSleepStart;\r
+    int mNumFailures;\r
+\r
+    inline PRConClient(NLsocket &Sock)\r
+    {\r
+        mSocket = new PSocket(Sock);\r
+        mAccount = 0;\r
+        mInputLen = 0;\r
+        mEcho = true;\r
+        mSleep = 0;\r
+        mSleepStart = 0;\r
+        mNumFailures = 0;\r
+    }\r
+\r
+    inline ~PRConClient()\r
+    {\r
+        delete mSocket;\r
+    }\r
+\r
+    inline void Print(const char *Fmt, ...)\r
+    {\r
+        static char Str[256];\r
+        va_list args;\r
+        va_start(args, Fmt);\r
+        vsnprintf(Str, 255, Fmt, args);\r
+        va_end(args);\r
+        mSocket->Write(Str);\r
+    }\r
+\r
+};\r
+\r
+PRConsole::PRConsole()\r
+{\r
+    mListener = NL_INVALID;\r
+}\r
+\r
+PRConsole::~PRConsole()\r
+{\r
+    if(mListener != NL_INVALID)\r
+        nlClose(mListener);\r
+\r
+    for(ClientList::iterator i=mClients.begin(); i!=mClients.end(); i++)\r
+        delete *i;\r
+}\r
+\r
+void PRConsole::Start()\r
+{\r
+  // CHECK FOR rconsole enabled!!!\r
+    Console->LPrint("Starting remote console...");\r
+    uint16_t Port = Config->GetOptionInt("rconsole_port");\r
+    mListener = nlOpen(Port, NL_TCP);\r
+    if(mListener == NL_INVALID)\r
+    {\r
+        Console->LPrint(RED, BLACK, "[ERROR]");\r
+        Console->LPrint(" Remote console failed");\r
+        Console->LClose();\r
+        return;\r
+    }\r
+\r
+    Console->LPrint(GREEN, BLACK, "Success");\r
+    Console->LClose();\r
+    nlListen(mListener);\r
+}\r
+\r
+void PRConsole::Update()\r
+{\r
+    if(mListener==NL_INVALID)\r
+        return;\r
+\r
+    NLsocket temp = nlAcceptConnection(mListener);\r
+    if(temp != NL_INVALID)\r
+    {\r
+        // TODO: print client ip addr\r
+        Console->Print("RConsole: client connected");\r
+        PRConClient *cl = new PRConClient(temp);\r
+        cl->mState = PRConClient::RCCS_AUTH;\r
+        mClients.push_back(cl);\r
+        cl->Print("TinNS shell [%s]\r\n", TINNS_VERSION);\r
+    }\r
+\r
+    for(ClientList::iterator i=mClients.begin(); i!=mClients.end();)\r
+    {\r
+        ClientList::iterator j=i;\r
+        PRConClient *cl = *i;\r
+        ++i;\r
+        if(!cl->mSocket->Update() || cl->mSocket->TimeOut())\r
+        {\r
+            Console->Print("RConsole: client disconnected");\r
+            mClients.erase(j);\r
+            delete cl;\r
+            continue;\r
+        }\r
+\r
+        if(cl->mSleep > 0)\r
+        {\r
+            std::clock_t t = std::clock();\r
+            cl->mSleep -= (t-cl->mSleepStart);\r
+            cl->mSleepStart = t;\r
+\r
+            if(cl->mSleep < 0)\r
+                cl->mSleep = 0;\r
+\r
+            // flush socket while sleeping\r
+            int Size=0;\r
+            cl->mSocket->Read(&Size);\r
+\r
+            continue;\r
+        }\r
+\r
+        if(cl->mState==PRConClient::RCCS_AUTH)\r
+        {\r
+            cl->Print("\r\nlogin: ");\r
+            cl->mState = PRConClient::RCCS_AUTH_USER;\r
+        }\r
+\r
+        const uint8_t *Buf = 0;\r
+        int Size=0;\r
+        if((bool)(Buf = cl->mSocket->Read(&Size)))\r
+        {\r
+            for(int i=0; i<Size; i++)\r
+                if(cl->mInputLen < RCON_INPUTLEN)\r
+                {\r
+                    switch(Buf[i])\r
+                    {\r
+                        case 0x08 :\r
+                        {\r
+                            if(cl->mInputLen > 0)\r
+                            {\r
+                                if(cl->mEcho)\r
+                                    cl->mSocket->Write(Buf[i]);\r
+                                cl->mInput[cl->mInputLen]=0;\r
+                                --cl->mInputLen;\r
+                            }\r
+                            break;\r
+                        }\r
+\r
+                        case '\n' :\r
+                        {\r
+                            if(cl->mEcho)\r
+                                cl->mSocket->Write(Buf[i]);\r
+                            cl->mInput[cl->mInputLen]=0;\r
+                            ProcessClient(cl);\r
+                            cl->mInputLen = 0;\r
+                            break;\r
+                        }\r
+\r
+                        default :\r
+                        {\r
+                            cl->mInput[cl->mInputLen++]=Buf[i];\r
+                            if(cl->mEcho)\r
+                                cl->mSocket->Write(Buf[i]);\r
+                            break;\r
+                        }\r
+                    }\r
+                }\r
+        }\r
+    }\r
+}\r
+\r
+void PRConsole::ProcessClient(PRConClient* Client)\r
+{\r
+    Console->Print(">%s", Client->mInput);\r
+    if(Client->mInputLen > 1)\r
+    {\r
+        if(Client->mInput[Client->mInputLen-1] == '\r')\r
+            Client->mInput[Client->mInputLen-1]=0;\r
+\r
+        if(Client->mState == PRConClient::RCCS_AUTH_USER)\r
+        {\r
+            Client->mAccount = Database->GetAccount(Client->mInput);\r
+            Client->mState = PRConClient::RCCS_AUTH_PASS;\r
+            Client->Print("password: ");\r
+            Client->mEcho = false;\r
+        } else\r
+        if(Client->mState == PRConClient::RCCS_AUTH_PASS)\r
+        {\r
+            Client->mEcho = true;\r
+            if((!Client->mAccount) || (Client->mAccount->GetPassword() != Client->mInput) || (!Client->mAccount->IsConsoleAllowed()))\r
+            {\r
+                Client->Print("Invalid user or password\r\n");\r
+                Client->mSleepStart = std::clock();\r
+                ++Client->mNumFailures;\r
+                if(Client->mNumFailures >= 3)\r
+                {\r
+                    // sleep 1 minute\r
+                    Client->mSleep = 60*CLOCKS_PER_SEC;\r
+                    Client->mNumFailures = 0;\r
+                } else\r
+                    Client->mSleep = 5*CLOCKS_PER_SEC;\r
+\r
+                Client->mState = PRConClient::RCCS_AUTH;\r
+            } else\r
+            {\r
+                Client->Print("\r\n\nUser %s logged in\r\n", Client->mAccount->GetName().c_str());\r
+                Client->mState = PRConClient::RCCS_VALID;\r
+                // disconnect after 30 minutes lacking socket activity\r
+                Client->mSocket->SetTimeOutValue(1800);\r
+                Prompt(Client);\r
+            }\r
+        }\r
+    }\r
+}\r
+\r
+void PRConsole::Prompt(PRConClient *Client)\r
+{\r
+    Client->Print("$ ", Client->mAccount->GetName().c_str(), Config->GetOption("server_name").c_str());\r
+}\r
+#endif\r
diff --git a/TinNS/Source/GameServer/RemoteConsole.hxx b/TinNS/Source/GameServer/RemoteConsole.hxx
new file mode 100644 (file)
index 0000000..82bea20
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once\r
+\r
+#if 0\r
+#include <list>\r
+\r
+struct PRConClient;\r
+\r
+class PRConsole {\r
+private :\r
+    typedef std::list<PRConClient *> ClientList;\r
+    ClientList mClients;\r
+\r
+    void ProcessClient(PRConClient* Client);\r
+    void Prompt(PRConClient *Client);\r
+public :\r
+    PRConsole();\r
+    ~PRConsole();\r
+\r
+    void Start();\r
+    void Update();\r
+};\r
+#endif\r
diff --git a/TinNS/Source/GameServer/Server.cxx b/TinNS/Source/GameServer/Server.cxx
new file mode 100644 (file)
index 0000000..a5f9932
--- /dev/null
@@ -0,0 +1,82 @@
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+PServer::PServer()\r
+{\r
+    mNumClients = 0;\r
+    mMaxClients = Config->GetOptionInt("maxclients");\r
+    mGMSlots = Config->GetOptionInt("gm_slots");\r
+    if(mMaxClients==0)\r
+        mMaxClients=1;\r
+    if(mGMSlots==0)\r
+        mGMSlots=1;\r
+    Console->Print("Max clients: %i / GM slots: %i", mMaxClients, mGMSlots);\r
+    mClients.reserve(mMaxClients + mGMSlots);\r
+    for(int i=0; i<mMaxClients+mGMSlots; i++)\r
+        mClients[i]=0;\r
+}\r
+\r
+PServer::~PServer()\r
+{\r
+    for(int i=0; i<mMaxClients+mGMSlots; i++)\r
+        delete mClients[i];\r
+}\r
+\r
+int PServer::NewClient()\r
+{\r
+    if(mNumClients==mMaxClients+mGMSlots)\r
+        return -1;\r
+\r
+    for(int i=0; i<mMaxClients+mGMSlots; i++)\r
+    {\r
+        if(!mClients[i])\r
+        {\r
+            mClients[i]=new PClient(i);\r
+            ++mNumClients;\r
+            return i;\r
+        }\r
+    }\r
+    return -1;\r
+}\r
+\r
+PClient *PServer::GetClient(int Client) const\r
+{\r
+    if(Client < 0 || Client >= mMaxClients+mGMSlots)\r
+        return 0;\r
+\r
+    return mClients[Client];\r
+}\r
+\r
+void PServer::Update()\r
+{\r
+    for(int i=0; i<mMaxClients+mGMSlots; i++)\r
+    {\r
+        if(mClients[i])\r
+        {\r
+            mClients[i]->Update();\r
+            if(mClients[i]->GetConnection()==PCC_NONE && mClients[i]->getTCPConn() == 0)\r
+            {\r
+                Console->Print("Removing client %i...", i);\r
+                delete mClients[i];\r
+                mClients[i]=0;\r
+                --mNumClients;\r
+            }\r
+        }\r
+    }\r
+}\r
+\r
+void PServer::Shutdown()\r
+{\r
+    Console->Print("======================");\r
+    Console->Print("Shutting down Gameserver...");\r
+    for(int i=0; i<mMaxClients+mGMSlots; i++)\r
+    {\r
+        if(mClients[i])\r
+        {\r
+            delete mClients[i];\r
+            mClients[i]=0;\r
+        }\r
+    }\r
+}\r
+\r
+//SELECT `s_name` , NOW( ) , `s_lastupdate` , NOW( ) - `s_lastupdate` FROM `server_list` \r
diff --git a/TinNS/Source/GameServer/Server.hxx b/TinNS/Source/GameServer/Server.hxx
new file mode 100644 (file)
index 0000000..7015ddf
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <vector>\r
+\r
+class PClient;\r
+\r
+class PServer{\r
+private:\r
+    int32_t mMaxClients;\r
+    int32_t mGMSlots;\r
+    int32_t mNumClients;\r
+    std::vector<PClient*> mClients;\r
+\r
+public:\r
+    PServer();\r
+    ~PServer();\r
+\r
+    inline int32_t GetMaxClients() const { return mMaxClients; }\r
+    inline int32_t GetGMSlots() const { return mGMSlots; }\r
+    inline int32_t GetNumClients() const { return mNumClients; }\r
+    int NewClient();\r
+    PClient *GetClient(int Client) const;\r
+    void Update();\r
+    void Shutdown();\r
+};\r
similarity index 91%
rename from server/src/game/skill.cpp
rename to TinNS/Source/GameServer/Skill.cxx
index 74b76b2..f47ae4d 100644 (file)
@@ -1,44 +1,4 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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.
-*/
-
-
-
-/*
-       skill.cpp
-
-       Authors:
-       - Namikon
-
-       MODIFIED: 18 Dec 2005 Namikon
-       REASON: - Initial Release
-       MODIFIED: 01 Jan 2006 Namikon
-       REASON: - Initial Release
-            - Added SetMainSkill()
-            - Added SetSubSkill()
-            - Added SetXP()
-            - Added SetSP()
-            - Removed IncreaseSubSkill and IncreaseMainSkill
-
-*/
-#include "main.h"
+#include "GameServer/Includes.hxx"
 
 void PSkillHandler::SetMainSkill(MAIN_SKILLS Skill, int value)
 {
similarity index 63%
rename from server/src/game/include/skill.h
rename to TinNS/Source/GameServer/Skill.hxx
index 74a93c6..cbd0867 100644 (file)
@@ -1,61 +1,8 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
+#pragma once
 
-       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 <cstdint>
 
-       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.
-*/
-
-
-
-/*
-       skill.h
-
-       Authors:
-       - Namikon
-       - bakkdoor
-
-       MODIFIED: 17 Dec 2005 Namikon
-       REASON: - Initial Release
-       MODIFIED: 17 Dec 2005 bakkdoor
-       REASON: - Fixed some typos and small bugs
-       MODIFIED: 18 Dec 2005 Namikon
-       REASON: - Moved Structs to new file, added vars for XP and SkillPoints
-                - Added initial skillhandling
-       MODIFIED: 01 Jan 2006 Namikon
-       REASON: - Added SetMainSkill()
-            - Added SetSubSkill()
-            - Added SetXP()
-            - Added SetSP()
-            - Removed IncreaseSubSkill and IncreaseMainSkill
-            - Fixed typo in SUB_SKILLS enum
-       MODIFIED: 19 Sep 2006 Hammag
-       REASON: - Added destructor for struct PSkills in order to free allocated memory
-                   and avoid memory leak.
-       MODIFIED: 25 Nov 2006 Hammag
-       REASON: - Changed from enums (MAIN_SKILLS & SUB_SKILLS) to define, because there is no
-                 simple way to call methods with enum-type params when using arbitrary data (from the client in the present case).
-                 Values should even be taken from def_skills & def_subskills, with global constants
-
-*/
-
-#ifndef SKILL_H
-#define SKILL_H
-
-#define SUB_SKILLS u8
+#define SUB_SKILLS uint8_t
 #define SK_MC 1
 #define SK_HC 2
 #define SK_TRA 3
 #define SK_PSR 44
 #define SK_WPW 45
 
-#define MAIN_SKILLS u8
+#define MAIN_SKILLS uint8_t
 #define MS_STR 1
 #define MS_DEX 2
 #define MS_CON 3
 #define MS_INT 4
 #define MS_PSI 5
 
-
 class PSkillHandler
 {
 private:
@@ -107,11 +53,11 @@ private:
         int mSTR;
         int mDEX;
         int mPSI;
-        unsigned short mINTsp;
-        unsigned short mCONsp;
-        unsigned short mSTRsp;
-        unsigned short mDEXsp;
-        unsigned short mPSIsp;
+        uint16_t mINTsp;
+        uint16_t mCONsp;
+        uint16_t mSTRsp;
+        uint16_t mDEXsp;
+        uint16_t mPSIsp;
         float mINTxp;
         float mCONxp;
         float mSTRxp;
@@ -257,8 +203,6 @@ public:
 
     int IncreaseSubSkill(SUB_SKILLS Skill);
 
-    unsigned short GetSP(MAIN_SKILLS Skill);
+    uint16_t GetSP(MAIN_SKILLS Skill);
     float GetXP(MAIN_SKILLS Skill);
 };
-
-#endif
similarity index 78%
rename from server/src/game/sql.cpp
rename to TinNS/Source/GameServer/Sql.cxx
index 9616c25..ff2fd8e 100644 (file)
@@ -1,64 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       sql.cpp - handles all mysql interactions\r
-\r
-       Authors:\r
-       - Namikon\r
-       - bakkdoor\r
-\r
-        MODIFIED: 24 Dec 2005 Namikon\r
-        REASON: - initial release by Namikon\r
-        MODIFIED: 26 Dec 2005 Namikon\r
-        REASON: - Fixed Connect and Query function\r
-                - Added GetWorldDoorType() for door interaction\r
-                - Added GetWorldItemType() for item interaction\r
-                - Added GetWorldItemOption() for item interaction\r
-        MODIFIED: 30 Dec 2005 bakkdoor\r
-        REASON: - changed mysql_init() parameter to null to prevent segfault\r
-                - added checking for dbHandle to prevent segfault\r
-        MODIFIED: 01 Jan 2006 Namikon\r
-        REASON: - Removed 2 Console outputs in ResQuery()\r
-                - Added missing "return NULL" to ResQuery\r
-        MODIFIED: 06 Jan 2006 Namikon\r
-        REASON: - Added color to console outputs\r
-                - Changed a few lines on the Get* functions (another std::atoi thing)\r
-        MODIFIED: 26 Jul 2006 Hammag\r
-        REASON: - Added CheckResCount() for DB Res memory leak tracking (to be done in the main loop)\r
-                    rather than through Info/GameResQuery()\r
-                - fixed InfoDBInuse and GameDBInuse updating\r
-                - inhibited Info/GameDBInuse warning message in Info/GameResQuery()\r
-        MODIFIED: 27 Sep 2006 Hammag\r
-        REASON: - Added GetAptLocation() method\r
-                - Modified Apt & Item info methods as they should work, but it doesn't match the DB\r
-                  So commented out some changes\r
-                  DB shouln't be used anymore for that soon anyway\r
-        MODIFIED: 25 Jun 2007 Hammag\r
-        REASON: - Moved all Appartements related methods to PAppartements class\r
-\r
-*/\r
-#include "main.h"\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 PMySQL::PMySQL()\r
 {\r
@@ -303,15 +245,15 @@ void PMySQL::FreeGameSQLResult(MYSQL_RES *res)
         Console->Print("PMySQL::FreeGameSQLResult: Nothing to free...");\r
 }\r
 \r
-u32 PMySQL::EscapeString(const char* nText, char* dText, u32 dMaxLength)\r
+uint32_t PMySQL::EscapeString(const char* nText, char* dText, uint32_t dMaxLength)\r
 {\r
-  u32 nLength = strlen(nText);\r
-  u32 tMax = (dMaxLength - 1)/2;\r
+  uint32_t nLength = strlen(nText);\r
+  uint32_t tMax = (dMaxLength - 1)/2;\r
   if(nLength > tMax)\r
   {\r
     nLength = tMax;\r
   }\r
-  \r
+\r
   return mysql_real_escape_string(game_dbHandle, dText, nText, nLength);\r
 }\r
 \r
diff --git a/TinNS/Source/GameServer/Sql.hxx b/TinNS/Source/GameServer/Sql.hxx
new file mode 100644 (file)
index 0000000..ed028b3
--- /dev/null
@@ -0,0 +1,64 @@
+#pragma once\r
+\r
+#include <chrono>\r
+#include <cstdint>\r
+#ifdef MYSQL_INC_DIR\r
+#include <mysql/mysql.h>\r
+#else\r
+#include <mysql.h>\r
+#endif\r
+\r
+// TODO: take all non-pure SQL DB access stuff out of this class\r
+\r
+class PMySQL {\r
+private:\r
+    int info_port;\r
+    char info_host[100];\r
+    char info_userName[100];\r
+    char info_password[100];\r
+    char info_database[100];\r
+    MYSQL *info_dbHandle;\r
+    std::time_t mKeepaliveDelay;\r
+    std::time_t mLastKeepaliveSent;\r
+\r
+    int game_port;\r
+    char game_host[100];\r
+    char game_userName[100];\r
+    char game_password[100];\r
+    char game_database[100];\r
+    MYSQL *game_dbHandle;\r
+\r
+    int GameDBInuse;\r
+    int InfoDBInuse;\r
+\r
+public:\r
+    PMySQL();\r
+    ~PMySQL();\r
+\r
+    void Update();\r
+    void CheckResCount();\r
+\r
+    inline MYSQL *GetInfoHandle() { return info_dbHandle; };\r
+    inline MYSQL *GetGameHandle() { return game_dbHandle; };\r
+\r
+    bool Connect();\r
+\r
+    int InfoQuery(const char *query);\r
+    MYSQL_RES *InfoResQuery(const char *query);\r
+    int GameQuery(const char *query);\r
+    MYSQL_RES *GameResQuery(const char *query);\r
+\r
+    /*int GetWorldItemType(unsigned short ID, int Location);\r
+    int GetWorldItemOption(unsigned short ID, int Location, int option);\r
+    int GetWorldDoorType(unsigned int ID, int Location);*/\r
+\r
+    void ShowInfoSQLError();\r
+    void ShowGameSQLError();\r
+    void FreeGameSQLResult(MYSQL_RES *res);\r
+    void FreeInfoSQLResult(MYSQL_RES *res);\r
+\r
+    inline uint32_t GetLastGameInsertId() { return mysql_insert_id(game_dbHandle); };\r
+    inline uint32_t GetLastInfoInsertId() { return mysql_insert_id(info_dbHandle); };\r
+\r
+    uint32_t EscapeString(const char* nText, char* dText, uint32_t dMaxLength);\r
+};\r
similarity index 61%
rename from server/src/game/subway.cpp
rename to TinNS/Source/GameServer/Subway.cxx
index 8a1a298..f2ced03 100644 (file)
@@ -1,33 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       subway.h - subway class\r
-\r
-       MODIFIED: 9 Nov 2007 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /*\r
 (Real time)\r
@@ -35,70 +7,62 @@ Full cycle = 328860 ms
 Network delay = TBD\r
 \r
 Offset =MOD(M86-122778+(M85*29896);328860)\r
-\r
 */\r
 \r
-\r
-#include "main.h"\r
-\r
-#include "include/subway.h"\r
-#include "include/chars.h" // for PCharCoordinates only\r
-\r
-\r
 // Determines relative position of cabs, but how ???\r
-const u16 PSubway::mSubwayInitData [] = {0x4396, 0x4387, 0x4370, 0x4352, 0x4334, 0x4316, 0x42f0, 0x42b4, 0x4270, 0x41f0, 0x0000};\r
-const u32 PSubway::mCabLoopTime = 328860;\r
-const u32 PSubway::mCab0TimeOffset = 122778;\r
-const s32 PSubway::mTimingAdjust = 0;\r
-const u32 PSubway::mCabIntervalTime = 29896;\r
-const u32 PSubway::mOpenDoorOffset [] = { 0, 42500, 83000, 146800, 170700, 226200, 262800, 303200 };\r
-const u32 PSubway::mOpenDoorDuration [] = { 8500, 6900, 12000, 7500, 8800, 9000, 8500, 9300 };\r
+const uint16_t PSubway::mSubwayInitData [] = {0x4396, 0x4387, 0x4370, 0x4352, 0x4334, 0x4316, 0x42f0, 0x42b4, 0x4270, 0x41f0, 0x0000};\r
+const uint32_t PSubway::mCabLoopTime = 328860;\r
+const uint32_t PSubway::mCab0TimeOffset = 122778;\r
+const int32_t PSubway::mTimingAdjust = 0;\r
+const uint32_t PSubway::mCabIntervalTime = 29896;\r
+const uint32_t PSubway::mOpenDoorOffset [] = { 0, 42500, 83000, 146800, 170700, 226200, 262800, 303200 };\r
+const uint32_t PSubway::mOpenDoorDuration [] = { 8500, 6900, 12000, 7500, 8800, 9000, 8500, 9300 };\r
 const char* PSubway::mSubwayStationName[] = { "Pla => Oz", "Vr => Oz", "Pp => Oz", "Oz end", "Oz => Pla", "Pp => Pla", "Vr => Pla", "Pla end" };\r
 PCharCoordinates PSubway::mCabExitPositions [2][mStationsNumber];\r
 \r
 \r
 PSubway::PSubway()\r
 {\r
-  for(u8 i=0; i<mCabsNumber; i++)\r
+  for(uint8_t i=0; i<mCabsNumber; i++)\r
   {\r
     mSubways[i].mVhcId = mCabsBaseId+i;\r
     mSubways[i].mPosition = mSubwayInitData[i];\r
     mSubways[i].mDoorOpened = 0;\r
-    for(u8 j=0; j<4; j++)\r
+    for(uint8_t j=0; j<4; j++)\r
     {\r
       mSubways[i].mSeatUsersId[j] = 0;\r
     }\r
   }\r
-  \r
+\r
   mCabExitPositions[0][0].SetPosition(32000-5205, 32000-608, 32000-4766, 0x80, 0);\r
   mCabExitPositions[1][0].SetPosition(32000-5764, 32000-608, 32000-4766, 0x80, 0);\r
 \r
   mCabExitPositions[0][1].SetPosition(32000+7290, 32000-600, 32000-500, 0x80, 45);\r
-  mCabExitPositions[1][1].SetPosition(32000+7290, 32000-600, 32000-0, 0x80, 45); \r
+  mCabExitPositions[1][1].SetPosition(32000+7290, 32000-600, 32000-0, 0x80, 45);\r
 \r
   mCabExitPositions[0][2].SetPosition(32000-2300, 32000-600, 32000+7985, 0x80, 0);\r
-  mCabExitPositions[1][2].SetPosition(32000-2850, 32000-600, 32000+7985, 0x80, 0); \r
+  mCabExitPositions[1][2].SetPosition(32000-2850, 32000-600, 32000+7985, 0x80, 0);\r
 \r
   mCabExitPositions[0][3].SetPosition(32000-1700, 32000-596, 32000+1840, 0x80, 90);\r
-  mCabExitPositions[1][3].SetPosition(32000-1250, 32000-596, 32000+1840, 0x80, 90); \r
+  mCabExitPositions[1][3].SetPosition(32000-1250, 32000-596, 32000+1840, 0x80, 90);\r
 \r
   mCabExitPositions[0][4].SetPosition(32000-1700, 32000-596, 32000+1570, 0x80, 0);\r
-  mCabExitPositions[1][4].SetPosition(32000-1250, 32000-596, 32000+1570, 0x80, 0);    \r
-  \r
+  mCabExitPositions[1][4].SetPosition(32000-1250, 32000-596, 32000+1570, 0x80, 0);\r
+\r
   mCabExitPositions[0][5].SetPosition(32000-2300, 32000-600, 32000+8625, 0x80, 90);\r
-  mCabExitPositions[1][5].SetPosition(32000-2850, 32000-600, 32000+8625, 0x80, 90);   \r
\r
+  mCabExitPositions[1][5].SetPosition(32000-2850, 32000-600, 32000+8625, 0x80, 90);\r
+\r
   mCabExitPositions[0][6].SetPosition(32000+7815, 32000-600, 32000-500, 0x80, 135);\r
-  mCabExitPositions[1][6].SetPosition(32000+7815, 32000-600, 32000-0, 0x80, 135); \r
\r
+  mCabExitPositions[1][6].SetPosition(32000+7815, 32000-600, 32000-0, 0x80, 135);\r
+\r
   mCabExitPositions[0][7].SetPosition(32000-5205, 32000-608, 32000-4092, 0x80, 0);\r
-  mCabExitPositions[1][7].SetPosition(32000-5764, 32000-608, 32000-4092, 0x80, 0); \r
+  mCabExitPositions[1][7].SetPosition(32000-5764, 32000-608, 32000-4092, 0x80, 0);\r
 }\r
 \r
-u32 PSubway::GetTimeOffset(u32 nVhcId, u32 nTime)\r
+uint32_t PSubway::GetTimeOffset(uint32_t nVhcId, uint32_t nTime)\r
 {\r
-  u8 tIndex;\r
-  \r
+  uint8_t tIndex;\r
+\r
   if(!GetInfoIndex(nVhcId, &tIndex))\r
   {\r
     Console->Print(RED, BLACK, "[Error] PSubway::GetTimeOffset : invalid cab VhcId %d", nVhcId);\r
@@ -108,30 +72,30 @@ u32 PSubway::GetTimeOffset(u32 nVhcId, u32 nTime)
   return ((nTime + mCabLoopTime - mCab0TimeOffset + mTimingAdjust + (tIndex * mCabIntervalTime)) % mCabLoopTime);\r
 }\r
 \r
-u8 PSubway::GetStation(u32 nVhcId, u32 nTime, u32* TimeOffset)\r
-{  \r
-  s8 i;\r
-  \r
-  u32 tTimeOffset = GetTimeOffset(nVhcId, nTime);\r
+uint8_t PSubway::GetStation(uint32_t nVhcId, uint32_t nTime, uint32_t* TimeOffset)\r
+{\r
+  int8_t i;\r
+\r
+  uint32_t tTimeOffset = GetTimeOffset(nVhcId, nTime);\r
   if(TimeOffset)\r
   {\r
     *TimeOffset = tTimeOffset;\r
   }\r
-   \r
+\r
   for(i = mStationsNumber-1; (i >= 0) && (tTimeOffset < mOpenDoorOffset[i]); --i) ;\r
 \r
   return i;\r
 }\r
 \r
-bool PSubway::IsDoorOpen(u32 nVhcId, u32 nTime)\r
+bool PSubway::IsDoorOpen(uint32_t nVhcId, uint32_t nTime)\r
 {\r
-  u32 TimeOffset;\r
-  u8 tStation;\r
-  \r
+  uint32_t TimeOffset;\r
+  uint8_t tStation;\r
+\r
   if(!GetInfoIndex(nVhcId))\r
   {\r
     Console->Print(RED, BLACK, "[Error] PSubway::IsDoorOpen : invalid cab VhcId %d", nVhcId);\r
-    return false;  \r
+    return false;\r
   }\r
   else\r
   {\r
@@ -140,7 +104,7 @@ bool PSubway::IsDoorOpen(u32 nVhcId, u32 nTime)
   }\r
 }\r
 \r
-std::string* PSubway::GetStationName(u8 nStationId)\r
+std::string* PSubway::GetStationName(uint8_t nStationId)\r
 {\r
   if(nStationId < mStationsNumber)\r
   {\r
@@ -153,7 +117,7 @@ std::string* PSubway::GetStationName(u8 nStationId)
   }\r
 }\r
 \r
-bool PSubway::GetStationExitPosition(PCharCoordinates* nPosition, u8 nStationId, f32 nCoef)\r
+bool PSubway::GetStationExitPosition(PCharCoordinates* nPosition, uint8_t nStationId, float nCoef)\r
 {\r
   if(nStationId < mStationsNumber)\r
   {\r
@@ -164,17 +128,17 @@ bool PSubway::GetStationExitPosition(PCharCoordinates* nPosition, u8 nStationId,
   {\r
     Console->Print(RED, BLACK, "[Error] PSubway::SetStationExitPosition : invalid subway station %d", nStationId);\r
     return false;\r
-  } \r
+  }\r
 }\r
 \r
-bool PSubway::GetInfoIndex(u32 nVhcId, u8 *Index)\r
+bool PSubway::GetInfoIndex(uint32_t nVhcId, uint8_t *Index)\r
 {\r
-  s32 tIndex = nVhcId - mCabsBaseId;\r
+  int32_t tIndex = nVhcId - mCabsBaseId;\r
   if ((tIndex >= 0) && (tIndex < mCabsNumber))\r
   {\r
     if(Index)\r
     {\r
-      *Index = (u8)tIndex;\r
+      *Index = (uint8_t)tIndex;\r
     }\r
     return true;\r
   }\r
@@ -182,15 +146,15 @@ bool PSubway::GetInfoIndex(u32 nVhcId, u8 *Index)
     return false;\r
 }\r
 \r
-bool PSubway::UpdateInfo(u32 nVhcId, u16 nPosition, u8 nDoorOpened)\r
+bool PSubway::UpdateInfo(uint32_t nVhcId, uint16_t nPosition, uint8_t nDoorOpened)\r
 {\r
-  u8 tIndex;\r
+  uint8_t tIndex;\r
   if(GetInfoIndex(nVhcId, &tIndex))\r
   {\r
     mSubways[tIndex].mPosition = nPosition;\r
 //if(mSubways[tIndex].mDoorOpened != nDoorOpened)\r
 //  Console->Print("[DEBUG] Subway cab %08x : door now %s ", nVhcId, nDoorOpened ? "opened" : "closed" );\r
-  \r
+\r
     mSubways[tIndex].mDoorOpened = nDoorOpened;\r
 \r
     return true;\r
@@ -199,9 +163,9 @@ bool PSubway::UpdateInfo(u32 nVhcId, u16 nPosition, u8 nDoorOpened)
     return false;\r
 }\r
 \r
-u16 PSubway::GetPosition(u32 nVhcId)\r
+uint16_t PSubway::GetPosition(uint32_t nVhcId)\r
 {\r
-  u8 tIndex;\r
+  uint8_t tIndex;\r
   if(GetInfoIndex(nVhcId, &tIndex))\r
   {\r
     return mSubways[tIndex].mPosition;\r
@@ -210,13 +174,13 @@ u16 PSubway::GetPosition(u32 nVhcId)
     return 0;\r
 }\r
 \r
-u8 PSubway::GetFreeSeat(u32 nVhcId)\r
+uint8_t PSubway::GetFreeSeat(uint32_t nVhcId)\r
 {\r
-  u8 tIndex;\r
-  u8 tSeatFound = 0;\r
+  uint8_t tIndex;\r
+  uint8_t tSeatFound = 0;\r
   if(GetInfoIndex(nVhcId, &tIndex))\r
   {\r
-    for(u8 j=0; j<4; j++)\r
+    for(uint8_t j=0; j<4; j++)\r
     {\r
       if(! mSubways[tIndex].mSeatUsersId[j])\r
       {\r
@@ -230,9 +194,9 @@ u8 PSubway::GetFreeSeat(u32 nVhcId)
     return 0;\r
 }\r
 \r
-bool PSubway::SetSeatUser(u32 nVhcId, u8 nSeat, u32 nCharId)\r
+bool PSubway::SetSeatUser(uint32_t nVhcId, uint8_t nSeat, uint32_t nCharId)\r
 {\r
-  u8 tIndex;\r
+  uint8_t tIndex;\r
 \r
   if(GetInfoIndex(nVhcId, &tIndex) && (nSeat >= 1) && (nSeat <= 4))\r
   {\r
@@ -247,9 +211,9 @@ bool PSubway::SetSeatUser(u32 nVhcId, u8 nSeat, u32 nCharId)
   return false;\r
 }\r
 \r
-bool PSubway::UnsetSeatUser(u32 nVhcId, u8 nSeat, u32 nCharId)\r
+bool PSubway::UnsetSeatUser(uint32_t nVhcId, uint8_t nSeat, uint32_t nCharId)\r
 {\r
-  u8 tIndex;\r
+  uint8_t tIndex;\r
 \r
   if(GetInfoIndex(nVhcId, &tIndex) && (nSeat >= 1) && (nSeat <= 4))\r
   {\r
diff --git a/TinNS/Source/GameServer/Subway.hxx b/TinNS/Source/GameServer/Subway.hxx
new file mode 100644 (file)
index 0000000..40197e3
--- /dev/null
@@ -0,0 +1,56 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <string>\r
+\r
+class PSubway {\r
+  friend class PMsgBuilder;\r
+\r
+  struct PSubwayInfo\r
+  {\r
+    uint16_t mVhcId;\r
+    uint16_t mPosition;\r
+    uint8_t mDoorOpened;\r
+    uint32_t mSeatUsersId[4];\r
+  };\r
+\r
+  public:\r
+    static const uint16_t mCabsNumber = 11;\r
+    static const uint32_t mCabsBaseId = 0x03f2;\r
+    static const uint32_t mCabsBaseHealth = 100; //should take that from .def instead...\r
+    static const uint8_t mStationsNumber = 8;\r
+\r
+  private:\r
+    static const uint16_t mSubwayInitData [];\r
+    static const uint32_t mCabLoopTime;\r
+    static const uint32_t mCab0TimeOffset;\r
+    static const int32_t mTimingAdjust;\r
+    static const uint32_t mCabIntervalTime;\r
+    static const uint32_t mOpenDoorOffset [];\r
+    static const uint32_t mOpenDoorDuration [];\r
+    static const char* mSubwayStationName [];\r
+    static PCharCoordinates mCabExitPositions [2][mStationsNumber];\r
+\r
+    PSubwayInfo mSubways[mCabsNumber];\r
+\r
+public:\r
+    bool GetInfoIndex(uint32_t nVhcId, uint8_t *Index = NULL);\r
+\r
+  public:\r
+    PSubway();\r
+    //~PSubway();\r
+\r
+    inline bool IsValidSubwayCab(uint32_t nVhcId) {return GetInfoIndex(nVhcId); }\r
+    bool UpdateInfo(uint32_t nVhcId, uint16_t nPosition, uint8_t nDoorOpened);\r
+    uint16_t GetPosition(uint32_t nVhcId);\r
+\r
+    uint32_t GetTimeOffset(uint32_t nVhcId, uint32_t nTime);\r
+    uint8_t GetStation(uint32_t nVhcId, uint32_t nTime, uint32_t* TimeOffset = NULL);\r
+    bool IsDoorOpen(uint32_t nVhcId, uint32_t nTime);\r
+    std::string* GetStationName(uint8_t nStationId);\r
+    bool GetStationExitPosition(PCharCoordinates* nPosition, uint8_t nStationId, float nCoef = 0.5);\r
+\r
+    uint8_t GetFreeSeat(uint32_t nVhcId);\r
+    bool SetSeatUser(uint32_t nVhcId, uint8_t nSeat, uint32_t nCharId);\r
+    bool UnsetSeatUser(uint32_t nVhcId, uint8_t nSeat, uint32_t nCharId);\r
+};\r
similarity index 50%
rename from server/src/game/terminal.cpp
rename to TinNS/Source/GameServer/Terminal.cxx
index 0577627..48525ff 100644 (file)
@@ -1,40 +1,6 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...)
-
-       MODIFIED: 08 Jan 2007 Namikon
-       REASON: - Created
-       MODIFIED: 09 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-#include "include/terminal.h"
-#include "include/msgbuilder.h"
-
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
 PTerminal::PTerminal()
 {
@@ -48,7 +14,7 @@ void PTerminal::EraseVars()
     mResultFields = 0;
 }
 
-u8 PTerminal::GetNewEmailCount(PClient* nClient, bool nNoticeClient)
+uint8_t PTerminal::GetNewEmailCount(PClient* nClient, bool nNoticeClient)
 {
     MYSQL_RES *result = NULL;
     MYSQL_ROW row;
@@ -74,7 +40,7 @@ u8 PTerminal::GetNewEmailCount(PClient* nClient, bool nNoticeClient)
     if(gDevDebug) Console->Print("[DEBUG] Found new email, sending notice");
 
     row = mysql_fetch_row(result);
-    u8 tRetVal = (u8)atoi(row[0]);
+    uint8_t tRetVal = (uint8_t)atoi(row[0]);
     MySQL->FreeGameSQLResult(result);
 
     if(nNoticeClient)
@@ -85,4 +51,3 @@ u8 PTerminal::GetNewEmailCount(PClient* nClient, bool nNoticeClient)
 
     return tRetVal;
 }
-
diff --git a/TinNS/Source/GameServer/Terminal.hxx b/TinNS/Source/GameServer/Terminal.hxx
new file mode 100644 (file)
index 0000000..6e92092
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+class PTerminal {\r
+private:\r
+    void SendTryAccessAnswer(PClient* nClient, char *nArea, bool nAllowed);\r
+    char mSQLQuery[500];\r
+\r
+    int mResultFields;\r
+    void EraseVars();\r
+\r
+    char mConPrefix[50];\r
+\r
+    inline bool ChkOpt(uint8_t nNumOptions, uint8_t nReqOpt) { if(nNumOptions < nReqOpt) return false; else return true; };\r
+    bool DoStockXCheck(PClient* nClient, int nAmountEntered, int nNewAmount);\r
+\r
+public:\r
+    PTerminal();\r
+    //~PTerminal();\r
+    // Check accesslevel of Player for various Terminal actions\r
+    bool CheckAccess(PClient* nClient, char *nArea, uint16_t nCmdNr, char *nOption1, char *nOption2, char *nOption3);\r
+    uint8_t GetNewEmailCount(PClient* nClient, bool nNoticeClient = true);\r
+    // Handle ReceiveDB queries\r
+    bool HandleQueryDB(PClient* nClient, std::string *nDBCommandName, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions);\r
+    bool HandleReceiveDB(PClient* nClient, uint16_t mTerminalSessionId, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions, uint16_t nDBID, uint8_t nUnknown);\r
+    bool HandleTryAccess(PClient* nClient, uint16_t mTerminalSessionId, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions, uint16_t nDBID, uint8_t nUnknown, bool nCheckOnly = false);\r
+    bool HandleUpdateDB(PClient* nClient, uint16_t mTerminalSessionId, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions, uint16_t nDBID, uint8_t nUnknown);\r
+};\r
similarity index 81%
rename from server/src/game/terminal_querydb.cpp
rename to TinNS/Source/GameServer/TerminalQueryDatabase.cxx
index f01d0c7..ecc03ac 100644 (file)
@@ -1,41 +1,8 @@
-/*
-   TinNS (TinNS is not a Neocron Server)
-   Copyright (C) 2005 Linux Addicted Community
-   maintainer Akiko <akiko@gmx.org>
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
 
-   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)
+bool PTerminal::HandleQueryDB(PClient* nClient, std::string *nDBCommandName, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions)
 {
     EraseVars();
 
similarity index 95%
rename from server/src/game/terminal_receivedb.cpp
rename to TinNS/Source/GameServer/TerminalReceiveDatabase.cxx
index d107638..29a7c61 100644 (file)
@@ -1,43 +1,8 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
+#include <cstring>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       terminal_receivedb.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...)\r
-                                Sub-File for terminal "ReceiveDB" command\r
-\r
-       MODIFIED: 12 Jan 2007 Namikon\r
-       REASON: - Created\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/terminal.h"\r
-#include "include/msgbuilder.h"\r
-\r
-bool PTerminal::HandleReceiveDB(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown)\r
+bool PTerminal::HandleReceiveDB(PClient* nClient, uint16_t mTerminalSessionId, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions, uint16_t nDBID, uint8_t nUnknown)\r
 {\r
     EraseVars();\r
     int nAccessLevel = nClient->GetAccountLevel();\r
@@ -1027,7 +992,7 @@ bool PTerminal::HandleReceiveDB(PClient* nClient, u16 mTerminalSessionId, std::s
         // Loop all result fields and push answers into Message\r
         for (int t = 0; t < mResultFields; t++)\r
         {\r
-            *tDBResult << ( u16 )(strlen(row[t]) + 1);\r
+            *tDBResult << ( uint16_t )(strlen(row[t]) + 1);\r
             *tDBResult << row[t];\r
         }\r
     }\r
similarity index 90%
rename from server/src/game/terminal_tryaccess.cpp
rename to TinNS/Source/GameServer/TerminalTryAccess.cxx
index 79602a2..af52fcb 100644 (file)
@@ -1,47 +1,13 @@
- /*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
- 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 "include/terminal.h"
-#include "include/msgbuilder.h"
+#include <cstring>
+#include "GameServer/Includes.hxx"
+#include "Common/Includes.hxx"
+
 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 +17,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,64 +41,64 @@ 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)
+
+bool PTerminal::HandleTryAccess(PClient* nClient, uint16_t mTerminalSessionId, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions, uint16_t nDBID, uint8_t nUnknown, bool nCheckOnly)
  {
     // Empty buffer
     EraseVars();
+
     // Stop gcc annoying about unused var
-    u8 dummy2 = nUnknown;
-    u16 dummy3 = mTerminalSessionId;
+    uint8_t dummy2 = nUnknown;
+    uint16_t dummy3 = mTerminalSessionId;
     dummy3 = dummy2;
+
     char mSQLQuery[500];
     bool tGetResultFromSQL = false;
      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;
         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!
@@ -355,6 +321,6 @@ bool PTerminal::HandleTryAccess(PClient* nClient, u16 mTerminalSessionId, std::s
         PMessage* tmpMsg = MsgBuilder->BuildTryAccessAnswerMsg(nClient, tCmd, tAllowed);
         nClient->SendUDPMessage(tmpMsg);
      }
+
     return tAllowed;
  }
similarity index 92%
rename from server/src/game/terminal_updatedb.cpp
rename to TinNS/Source/GameServer/TerminalUpdateDatabase.cxx
index b5a4626..96a57b1 100644 (file)
@@ -1,43 +1,9 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
+#include <cstring>\r
+#include <sstream>\r
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       terminal_upcatedb.cpp - Management class for Terminal actions (Citycom, keys, vehicledepot, ...)\r
-                               Sub-File for terminal "UpdateDB" command\r
-\r
-       MODIFIED: 12 Jan 2007 Namikon\r
-       REASON: - Created\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-#include "include/terminal.h"\r
-#include "include/msgbuilder.h"\r
-\r
-\r
-bool PTerminal::HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown)\r
+bool PTerminal::HandleUpdateDB(PClient* nClient, uint16_t mTerminalSessionId, std::string *nCommandName, std::string *nOptions, uint8_t nNumOptions, uint16_t nDBID, uint8_t nUnknown)\r
 {\r
     std::ostringstream tLongSQL; // omg my eyes... Stringstream is one of the worst inventions ever! Stick with printf syntax!!111\r
     char tShortSQL[1024]; // Use this for small updates that will not exceed 1kb\r
similarity index 69%
rename from server/src/game/vehicle.cpp
rename to TinNS/Source/GameServer/Vehicle.cxx
index 56e79f0..2eb6e05 100644 (file)
@@ -1,65 +1,26 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       vehicle.cpp - Vehicle handling\r
-\r
-       Authors:\r
-       - Namikon\r
-       - Akiko\r
-\r
-       MODIFIED: 08 Jan 2006 Namikon\r
-       REASON: - initial release by Namikon\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/vehicle.h"\r
-#include "include/worlds.h"\r
-\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 // PVhcCoordinates\r
-void PVhcCoordinates::SetInterpolate( const PVhcCoordinates& Pos1, const PVhcCoordinates& Pos2, f32 nCoef )\r
+void PVhcCoordinates::SetInterpolate( const PVhcCoordinates& Pos1, const PVhcCoordinates& Pos2, float nCoef )\r
 {\r
   if (( nCoef < 0 ) || ( nCoef > 1 ) )\r
   {\r
     Console->Print( RED, BLACK, "[Error] PVhcCoordinates::Interpolate : Invalid nCoef value: %f", nCoef );\r
     nCoef = 0;\r
   }\r
-  f32 rCoef = 1 - nCoef;\r
-\r
-  mY = ( u16 )( rCoef * Pos1.mY + nCoef * Pos2.mY );\r
-  mZ = ( u16 )( rCoef * Pos1.mZ + nCoef * Pos2.mZ );\r
-  mX = ( u16 )( rCoef * Pos1.mX + nCoef * Pos2.mX );\r
-  mUD = ( u8 )( rCoef * Pos1.mUD + nCoef * Pos2.mUD );\r
-  mLR = ( u16 )( rCoef * Pos1.mLR + nCoef * Pos2.mLR );\r
-  mRoll = ( u16 )( rCoef * Pos1.mRoll + nCoef * Pos2.mRoll );\r
+  float rCoef = 1 - nCoef;\r
+\r
+  mY = ( uint16_t )( rCoef * Pos1.mY + nCoef * Pos2.mY );\r
+  mZ = ( uint16_t )( rCoef * Pos1.mZ + nCoef * Pos2.mZ );\r
+  mX = ( uint16_t )( rCoef * Pos1.mX + nCoef * Pos2.mX );\r
+  mUD = ( uint8_t )( rCoef * Pos1.mUD + nCoef * Pos2.mUD );\r
+  mLR = ( uint16_t )( rCoef * Pos1.mLR + nCoef * Pos2.mLR );\r
+  mRoll = ( uint16_t )( rCoef * Pos1.mRoll + nCoef * Pos2.mRoll );\r
 }\r
 \r
-void PVhcCoordinates::SetPosition( u16 nY, u16 nZ, u16 nX, u8 nUD, u16 nLR, u16 nRoll, u8 nAct, u16 nUnknown, u8 nFF )\r
+void PVhcCoordinates::SetPosition( uint16_t nY, uint16_t nZ, uint16_t nX, uint8_t nUD, uint16_t nLR, uint16_t nRoll, uint8_t nAct, uint16_t nUnknown, uint8_t nFF )\r
 {\r
   mY = nY;\r
   mZ = nZ;\r
@@ -74,20 +35,20 @@ void PVhcCoordinates::SetPosition( u16 nY, u16 nZ, u16 nX, u8 nUD, u16 nLR, u16
 \r
 // PVehicleInformation\r
 //Tmp\r
-const u8 VhcTypes[] = {  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,\r
+const uint8_t VhcTypes[] = {  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,\r
                          11, 12, 13, 50, 60, 62, 64, 65, 70\r
                       }; // (adv.) assault gliders discarded because not ok\r
 #define VHC_DISABLE_NOVULARI\r
 #ifndef VHC_DISABLE_NOVULARI\r
-const u8 VhcTypesNum = 19;\r
+const uint8_t VhcTypesNum = 19;\r
 #else\r
-const u8 VhcTypesNum = 18;\r
+const uint8_t VhcTypesNum = 18;\r
 #endif\r
 \r
-bool PVehicleInformation::Load( u32 nVehicleId )\r
+bool PVehicleInformation::Load( uint32_t nVehicleId )\r
 {\r
-  u8 i;\r
-  u8 nVId = nVehicleId % 100; //Tmp\r
+  uint8_t i;\r
+  uint8_t nVId = nVehicleId % 100; //Tmp\r
   for ( i = 0; ( i < VhcTypesNum ) && ( VhcTypes[i] < nVId ); i++ ) ; //Tmp\r
   if (( i < VhcTypesNum ) && ( VhcTypes[i] == nVId ) ) //Tmp\r
   {\r
@@ -120,7 +81,7 @@ bool PVehicleInformation::Destroy()
     return false;\r
 }\r
 \r
-bool PVehicleInformation::SetStatus( u8 nStatus )\r
+bool PVehicleInformation::SetStatus( uint8_t nStatus )\r
 {\r
   if (( mStatus != 2 ) && ( nStatus <= 2 ) )\r
   {\r
@@ -132,9 +93,9 @@ bool PVehicleInformation::SetStatus( u8 nStatus )
 }\r
 \r
 // PSpawnedVehicule\r
-const u8 PSpawnedVehicle::mSeatsFlags[] = { 1, 2, 4, 8, 16, 32, 64, 128 };\r
+const uint8_t PSpawnedVehicle::mSeatsFlags[] = { 1, 2, 4, 8, 16, 32, 64, 128 };\r
 \r
-PSpawnedVehicle::PSpawnedVehicle( u32 nLocalId, PVehicleInformation const* nVhcInfo, u32 nLocation, PVhcCoordinates const* nVhcPos )\r
+PSpawnedVehicle::PSpawnedVehicle( uint32_t nLocalId, PVehicleInformation const* nVhcInfo, uint32_t nLocation, PVhcCoordinates const* nVhcPos )\r
 {\r
   mLocalId = nLocalId;\r
   mInfo = *nVhcInfo;\r
@@ -169,7 +130,7 @@ PSpawnedVehicle::PSpawnedVehicle( u32 nLocalId, PVehicleInformation const* nVhcI
   }\r
 }\r
 \r
-void PSpawnedVehicle::SetLocation( u32 nLocation )\r
+void PSpawnedVehicle::SetLocation( uint32_t nLocation )\r
 {\r
   mLocation = nLocation;\r
 }\r
@@ -195,7 +156,7 @@ int PSpawnedVehicle::GetNumSeats() const
   return mVhcDef->GetNumSeats();\r
 }\r
 \r
-bool PSpawnedVehicle::SetSeatUser( u8 nSeatId, u32 nCharId )\r
+bool PSpawnedVehicle::SetSeatUser( uint8_t nSeatId, uint32_t nCharId )\r
 {\r
   if ( nSeatId < mVhcDef->GetNumSeats() )\r
   {\r
@@ -210,7 +171,7 @@ bool PSpawnedVehicle::SetSeatUser( u8 nSeatId, u32 nCharId )
   return false;\r
 }\r
 \r
-bool PSpawnedVehicle::UnsetSeatUser( u8 nSeatId, u32 nCharId )\r
+bool PSpawnedVehicle::UnsetSeatUser( uint8_t nSeatId, uint32_t nCharId )\r
 {\r
   if ( nSeatId < mVhcDef->GetNumSeats() )\r
   {\r
@@ -225,7 +186,7 @@ bool PSpawnedVehicle::UnsetSeatUser( u8 nSeatId, u32 nCharId )
   return false;\r
 }\r
 \r
-bool PSpawnedVehicle::IsCharInside( u32 nCharId ) const\r
+bool PSpawnedVehicle::IsCharInside( uint32_t nCharId ) const\r
 {\r
   for ( int i = 0; i < mVhcDef->GetNumSeats(); ++i )\r
   {\r
@@ -235,7 +196,7 @@ bool PSpawnedVehicle::IsCharInside( u32 nCharId ) const
   return false;\r
 }\r
 \r
-u8 PSpawnedVehicle::GetFirstFreeSeat() const\r
+uint8_t PSpawnedVehicle::GetFirstFreeSeat() const\r
 {\r
   for ( int i = 0; i < mVhcDef->GetNumSeats(); ++i )\r
   {\r
@@ -245,9 +206,9 @@ u8 PSpawnedVehicle::GetFirstFreeSeat() const
 \r
   return 255;\r
 }\r
-/*u8 PSpawnedVehicle::GetFreeSeats() const\r
+/*uint8_t PSpawnedVehicle::GetFreeSeats() const\r
 {\r
-  u8 bitField = 0;\r
+  uint8_t bitField = 0;\r
 \r
   for(int i = mVhcDef->GetNumSeats() - 1; i >= 0 ; --i)\r
   {\r
@@ -276,7 +237,7 @@ bool PVehicles::RegisterSpawnedVehicle( PSpawnedVehicle* nSpawnedVehicle )
   return Result.second;\r
 }\r
 \r
-bool PVehicles::UnregisterSpawnedVehicle( u32 nVehicleId )\r
+bool PVehicles::UnregisterSpawnedVehicle( uint32_t nVehicleId )\r
 {\r
   PSpawnedVhcMap::iterator it = mSpawnedVehicles.find( nVehicleId );\r
   if ( it != mSpawnedVehicles.end() )\r
@@ -290,21 +251,21 @@ bool PVehicles::UnregisterSpawnedVehicle( u32 nVehicleId )
   }\r
 }\r
 \r
-//u32 PVehicles::CreateVehicle(u32 nOwnerChar, u8 mVehicleType) {}\r
-//bool PVehicles::RegisterVehicleOwner(u32 nVehicleId, u32 nOwnerChar) {}\r
-//bool PVehicles::DestroyVehicle(u32 nVehicleId) {}\r
+//uint32_t PVehicles::CreateVehicle(uint32_t nOwnerChar, uint8_t mVehicleType) {}\r
+//bool PVehicles::RegisterVehicleOwner(uint32_t nVehicleId, uint32_t nOwnerChar) {}\r
+//bool PVehicles::DestroyVehicle(uint32_t nVehicleId) {}\r
 \r
-bool PVehicles::IsValidVehicle( u32 nVehicleId, bool nCheckOwner, u32 nOwnerId ) const\r
+bool PVehicles::IsValidVehicle( uint32_t nVehicleId, bool nCheckOwner, uint32_t nOwnerId ) const\r
 {\r
   // Look in DB\r
   // tmp\r
-  u32 tVehicleId = nVehicleId; tVehicleId = tVehicleId;\r
+  uint32_t tVehicleId = nVehicleId; tVehicleId = tVehicleId;\r
   bool tCheckOwner = nCheckOwner; tCheckOwner = tCheckOwner;\r
-  u32 tOwnerId = nOwnerId; tOwnerId = tOwnerId;\r
+  uint32_t tOwnerId = nOwnerId; tOwnerId = tOwnerId;\r
   return true; // tmp\r
 }\r
 \r
-PSpawnedVehicle* PVehicles::GetSpawnedVehicle( u32 nVehicleId ) const\r
+PSpawnedVehicle* PVehicles::GetSpawnedVehicle( uint32_t nVehicleId ) const\r
 {\r
   PSpawnedVhcMap::const_iterator it = mSpawnedVehicles.find( nVehicleId );\r
   if ( it != mSpawnedVehicles.end() )\r
@@ -317,7 +278,7 @@ PSpawnedVehicle* PVehicles::GetSpawnedVehicle( u32 nVehicleId ) const
   }\r
 }\r
 \r
-bool PVehicles::GetVehicleInfo( u32 nVehicleId, PVehicleInformation* nInfo ) const\r
+bool PVehicles::GetVehicleInfo( uint32_t nVehicleId, PVehicleInformation* nInfo ) const\r
 {\r
   PSpawnedVehicle* tVhc = GetSpawnedVehicle( nVehicleId );\r
   if ( tVhc )\r
@@ -331,18 +292,18 @@ bool PVehicles::GetVehicleInfo( u32 nVehicleId, PVehicleInformation* nInfo ) con
   }\r
 }\r
 \r
-PVhcInfoList* PVehicles::GetCharVehicles( u32 nCharId, u16 nMaxCount, u16 nStartIndex )\r
+PVhcInfoList* PVehicles::GetCharVehicles( uint32_t nCharId, uint16_t nMaxCount, uint16_t nStartIndex )\r
 {\r
   PVhcInfoList* Entries = new PVhcInfoList();\r
   PVehicleInformation* InfoEntry;\r
   // Tmp implementation\r
-  u16 LimitIndex = nStartIndex + nMaxCount;\r
+  uint16_t LimitIndex = nStartIndex + nMaxCount;\r
   if ( !nMaxCount || ( VhcTypesNum < LimitIndex ) )\r
   {\r
     LimitIndex = VhcTypesNum;\r
   }\r
 \r
-  for ( u16 i = nStartIndex; ( i < LimitIndex ) ; ++i )\r
+  for ( uint16_t i = nStartIndex; ( i < LimitIndex ) ; ++i )\r
   {\r
     InfoEntry = new PVehicleInformation();\r
     if ( GetVehicleInfo( nCharId * 100 + VhcTypes[i], InfoEntry ) )\r
@@ -358,7 +319,7 @@ PVhcInfoList* PVehicles::GetCharVehicles( u32 nCharId, u16 nMaxCount, u16 nStart
   return Entries;\r
 }\r
 \r
-PSpawnedVehicle* PVehicles::SpawnVehicle( u32 nVehicleId, u32 nLocation, PVhcCoordinates const* nVhcPos )\r
+PSpawnedVehicle* PVehicles::SpawnVehicle( uint32_t nVehicleId, uint32_t nLocation, PVhcCoordinates const* nVhcPos )\r
 {\r
   PSpawnedVehicle* newVhc = NULL;\r
   PWorld* cWorld;\r
@@ -370,7 +331,7 @@ PSpawnedVehicle* PVehicles::SpawnVehicle( u32 nVehicleId, u32 nLocation, PVhcCoo
 \r
     if ( cWorld && GetVehicleInfo( nVehicleId, &nVhcInfo ) )\r
     {\r
-      newVhc = cWorld->GetSpawnedVehicules()->SpawnVehicle( &nVhcInfo, nVhcPos );\r
+      newVhc = cWorld->GetSpawnedVehicles()->SpawnVehicle( &nVhcInfo, nVhcPos );\r
       if ( newVhc )\r
       {\r
         if ( !RegisterSpawnedVehicle( newVhc ) )\r
@@ -390,7 +351,7 @@ PSpawnedVehicle* PVehicles::SpawnVehicle( u32 nVehicleId, u32 nLocation, PVhcCoo
   return newVhc;\r
 }\r
 \r
-bool PVehicles::UnspawnVehicle( u32 nVehicleId )\r
+bool PVehicles::UnspawnVehicle( uint32_t nVehicleId )\r
 {\r
   PWorld* cWorld;\r
   bool Result = false;\r
@@ -407,7 +368,7 @@ bool PVehicles::UnspawnVehicle( u32 nVehicleId )
         Console->Print( RED, BLACK, "[Error] PVehicles::UnspawnVehicle : Could not save vhc %d", nVehicleId );\r
       }\r
 \r
-      Result = cWorld->GetSpawnedVehicules()->UnspawnVehicle( it->second->GetLocalId() );\r
+      Result = cWorld->GetSpawnedVehicles()->UnspawnVehicle( it->second->GetLocalId() );\r
       if ( Result )\r
       {\r
         if ( !UnregisterSpawnedVehicle( nVehicleId ) )\r
@@ -438,7 +399,7 @@ PSpawnedVehicles::~PSpawnedVehicles()
 PSpawnedVehicle* PSpawnedVehicles::SpawnVehicle( PVehicleInformation const* nVhcInfo, PVhcCoordinates const* nVhcPos )\r
 {\r
   PSpawnedVehicle* newVhc = NULL;\r
-  u32 nSize;\r
+  uint32_t nSize;\r
 \r
   if ( nVhcInfo->GetStatus() == 0 ) // only if in garage\r
   {\r
@@ -467,7 +428,7 @@ PSpawnedVehicle* PSpawnedVehicles::SpawnVehicle( PVehicleInformation const* nVhc
   return newVhc;\r
 }\r
 \r
-PSpawnedVehicle* PSpawnedVehicles::GetVehicle( u32 nLocalId )\r
+PSpawnedVehicle* PSpawnedVehicles::GetVehicle( uint32_t nLocalId )\r
 {\r
   if (( nLocalId <= mVhcBaseLocalId ) && ( nLocalId > ( mVhcBaseLocalId - mSpawnedVehicles.size() ) ) )\r
   {\r
@@ -479,7 +440,7 @@ PSpawnedVehicle* PSpawnedVehicles::GetVehicle( u32 nLocalId )
   }\r
 }\r
 \r
-PSpawnedVehicle* PSpawnedVehicles::GetVehicleByGlobalId( u32 nVehicleId ) const\r
+PSpawnedVehicle* PSpawnedVehicles::GetVehicleByGlobalId( uint32_t nVehicleId ) const\r
 {\r
   for ( PSpawnedVhcVector::const_iterator it = mSpawnedVehicles.begin(); it != mSpawnedVehicles.end(); it++ )\r
   {\r
@@ -492,9 +453,9 @@ PSpawnedVehicle* PSpawnedVehicles::GetVehicleByGlobalId( u32 nVehicleId ) const
   return NULL;\r
 }\r
 \r
-bool PSpawnedVehicles::UnspawnVehicle( u32 nLocalId )\r
+bool PSpawnedVehicles::UnspawnVehicle( uint32_t nLocalId )\r
 {\r
-  u16 Index;\r
+  uint16_t Index;\r
   PSpawnedVehicle* tVhc;\r
 \r
   if (( nLocalId <= mVhcBaseLocalId ) && ( nLocalId > ( mVhcBaseLocalId - mSpawnedVehicles.size() ) ) )\r
diff --git a/TinNS/Source/GameServer/Vehicle.hxx b/TinNS/Source/GameServer/Vehicle.hxx
new file mode 100644 (file)
index 0000000..d7c407b
--- /dev/null
@@ -0,0 +1,188 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+#include <queue>\r
+#include <vector>\r
+\r
+class PDefVhc;\r
+\r
+class PVhcCoordinates {\r
+    friend class PSpawnedVehicle;\r
+\r
+  private:\r
+    uint16_t mY;     // Y-Position in world\r
+    uint16_t mZ;     // Z-Position in world\r
+    uint16_t mX;     // X-Position in world\r
+    uint8_t mUD;     // Up - Mid - Down (d6 - 80 - 2a) // Pitch\r
+    uint16_t mLR;     // Yaw\r
+    uint16_t mRoll;\r
+    uint16_t mUnknown; // Usually 0x0001\r
+    uint8_t mFF; // Usually 0xff ...\r
+    uint8_t mAct;    // Last user action state\r
+    // mAct: bit field\r
+    //0x00 = not moving\r
+    //0x01 = Left\r
+    //0x02 = Right\r
+    //0x04 = Forward\r
+    //0x08 = Back\r
+    //0x20 = Pushing down\r
+    //0x40 = Pulling up\r
+\r
+  public:\r
+    inline PVhcCoordinates() { mX = mY = mZ = mAct = 0; mUD = 128; mLR = 34683; mRoll = 32403;}\r
+\r
+    void SetPosition( uint16_t nY, uint16_t nZ, uint16_t nX, uint8_t nUD, uint16_t nLR, uint16_t nRoll, uint8_t nAct = 0, uint16_t nUnknown = 1, uint8_t nFF = 0xff );\r
+    void SetInterpolate( const PVhcCoordinates& Pos1, const PVhcCoordinates& Pos2, float nCoef );\r
+    inline uint16_t GetX() const { return mX; }\r
+    inline uint16_t GetY() const { return mY; }\r
+    inline uint16_t GetZ() const { return mZ; }\r
+    inline uint8_t GetUD() const { return mUD; }\r
+    inline uint16_t GetLR() const { return mLR; }\r
+    inline uint16_t GetRoll() const { return mRoll; }\r
+    inline uint8_t GetAct() const { return mAct; }\r
+    inline uint8_t GetUnknown() const { return mUnknown; }\r
+    inline uint8_t GetFF() const { return mFF; }\r
+};\r
+\r
+class PVehicleInformation\r
+{\r
+    friend class PSpawnedVehicle;\r
+    friend class PVehicles;\r
+\r
+  private:\r
+    uint32_t mVehicleId;\r
+    uint32_t mOwnerCharId;\r
+    uint32_t mHealth; // or float ???\r
+    uint8_t mVehicleType;\r
+    uint8_t mStatus; //vhcStatus 0:parking, 1:in_service, 2:destroyed\r
+\r
+  public:\r
+    inline PVehicleInformation( uint32_t nVehicleId = 0, uint32_t nOwnerCharId = 0, uint32_t nHealth = 0, uint8_t nVehicleType = 0, uint8_t nStatus = 0 ) :\r
+        mVehicleId( nVehicleId ),\r
+        mOwnerCharId( nOwnerCharId ),\r
+        mHealth( nHealth ),\r
+        mVehicleType( nVehicleType ),\r
+        mStatus( nStatus )\r
+    { }\r
+\r
+    inline uint32_t GetVehicleId() const { return mVehicleId; }\r
+    inline uint32_t GetOwnerCharId() const { return mOwnerCharId; }\r
+    inline uint32_t GetHealth() const { return mHealth; } // or float ???\r
+    inline uint8_t GetVehicleType() const { return mVehicleType; }\r
+    inline uint8_t GetStatus() const { return mStatus; }\r
+    bool SetStatus( uint8_t nStatus );\r
+\r
+    bool Load( uint32_t nVehicleId );\r
+    bool Save();\r
+    bool Destroy();\r
+};\r
+\r
+class PSpawnedVehicle\r
+{\r
+  private:\r
+    static const uint8_t mSeatsFlags[];\r
+\r
+  private:\r
+    uint32_t mLocalId;\r
+    PVehicleInformation mInfo;\r
+    uint32_t mLocation;\r
+    PVhcCoordinates mCoords;\r
+    const PDefVhc* mVhcDef;\r
+\r
+    uint32_t mSeatUserId[8];\r
+    uint8_t mFreeSeatsFlags;\r
+    uint8_t mNbFreeSeats;\r
+\r
+    uint16_t minmax[4][2]; //Temp\r
+\r
+  public:\r
+    PSpawnedVehicle( uint32_t nLocalId, PVehicleInformation const* nVhcInfo, uint32_t nLocation, PVhcCoordinates const* nVhcPos );\r
+\r
+    inline uint32_t GetVehicleId() const { return mInfo.mVehicleId; }\r
+    inline uint32_t GetLocalId() const { return mLocalId; }\r
+    inline const PVhcCoordinates& GetPosition() const { return mCoords; }\r
+    inline const PVehicleInformation& GetInformation() const { return mInfo; }\r
+    inline bool SetStatus( uint8_t nStatus ) { return mInfo.SetStatus( nStatus ); }\r
+\r
+    void SetLocation( uint32_t nLocation );\r
+    inline uint32_t GetLocation() const { return mLocation; }\r
+    void SetPosition( PVhcCoordinates const* nVhcPos );\r
+\r
+    inline bool Save() { return mInfo.Save(); }\r
+\r
+    int GetNumSeats() const;\r
+    inline uint32_t GetSeatUser( uint8_t nSeatId ) const { return (( nSeatId < 8 ) ? mSeatUserId[nSeatId] : 0 ); }\r
+    bool SetSeatUser( uint8_t nSeatId, uint32_t nCharId );\r
+    bool UnsetSeatUser( uint8_t nSeatId, uint32_t nCharId );\r
+    bool IsCharInside( uint32_t nCharId ) const;\r
+    inline uint8_t GetFreeSeatsFlags() const { return mFreeSeatsFlags; }\r
+    inline uint8_t GetNbFreeSeats() const { return mNbFreeSeats; }\r
+    uint8_t GetFirstFreeSeat() const;\r
+\r
+    //SetHealth(const uint32_t nHealth);\r
+    //uint32_t DoDamage(const uint32_t nHealthDec);\r
+    //uint32_t DoRepair(const uint32_t nHealthInc);\r
+};\r
+\r
+typedef std::map<uint32_t, PSpawnedVehicle*> PSpawnedVhcMap;\r
+typedef std::queue<PVehicleInformation*> PVhcInfoList;\r
+class PVehicles\r
+{\r
+  private:\r
+    PSpawnedVhcMap mSpawnedVehicles;\r
+\r
+    bool RegisterSpawnedVehicle( PSpawnedVehicle*  nSpawnedVehicle );\r
+    bool UnregisterSpawnedVehicle( uint32_t nVehicleId );\r
+\r
+  public:\r
+    PVehicles();\r
+    ~PVehicles();\r
+\r
+    //uint32_t CreateVehicle(uint32_t nOwnerChar, uint8_t mVehicleType);\r
+    //bool RegisterVehicleOwner(uint32_t nVehiculeId, uint32_t nOwnerChar);\r
+    //bool DestroyVehicle(uint32_t nVehiculeId);\r
+    bool IsValidVehicle( uint32_t nVehicleId, bool nCheckOwner = false, uint32_t nOwnerId = 0 ) const;\r
+    inline bool IsSpawned( uint32_t nVehicleId ) const { return ( mSpawnedVehicles.find( nVehicleId ) != mSpawnedVehicles.end() ); }\r
+    PSpawnedVehicle* GetSpawnedVehicle( uint32_t nVehicleId ) const;\r
+    bool GetVehicleInfo( uint32_t nVehicleId, PVehicleInformation* nInfo ) const;\r
+    PSpawnedVehicle* SpawnVehicle( uint32_t nVehicleId, uint32_t nLocation, PVhcCoordinates const* nVhcPos ); // Refuses for subway zone atm\r
+    bool UnspawnVehicle( uint32_t nVehicleId );\r
+\r
+    PVhcInfoList* GetCharVehicles( uint32_t nCharId, uint16_t nMaxCount = 0, uint16_t nStartIndex = 0 );\r
+\r
+};\r
+\r
+typedef std::vector<PSpawnedVehicle*> PSpawnedVhcVector;\r
+typedef std::queue<PSpawnedVehicle*> PSpawnedVhcList;\r
+\r
+class PSpawnedVehicles\r
+{\r
+    friend class PWorld;\r
+\r
+  public:\r
+    static const uint32_t mVhcBaseLocalId = 0x03fd; //Vhc local Id are allocated downward from this value. Could br 0x3ff, but 0x3fe is used as "target" when shooting nowhere\r
+    static const uint16_t mMaxLocalVhc = 127;\r
+\r
+    inline static bool IsPotentialSpawnedVehicle( uint32_t nLocalId )\r
+    { return (( nLocalId <= mVhcBaseLocalId ) && (( mVhcBaseLocalId - nLocalId ) < mMaxLocalVhc ) ); }\r
+\r
+  private:\r
+    PSpawnedVhcVector mSpawnedVehicles;\r
+    uint16_t mNextFreeHint;\r
+    uint32_t mLocation;\r
+\r
+    inline void SetLocation( uint32_t nLocation ) { mLocation = nLocation; }\r
+\r
+  public:\r
+    PSpawnedVehicles();\r
+    ~PSpawnedVehicles();\r
+\r
+    inline bool IsSpawned( uint32_t nLocalId ) const { return (( nLocalId <= mVhcBaseLocalId ) && (( mVhcBaseLocalId - nLocalId ) < mSpawnedVehicles.size() ) && mSpawnedVehicles[mVhcBaseLocalId-nLocalId] ); }\r
+    PSpawnedVehicle* SpawnVehicle( PVehicleInformation const* nVhcInfo, PVhcCoordinates const* nVhcPos );\r
+    PSpawnedVehicle* GetVehicle( uint32_t nLocalId );\r
+    PSpawnedVehicle* GetVehicleByGlobalId( uint32_t nVehicleId ) const;\r
+    bool UnspawnVehicle( uint32_t nVehicleId );\r
+\r
+    PSpawnedVhcList* GetSpawnedVehicles() const;\r
+};\r
similarity index 65%
rename from server/src/game/vhcaccessrequest.cpp
rename to TinNS/Source/GameServer/VehicleAccessRequest.cxx
index 11e3fcd..38a97b4 100644 (file)
@@ -1,42 +1,4 @@
-/*
-       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
-
-       Authors:
-       - Hammag
-       - Akiko
-
-       CREATION: 14 Apr 2009 Hammag
-       MODIFIED: 09 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/vhcaccessrequest.h"
-
+#include "GameServer/Includes.hxx"
 
 PVhcAccessRequest::PVhcAccessRequest()
 {
@@ -45,7 +7,7 @@ PVhcAccessRequest::PVhcAccessRequest()
   mTimestamp = 0;
 }
 
-PVhcAccessRequest::PVhcAccessRequest( u32 nRequesterCharId, u32 nVhcGlobalId )
+PVhcAccessRequest::PVhcAccessRequest( uint32_t nRequesterCharId, uint32_t nVhcGlobalId )
 {
   mCharId = nRequesterCharId;
   mVhcGlobalId = nVhcGlobalId;
@@ -54,10 +16,10 @@ PVhcAccessRequest::PVhcAccessRequest( u32 nRequesterCharId, u32 nVhcGlobalId )
 }
 
 /*
-typedef std::map<u32, PVhcAccessRequest> PVhcAccessRequestMap;
+typedef std::map<uint32_t, PVhcAccessRequest> PVhcAccessRequestMap;
 
 PVhcAccessRequestMap mActiveRequests;
-u32 mNextRequestId;
+uint32_t mNextRequestId;
 
 std::time_t mResponseWaitTime; // How long do we wait for owner answer
 std::time_t mCheckWaitTime; // How long do we wait for user access check (0: remaining time from mResponseWaitTime)
@@ -109,12 +71,12 @@ void PVhcAccessRequestList::SetParameters( std::time_t nResponseWaitTime, std::t
   mReuseWaitTime = nReuseWaitTime;
 }
 
-u32 PVhcAccessRequestList::Add( u32 nRequesterCharId, u32 nVhcGlobalId )
+uint32_t PVhcAccessRequestList::Add( uint32_t nRequesterCharId, uint32_t nVhcGlobalId )
 {
   DropTimedOut();
   // We could check for existing entries before
   PVhcAccessRequest newReq( nRequesterCharId, nVhcGlobalId );
-  u32 newId = mNextRequestId;
+  uint32_t newId = mNextRequestId;
   mActiveRequests[newId] = newReq;
 
   if ( ++mNextRequestId == 0 )
@@ -123,7 +85,7 @@ u32 PVhcAccessRequestList::Add( u32 nRequesterCharId, u32 nVhcGlobalId )
   return ( newId );
 }
 
-bool PVhcAccessRequestList::GetInfo(u32 nRequestId, u32* oRequesterCharId, u32* oVehicleId) const
+bool PVhcAccessRequestList::GetInfo(uint32_t nRequestId, uint32_t* oRequesterCharId, uint32_t* oVehicleId) const
 {
   PVhcAccessRequestMap::const_iterator it = mActiveRequests.find( nRequestId );
   if ( it != mActiveRequests.end() )
@@ -136,7 +98,7 @@ bool PVhcAccessRequestList::GetInfo(u32 nRequestId, u32* oRequesterCharId, u32*
     return false;
 }
 
-bool PVhcAccessRequestList::RegisterResponse( u32 nRequestId, bool nStatus )
+bool PVhcAccessRequestList::RegisterResponse( uint32_t nRequestId, bool nStatus )
 {
   DropTimedOut();
   PVhcAccessRequestMap::iterator it = mActiveRequests.find( nRequestId );
@@ -160,7 +122,7 @@ bool PVhcAccessRequestList::RegisterResponse( u32 nRequestId, bool nStatus )
   return false;
 }
 
-bool PVhcAccessRequestList::Check( u32 nRequestId, u32 nRequesterCharId, u32 nVhcGlobalId )
+bool PVhcAccessRequestList::Check( uint32_t nRequestId, uint32_t nRequesterCharId, uint32_t nVhcGlobalId )
 {
   DropTimedOut();
   PVhcAccessRequestMap::iterator it = mActiveRequests.find( nRequestId );
diff --git a/TinNS/Source/GameServer/VehicleAccessRequest.hxx b/TinNS/Source/GameServer/VehicleAccessRequest.hxx
new file mode 100644 (file)
index 0000000..fbee1bf
--- /dev/null
@@ -0,0 +1,42 @@
+#pragma once
+
+#include <chrono>
+#include <cstdint>
+#include <map>
+
+class PVhcAccessRequest {
+public:
+    //uint32_t mRequestId;
+    time_t mTimestamp;
+    uint32_t mCharId;
+    uint32_t mVhcGlobalId;
+    uint8_t mStatus; // 0: no answer yet, 1: access allowed (refused req are dropped) 2: result checked
+
+    PVhcAccessRequest();
+    PVhcAccessRequest(uint32_t nRequesterCharId, uint32_t nVhcGlobalId);
+};
+
+class PVhcAccessRequestList {
+    typedef std::map<uint32_t, PVhcAccessRequest> PVhcAccessRequestMap;
+
+private:
+    PVhcAccessRequestMap mActiveRequests;
+    uint32_t mNextRequestId;
+
+    time_t mResponseWaitTime; // How long do we wait for owner answer
+    time_t mCheckWaitTime; // How long do we wait for user access check (0: remaining time from mResponseWaitTime)
+    time_t mReuseWaitTime; // How long do we allow user to re-use the autorization after first check
+
+    void DropTimedOut();
+
+public:
+    PVhcAccessRequestList() ;
+    ~PVhcAccessRequestList();
+
+    void SetParameters(time_t nResponseWaitTime, time_t nCheckWaitTime, time_t nReuseWaitTime);
+
+    uint32_t Add(uint32_t nRequesterCharId, uint32_t nVhcGlobalId);
+    bool GetInfo(uint32_t nRequestId, uint32_t* oRequesterCharId, uint32_t* oVehicleId) const;
+    bool RegisterResponse(uint32_t nRequestId, bool nStatus);
+    bool Check(uint32_t nRequestId, uint32_t nRequesterCharId = 0, uint32_t nVhcGlobalId = 0);
+};
similarity index 79%
rename from server/src/game/worldactors.cpp
rename to TinNS/Source/GameServer/WorldActors.cxx
index f111965..36f75d3 100644 (file)
@@ -1,44 +1,6 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       Authors:
-       - Namikon
-       - Akiko
-
-       CREATION: 02 Jan 2007 Namikon
-
-       MODIFIED: 09 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/worldactors.h"
-#include "include/worlds.h"
-#include "include/msgbuilder.h"
-
+#include "GameServer/Includes.hxx"
+#include "GameServer/Definitions/Includes.hxx"
+#include "Common/Includes.hxx"
 
 PWorldActors::PWorldActors()
 {
@@ -49,19 +11,19 @@ PWorldActors::~PWorldActors()
 {
 }
 
-void PWorldActors::SpawnWA(u32 nWorld, u16 nActorID, u16 nFunctionID, u32 nWOID, u16 nPosX, u16 nPosY, u16 nPosZ, u8 nRotX, u8 nRotY, u8 nRotZ)
+void PWorldActors::SpawnWA(uint32_t nWorld, uint16_t nActorID, uint16_t nFunctionID, uint32_t nWOID, uint16_t nPosX, uint16_t nPosY, uint16_t nPosZ, uint8_t nRotX, uint8_t nRotY, uint8_t nRotZ)
 {
     PMessage* tmpMsg = MsgBuilder->BuildSpawnWorldObjectMsg(nActorID, nFunctionID, nWOID, nPosX, nPosY, nPosZ, nRotX, nRotY, nRotZ);
     ClientManager->UDPBroadcast(tmpMsg, nWorld);
 }
 
-void PWorldActors::VanishWA(u32 nWorld, u32 nWAid)
-{    
+void PWorldActors::VanishWA(uint32_t nWorld, uint32_t nWAid)
+{
     PMessage* tmpMsg = MsgBuilder->BuildRemoveWorldObjectMsg(nWAid);
     ClientManager->UDPBroadcast(tmpMsg, nWorld);
 }
 
-u32 PWorldActors::GetNextFreeWAID()
+uint32_t PWorldActors::GetNextFreeWAID()
 {
     if (gDevDebug) Console->Print("DEBUG: Getting next free worldactor ID...");
     MYSQL_RES *result = NULL;
@@ -82,7 +44,7 @@ u32 PWorldActors::GetNextFreeWAID()
     }
 
     row = mysql_fetch_row(result);
-    u32 newWAid;
+    uint32_t newWAid;
     if(mysql_num_rows(result) == 1)
     {
         newWAid = atoi(row[wa_actor_id]);
@@ -106,7 +68,7 @@ void PWorldActors::InitWorld(PClient* nClient)
 {
     DoActorCheck();
     if (gDevDebug) Console->Print("DEBUG: Initializing WorldActors for client...");
-    u32 tZone = nClient->GetChar()->GetLocation();
+    uint32_t tZone = nClient->GetChar()->GetLocation();
     MYSQL_RES *result = NULL;
     MYSQL_ROW row;
     char query[100];
@@ -130,21 +92,21 @@ void PWorldActors::InitWorld(PClient* nClient)
     }
     if (gDevDebug) Console->Print("DEBUG: We have dynamic actors, building message...");
     PMessage* tmpActorSpawn = new PMessage(256);
-    *tmpActorSpawn << (u8)0x13;
-    *tmpActorSpawn << (u16)0x0000; // Placeholder
-    *tmpActorSpawn << (u16)0x0000; // Placeholder
+    *tmpActorSpawn << (uint8_t)0x13;
+    *tmpActorSpawn << (uint16_t)0x0000; // Placeholder
+    *tmpActorSpawn << (uint16_t)0x0000; // Placeholder
 
-    u16 tFuncID = 0;
-    u16 tOpt1 = 0;
-    u32 tActorID = 0;
+    uint16_t tFuncID = 0;
+    uint16_t tOpt1 = 0;
+    uint32_t tActorID = 0;
 
     bool tActorOk = false;
 
     while((row = mysql_fetch_row(result)))
     {
-        tFuncID = (u16)atoi(row[wa_actor_type]);
-        tOpt1 = (u16)atoi(row[wa_option1]);
-        tActorID = (u32)atoi(row[wa_actor_id]);
+        tFuncID = (uint16_t)atoi(row[wa_actor_type]);
+        tOpt1 = (uint16_t)atoi(row[wa_option1]);
+        tActorID = (uint32_t)atoi(row[wa_actor_id]);
         // First make sure we have an VALID worldactor here
         tActorOk = false;
         if(IsValidWAFunction(tFuncID) == true)
@@ -166,19 +128,19 @@ void PWorldActors::InitWorld(PClient* nClient)
         {
             // Build multiframe message
             nClient->IncreaseUDP_ID();
-            *tmpActorSpawn << (u8)0x16;
-            *tmpActorSpawn << (u8)0x03;
-            *tmpActorSpawn << (u16)nClient->GetUDP_ID();
-            *tmpActorSpawn << (u8)0x1b;
+            *tmpActorSpawn << (uint8_t)0x16;
+            *tmpActorSpawn << (uint8_t)0x03;
+            *tmpActorSpawn << (uint16_t)nClient->GetUDP_ID();
+            *tmpActorSpawn << (uint8_t)0x1b;
             *tmpActorSpawn << tActorID;
-            *tmpActorSpawn << (u8)0x19;
-            *tmpActorSpawn << (u16)atoi(row[wa_posY]);
-            *tmpActorSpawn << (u16)atoi(row[wa_posZ]);
-            *tmpActorSpawn << (u16)atoi(row[wa_posX]);
-            *tmpActorSpawn << (u8)atoi(row[wa_rotY]);
-            *tmpActorSpawn << (u8)atoi(row[wa_rotZ]);
-            *tmpActorSpawn << (u8)atoi(row[wa_rotX]);
-            *tmpActorSpawn << (u16)atoi(row[wa_actor_model]);
+            *tmpActorSpawn << (uint8_t)0x19;
+            *tmpActorSpawn << (uint16_t)atoi(row[wa_posY]);
+            *tmpActorSpawn << (uint16_t)atoi(row[wa_posZ]);
+            *tmpActorSpawn << (uint16_t)atoi(row[wa_posX]);
+            *tmpActorSpawn << (uint8_t)atoi(row[wa_rotY]);
+            *tmpActorSpawn << (uint8_t)atoi(row[wa_rotZ]);
+            *tmpActorSpawn << (uint8_t)atoi(row[wa_rotX]);
+            *tmpActorSpawn << (uint16_t)atoi(row[wa_actor_model]);
             *tmpActorSpawn << tFuncID;
             if((tmpActorSpawn->GetSize() + 23) >= (tmpActorSpawn->GetMaxSize() - tmpActorSpawn->GetSize()))
             {
@@ -190,9 +152,9 @@ void PWorldActors::InitWorld(PClient* nClient)
 
                 // ReInit message
                 tmpActorSpawn = new PMessage(256);
-                *tmpActorSpawn << (u8)0x13;
-                *tmpActorSpawn << (u16)0x0000; // Placeholder
-                *tmpActorSpawn << (u16)0x0000; // Placeholder
+                *tmpActorSpawn << (uint8_t)0x13;
+                *tmpActorSpawn << (uint16_t)0x0000; // Placeholder
+                *tmpActorSpawn << (uint16_t)0x0000; // Placeholder
                 //if (gDevDebug) Console->Print("DEBUG: Done. Starting over!");
             }
         }
@@ -213,22 +175,22 @@ void PWorldActors::InitWorld(PClient* nClient)
     MySQL->FreeGameSQLResult(result);
 }
 
-u32 PWorldActors::AddWorldActor(PClient* nClient, u16 nActorID, u16 nFuncID, u16 nOpt1, u16 nOpt2, u16 nOpt3)
+uint32_t PWorldActors::AddWorldActor(PClient* nClient, uint16_t nActorID, uint16_t nFuncID, uint16_t nOpt1, uint16_t nOpt2, uint16_t nOpt3)
 {
     PChar *tChar = nClient->GetChar();
-    u16 tPosX = tChar->Coords.mX + 768;
-    u16 tPosY = tChar->Coords.mY + 768;
-    u16 tPosZ = tChar->Coords.mZ + 768;
-    u16 tLoc = tChar->GetLocation();
+    uint16_t tPosX = tChar->Coords.mX + 768;
+    uint16_t tPosY = tChar->Coords.mY + 768;
+    uint16_t tPosZ = tChar->Coords.mZ + 768;
+    uint16_t tLoc = tChar->GetLocation();
 
     //if (gDevDebug) Console->Print("DEBUG: Adding worldactor %d function %d to world %d", nActorID, nFuncID, tLoc);
-    return AddWorldActor(tLoc, nActorID, nFuncID, tPosX, tPosY, tPosZ, (u8)194, (u8)128, (u8)128, nOpt1, nOpt2, nOpt3);
+    return AddWorldActor(tLoc, nActorID, nFuncID, tPosX, tPosY, tPosZ, (uint8_t)194, (uint8_t)128, (uint8_t)128, nOpt1, nOpt2, nOpt3);
 }
 
-u32 PWorldActors::AddWorldActor(u32 nWorldID, u16 nActorID, u16 nFuncID, u16 nPosX, u16 nPosY, u16 nPosZ, u8 nRotX, u8 nRotY, u8 nRotZ, u16 nOpt1, u16 nOpt2, u16 nOpt3)
+uint32_t PWorldActors::AddWorldActor(uint32_t nWorldID, uint16_t nActorID, uint16_t nFuncID, uint16_t nPosX, uint16_t nPosY, uint16_t nPosZ, uint8_t nRotX, uint8_t nRotY, uint8_t nRotZ, uint16_t nOpt1, uint16_t nOpt2, uint16_t nOpt3)
 {
     if (gDevDebug) Console->Print("DEBUG: Adding new worldactor: ActorModel: %d, Function: %d, Option1: %d", nActorID, nFuncID, nOpt1);
-    u32 tNextWAID = GetNextFreeWAID(); // Grab next free WorldActorID
+    uint32_t tNextWAID = GetNextFreeWAID(); // Grab next free WorldActorID
     //if (gDevDebug) Console->Print("DEBUG: Next ID will be: %d", tNextWAID);
 
     char query[512];
@@ -250,10 +212,10 @@ u32 PWorldActors::AddWorldActor(u32 nWorldID, u16 nActorID, u16 nFuncID, u16 nPo
     return tNextWAID;
 }
 
-void PWorldActors::DelWorldActor(PClient* nClient, u32 nWAid)
+void PWorldActors::DelWorldActor(PClient* nClient, uint32_t nWAid)
 {
     char query[100];
-    u16 tLoc = nClient->GetChar()->GetLocation();
+    uint16_t tLoc = nClient->GetChar()->GetLocation();
     if (gDevDebug) Console->Print("DEBUG: Removing worldactor %d from world %d", nWAid, tLoc);
 
     snprintf(query, 100, "DELETE FROM `world_actors` WHERE `wa_actor_map` = %d AND `wa_actor_id` = %d", tLoc, nWAid);
@@ -269,7 +231,7 @@ void PWorldActors::DelWorldActor(PClient* nClient, u32 nWAid)
     VanishWA(tLoc, nWAid);
 }
 
-void PWorldActors::GetWAoption(u32 nWAid, u16 nWorld, u16 &nValue1, u16 &nValue2, u16 &nValue3)
+void PWorldActors::GetWAoption(uint32_t nWAid, uint16_t nWorld, uint16_t &nValue1, uint16_t &nValue2, uint16_t &nValue3)
 {
     MYSQL_RES *result = NULL;
     MYSQL_ROW row;
@@ -303,7 +265,7 @@ void PWorldActors::GetWAoption(u32 nWAid, u16 nWorld, u16 &nValue1, u16 &nValue2
     MySQL->FreeGameSQLResult(result);
 }
 
-int PWorldActors::GetWASQLID(u32 nWAid, u32 nWorld)
+int PWorldActors::GetWASQLID(uint32_t nWAid, uint32_t nWorld)
 {
     MYSQL_RES *result = NULL;
     MYSQL_ROW row;
@@ -333,7 +295,7 @@ int PWorldActors::GetWASQLID(u32 nWAid, u32 nWorld)
     return tWAid;
 }
 
-bool PWorldActors::IsDynamicActor(u32 nWAid)
+bool PWorldActors::IsDynamicActor(uint32_t nWAid)
 {
     MYSQL_RES *result = NULL;
     char query[100];
@@ -369,7 +331,7 @@ bool PWorldActors::IsDynamicActor(u32 nWAid)
     return false;
 }
 /* Not needed. Better re-spawn the actor
-bool PWorldActors::EditWorldActor(u32 nWorldID, int nOption1, int nOption2, int nOption3)
+bool PWorldActors::EditWorldActor(uint32_t nWorldID, int nOption1, int nOption2, int nOption3)
 {
     if(IsDynamicActor(nWorldID) == false) // Make sure we really have this actor in DB
         return false;
@@ -407,7 +369,7 @@ bool PWorldActors::EditWorldActor(u32 nWorldID, int nOption1, int nOption2, int
     return true;
 }
 */
-int PWorldActors::GetWorldActorFunctionID(u32 nWAid)
+int PWorldActors::GetWorldActorFunctionID(uint32_t nWAid)
 {
     MYSQL_RES *result = NULL;
     MYSQL_ROW row;
@@ -437,15 +399,15 @@ int PWorldActors::GetWorldActorFunctionID(u32 nWAid)
     return tFuncID;
 }
 
-void PWorldActors::GetFrontPos(u32 nWAID, u16* mX, u16* mY, u16* mZ)
+void PWorldActors::GetFrontPos(uint32_t nWAID, uint16_t* mX, uint16_t* mY, uint16_t* mZ)
 {
     MYSQL_RES *result = NULL;
     MYSQL_ROW row;
     char query[100];
 
-    u16 tNewX = 0;
-    u16 tNewY = 0;
-    u16 tNewZ = 0;
+    uint16_t tNewX = 0;
+    uint16_t tNewY = 0;
+    uint16_t tNewZ = 0;
 
     snprintf(query, 100, "SELECT * FROM `world_actors` WHERE `wa_actor_id` = %d", nWAID);
 
@@ -465,9 +427,9 @@ void PWorldActors::GetFrontPos(u32 nWAID, u16* mX, u16* mY, u16* mZ)
     }
 
     row = mysql_fetch_row(result);
-    tNewX = (u16)atoi(row[wa_posX]);
-    tNewY = (u16)atoi(row[wa_posY]);
-    tNewZ = (u16)atoi(row[wa_posZ]);
+    tNewX = (uint16_t)atoi(row[wa_posX]);
+    tNewY = (uint16_t)atoi(row[wa_posY]);
+    tNewZ = (uint16_t)atoi(row[wa_posZ]);
 
     if(tNewX > 0) *mX = tNewX - 768;
     if(tNewY > 0) *mY = tNewY - 768;
@@ -478,7 +440,7 @@ void PWorldActors::GetFrontPos(u32 nWAID, u16* mX, u16* mY, u16* mZ)
     return;
 }
 
-int PWorldActors::GetLinkedObjectID(u32 nWAID)
+int PWorldActors::GetLinkedObjectID(uint32_t nWAID)
 {
     MYSQL_RES *result = NULL;
     MYSQL_ROW row;
@@ -530,7 +492,7 @@ bool PWorldActors::RequiresLinkedObject(int nFunctionID)
         return false;
 }
 
-bool PWorldActors::IsValidLinkedObject(PClient *nClient, u16 nOption1, int nFunctionID)
+bool PWorldActors::IsValidLinkedObject(PClient *nClient, uint16_t nOption1, int nFunctionID)
 {
     /*
 
similarity index 56%
rename from server/src/game/include/worldactors.h
rename to TinNS/Source/GameServer/WorldActors.hxx
index 83a6225..423327b 100644 (file)
@@ -1,34 +1,8 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- worldactors.h - Management class for dynamic worldactors\r
+#pragma once\r
 \r
- CREATION: 02 Jan 2007 Namikon\r
+#include <cstdint>\r
 \r
- MODIFIED:\r
- REASON: -\r
-\r
-*/\r
+class PClient;\r
 \r
 /*\r
 Current known WorldActors:\r
@@ -100,17 +74,12 @@ Current known WorldActors:
 \r
 */\r
 \r
-\r
-#ifndef WORLDACTORS_H\r
-#define WORLDACTORS_H\r
-\r
 // Start from this offset (00 00 80 00)\r
 #define DYNACTORIDSTART 8388608\r
 \r
-class PWorldActors\r
-{\r
+class PWorldActors {\r
     private:\r
-       // SQL Layout\r
+    // SQL Layout\r
         enum\r
         {\r
             wa_id,\r
@@ -129,13 +98,13 @@ class PWorldActors
             wa_option3\r
         };\r
 \r
-        void SpawnWA(u32 nWorld, u16 nActorID, u16 nFunctionID, u32 nWOID, u16 nPosX, u16 nPosY, u16 nPosZ, u8 nRotX, u8 nRotY, u8 nRotZ);\r
-        void VanishWA(u32 nWorld, u32 nWAid);\r
+        void SpawnWA(uint32_t nWorld, uint16_t nActorID, uint16_t nFunctionID, uint32_t nWOID, uint16_t nPosX, uint16_t nPosY, uint16_t nPosZ, uint8_t nRotX, uint8_t nRotY, uint8_t nRotZ);\r
+        void VanishWA(uint32_t nWorld, uint32_t nWAid);\r
 \r
         // Get next availeable WorldactorID. First, try to find ID in known .dat files, then\r
         // Get the currently highest ID from SQL and add +1\r
         // select distinct wi_worlditem_id from world_items order by wi_worlditem_id desc limit 1;\r
-        u32 GetNextFreeWAID();\r
+        uint32_t GetNextFreeWAID();\r
 \r
     public:\r
         PWorldActors();\r
@@ -147,31 +116,31 @@ class PWorldActors
         // Add new worldactor to database and spawn it. Returns created WorldID\r
         // Position is taken from nClient, same as the worldID and calls the mainfunction\r
         // The function values are optional (used for interactive objects, gogo or genrep)\r
-        u32 AddWorldActor(PClient* nClient, u16 nActorID, u16 nFuncID, u16 nOpt1 = 0, u16 nOpt2 = 0, u16 nOpt3 = 0);\r
+        uint32_t AddWorldActor(PClient* nClient, uint16_t nActorID, uint16_t nFuncID, uint16_t nOpt1 = 0, uint16_t nOpt2 = 0, uint16_t nOpt3 = 0);\r
 \r
         // Add new worldactor to database and spawn it. Returns created WorldID\r
         // The function values are optional (used for interactive objects, gogo or genrep)\r
-        u32 AddWorldActor(u32 nWorldID, u16 nActorID, u16 nFuncID, u16 nPosX, u16 nPosY, u16 nPosZ, u8 nRotX, u8 nRotY, u8 nRotZ, u16 nOpt1 = 0, u16 nOpt2 = 0, u16 nOpt3 = 0);\r
+        uint32_t AddWorldActor(uint32_t nWorldID, uint16_t nActorID, uint16_t nFuncID, uint16_t nPosX, uint16_t nPosY, uint16_t nPosZ, uint8_t nRotX, uint8_t nRotY, uint8_t nRotZ, uint16_t nOpt1 = 0, uint16_t nOpt2 = 0, uint16_t nOpt3 = 0);\r
 \r
         // Remove worldactor in given world from SQL and game\r
-        void DelWorldActor(PClient* nClient, u32 nWAid);\r
+        void DelWorldActor(PClient* nClient, uint32_t nWAid);\r
 \r
         // Get functionvalues for worldactor\r
-        void GetWAoption(u32 nWAid, u16 nWorld, u16 &nValue1, u16 &nValue2, u16 &nValue3);\r
+        void GetWAoption(uint32_t nWAid, uint16_t nWorld, uint16_t &nValue1, uint16_t &nValue2, uint16_t &nValue3);\r
 \r
         // Get SQL ID from world and worldID\r
-        int GetWASQLID(u32 nWAid, u32 nWorld);\r
+        int GetWASQLID(uint32_t nWAid, uint32_t nWorld);\r
 \r
         // Check if actorID is dynamic\r
-        bool IsDynamicActor(u32 nWAid);\r
+        bool IsDynamicActor(uint32_t nWAid);\r
 \r
         // Not needed. Better re-spawn the actor\r
-        //bool EditWorldActor(u32 nWorldID, int nOption1 = -1, int nOption2 = -1, int nOption3 = -1);\r
+        //bool EditWorldActor(uint32_t nWorldID, int nOption1 = -1, int nOption2 = -1, int nOption3 = -1);\r
 \r
-        int GetWorldActorFunctionID(u32 nWAid);\r
+        int GetWorldActorFunctionID(uint32_t nWAid);\r
 \r
-        void GetFrontPos(u32 nWAID, u16* mX, u16* mY, u16* mZ); // For chairs\r
-        int GetLinkedObjectID(u32 nWAID); // OptionValue 1 is used for linked object!\r
+        void GetFrontPos(uint32_t nWAID, uint16_t* mX, uint16_t* mY, uint16_t* mZ); // For chairs\r
+        int GetLinkedObjectID(uint32_t nWAID); // OptionValue 1 is used for linked object!\r
 \r
         // Check if given functionID does exist\r
         bool IsValidWAFunction(int nFunctionID);\r
@@ -180,10 +149,8 @@ class PWorldActors
         bool RequiresLinkedObject(int nFunctionID);\r
 \r
         // Checks if the given worldobjectID is valid for this type of functionID\r
-        bool IsValidLinkedObject(PClient *nClient, u16 nOption1, int nFunctionID);\r
+        bool IsValidLinkedObject(PClient *nClient, uint16_t nOption1, int nFunctionID);\r
 \r
         // Checks for double actor-IDs and deletes them from DB\r
         void DoActorCheck();\r
 };\r
-\r
-#endif\r
similarity index 78%
rename from server/src/game/worlddatatemplate.cpp
rename to TinNS/Source/GameServer/WorldDataTemplate.cxx
index c349f8a..003863d 100644 (file)
@@ -1,43 +1,6 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-  worlddatatemplate.cpp - world data template (from worlds .dat files) class\r
-\r
- MODIFIED: 04 Oct 2006 Hammag\r
- REASON: - creation\r
-\r
- MODIFIED: 21 Jun 2009 Namikon\r
- REASON: - Added NPC Template stuff\r
-\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/worlddatatemplate.h"\r
-#include "include/world_datparser.h"\r
-#include "include/furnituretemplate.h"\r
-#include "include/doortemplate.h"\r
-#include "include/npctemplate.h"\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 PWorldDataTemplate::PWorldDataTemplate()\r
 {\r
@@ -109,7 +72,7 @@ bool PWorldDataTemplate::LoadDatFile( const std::string& WorldTemplateName, cons
     return false;\r
 }\r
 \r
-u32 PWorldDataTemplate::AddFurnitureItem( PFurnitureItemTemplate* nItem )\r
+uint32_t PWorldDataTemplate::AddFurnitureItem( PFurnitureItemTemplate* nItem )\r
 {\r
     if ( nItem )\r
     {\r
@@ -138,12 +101,12 @@ u32 PWorldDataTemplate::AddFurnitureItem( PFurnitureItemTemplate* nItem )
                     mPositionItems[v] = nItem;\r
                     /*\r
                     Console->Print("Position entity %d (id 0x%x) added to world template", v, nItem->GetID());\r
-                    f32 fpX, fpY, fpZ;\r
-                    u16 pX, pY, pZ;\r
+                    float fpX, fpY, fpZ;\r
+                    uint16_t pX, pY, pZ;\r
                     nItem->GetPos(&fpX, &fpY, &fpZ);\r
-                    pX = (u16) (fpX + 32000);\r
-                    pY = (u16) (fpY + 32000);\r
-                    pZ = (u16) (fpZ + 32000);\r
+                    pX = (uint16_t) (fpX + 32000);\r
+                    pY = (uint16_t) (fpY + 32000);\r
+                    pZ = (uint16_t) (fpZ + 32000);\r
                     Console->Print("Position Y=%f (0x%04x) Z=%f (0x%04x) X=%f (0x%04x)", fpY, pY, fpZ, pZ, fpX, pX);\r
                     */\r
                 }\r
@@ -162,7 +125,7 @@ u32 PWorldDataTemplate::AddFurnitureItem( PFurnitureItemTemplate* nItem )
     return 0;\r
 }\r
 \r
-const PFurnitureItemTemplate* PWorldDataTemplate::GetFurnitureItem( u32 ItemID )\r
+const PFurnitureItemTemplate* PWorldDataTemplate::GetFurnitureItem( uint32_t ItemID )\r
 {\r
     PFurnitureItemsMap::const_iterator it = mFurnitureItems.find( ItemID );\r
     if ( it == mFurnitureItems.end() )\r
@@ -171,7 +134,7 @@ const PFurnitureItemTemplate* PWorldDataTemplate::GetFurnitureItem( u32 ItemID )
         return it->second;\r
 }\r
 \r
-bool PWorldDataTemplate::getPositionItemPosition( u8 PosID, f32* pX, f32* pY, f32* pZ )\r
+bool PWorldDataTemplate::getPositionItemPosition( uint8_t PosID, float* pX, float* pY, float* pZ )\r
 {\r
     if (( PosID < WORLDDATATEMPLATE_MAXPOSITEMS ) && mPositionItems[PosID] )\r
     {\r
@@ -181,7 +144,7 @@ bool PWorldDataTemplate::getPositionItemPosition( u8 PosID, f32* pX, f32* pY, f3
     return false;\r
 }\r
 \r
-u32 PWorldDataTemplate::AddDoor( PDoorTemplate* nDoor )\r
+uint32_t PWorldDataTemplate::AddDoor( PDoorTemplate* nDoor )\r
 {\r
     if ( nDoor )\r
     {\r
@@ -198,7 +161,7 @@ u32 PWorldDataTemplate::AddDoor( PDoorTemplate* nDoor )
     return 0;\r
 }\r
 \r
-const PDoorTemplate* PWorldDataTemplate::GetDoor( u32 DoorID )\r
+const PDoorTemplate* PWorldDataTemplate::GetDoor( uint32_t DoorID )\r
 {\r
     PDoorsMap::const_iterator it = mDoors.find( DoorID );\r
     if ( it == mDoors.end() )\r
@@ -208,7 +171,7 @@ const PDoorTemplate* PWorldDataTemplate::GetDoor( u32 DoorID )
 }\r
 \r
 \r
-u32 PWorldDataTemplate::AddNPC( PNPCTemplate* nNPC )\r
+uint32_t PWorldDataTemplate::AddNPC( PNPCTemplate* nNPC )\r
 {\r
     if ( nNPC )\r
     {\r
@@ -225,7 +188,7 @@ u32 PWorldDataTemplate::AddNPC( PNPCTemplate* nNPC )
     return 0;\r
 }\r
 \r
-const PNPCTemplate* PWorldDataTemplate::GetNPC( u32 NPCID )\r
+const PNPCTemplate* PWorldDataTemplate::GetNPC( uint32_t NPCID )\r
 {\r
     PNPCsMap::const_iterator it = mNPCs.find( NPCID );\r
     if ( it == mNPCs.end() )\r
@@ -236,12 +199,12 @@ const PNPCTemplate* PWorldDataTemplate::GetNPC( u32 NPCID )
 \r
 void PWorldDataTemplate::SetLinkedObjects()\r
 {\r
-    f32 xI, yI, zI;\r
-    f32 xD, yD, zD;\r
-    f32 D2, minD2;\r
-    u32 minObjID;\r
-    u16 fnctType;\r
-    u16 tGROrder = 0;\r
+    float xI, yI, zI;\r
+    float xD, yD, zD;\r
+    float D2, minD2;\r
+    uint32_t minObjID;\r
+    uint16_t fnctType;\r
+    uint16_t tGROrder = 0;\r
 \r
     for ( PFurnitureItemsMap::iterator it = mFurnitureItems.begin(); it != mFurnitureItems.end(); it++ )\r
     {\r
diff --git a/TinNS/Source/GameServer/WorldDataTemplate.hxx b/TinNS/Source/GameServer/WorldDataTemplate.hxx
new file mode 100644 (file)
index 0000000..d93f4ba
--- /dev/null
@@ -0,0 +1,74 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+\r
+#define WORLDDATATEMPLATE_MAXPOSITEMS 11\r
+\r
+class PFurnitureItemTemplate;\r
+typedef std::map<uint32_t, PFurnitureItemTemplate*> PFurnitureItemsMap;\r
+\r
+class PDoorTemplate;\r
+typedef std::map<uint32_t, PDoorTemplate*> PDoorsMap;\r
+\r
+class PNPCTemplate;\r
+typedef std::map<uint32_t, PNPCTemplate*> PNPCsMap;\r
+\r
+class PWorldDataTemplate\r
+{\r
+private:\r
+    std::string mName; // (datfile) relative path+filename without leading ./ or ./worlds/ nor .dat extension\r
+    std::string mBspName; // (bsp file) relative path+filename without leading ./ or ./worlds/ nor .bsp extension\r
+    PFurnitureItemsMap mFurnitureItems;\r
+    PDoorsMap mDoors;\r
+    PNPCsMap mNPCs;\r
+    PFurnitureItemTemplate* mPositionItems[WORLDDATATEMPLATE_MAXPOSITEMS];\r
+\r
+    int mUseCount;\r
+\r
+    void DatFileDataCleanup();\r
+    void SetLinkedObjects(); // This method implements some workarouds for some world objects on which we lack info.\r
+\r
+public:\r
+    PWorldDataTemplate();\r
+    ~PWorldDataTemplate();\r
+\r
+    bool LoadDatFile(const std::string& WorldTemplateName, const std::string& nFilename, const bool nTestAccesOnly = false);\r
+    inline const std::string& GetName()\r
+    {\r
+        return mName;\r
+    }\r
+    inline const std::string& GetBspName()\r
+    {\r
+        return mBspName;\r
+    }\r
+\r
+    inline void IncreaseUseCount()\r
+    {\r
+        ++mUseCount;\r
+    }\r
+    inline int DecreaseUseCount()\r
+    {\r
+        return (mUseCount ? --mUseCount : 0);\r
+    }\r
+    inline int GetUseCount()\r
+    {\r
+        return mUseCount;\r
+    }\r
+\r
+    uint32_t AddFurnitureItem(PFurnitureItemTemplate* nItem);\r
+    const PFurnitureItemTemplate* GetFurnitureItem(uint32_t ItemID);\r
+    bool getPositionItemPosition(uint8_t PosID, float* pX, float* pY, float* pZ);\r
+\r
+    uint32_t AddDoor(PDoorTemplate* nDoor);\r
+    const PDoorTemplate* GetDoor(uint32_t DoorID);\r
+\r
+    uint32_t AddNPC(PNPCTemplate* nNPC);\r
+\r
+    // External functions for NPCManager\r
+    const PNPCTemplate* GetNPC(uint32_t NPCID);\r
+    inline const PNPCsMap *GetNPCMap() const\r
+    {\r
+        return &mNPCs;\r
+    }; // called by class PNPCWorld to get all NPCs for this world\r
+};\r
similarity index 84%
rename from server/src/game/worlds.cpp
rename to TinNS/Source/GameServer/Worlds.cxx
index 2921d92..5efc667 100644 (file)
@@ -1,55 +1,15 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       worlds.cpp - world class and world map class\r
-\r
-       MODIFIED: 06 Oct 2006 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "common/filesystem.h"\r
-#include "include/def_worlds.h"\r
-#include "include/gamedefs.h"\r
-#include "include/furnituretemplate.h"\r
-#include "include/worlddatatemplate.h"\r
-#include "include/worlds.h"\r
-#include "include/appartements.h"\r
-#include "include/vehicle.h"\r
-\r
 #include <set>\r
-\r
+#include "GameServer/Includes.hxx"\r
+#include "GameServer/Definitions/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /**** PWorld ****/\r
-u16 const PWorld::mZoneOutLimitOffset = 0x100;\r
-u16 const PWorld::mBottomZoneOutLimit = 0x4800 - PWorld::mZoneOutLimitOffset;\r
-u16 const PWorld::mBottomZoneInLimit = 0x4a00;\r
-u16 const PWorld::mTopZoneOutLimit = 0xb200 + PWorld::mZoneOutLimitOffset;\r
-u16 const PWorld::mTopZoneInLimit = 0xb000;\r
+uint16_t const PWorld::mZoneOutLimitOffset = 0x100;\r
+uint16_t const PWorld::mBottomZoneOutLimit = 0x4800 - PWorld::mZoneOutLimitOffset;\r
+uint16_t const PWorld::mBottomZoneInLimit = 0x4a00;\r
+uint16_t const PWorld::mTopZoneOutLimit = 0xb200 + PWorld::mZoneOutLimitOffset;\r
+uint16_t const PWorld::mTopZoneInLimit = 0xb000;\r
+const std::string EmptyString;\r
 \r
 PWorld::PWorld()\r
 {\r
@@ -62,7 +22,7 @@ PWorld::~PWorld()
 {\r
 }\r
 \r
-bool PWorld::Load( u32 nWorldID )\r
+bool PWorld::Load( uint32_t nWorldID )\r
 {\r
   std::string WorldTemplateName;\r
   std::string tFileName;\r
@@ -157,7 +117,27 @@ bool PWorld::Load( u32 nWorldID )
   return true;\r
 }\r
 \r
-const PDefWorldModel* PWorld::GetFurnitureItemModel( u32 nItemID )\r
+std::string PWorld::GetName()\r
+{\r
+    return ( mWorldDataTemplate ? mWorldDataTemplate->GetName() : EmptyString );\r
+}\r
+\r
+std::string PWorld::GetBspName()\r
+{\r
+    return ( mWorldDataTemplate ? mWorldDataTemplate->GetBspName() : EmptyString );\r
+}\r
+\r
+bool PWorld::IsAppartment()\r
+{\r
+    return mIsAppartment;\r
+}\r
+\r
+const PFurnitureItemTemplate *PWorld::GetFurnitureItemTemplate( uint32_t nItemID )\r
+{\r
+    return ( mWorldDataTemplate ? mWorldDataTemplate->GetFurnitureItem( nItemID ) : NULL ) ;\r
+}\r
+\r
+const PDefWorldModel *PWorld::GetFurnitureItemModel(uint32_t nItemID)\r
 {\r
   if ( mWorldDataTemplate )\r
   {\r
@@ -165,10 +145,20 @@ const PDefWorldModel* PWorld::GetFurnitureItemModel( u32 nItemID )
     if ( tFurniture )\r
       return tFurniture->GetDefWorldModel();\r
   }\r
-  return NULL;\r
+  return nullptr;\r
+}\r
+\r
+const PDoorTemplate *PWorld::GetDoor(uint32_t nDoorID)\r
+{\r
+    return (mWorldDataTemplate ? mWorldDataTemplate->GetDoor(nDoorID) : nullptr);\r
+}\r
+\r
+bool PWorld::getPositionItemPosition(uint8_t PosID, float *pX, float *pY, float *pZ)\r
+{\r
+    return (mWorldDataTemplate ? mWorldDataTemplate->getPositionItemPosition(PosID, pX, pY, pZ) : false);\r
 }\r
 \r
-bool PWorld::CharUseChair( int CharLocalID, u32 nItemID )\r
+bool PWorld::CharUseChair( int CharLocalID, uint32_t nItemID )\r
 {\r
   PChairsInUseMap::iterator it = mChairsInUseMap.find( nItemID );\r
   if ( it == mChairsInUseMap.end() ) // chair is free\r
@@ -195,7 +185,7 @@ bool PWorld::CharUseChair( int CharLocalID, u32 nItemID )
   }\r
 }\r
 \r
-void PWorld::CharLeaveChair( int CharLocalID, u32 nItemID )\r
+void PWorld::CharLeaveChair( int CharLocalID, uint32_t nItemID )\r
 {\r
   PChairsInUseMap::iterator it = mChairsInUseMap.find( nItemID );\r
   if (( it != mChairsInUseMap.end() ) && ( it->second == CharLocalID ) ) // chair is in use by this char\r
@@ -206,12 +196,17 @@ void PWorld::CharLeaveChair( int CharLocalID, u32 nItemID )
   }\r
 }\r
 \r
-PClient* PWorld::GetClientByCharLocalId( u32 rawObjectId ) const\r
+PClient* PWorld::GetClientByCharLocalId( uint32_t rawObjectId ) const\r
 {\r
   // Temp implementation\r
   return ClientManager->GetClientByCharLocalId( rawObjectId, mID );\r
 }\r
 \r
+PSpawnedVehicles *PWorld::GetSpawnedVehicles()\r
+{\r
+    return &mSpawnedVehicles;\r
+}\r
+\r
 bool PWorld::CheckVhcNeedZoning( PVhcCoordinates const* nPos ) const\r
 {\r
   if ( ( nPos->GetX() <= mBottomZoneOutLimit ) || ( nPos->GetX() >= mTopZoneOutLimit ) || ( nPos->GetY() <= mBottomZoneOutLimit )   || ( nPos->GetY() >= mTopZoneOutLimit ) )\r
@@ -220,14 +215,14 @@ bool PWorld::CheckVhcNeedZoning( PVhcCoordinates const* nPos ) const
     return false;\r
 }\r
 \r
-u32 PWorld::GetVhcZoningDestination( PSpawnedVehicle const* nVhc, PVhcCoordinates* nPos ) const\r
+uint32_t PWorld::GetVhcZoningDestination( PSpawnedVehicle const* nVhc, PVhcCoordinates* nPos ) const\r
 {\r
-  u32 destWorldId = 0;\r
-  s16 vChange = 0;\r
-  s16 hChange = 0;\r
+  uint32_t destWorldId = 0;\r
+  int16_t vChange = 0;\r
+  int16_t hChange = 0;\r
   PVhcCoordinates const vhcPos = nVhc->GetPosition();\r
-  u16 posX = vhcPos.GetX();\r
-  u16 posY = vhcPos.GetY();\r
+  uint16_t posX = vhcPos.GetX();\r
+  uint16_t posY = vhcPos.GetY();\r
 \r
   if ( posX <= mBottomZoneOutLimit )\r
   {\r
@@ -250,9 +245,9 @@ u32 PWorld::GetVhcZoningDestination( PSpawnedVehicle const* nVhc, PVhcCoordinate
   if ( vChange || hChange )\r
   {\r
     //Console->Print( YELLOW, BLACK, "[DEBUG] Limit Reached V:%d H:%d mapId:%d", vChange,hChange,mID );\r
-    u8 currH = 0;\r
-    u8 currV = 0;\r
-    s16 newH, newV;\r
+    uint8_t currH = 0;\r
+    uint8_t currV = 0;\r
+    int16_t newH, newV;\r
 \r
     if ( Worlds->GetWorldmapFromWorldId( mID, currH, currV ) )\r
     {\r
@@ -295,14 +290,24 @@ u32 PWorld::GetVhcZoningDestination( PSpawnedVehicle const* nVhc, PVhcCoordinate
   return destWorldId;\r
 }\r
 \r
+const PNPCsMap *PWorld::GetNPCMap() const\r
+{\r
+    return (mWorldDataTemplate ? mWorldDataTemplate->GetNPCMap() : nullptr);\r
+}\r
+\r
+const PNPCTemplate *PWorld::GetNPCTemplate(uint32_t nNPCID) const\r
+{\r
+    return (mWorldDataTemplate ? mWorldDataTemplate->GetNPC(nNPCID) : nullptr);\r
+}\r
+\r
 /**** PWorlds ****/\r
-u32 const PWorlds::mNcSubwayWorldId = 1000;\r
-u32 const PWorlds::mAptBaseWorldId = 100000;\r
-u32 const PWorlds::mOutdoorBaseWorldId = 2001;\r
-u32 const PWorlds::mOutdoorWorldIdVIncrement = 20;\r
-u8 const PWorlds::mOutdoorWorldmapHSize = 16;\r
-u8 const PWorlds::mOutdoorWorldmapVSize = 11;\r
-u32 const PWorlds::mOutdoorMaxWorldId = PWorlds::mOutdoorBaseWorldId + PWorlds::mOutdoorWorldIdVIncrement * ( PWorlds::mOutdoorWorldmapVSize - 1 ) + PWorlds::mOutdoorWorldmapHSize - 1;\r
+uint32_t const PWorlds::mNcSubwayWorldId = 1000;\r
+uint32_t const PWorlds::mAptBaseWorldId = 100000;\r
+uint32_t const PWorlds::mOutdoorBaseWorldId = 2001;\r
+uint32_t const PWorlds::mOutdoorWorldIdVIncrement = 20;\r
+uint8_t const PWorlds::mOutdoorWorldmapHSize = 16;\r
+uint8_t const PWorlds::mOutdoorWorldmapVSize = 11;\r
+uint32_t const PWorlds::mOutdoorMaxWorldId = PWorlds::mOutdoorBaseWorldId + PWorlds::mOutdoorWorldIdVIncrement * ( PWorlds::mOutdoorWorldmapVSize - 1 ) + PWorlds::mOutdoorWorldmapHSize - 1;\r
 \r
 PWorlds::PWorlds()\r
 {\r
@@ -617,7 +622,7 @@ bool PWorlds::LoadWorlds() // once Load is done, only WorldDataTemplate registre
   return true;\r
 }\r
 \r
-bool PWorlds::IsValidWorld( u32 nWorldID ) const\r
+bool PWorlds::IsValidWorld( uint32_t nWorldID ) const\r
 {\r
   if ( nWorldID > PWorlds::mAptBaseWorldId )\r
   {\r
@@ -647,7 +652,7 @@ bool PWorlds::IsValidWorld( u32 nWorldID ) const
   }\r
 }\r
 \r
-PWorld* PWorlds::LeaseWorld( u32 nWorldID, const bool nPreloadPhase )\r
+PWorld* PWorlds::LeaseWorld( uint32_t nWorldID, const bool nPreloadPhase )\r
 {\r
   PWorldsMap::iterator it;\r
 \r
@@ -715,7 +720,7 @@ PWorld* PWorlds::LeaseWorld( u32 nWorldID, const bool nPreloadPhase )
   }\r
 }\r
 \r
-PWorld* PWorlds::GetWorld( u32 nWorldID )\r
+PWorld* PWorlds::GetWorld( uint32_t nWorldID )\r
 {\r
   PWorldsMap* tMap;\r
   PWorldsMap::iterator it;\r
@@ -734,7 +739,7 @@ PWorld* PWorlds::GetWorld( u32 nWorldID )
   }\r
 }\r
 \r
-void PWorlds::ReleaseWorld( u32 nWorldID ) // no dynamic unload is performed atm + don't forget spawned vhc !\r
+void PWorlds::ReleaseWorld( uint32_t nWorldID ) // no dynamic unload is performed atm + don't forget spawned vhc !\r
 {\r
   PWorld* tWorld = GetWorld( nWorldID );\r
   if ( tWorld )\r
@@ -756,7 +761,7 @@ void PWorlds::ReleaseWorld( u32 nWorldID ) // no dynamic unload is performed atm
   }\r
 }\r
 \r
-bool PWorlds::IsAppartment( u32 nWorldID )\r
+bool PWorlds::IsAppartment( uint32_t nWorldID )\r
 {\r
   return (( nWorldID > PWorlds::mAptBaseWorldId ) && IsValidWorld( nWorldID ) );\r
 }\r
@@ -767,9 +772,9 @@ void PWorlds::Update()
 void PWorlds::Shutdown()\r
 {}\r
 \r
-u32 PWorlds::GetWorldIdFromWorldmap( u8 mapH, u8 mapV ) const\r
+uint32_t PWorlds::GetWorldIdFromWorldmap( uint8_t mapH, uint8_t mapV ) const\r
 {\r
-  u32 loc = 0;\r
+  uint32_t loc = 0;\r
   if (( mapH < mOutdoorWorldmapHSize ) && ( mapV < mOutdoorWorldmapVSize ) )\r
   {\r
     loc = mOutdoorBaseWorldId + mOutdoorWorldIdVIncrement * mapV + mapH;\r
@@ -779,7 +784,7 @@ u32 PWorlds::GetWorldIdFromWorldmap( u8 mapH, u8 mapV ) const
   return loc;\r
 }\r
 \r
-bool PWorlds::GetWorldmapFromWorldId( u32 nWorldId, u8& mapH, u8& mapV ) const\r
+bool PWorlds::GetWorldmapFromWorldId( uint32_t nWorldId, uint8_t& mapH, uint8_t& mapV ) const\r
 {\r
   if (( nWorldId >= mOutdoorBaseWorldId ) && ( nWorldId <= mOutdoorMaxWorldId ) )\r
   {\r
diff --git a/TinNS/Source/GameServer/Worlds.hxx b/TinNS/Source/GameServer/Worlds.hxx
new file mode 100644 (file)
index 0000000..4b3090d
--- /dev/null
@@ -0,0 +1,124 @@
+#pragma once
+
+#include <cstdint>
+#include <map>
+#include <string>
+
+class PDefWorldModel;
+
+typedef std::map<uint32_t, PNPCTemplate*> PNPCsMap;
+typedef std::map<uint32_t, int32_t> PChairsInUseMap;
+
+class PWorld {
+    friend class PWorlds;
+
+public:
+    static uint16_t const mZoneOutLimitOffset;
+    static uint16_t const mBottomZoneOutLimit;
+    static uint16_t const mBottomZoneInLimit;
+    static uint16_t const mTopZoneOutLimit;
+    static uint16_t const mTopZoneInLimit;
+
+private:
+    uint32_t mID;
+    bool mIsAppartment;
+    int32_t mUseCount;
+    PWorldDataTemplate* mWorldDataTemplate;
+    PChairsInUseMap mChairsInUseMap;
+    PSpawnedVehicles mSpawnedVehicles;
+
+    inline void IncreaseUseCount()
+    {
+        ++mUseCount;
+    }
+    inline int32_t DecreaseUseCount()
+    {
+        return ( mUseCount ? --mUseCount : 0 );
+    }
+    inline int32_t GetUseCount()
+    {
+        return mUseCount;
+    }
+    bool Load( uint32_t nWorldID );
+
+public:
+    PWorld();
+    ~PWorld();
+
+    std::string GetName();
+    std::string GetBspName();
+    bool IsAppartment();
+    const PFurnitureItemTemplate* GetFurnitureItemTemplate( uint32_t nItemID );
+    const PDefWorldModel *GetFurnitureItemModel(uint32_t nItemID);
+    const PDoorTemplate *GetDoor(uint32_t nDoorID);
+    bool getPositionItemPosition(uint8_t PosID, float *pX, float *pY, float *pZ);
+
+    bool CharUseChair( int32_t CharLocalID, uint32_t nItemID );
+    void CharLeaveChair( int32_t CharLocalID, uint32_t nItemID );
+
+    PClient* GetClientByCharLocalId( uint32_t rawObjectId ) const; // returns Client if object is a PC char, and 0 if not.
+
+    PSpawnedVehicles *GetSpawnedVehicles();
+    bool CheckVhcNeedZoning(PVhcCoordinates const *nPos) const;
+    uint32_t GetVhcZoningDestination(PSpawnedVehicle const* nVhc, PVhcCoordinates* nPos = 0) const;
+
+    // Evil thing... bounced through stuff :| wasnt able to find a better solution for this
+    const PNPCsMap *GetNPCMap() const;
+    const PNPCTemplate *GetNPCTemplate(uint32_t nNPCID) const;
+};
+
+
+typedef std::map<uint32_t, PWorld*> PWorldsMap;
+typedef std::map<std::string, PWorldDataTemplate*> PWorldDataTemplatesMap;
+
+class PWorlds
+{
+    friend class PWorld;
+
+public:
+    static uint32_t const mNcSubwayWorldId;
+    static uint32_t const mAptBaseWorldId;
+    static uint32_t const mOutdoorBaseWorldId;
+    static uint32_t const mOutdoorWorldIdVIncrement;
+    static uint8_t const mOutdoorWorldmapHSize;
+    static uint8_t const mOutdoorWorldmapVSize;
+    static uint32_t const mOutdoorMaxWorldId;
+
+private:
+    bool mPreloadWorldsTemplates;
+    bool mPreloadStaticWorlds;
+
+    PWorldsMap mStaticWorldsMap; // lists all valid static worlds, with second=NULL if not loaded
+    PWorldsMap mOnDemandWorldsMap; // mostly appartments. Could be used for instance dungeons too, but instance dungeons are crap :p
+    PWorldDataTemplatesMap mWorldDataTemplatesMap;
+
+    bool LeaseWorldDataTemplate( const std::string& nBspName, const std::string& nFileName, const bool nPreloadPhase = false );
+    void ReleaseWorldDataTemplate( const std::string& nFileName );
+    void UnloadWorldDataTemplate( const std::string& nFileName );
+    PWorldDataTemplate* GetWorldDataTemplate( const std::string& nFileName );
+    PWorld* LeaseWorld( uint32_t nWorldID, const bool nPreloadPhase );
+
+public:
+    PWorlds();
+    ~PWorlds();
+
+    bool LoadWorlds();
+    bool IsValidWorld( uint32_t nWorldID ) const;
+    inline PWorld* LeaseWorld( uint32_t nWorldID )
+    {
+        return LeaseWorld( nWorldID, false );
+    }
+    PWorld* GetWorld( uint32_t nWorldID );
+    void ReleaseWorld( uint32_t nWorldID );
+    bool IsAppartment( uint32_t nWorldID );
+    inline bool IsPotentialAppartement( uint32_t nWorldID )
+    {
+        return ( nWorldID > PWorlds::mAptBaseWorldId );
+    }
+
+    void Update();
+    void Shutdown();
+
+    uint32_t GetWorldIdFromWorldmap( uint8_t mapH, uint8_t mapV ) const;  // H & V pos are 0-based
+    bool GetWorldmapFromWorldId( uint32_t nWorldId, uint8_t& mapH, uint8_t& mapV ) const;
+};
diff --git a/TinNS/Source/GameServer/Zoning.cxx b/TinNS/Source/GameServer/Zoning.cxx
new file mode 100644 (file)
index 0000000..8f35f74
--- /dev/null
@@ -0,0 +1,36 @@
+#include "GameServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+// TODO: Put get the fallback world from config\r
+//       Check for file existence before sending info to client to avoid client crash and bad location in char info\r
+\r
+void SendZone(PClient *Client, uint32_t loc)\r
+{\r
+    //TODO : FIX case for worldroute and 5 missing id 505\r
+  std::string worldName;\r
+    ConnectionTCP *Socket = Client->getTCPConn();\r
+    //PChar *Char = Chars->GetChar(Client->GetCharID());\r
+\r
+    Socket->SetTimeOutValue(0xffff);\r
+\r
+  PWorld* CurrentWorld = Worlds->GetWorld(loc);\r
+  if (CurrentWorld)\r
+  {\r
+    worldName = CurrentWorld->GetBspName();\r
+    if (worldName.empty())\r
+    {\r
+      worldName = "plaza/plaza_p1"; // Should be a config entry\r
+      Console->Print("Client %d: Empty name for world %d. Redirecting to %s", Console->ColorText(RED, BLACK, "Warning"), Client->GetID(), loc, worldName.c_str());\r
+      loc = 1;\r
+    }\r
+  }\r
+  else\r
+  {\r
+    worldName = "plaza/plaza_p1"; // Should be a config entry\r
+    Console->Print("Client %d: Invalid or not loaded world %d. Redirecting to %s", Console->ColorText(YELLOW, BLACK, "Warning"), Client->GetID(), loc, worldName.c_str());\r
+    loc = 1;\r
+  }\r
+\r
+  PMessage* cMsg = MsgBuilder->BuildSendZoneTCPMsg(loc, &worldName);\r
+    Client->SendTCPMessage(cMsg);\r
+}\r
diff --git a/TinNS/Source/GameServer/Zoning.hxx b/TinNS/Source/GameServer/Zoning.hxx
new file mode 100644 (file)
index 0000000..6f6950c
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+class PClient;\r
+\r
+//void SendZone(PClient *Client, PGameState *State,int loc);\r
+void SendZone(PClient *Client, uint32_t loc);\r
similarity index 56%
rename from server/src/info/accounts.cpp
rename to TinNS/Source/InfoServer/Accounts.cxx
index f6789f0..9872c0c 100644 (file)
@@ -1,48 +1,5 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       accounts.cpp\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 26 Dec 2005 Namikon\r
-       REASON: - Added SQLLoad to PAccounts. First step in adding MySQL support to accounts\r
-       MODIFIED: 01 Jan 2006 Namikon\r
-       REASON: - Changed FmtTxt() to sprintf(). It does... uhm, the same :D\r
-       MODIFIED: 06 Jan 2006 Namikon\r
-       REASON: - Removed the old XML loading functions, and changed the SQL ones to work with the Global Neopolis/TinNS Database\r
-               - Added SetBannedStatus(<unix timestamp>) to ban/unban an account (use SetBannedStatus(0) to unban a player)\r
-       MODIFIED: 03 Oct 2006 Hammag\r
-       REASON: - Fixed an issue in PAccount::SetBannedStatus() that was causing the "can't update banned status" error message.\r
-       MODIFIED: 27 May 2007 Hammag\r
-       REASON: - Full changes for on-demand account access (no more memory-resident account data)\r
-       \r
-       \r
-       MODIFIED: 02 Feb 2008 Hammag\r
-       REASON: - Correction of the account creation/update SQL query (thank to drhawk ;) )\r
-*/\r
-\r
+#include "InfoServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 /*\r
 NOTE ABOUT ACCESS LEVELS IN THE MYSQL DATABASE:\r
@@ -58,12 +15,10 @@ a_status:
 1 = Online\r
 2 = Banned\r
 */\r
-#include "main.h"\r
-#include "accounts.h"\r
 \r
 /** Static members **/\r
-RegEx* PAccount::mUsernameRegexFilter = NULL;\r
-RegEx* PAccount::mPasswordRegexFilter = NULL;\r
+RegEx* PAccount::mUsernameRegexFilter = nullptr;\r
+RegEx* PAccount::mPasswordRegexFilter = nullptr;\r
 \r
 bool PAccount::SetUsernameRegexFilter(const char* RegexStr)\r
 {\r
@@ -72,7 +27,7 @@ bool PAccount::SetUsernameRegexFilter(const char* RegexStr)
     delete mUsernameRegexFilter;\r
     mUsernameRegexFilter = NULL;\r
   }\r
-  \r
+\r
   if(RegexStr)\r
   {\r
     try {\r
@@ -92,7 +47,7 @@ bool PAccount::SetPasswordRegexFilter(const char* RegexStr)
     delete mPasswordRegexFilter;\r
     mPasswordRegexFilter = NULL;\r
   }\r
-  \r
+\r
   if(RegexStr)\r
   {\r
     try {\r
@@ -125,16 +80,16 @@ bool PAccount::IsPasswordWellFormed(const char *Password)
     return true;\r
 }\r
 \r
-/** Instance members **/           \r
+/** Instance members **/\r
 PAccount::PAccount()\r
 {\r
-       mID = 0;\r
-       mLevel = PAL_BANNED;\r
+    mID = 0;\r
+    mLevel = PAL_BANNED;\r
   mStatus = PAS_OFFLINE;\r
   mBannedUntil = 0;\r
 }\r
 \r
-PAccount::PAccount(const u32 AccountId)\r
+PAccount::PAccount(const uint32_t AccountId)\r
 {\r
   char query[256];\r
   mID = 0;\r
@@ -158,7 +113,7 @@ bool PAccount::LoadFromQuery(char* query)
 {\r
   MYSQL_ROW row = 0;\r
   MYSQL_RES *result = 0;\r
-  \r
+\r
   bool FinalResult = false;\r
 \r
   //result = MySQL->InfoResQuery(query);\r
@@ -195,12 +150,17 @@ bool PAccount::LoadFromQuery(char* query)
   {\r
 Console->Print(YELLOW, BLACK, "Failed to load AccountData from SQL; Nothing to load...");\r
   }\r
-  \r
+\r
   //MySQL->FreeInfoSQLResult(result);\r
   MySQL->FreeSQLResult(result);\r
   return FinalResult;\r
 }\r
 \r
+uint32_t PAccount::GetID() const\r
+{\r
+    return mID;\r
+}\r
+\r
 bool PAccount::SetName(const std::string &Username)\r
 {\r
   if(IsUsernameWellFormed(Username.c_str()))\r
@@ -214,6 +174,11 @@ bool PAccount::SetName(const std::string &Username)
   }\r
 }\r
 \r
+const std::string &PAccount::GetName() const\r
+{\r
+    return mName;\r
+}\r
+\r
 bool PAccount::SetPassword(const std::string &Password)\r
 {\r
   if(IsPasswordWellFormed(Password.c_str()))\r
@@ -227,19 +192,24 @@ bool PAccount::SetPassword(const std::string &Password)
   }\r
 }\r
 \r
-bool PAccount::SetPasswordEncoded(const u8* PasswordData, int PassLen, const u8* Key)\r
+bool PAccount::SetPasswordEncoded(const uint8_t* PasswordData, int PassLen, const uint8_t* Key)\r
 {\r
-       char Pass[128];\r
-       \r
-       if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
+    char Pass[128];\r
+\r
+    if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
   {\r
-               return SetPassword((std::string)Pass);\r
-       }\r
-       else\r
-       {\r
-               Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
-               return false;\r
-       }\r
+        return SetPassword((std::string)Pass);\r
+    }\r
+    else\r
+    {\r
+        Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
+        return false;\r
+    }\r
+}\r
+\r
+const std::string &PAccount::GetPassword() const\r
+{\r
+    return mPassword;\r
 }\r
 \r
 bool PAccount::SetLevel(int newLevel)\r
@@ -255,19 +225,24 @@ bool PAccount::SetLevel(int newLevel)
   }\r
 }\r
 \r
+int32_t PAccount::GetLevel() const\r
+{\r
+    return mLevel;\r
+}\r
+\r
 std::string PAccount::GetLevelString() const\r
 {\r
-       switch(mLevel)\r
-       {\r
-               case PAL_BANNED : return "banned";\r
-               case PAL_UNREGPLAYER : return "unregplayer";\r
-               case PAL_REGPLAYER : return "regplayer";\r
-               case PAL_VOLUNTEER : return "volunteer";\r
-               case PAL_GM : return "gm";\r
-               case PAL_ADMIN : return "admin";\r
-       }\r
-\r
-       return "custom";\r
+    switch(mLevel)\r
+    {\r
+        case PAL_BANNED : return "banned";\r
+        case PAL_UNREGPLAYER : return "unregplayer";\r
+        case PAL_REGPLAYER : return "regplayer";\r
+        case PAL_VOLUNTEER : return "volunteer";\r
+        case PAL_GM : return "gm";\r
+        case PAL_ADMIN : return "admin";\r
+    }\r
+\r
+    return "custom";\r
 }\r
 \r
 bool PAccount::SetStatus(PAccountStatus Status)\r
@@ -276,6 +251,11 @@ bool PAccount::SetStatus(PAccountStatus Status)
   return true;\r
 }\r
 \r
+PAccountStatus PAccount::GetStatus() const\r
+{\r
+    return mStatus;\r
+}\r
+\r
 bool PAccount::SetBannedUntilTime(std::time_t BannedUntil)\r
 {\r
   if ((BannedUntil == 0) || (BannedUntil > std::time(NULL)))\r
@@ -289,55 +269,60 @@ bool PAccount::SetBannedUntilTime(std::time_t BannedUntil)
   }\r
 }\r
 \r
-bool PAccount::DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key, char* ClearPassword)\r
+bool PAccount::IsBanned() const\r
+{\r
+    return (mBannedUntil > std::time(nullptr));\r
+}\r
+\r
+bool PAccount::DecodePassword(const uint8_t* PasswordData, int PassLen, const uint8_t *Key, char* ClearPassword)\r
 {\r
   ClearPassword[0] = 0;\r
-  \r
+\r
   if(PassLen < 128)\r
-       {\r
-               if(Key[0]>7) // TODO: >7 correct?\r
-               {\r
-                       for(int i=0; i<PassLen; i+=2)\r
-                               ClearPassword[i>>1] = (char)(((PasswordData[i]&0xf0)>>4)\r
-                                       +((PasswordData[i+1]&0x0f)<<4)-Key[0]);\r
-                       ClearPassword[PassLen>>1]=0;\r
-               }\r
-               else\r
-               {\r
-                       for(int i=0; i<PassLen; i++)\r
-                               ClearPassword[i] = (char)(PasswordData[i]-Key[0]);\r
-                       ClearPassword[PassLen]=0;\r
-               }\r
-               return true;\r
-       }\r
-       else\r
-         return false;\r
+    {\r
+        if(Key[0]>7) // TODO: >7 correct?\r
+        {\r
+            for(int i=0; i<PassLen; i+=2)\r
+                ClearPassword[i>>1] = (char)(((PasswordData[i]&0xf0)>>4)\r
+                    +((PasswordData[i+1]&0x0f)<<4)-Key[0]);\r
+            ClearPassword[PassLen>>1]=0;\r
+        }\r
+        else\r
+        {\r
+            for(int i=0; i<PassLen; i++)\r
+                ClearPassword[i] = (char)(PasswordData[i]-Key[0]);\r
+            ClearPassword[PassLen]=0;\r
+        }\r
+        return true;\r
+    }\r
+    else\r
+      return false;\r
 }\r
 \r
-bool PAccount::Authenticate(const u8* PasswordData, int PassLen, const u8 *Key)\r
+bool PAccount::Authenticate(const uint8_t* PasswordData, int PassLen, const uint8_t *Key)\r
 {\r
-       char Pass[128];\r
-       \r
-       if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
+    char Pass[128];\r
+\r
+    if(DecodePassword(PasswordData, PassLen, Key, Pass))\r
   {\r
-               return Authenticate(Pass);\r
-       }\r
-       else\r
-       {\r
-               Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
-               return false;\r
-       }\r
+        return Authenticate(Pass);\r
+    }\r
+    else\r
+    {\r
+        Console->Print(RED, BLACK, "[Error]: user %s : malformed auth data (size=%d)", mName.c_str(), PassLen);\r
+        return false;\r
+    }\r
 }\r
 \r
 bool PAccount::Authenticate(const char *Password) const\r
 {\r
-       if(mID == 0) // User doesn't exist and that hasn't been checked !\r
-       {\r
-         Console->Print(RED, BLACK, "[Bug]: user %s doesn't exist and was not checked by code !", mName.c_str());\r
-         return false;\r
-       }\r
-       \r
-       return(mPassword == Password);\r
+    if(mID == 0) // User doesn't exist and that hasn't been checked !\r
+    {\r
+      Console->Print(RED, BLACK, "[Bug]: user %s doesn't exist and was not checked by code !", mName.c_str());\r
+      return false;\r
+    }\r
+\r
+    return(mPassword == Password);\r
 }\r
 \r
 bool PAccount::Create()\r
@@ -359,7 +344,7 @@ bool PAccount::Save(bool CreateMode)
   char escPassword[256];\r
   MySQL->EscapeString(mName.c_str(), escUsername, 256);\r
   MySQL->EscapeString(mPassword.c_str(), escPassword, 256);\r
-    \r
+\r
   std::string Query;\r
   Query = CreateMode ? "INSERT INTO" : "UPDATE";\r
   Query += " accounts SET ";\r
@@ -367,11 +352,11 @@ bool PAccount::Save(bool CreateMode)
   Query += Ssprintf(", a_priv = %d, a_status = %d, a_bandate = %d", mLevel, mStatus, mBannedUntil);\r
   if(!CreateMode )\r
   {\r
-       Query += Ssprintf(" a_lastused = NOW()");\r
+    Query += Ssprintf(" a_lastused = NOW()");\r
     Query += Ssprintf(" WHERE a_id = %d LIMIT 1", mID);\r
   }\r
   else\r
-       Query += Ssprintf(" a_creationdate = NOW()");\r
+    Query += Ssprintf(" a_creationdate = NOW()");\r
 \r
   //if(MySQL->InfoQuery(Query.c_str()))\r
   if(MySQL->Query(Query.c_str()))\r
@@ -387,7 +372,7 @@ bool PAccount::Save(bool CreateMode)
 std::string PAccount::GetBannedTime() const\r
 {\r
   const char* unit[5] = {"seconds", "minutes", "hours", "days", "weeks"};\r
-  \r
+\r
   std::time_t timediff = mBannedUntil - std::time(NULL);\r
   if(timediff <=0)\r
   {\r
diff --git a/TinNS/Source/InfoServer/Accounts.hxx b/TinNS/Source/InfoServer/Accounts.hxx
new file mode 100644 (file)
index 0000000..96bd185
--- /dev/null
@@ -0,0 +1,103 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <ctime>\r
+#include <string>\r
+\r
+class RegEx;\r
+\r
+/*\r
+0 = unregistered user\r
+1 = Registered user\r
+30 = volunteer\r
+50 = GM\r
+100 = Admin\r
+*/\r
+\r
+// New way of AccountLevel handling:\r
+// Every level is possible, the following values are only edge values. We need a bit control about that\r
+#define PAL_BANNED -1\r
+#define PAL_UNREGPLAYER 0\r
+#define PAL_REGPLAYER 1\r
+#define PAL_VOLUNTEER 30\r
+#define PAL_GM 50\r
+#define PAL_ADMIN 100\r
+\r
+// Max number of char slots per account\r
+#define MAX_CHARS_PER_ACCOUNT  4\r
+\r
+/*\r
+0 = Offline\r
+1 = Online\r
+2 = Banned\r
+*/\r
+\r
+enum PAccountStatus\r
+{\r
+    PAS_OFFLINE = 0,\r
+    PAS_ONLINE = 1,\r
+    PAS_BANNED = 2\r
+};\r
+\r
+class PAccount\r
+{\r
+    private :\r
+    // SQL Layout\r
+    enum {\r
+        a_id,\r
+        a_username,\r
+        a_password,\r
+        a_priv,\r
+        a_status,\r
+        a_bandate,\r
+        a_emailaddress,\r
+        a_creationdate,\r
+        a_lastused\r
+    };\r
+\r
+    // static members\r
+    static RegEx *mUsernameRegexFilter;\r
+    static RegEx *mPasswordRegexFilter;\r
+\r
+    // instance members\r
+    uint32_t mID;\r
+    std::string mName;\r
+    std::string mPassword;\r
+    int32_t mLevel;\r
+    PAccountStatus mStatus;\r
+    std::time_t mBannedUntil;\r
+\r
+    bool LoadFromQuery(char *query);\r
+    bool DecodePassword(const uint8_t *PasswordData, int32_t PassLen, const uint8_t *Key, char *ClearPassword);\r
+\r
+public:\r
+    PAccount();\r
+    PAccount(const uint32_t AccountId);\r
+    PAccount(const char *Username);\r
+\r
+    static bool SetUsernameRegexFilter(const char *RegexStr);\r
+    static bool SetPasswordRegexFilter(const char *RegexStr);\r
+    static bool IsUsernameWellFormed(const char *Username);\r
+    static bool IsPasswordWellFormed(const char *Password);\r
+\r
+    uint32_t GetID() const;\r
+    bool SetName(const std::string &Pass);\r
+    const std::string &GetName() const;\r
+    bool SetPassword(const std::string &Pass);\r
+    bool SetPasswordEncoded(const uint8_t *PasswordData, int32_t PassLen, const uint8_t *Key);\r
+    const std::string &GetPassword() const;\r
+    bool SetLevel(int32_t newLevel);\r
+    int32_t GetLevel() const;\r
+    std::string GetLevelString() const;\r
+    bool SetStatus(PAccountStatus Status);\r
+    PAccountStatus GetStatus() const;\r
+    bool SetBannedUntilTime(std::time_t BannedUntil);\r
+    bool IsBanned() const;\r
+    std::string GetBannedTime() const;\r
+    bool Authenticate(const uint8_t *PasswordData, int32_t PassLen, const uint8_t *Key);\r
+    bool Authenticate(const char *Password) const;\r
+    bool Create();\r
+    bool Save(bool CreateMode = false);\r
+\r
+    //u32 GetCharIdBySlot(const u32 SlotId);\r
+};\r
diff --git a/TinNS/Source/InfoServer/CMakeLists.txt b/TinNS/Source/InfoServer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..da661d4
--- /dev/null
@@ -0,0 +1,2 @@
+ADD_EXECUTABLE          (InfoServer Accounts.cxx Client.cxx Includes.cxx InfoServer.cxx Main.cxx Server.cxx Sql.cxx)
+TARGET_LINK_LIBRARIES   (InfoServer Common ${MYSQL_LIBRARY} ${PCRE_LIBRARY})
diff --git a/TinNS/Source/InfoServer/Client.cxx b/TinNS/Source/InfoServer/Client.cxx
new file mode 100644 (file)
index 0000000..12ea790
--- /dev/null
@@ -0,0 +1,84 @@
+#include "InfoServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+PClient::PClient(int32_t Index)\r
+{\r
+    mIndex = Index;\r
+    mConnection = PCC_NONE;\r
+    mAccountID = 0;\r
+}\r
+\r
+PClient::~PClient()\r
+{\r
+    if(m_TCPConnection)\r
+    {\r
+        delete m_TCPConnection;\r
+    }\r
+}\r
+\r
+int32_t PClient::GetIndex() const\r
+{\r
+    return mIndex;\r
+}\r
+\r
+void PClient::setTCPConnection(ConnectionTCP *conn)\r
+{\r
+    m_TCPConnection = conn; mConnection = PCC_INFO;\r
+}\r
+\r
+ConnectionTCP *PClient::getTCPConn() const\r
+{\r
+    return m_TCPConnection;\r
+}\r
+\r
+int32_t PClient::GetConnection() const\r
+{\r
+    return mConnection;\r
+}\r
+\r
+const char *PClient::GetAddress() const\r
+{\r
+    return m_TCPConnection->getRemoteAddress();\r
+}\r
+\r
+void PClient::setAccountID(uint32_t nAccountID)\r
+{\r
+    mAccountID = nAccountID;\r
+}\r
+\r
+uint32_t PClient::getAccountID()\r
+{\r
+    return mAccountID;\r
+}\r
+\r
+void PClient::InfoDisconnect()\r
+{\r
+    if(m_TCPConnection)\r
+    {\r
+        delete m_TCPConnection;\r
+    }\r
+    m_TCPConnection = 0;\r
+\r
+    //mConnection &= ~PCC_INFO;\r
+    mConnection = PCC_NONE;\r
+    mAccountID = 0;\r
+}\r
+\r
+void PClient::Update()\r
+{\r
+    if(m_TCPConnection)\r
+    {\r
+        if(m_TCPConnection->timeOut())\r
+        {\r
+                Console->Print("InfoSocket: Client %i: timeout", mIndex);\r
+                InfoServer->ClientDisconnected(this);\r
+        }\r
+        else\r
+        {\r
+            if(!m_TCPConnection->update())\r
+            {\r
+                InfoServer->ClientDisconnected(this);\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/TinNS/Source/InfoServer/Client.hxx b/TinNS/Source/InfoServer/Client.hxx
new file mode 100644 (file)
index 0000000..44d284b
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+class ConnectionTCP;\r
+\r
+enum PClientConnection\r
+{\r
+    PCC_NONE = 0,\r
+    PCC_INFO = 1\r
+};\r
+\r
+class PClient {\r
+private:\r
+    ConnectionTCP* m_TCPConnection;\r
+    int32_t mIndex;\r
+    int32_t mConnection;\r
+    uint32_t mAccountID;\r
+\r
+public:\r
+    PClient(int32_t Index);\r
+    ~PClient();\r
+\r
+    int32_t GetIndex() const;\r
+    void setTCPConnection(ConnectionTCP *conn);\r
+    ConnectionTCP *getTCPConn() const;\r
+    int32_t GetConnection() const;\r
+    const char *GetAddress() const;\r
+    void setAccountID(uint32_t nAccountID);\r
+    uint32_t getAccountID();\r
+    void InfoDisconnect();\r
+    void Update();\r
+};\r
similarity index 53%
rename from server/src/info/configtemplate.h
rename to TinNS/Source/InfoServer/ConfigTemplate.hxx
index 82a3ff4..92eced8 100644 (file)
@@ -1,30 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
+#pragma once\r
 \r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-    Configuration template for infoserver\r
-    Used to set available/optional/required options when loading config\r
-      with a PConfig object.\r
-*/\r
-\r
-const char* InfoConfigTemplate[][2] = {\r
+static const char *InfoConfigTemplate[][2] = {\r
   // {option_name, default_value} if default_value is empty string, it means option is mandatory\r
   // List ends with empty string for option_name\r
   {"sql_host", "127.0.0.1"}, // should be renanmed to info_sql_host\r
@@ -46,8 +22,7 @@ const char* InfoConfigTemplate[][2] = {
   {"password_filter", "^[[:graph:]]{3,15}$"},\r
   {"sqlite_databasefile", "infoDB.s3db"},\r
   {"database_type", "sqlite"},\r
-  \r
-  \r
+\r
 // For futur use:\r
 //  {"max_chars_per_account", "4"},\r
 \r
similarity index 54%
rename from server/src/info/globals.cpp
rename to TinNS/Source/InfoServer/Includes.cxx
index 2c026e1..28ea027 100644 (file)
@@ -1,43 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       MODIFIED: 27 Aug 2006 Hammag\r
-       REASON: - Implemented shared Config class use and config template to load conf.\r
-               - Added gameserver configtemplate.h include,\r
-               - Added new required parameters to Config->LoadOptions()\r
-               - Added AdditionnalConfigChecks() local function, called after config loading\r
-                 taken from inital infoserver's PConfig::VerifyValues\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-#include "configtemplate.h"\r
-\r
-#include "include/version.h"\r
-\r
+#include <cstring>\r
+#include "InfoServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 const char ServerVersion[] = TINNS_INFO_VERSION;\r
 const char SVNRevision[] = TINNS_SVN_REVISION;\r
@@ -52,69 +15,69 @@ PInfoServer *InfoServer = 0;
 \r
 bool Init()\r
 {\r
-       Console = new PConsole("log/infoserver.log"); // Make that from config file !!!\r
-       Console->Print("Starting TinNS Infoserver");\r
-       Console->Print(WHITE, BLUE, "/-------------------------------------------------------------------\\");\r
-       Console->Print(WHITE, BLUE, "|               TinNS (TinNS is not a Neocron Server)               |");\r
+    Console = new PConsole("log/infoserver.log"); // Make that from config file !!!\r
+    Console->Print("Starting TinNS Infoserver");\r
+    Console->Print(WHITE, BLUE, "/-------------------------------------------------------------------\\");\r
+    Console->Print(WHITE, BLUE, "|               TinNS (TinNS is not a Neocron Server)               |");\r
   Console->Print(WHITE, BLUE, "|            Copyright (C) 2005 Linux Addicted Community            |");\r
-       Console->Print(WHITE, BLUE, "|                  maintainer Akiko <akiko@gmx.org>                 |");\r
-       Console->Print(WHITE, BLUE, "|             ==========================================            |");\r
-       Console->Print(WHITE, BLUE, "|      Head coders:                   The packet analyzing team:    |");\r
-       Console->Print(WHITE, BLUE, "|      - Akiko                         - MaxxJag                    |");\r
-       Console->Print(WHITE, BLUE, "|      - bakkdoor                      - Sting                      |");\r
-       Console->Print(WHITE, BLUE, "|      - Namikon                       - Balm                       |");\r
-       Console->Print(WHITE, BLUE, "|      - Hammag                                                     |");\r
-       Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
-       Console->Print(WHITE, BLUE, "|  This project would'nt be at its current stage without the help   |");\r
+    Console->Print(WHITE, BLUE, "|                  maintainer Akiko <akiko@gmx.org>                 |");\r
+    Console->Print(WHITE, BLUE, "|             ==========================================            |");\r
+    Console->Print(WHITE, BLUE, "|      Head coders:                   The packet analyzing team:    |");\r
+    Console->Print(WHITE, BLUE, "|      - Akiko                         - MaxxJag                    |");\r
+    Console->Print(WHITE, BLUE, "|      - bakkdoor                      - Sting                      |");\r
+    Console->Print(WHITE, BLUE, "|      - Namikon                       - Balm                       |");\r
+    Console->Print(WHITE, BLUE, "|      - Hammag                                                     |");\r
+    Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
+    Console->Print(WHITE, BLUE, "|  This project would'nt be at its current stage without the help   |");\r
   Console->Print(WHITE, BLUE, "|        from the NeoPolis team, special thanks to you guys!        |");\r
-       Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
-       Console->Print(WHITE, BLUE, "|  This project is under GPL, see any source file for more details  |");\r
-       Console->Print(WHITE, BLUE, "\\-------------------------------------------------------------------/");\r
-\r
-       //char svnrev[10];\r
-       //GetSVNRev(svnrev);\r
-       Console->LPrint("You are running TinNS Infoserver version");\r
-       Console->LPrint(GREEN, BLACK, " %s", ServerVersion);\r
-       Console->LPrint(WHITE, BLACK, " - SVN Rev");\r
-       Console->LPrint(GREEN, BLACK, " %s", SVNRevision);\r
-       Console->LClose();\r
-       \r
-       Config = new PConfig();\r
-       if(!Config->LoadOptions(InfoConfigTemplate, "./conf/infoserver.conf"))\r
-           return false; //Shutdown();\r
+    Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
+    Console->Print(WHITE, BLUE, "|  This project is under GPL, see any source file for more details  |");\r
+    Console->Print(WHITE, BLUE, "\\-------------------------------------------------------------------/");\r
+\r
+    //char svnrev[10];\r
+    //GetSVNRev(svnrev);\r
+    Console->LPrint("You are running TinNS Infoserver version");\r
+    Console->LPrint(GREEN, BLACK, " %s", ServerVersion);\r
+    Console->LPrint(WHITE, BLACK, " - SVN Rev");\r
+    Console->LPrint(GREEN, BLACK, " %s", SVNRevision);\r
+    Console->LClose();\r
+\r
+    Config = new PConfig();\r
+    if(!Config->LoadOptions(InfoConfigTemplate, "./conf/infoserver.conf"))\r
+        return false; //Shutdown();\r
   if(!AdditionnalConfigChecks())\r
     return false; //Shutdown();\r
 \r
-       ServerSock = new ServerSocket();\r
-       Server = new PServer();\r
-       \r
-       MySQL = new PMySQL();\r
+    ServerSock = new ServerSocket();\r
+    Server = new PServer();\r
+\r
+    MySQL = new PMySQL();\r
     if(MySQL->Connect() == false)\r
-           return false; //Shutdown();\r
+        return false; //Shutdown();\r
 \r
-       InfoServer = new PInfoServer();\r
-       //Accounts = new PAccounts(); // To be removed\r
+    InfoServer = new PInfoServer();\r
+    //Accounts = new PAccounts(); // To be removed\r
 \r
-       return true;\r
+    return true;\r
 }\r
 \r
 void Shutdown()\r
 {\r
   if(Server) Server->Shutdown();\r
-       if(InfoServer) delete InfoServer;\r
-       if(MySQL) delete MySQL;\r
-       if(Config) delete Config;\r
-       if(Console) delete Console;\r
-       if(ServerSock) delete ServerSock;\r
+    if(InfoServer) delete InfoServer;\r
+    if(MySQL) delete MySQL;\r
+    if(Config) delete Config;\r
+    if(Console) delete Console;\r
+    if(ServerSock) delete ServerSock;\r
     exit(0);\r
 }\r
 \r
 bool AdditionnalConfigChecks()\r
 {\r
   //NOTA: empty config values are never accepted by PConfig objects\r
-  \r
+\r
     int numErr, numWarn;\r
-    \r
+\r
     //std::string sqlhost = Config->GetOption("sql_host");\r
     std::string sqlusername = Config->GetOption("sql_username");\r
     //std::string sqlpassword = Config->GetOption("sql_password");\r
@@ -208,17 +171,15 @@ bool AdditionnalConfigChecks()
         Console->Print("%s Config: minlevel has to be between 0 and 255", Console->ColorText(RED, BLACK, "[Error]"));\r
         numErr++;\r
     }\r
-    \r
+\r
     if(maxclients < 1 )\r
     {\r
         Console->Print("%s Config: maxclients has to be higher or equal to 1", Console->ColorText(RED, BLACK, "[Error]"));\r
         numErr++;\r
     }\r
-    \r
+\r
     if(numErr == 0 /*&& numWarn == 0*/)\r
         return true;\r
     else\r
         return false;\r
 }\r
-\r
-\r
diff --git a/TinNS/Source/InfoServer/Includes.hxx b/TinNS/Source/InfoServer/Includes.hxx
new file mode 100644 (file)
index 0000000..eff92ed
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+\r
+#include "InfoServer/Accounts.hxx"\r
+#include "InfoServer/ConfigTemplate.hxx"\r
+#include "InfoServer/Client.hxx"\r
+#include "InfoServer/InfoServer.hxx"\r
+#include "InfoServer/Server.hxx"\r
+#include "InfoServer/Sql.hxx"\r
+\r
+extern class ServerSocket* ServerSock;\r
+extern class PConsole *Console;\r
+extern class PServer *Server;\r
+extern class PConfig *Config;\r
+extern class PInfoServer *InfoServer;\r
+\r
+extern class PMySQL* MySQL;\r
+//extern class PAccounts* Accounts;  // To be removed\r
+\r
+extern const char ServerVersion[];\r
+extern const char SVNRevision[];\r
+\r
+bool Init();\r
+void Shutdown();\r
+bool AdditionnalConfigChecks();\r
diff --git a/TinNS/Source/InfoServer/InfoServer.cxx b/TinNS/Source/InfoServer/InfoServer.cxx
new file mode 100644 (file)
index 0000000..3d92783
--- /dev/null
@@ -0,0 +1,576 @@
+#include <cstring>\r
+#include "InfoServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+struct PInfoState\r
+{\r
+    enum State\r
+    {\r
+        IS_UNKNOWN,\r
+        IS_CONNECTED,\r
+        IS_HANDSHAKE0,\r
+        IS_AUTHENTICATE,\r
+        IS_SERVERLIST\r
+    } mState;\r
+\r
+    bool mWaitSend; // wait-for-completition flag\r
+    PInfoState()\r
+    {\r
+        mState = IS_UNKNOWN;\r
+        mWaitSend = false;\r
+    };\r
+};\r
+\r
+PInfoServer::PInfoServer()\r
+{\r
+    //mNumClients = 1;\r
+    mLivecheckInterval = Config->GetOptionInt("gameserver_livecheck");\r
+}\r
+\r
+PInfoServer::~PInfoServer()\r
+{\r
+    Console->Print("Closing Infoserver...");\r
+\r
+    ServerSock->closeServer();\r
+\r
+    for(InfoStateMap::iterator i=ClientStates.begin(); i!=ClientStates.end(); i++)\r
+        delete i->second;\r
+}\r
+\r
+void PInfoServer::Start()\r
+{\r
+    uint16_t Port = Config->GetOptionInt("infoserver_port");\r
+    Console->LPrint("Starting Infoserver on port %i...", Port);\r
+\r
+    if(ServerSock->open(Port))\r
+    {\r
+        Console->LPrint(GREEN, BLACK, "Success");\r
+        Console->LClose();\r
+    }\r
+    else\r
+    {\r
+        Console->LPrint(RED, BLACK, "Failed");\r
+        Console->LClose();\r
+    }\r
+    ServerSock->settimeout(0, 10000);\r
+    GSLiveCheck();\r
+}\r
+\r
+void PInfoServer::Update()\r
+{\r
+    if(ServerSock->newConnection())\r
+    {\r
+        int32_t clid = Server->NewClient();\r
+        if(clid!=-1)\r
+        {\r
+            Console->Print(GREEN, BLACK, "Infoserver: client [%i] connected", clid);\r
+            PClient *Client = Server->GetClient(clid);\r
+\r
+            ConnectionTCP* tcpConn = ServerSock->getTCPConnection();\r
+            Client->setTCPConnection(tcpConn);\r
+\r
+            Console->Print("Client address: %s", Client->GetAddress());\r
+            //++mNumClients;\r
+\r
+            PInfoState *state = new PInfoState();\r
+            ClientStates.insert(std::make_pair(Client, state));\r
+            state->mState = PInfoState::IS_CONNECTED;\r
+        } else\r
+        {\r
+            Console->Print("Infoserver: Client connection refused (server full?)");\r
+        }\r
+    }\r
+\r
+    for(InfoStateMap::iterator i=ClientStates.begin(); i!=ClientStates.end();)\r
+    {\r
+        PClient *Client = i->first;\r
+        PInfoState *State = i->second;\r
+        // node gets erased in FinalizeClient, increment iterator now\r
+        ++i;\r
+        if(!ProcessClient(Client, State))\r
+            FinalizeClient(Client, State);\r
+    }\r
+}\r
+\r
+void PInfoServer::GSLiveCheck()\r
+{\r
+    MYSQL_ROW row;\r
+    MYSQL_RES *result;\r
+    char query[256];\r
+    snprintf (query, 256, "SELECT *, (NOW()< (`s_lastupdate` + INTERVAL %d SECOND)) FROM `server_list`", mLivecheckInterval);\r
+\r
+    result = MySQL->ResQuery(query);\r
+    if (result == nullptr)\r
+    {\r
+        Console->Print("Livecheck: %s unable to read server list!", Console->ColorText(RED, BLACK, "[Warning]"));\r
+        MySQL->ShowSQLError();\r
+        return;\r
+    }\r
+    if(mysql_num_rows(result) == 0)\r
+    {\r
+        Console->Print("Livecheck: %s no gameserver found!", Console->ColorText(RED, BLACK, "[Warning]"));\r
+        MySQL->FreeSQLResult(result);\r
+        return;\r
+    }\r
+\r
+    ServerMap::iterator it;\r
+    while((row = mysql_fetch_row(result)))\r
+    {\r
+        it = Serverlist.find(atoi(row[s_id]));\r
+        if(it != Serverlist.end())\r
+        {\r
+            strncpy(it->second.mName, row[s_name], MAX_SERVER_NAME_LENGTH);\r
+            it->second.mLanIp = IPStringToDWord(row[s_lanaddr]);\r
+            it->second.mWanIp = IPStringToDWord(row[s_wanaddr]);\r
+            it->second.mPort = atoi(row[s_port]);\r
+            it->second.mPlayers = atoi(row[s_players]);\r
+            /* Prepared for future addon Servers by Accesslevel */\r
+            // it->second.mMinLv = atoi(row[s_minlv]);\r
+            /* ------------------------------------------------ */\r
+\r
+            // ToDo: If statement correct? Maybe GSLiveCheck() has\r
+            // to be called every mLinvecheckInterval seconds.... We'll\r
+            // see when Gameserver has been rewritten\r
+\r
+            if(row[s_timecheck] && (atoi(row[s_timecheck]) == 1))\r
+            {\r
+                it->second.mLasttimestamp = atol(row[s_lastupdate]);\r
+                it->second.mOnline = true;\r
+            }\r
+            else\r
+            {\r
+                it->second.mOnline = false;\r
+            }\r
+\r
+            it->second.mUpdated = true;\r
+        }\r
+        else\r
+        {\r
+            GameServers tmpServer;\r
+\r
+            strncpy(tmpServer.mName, row[s_name], MAX_SERVER_NAME_LENGTH);\r
+            tmpServer.mLanIp = IPStringToDWord(row[s_lanaddr]);\r
+            tmpServer.mWanIp = IPStringToDWord(row[s_wanaddr]);\r
+            tmpServer.mLasttimestamp = atol(row[s_lastupdate]);\r
+            tmpServer.mPlayers = atoi(row[s_players]);\r
+            tmpServer.mPort = atoi(row[s_port]);\r
+            tmpServer.mOnline = true;\r
+            tmpServer.mUpdated = true;\r
+            Console->Print("Added GameServer %s", tmpServer.mName);\r
+            /* Prepared for future addon Servers by Accesslevel */\r
+            //    tmpServer.mMinLv = atoi(row[s_minlv]);\r
+            /* ------------------------------------------------ */\r
+\r
+            Serverlist.insert(std::make_pair(atoi(row[s_id]), tmpServer));\r
+        }\r
+    }\r
+    MySQL->FreeSQLResult(result);\r
+\r
+    for(ServerMap::iterator it = Serverlist.begin(); it != Serverlist.end(); it++)\r
+    {\r
+        if(it->second.mUpdated == false)\r
+            Serverlist.erase(it);\r
+        else\r
+            it->second.mUpdated = false;\r
+    }\r
+\r
+}\r
+\r
+void PInfoServer::ClientDisconnected(PClient *Client)\r
+{\r
+    InfoStateMap::iterator node = ClientStates.find(Client);\r
+    if(node == ClientStates.end())\r
+        return;\r
+\r
+    PInfoState *State = node->second;\r
+    FinalizeClient(Client, State);\r
+}\r
+\r
+bool PInfoServer::HandleHandshake(PInfoState *State, const uint8_t *Packet, int32_t PacketSize)\r
+{\r
+    //static const uint8_t HANDSHAKE1A[6]={0xfe, 0x03, 0x00, 0x80, 0x03, 0x68};\r
+\r
+    switch(State->mState)\r
+    {\r
+        case PInfoState::IS_HANDSHAKE0 :\r
+        {\r
+            if(PacketSize==6 && *(uint16_t*)&Packet[3]==0x0080 && Packet[5]==0x78)\r
+            {\r
+                //FIXME: this packet seems to be unnecessary, although it appears in traffic dumps\r
+                // (causes clientside "Wrong protocol" errors)\r
+                //Socket->Write(HANDSHAKE1A, 6);\r
+                State->mState = PInfoState::IS_AUTHENTICATE;\r
+            }\r
+            else\r
+            {\r
+                Console->Print(RED, BLACK, "Infoserver protocol error (IS_HANDSHAKE0): invalid packet [%04x]", *(uint16_t*)&Packet[3]);\r
+                return false;\r
+            }\r
+            break;\r
+        }\r
+        default:\r
+            break;\r
+    }\r
+\r
+    return true;\r
+}\r
+\r
+bool PInfoServer::HandleAuthenticate(PClient *Client, PInfoState *State, const uint8_t *Packet, int32_t PacketSize)\r
+{\r
+  int32_t returnval = 0;\r
+    // ReturnValue values:\r
+    // 0: No error\r
+    // -1: Wrong/Unknown username\r
+    // -2: Wrong Password\r
+    // -3: Malformed Auth Data. Please relog\r
+    // -4: Database error, contact admin\r
+    // -5: No such account, Account created. Please relog\r
+    // -6: Could not create autoaccount, PW too short\r
+    // -7: Could not create autoaccount, Name too short\r
+    // -8: Could not create autoaccount, PW and Name too short\r
+    // -9: Duplicate entry for Username! Contact Admin\r
+    // -10: User is banned\r
+    // -11: Insufficient access rights\r
+    // -12: Account is not yet activated (accesslevel = 0)\r
+    // -99: General fault. Contact admin\r
+    ConnectionTCP *Socket = Client->getTCPConn();\r
+    PAccount* currentAccount = NULL;\r
+\r
+    if (PacketSize > 20 && *(uint16_t *)&Packet[3] == 0x8084)\r
+    {\r
+        const uint8_t *Key = &Packet[5];         // password key\r
+        uint16_t ULen = *(uint16_t *)&Packet[16];      // username length\r
+        uint16_t PLen = *(uint16_t *)&Packet[18];      // password length\r
+        char *UserName = (char *)&Packet[20];    // account name\r
+        const uint8_t *PW = &Packet[20 + ULen];    // encoded password\r
+\r
+    if (UserName[ULen-1]) // Check that string is well terminated\r
+    {\r
+      Console->Print("Infoserver: Client [%d]: Username was not NULL-terminated !", Client->GetIndex());\r
+      returnval = -1;\r
+    }\r
+    else\r
+    {\r
+      currentAccount = new PAccount(UserName);\r
+      if(!currentAccount->GetID())\r
+      {\r
+        if(Config->GetOptionInt("auto_accounts")) // Autoaccount\r
+        {\r
+          delete currentAccount;\r
+          currentAccount = new PAccount();\r
+\r
+          if(!currentAccount->SetName(UserName)) // !!! len\r
+          {\r
+              returnval = -7;\r
+          }\r
+          if(!currentAccount->SetPasswordEncoded(PW, PLen, Key))\r
+          {\r
+              returnval = returnval ? -8 : -6;\r
+          }\r
+\r
+          if(!returnval)\r
+          {\r
+            if(currentAccount->Create())\r
+            {\r
+              returnval = -5;\r
+            }\r
+            else\r
+            {\r
+              returnval = -4;\r
+            }\r
+          }\r
+        }\r
+        else\r
+        {\r
+          returnval = -1;\r
+        }\r
+      }\r
+      else\r
+      {\r
+        if(currentAccount->Authenticate(PW, PLen, Key))\r
+        { // Username & Password correct\r
+          if(currentAccount->IsBanned())\r
+          {\r
+              returnval = -10;\r
+          }\r
+          else if(currentAccount->GetLevel() < Config->GetOptionInt("minlevel")) // insufficient access rights\r
+          {\r
+              returnval = -11;\r
+          }\r
+          else if(Config->GetOptionInt("require_validation") == 1 && currentAccount->GetLevel() == PAL_UNREGPLAYER)\r
+          {\r
+              returnval = -12;\r
+          }\r
+          else\r
+          {\r
+              Client->setAccountID(currentAccount->GetID());\r
+              returnval = 0;\r
+          }\r
+\r
+        }\r
+        else\r
+        {\r
+          returnval = -2;\r
+        }\r
+      }\r
+    }\r
+\r
+        bool Failed = false;\r
+        if(returnval == 0)\r
+        {\r
+            uint8_t AUTHOK[28]={0xfe, 0x19, 0x00, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\r
+                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
+                            0x00, 0x00, 0x00, 0x00, 0x00 };\r
+            *(uint32_t *)&AUTHOK[5] = currentAccount->GetID();\r
+            Socket->write(AUTHOK, 28);\r
+            State->mState = PInfoState::IS_SERVERLIST;\r
+        }\r
+        else\r
+        {\r
+            Console->Print("Infoserver: User '%s': authentication failed. Errorcode %d", UserName, returnval);\r
+            Failed = true;  // auth failed\r
+        }\r
+        if(Failed == true)\r
+        {\r
+            std::string errorReason;\r
+            switch(returnval)\r
+            {\r
+                // It seems that the client cuts the line off after 40 chars...\r
+//                                 |1       |10       |20       |30       |40       |50       |60       |70       |80\r
+                case -99:\r
+                {\r
+                    //errorReason = "General fault in processing your login request";\r
+                    errorReason = "General fault while login request";\r
+                    break;\r
+                }\r
+                case -12:\r
+                {\r
+                    //errorReason = "Account not activated. Please check your EMails";\r
+                    errorReason = "Error: Your account is not activated";\r
+                    break;\r
+                }\r
+                case -11:\r
+                {\r
+                    //errorReason = "Login rejected. You have to be " + GetAccessString(Config->GetOptionInt("minlevel")) + " or higher";\r
+                    errorReason = "Level " + GetAccessString(Config->GetOptionInt("minlevel")) + " or higher required";\r
+                    break;\r
+                }\r
+                case -10:\r
+                {\r
+                    errorReason = "You are banned for " + currentAccount->GetBannedTime();\r
+                    break;\r
+                }\r
+                case -9:\r
+                {\r
+                    //errorReason = "Duplicate entry for this login. Contact Admin";\r
+                    errorReason = "Duplicate entry found. Contact Admin";\r
+                    break;\r
+                }\r
+                case -8:\r
+                {\r
+                    //errorReason = "Autoaccount failed, name and password too short";\r
+                    errorReason = "AutoAcc failed, name and pwd too short";\r
+                    break;\r
+                }\r
+                case -7:\r
+                {\r
+                    errorReason = "Autoaccount failed, name is too short";\r
+                    break;\r
+                }\r
+                case -6:\r
+                {\r
+                    //errorReason = "Autoaccount failed, password is too short";\r
+                    errorReason = "Autoaccount failed, pwd is too short";\r
+                    break;\r
+                }\r
+                case -5:\r
+                {\r
+                    errorReason = "New Account created, please login again";\r
+                    break;\r
+                }\r
+                case -4:\r
+                {\r
+                    errorReason = "Database error, contact Administrator";\r
+                    break;\r
+                }\r
+                case -3:\r
+                {\r
+                    errorReason = "Malformed AuthData. Please login again";\r
+                    break;\r
+                }\r
+                case -2:\r
+                {\r
+                    errorReason = "Wrong password";\r
+                    break;\r
+                }\r
+                case -1:\r
+                {\r
+                    errorReason = "Unknown username";\r
+                    break;\r
+                }\r
+            }\r
+            uint8_t AUTHFAILED_HEADER[] = {0xfe, 0x0c, 0x00, 0x83, 0x86, 0x05, 0x00, 0x06, 0x00};\r
+            uint8_t AUTHFAILED_FOOTER[] = {0x00, 0x40};\r
+            *(uint16_t *)&AUTHFAILED_HEADER[1] = errorReason.size() + 8;\r
+            *(uint16_t *)&AUTHFAILED_HEADER[7] = errorReason.size() + 1;\r
+            //*(uint8_t*)&AUTHFAILED_FOOTER[1] = {0x40};\r
+\r
+            Socket->write(AUTHFAILED_HEADER, sizeof(AUTHFAILED_HEADER));\r
+            Socket->write(errorReason.c_str(), errorReason.size());\r
+            Socket->write(AUTHFAILED_FOOTER, sizeof(AUTHFAILED_FOOTER));\r
+            FinalizeClientDelayed(Client, State);\r
+            State->mState=PInfoState::IS_UNKNOWN;\r
+        }\r
+    }\r
+    else\r
+    {\r
+        Console->Print(RED, BLACK, "Infoserver protocol error (IS_AUTHENTICATE): invalid packet [%04x]",\r
+                       *(uint16_t *)&Packet[3]);\r
+        return false;\r
+    }\r
+\r
+    return true;\r
+}\r
+\r
+bool PInfoServer::HandleServerList(PClient *Client, const uint8_t *Packet, int32_t PacketSize)\r
+{\r
+    uint8_t SERVERLIST_HEAD[] = {0xfe, 0x00, 0x00, 0x83, 0x83, 0x01, 0x00, 0x0d, 0x00};\r
+    uint8_t SERVERLIST[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
+    uint8_t SERVERLIST_FOOTER[] = {0x00};\r
+\r
+    ConnectionTCP *Socket = Client->getTCPConn();\r
+\r
+    uint32_t tID = *(uint32_t *)&Packet[5];\r
+    PAccount* currentAccount = new PAccount(Client->getAccountID());\r
+    uint32_t aID = currentAccount->GetID();\r
+\r
+    if(!aID || (aID != tID))\r
+    {\r
+        Console->Print("%s invalid userID %d (auth with id %d)", Console->ColorText(YELLOW, BLACK, "Warning:"), tID, aID);\r
+        delete currentAccount;\r
+        return false;\r
+    }\r
+\r
+    if(currentAccount->GetLevel() < Config->GetOptionInt("minlevel"))\r
+    {\r
+        Console->Print("%s someone tried to bypass the login process! UserID %d", Console->ColorText(RED, BLACK, "Warning:"), aID);\r
+        delete currentAccount;\r
+        return false;\r
+    }\r
+\r
+  if(PacketSize == 31 && *(uint16_t *)&Packet[3]==0x8284)\r
+    {\r
+    GSLiveCheck(); // Perform livecheck to have up-to-date data\r
+\r
+    int32_t len = 0;\r
+    int32_t num = 0;\r
+    for(ServerMap::iterator it = Serverlist.begin(); it != Serverlist.end(); it++)\r
+    {\r
+        num++;\r
+        len += 14 + strlen(it->second.mName);\r
+    }\r
+\r
+    *(uint16_t *)&SERVERLIST_HEAD[1] = len;\r
+    *(uint8_t *)&SERVERLIST_HEAD[5] = num;\r
+    Socket->write(SERVERLIST_HEAD, sizeof(SERVERLIST_HEAD));\r
+\r
+    for(ServerMap::iterator it = Serverlist.begin(); it != Serverlist.end(); it++)\r
+    {\r
+            /* Prepared for future addon Servers by Accesslevel */\r
+//            if(accesslevel >= it->second.mMinLv)\r
+//            {\r
+            /* ------------------------------------------------ */\r
+            // Todo: Set correct lan/wan IP here!\r
+      *(uint32_t *)&SERVERLIST[0] = it->second.mLanIp;\r
+      *(uint16_t *)&SERVERLIST[4] = it->second.mPort;\r
+      *(uint8_t *)&SERVERLIST[8] = strlen(it->second.mName) + 1;\r
+      *(uint16_t *)&SERVERLIST[9] = it->second.mPlayers;\r
+      if(it->second.mOnline == true)\r
+      {\r
+          Console->Print("Sending server name: %s ip: %s player: %d port: %d online: yes", it->second.mName,\r
+                         IPlongToString(it->second.mLanIp), it->second.mPlayers, it->second.mPort);\r
+          *(uint16_t *)&SERVERLIST[11] = 1;\r
+      }\r
+      else if(it->second.mOnline == false)\r
+      {\r
+          Console->Print("Sending server name: %s ip: %s player: %d port: %d online: no", it->second.mName,\r
+                         IPlongToString(it->second.mLanIp), it->second.mPlayers, it->second.mPort);\r
+          *(uint16_t *)&SERVERLIST[11] = 0;\r
+      }\r
+      Socket->write(SERVERLIST, sizeof(SERVERLIST));\r
+      Socket->write(it->second.mName, strlen(it->second.mName));\r
+      Socket->write(SERVERLIST_FOOTER, sizeof(SERVERLIST_FOOTER));\r
+            /* Prepared for future addon Servers by Accesslevel */\r
+//            }\r
+            /* ------------------------------------------------ */\r
+    }\r
+    }\r
+    else\r
+    {\r
+        Console->Print(RED, BLACK, "Infoserver protocol error (IS_SERVERLIST): invalid packet [%04x]",\r
+                       *(uint16_t *)&Packet[3]);\r
+        delete currentAccount;\r
+        return false;\r
+    }\r
+    delete currentAccount;\r
+    return true;\r
+}\r
+\r
+bool PInfoServer::ProcessClient(PClient *Client, PInfoState *State)\r
+{\r
+    static const uint8_t HANDSHAKE0A[6]={0xfe, 0x03, 0x00, 0x80, 0x01, 0x66};\r
+\r
+    if(!State)\r
+    {\r
+        InfoStateMap::iterator node = ClientStates.find(Client);\r
+        if(node == ClientStates.end())\r
+            return false;\r
+\r
+        State = node->second;\r
+    }\r
+\r
+    ConnectionTCP *Socket = Client->getTCPConn();\r
+\r
+    if(State->mWaitSend && Socket->getSendBufferSize()==0)\r
+        return false;\r
+\r
+    if(State->mState==PInfoState::IS_CONNECTED)\r
+    {\r
+        Socket->write(HANDSHAKE0A, 6);\r
+        State->mState = PInfoState::IS_HANDSHAKE0;\r
+    }\r
+\r
+    int32_t PacketSize=0;\r
+    const uint8_t *Packet = Socket->read(&PacketSize);\r
+    if(PacketSize > 0)\r
+    {\r
+        switch(State->mState)\r
+        {\r
+            case PInfoState::IS_HANDSHAKE0:\r
+                return HandleHandshake(State, Packet, PacketSize);\r
+\r
+            case PInfoState::IS_AUTHENTICATE:\r
+                return HandleAuthenticate(Client, State, Packet, PacketSize);\r
+\r
+            case PInfoState::IS_SERVERLIST:\r
+                return HandleServerList(Client, Packet, PacketSize);\r
+            default:\r
+                break;\r
+        }\r
+    }\r
+    return true;\r
+}\r
+\r
+void PInfoServer::FinalizeClient(PClient *Client, PInfoState *State)\r
+{\r
+    Console->Print(RED, BLACK, "Infoserver: client %s disconnected", Client->GetAddress());\r
+    Client->InfoDisconnect();\r
+    ClientStates.erase(Client);\r
+    delete State;\r
+}\r
+\r
+void PInfoServer::FinalizeClientDelayed(PClient *Client, PInfoState *State)\r
+{\r
+    Console->Print("Infoserver: client %i is about to be disconnected", Client->GetIndex());\r
+    State->mWaitSend = true;\r
+}\r
diff --git a/TinNS/Source/InfoServer/InfoServer.hxx b/TinNS/Source/InfoServer/InfoServer.hxx
new file mode 100644 (file)
index 0000000..350391b
--- /dev/null
@@ -0,0 +1,64 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+\r
+class PClient;\r
+struct PInfoState;\r
+\r
+#define MAX_SERVER_NAME_LENGTH 45\r
+struct GameServers {\r
+    char  mName[MAX_SERVER_NAME_LENGTH];\r
+    uint32_t mLanIp;\r
+    uint32_t mWanIp;\r
+    int16_t mPort;\r
+    int32_t mPlayers;\r
+    bool mOnline;\r
+    bool mUpdated;\r
+    time_t mLasttimestamp;\r
+/* Prepared for future addon Servers by Accesslevel */\r
+//    int             mMinLv;\r
+/* ------------------------------------------------ */\r
+};\r
+\r
+class PInfoServer {\r
+private:\r
+    // SQL layout\r
+    enum {\r
+        s_id,\r
+        s_name,\r
+        s_wanaddr,\r
+        s_port,\r
+        s_players,\r
+        s_lastupdate,\r
+        s_lanaddr,\r
+        s_timecheck // computed field, not in table !\r
+    };\r
+    //int mNumClients;\r
+    typedef std::map<PClient *, struct PInfoState *> InfoStateMap;\r
+    InfoStateMap ClientStates;\r
+\r
+    typedef std::map<int32_t, GameServers> ServerMap;\r
+    ServerMap Serverlist;\r
+\r
+    //time_t mLastLivecheck;\r
+    int mLivecheckInterval;\r
+    void GSLiveCheck();\r
+\r
+protected:\r
+    bool ProcessClient(PClient *Client, PInfoState *State = nullptr);\r
+    void FinalizeClient(PClient *Client, PInfoState *State);\r
+    void FinalizeClientDelayed(PClient *Client, PInfoState *State);\r
+\r
+    bool HandleHandshake(PInfoState *State, const uint8_t *Packet, int32_t PacketSize);\r
+    bool HandleAuthenticate(PClient *Client, PInfoState *State, const uint8_t *Packet, int32_t PacketSize);\r
+    bool HandleServerList(PClient *Client, const uint8_t *Packet, int32_t PacketSize);\r
+\r
+public:\r
+    PInfoServer();\r
+    ~PInfoServer();\r
+\r
+    void Start();\r
+    void Update();\r
+    void ClientDisconnected(PClient *Client);\r
+};\r
diff --git a/TinNS/Source/InfoServer/Main.cxx b/TinNS/Source/InfoServer/Main.cxx
new file mode 100644 (file)
index 0000000..0c87d5e
--- /dev/null
@@ -0,0 +1,35 @@
+#include <csignal>\r
+#include "InfoServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+void signal_handler(int signal)\r
+{\r
+    if (signal == SIGINT)\r
+        Shutdown();\r
+}\r
+\r
+int main()\r
+{\r
+    signal(SIGINT, signal_handler);\r
+\r
+    if (!Init())\r
+    {\r
+        if(Console)\r
+            Console->Print("%s Aborting startup.", Console->ColorText(RED, BLACK, "[Fatal]"));\r
+        Shutdown(); // exits with 0 ...\r
+    }\r
+\r
+    InfoServer->Start();\r
+    Console->Print("Infoserver is now %s. Waiting for clients...", Console->ColorText(GREEN, BLACK, "Online"));\r
+\r
+    while (true)\r
+    {\r
+        ServerSock->update();\r
+        Server->Update();\r
+        InfoServer->Update();\r
+        MySQL->Update(); // MySQL keepalive\r
+        Console->Update();\r
+    }\r
+\r
+    return 0;\r
+}\r
diff --git a/TinNS/Source/InfoServer/Server.cxx b/TinNS/Source/InfoServer/Server.cxx
new file mode 100644 (file)
index 0000000..370063f
--- /dev/null
@@ -0,0 +1,80 @@
+#include "InfoServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+PServer::PServer()\r
+{\r
+  mMaxClients = Config->GetOptionInt("maxclients");\r
+\r
+    mClients.reserve(mMaxClients);\r
+    mNumClients = 0;\r
+    for (int32_t i=0; i<mMaxClients; i++)\r
+        mClients[i]=0;\r
+}\r
+\r
+PServer::~PServer()\r
+{\r
+    for (int32_t i=0; i<mMaxClients; i++)\r
+        delete mClients[i];\r
+}\r
+\r
+int32_t PServer::GetNumClients() const\r
+{\r
+    return mNumClients;\r
+}\r
+\r
+int PServer::NewClient()\r
+{\r
+    if(mNumClients==mMaxClients)\r
+        return -1;\r
+\r
+    for (int32_t i=0; i<mMaxClients; i++)\r
+    {\r
+        if(!mClients[i])\r
+        {\r
+            mClients[i]=new PClient(i);\r
+            ++mNumClients;\r
+            return i;\r
+        }\r
+    }\r
+    return -1;\r
+}\r
+\r
+PClient *PServer::GetClient(int32_t Client) const\r
+{\r
+    if (Client < 0 || Client >= mMaxClients)\r
+        return 0;\r
+\r
+    return mClients[Client];\r
+}\r
+\r
+void PServer::Update()\r
+{\r
+    for (int32_t i=0; i<mMaxClients; i++)\r
+    {\r
+        if(mClients[i])\r
+        {\r
+            mClients[i]->Update();\r
+            if(mClients[i]->GetConnection()==PCC_NONE && mClients[i]->getTCPConn() == 0)\r
+            {\r
+                Console->Print("Removing client ...");\r
+                delete mClients[i];\r
+                mClients[i]=0;\r
+                --mNumClients;\r
+            }\r
+        }\r
+    }\r
+}\r
+\r
+void PServer::Shutdown()\r
+{\r
+    Console->Print("======================");\r
+    Console->Print("Shutting down Infoserver...");\r
+    for (int32_t i=0; i<mMaxClients; i++)\r
+    {\r
+        if(mClients[i])\r
+        {\r
+            delete mClients[i];\r
+            mClients[i]=0;\r
+        }\r
+    }\r
+}\r
diff --git a/TinNS/Source/InfoServer/Server.hxx b/TinNS/Source/InfoServer/Server.hxx
new file mode 100644 (file)
index 0000000..c027fbb
--- /dev/null
@@ -0,0 +1,23 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <vector>\r
+\r
+class PClient;\r
+\r
+class PServer {\r
+private:\r
+    int32_t mMaxClients;\r
+    int32_t mNumClients;\r
+    std::vector<PClient *> mClients;\r
+\r
+public:\r
+    PServer();\r
+    ~PServer();\r
+\r
+    int32_t GetNumClients() const;\r
+    int32_t NewClient();\r
+    PClient *GetClient(int32_t Client) const;\r
+    void Update();\r
+    void Shutdown();\r
+};\r
similarity index 59%
rename from server/src/info/sql.cpp
rename to TinNS/Source/InfoServer/Sql.cxx
index 0513752..6dbdf96 100644 (file)
@@ -1,25 +1,6 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#include "main.h"\r
+#include <cstring>\r
+#include "InfoServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
 \r
 PMySQL::PMySQL()\r
 {\r
@@ -29,7 +10,7 @@ PMySQL::PMySQL()
     strncpy(password, Config->GetOption("sql_password").c_str(), 100);\r
     strncpy(database, Config->GetOption("global_sql_database").c_str(), 100);\r
 \r
-    mKeepaliveDelay = (std::time_t) (Config->GetOptionInt("mysql_wait_timeout") * 0.9) ; // we take 90% of the wait_timeout to trigger keepalive\r
+    mKeepaliveDelay = (time_t) (Config->GetOptionInt("mysql_wait_timeout") * 0.9) ; // we take 90% of the wait_timeout to trigger keepalive\r
     if (mKeepaliveDelay == 0)\r
     {\r
       Console->Print("%s MySQL keepalive disabled by config", Console->ColorText(GREEN, BLACK, "[Info]"));\r
@@ -49,9 +30,9 @@ PMySQL::~PMySQL()
 }\r
 \r
 void PMySQL::Update()\r
-{    \r
+{\r
     // MySQL keepalive\r
-    std::time_t t = std::time(NULL);\r
+    time_t t = std::time(NULL);\r
     if ((mKeepaliveDelay > 0) && ((t - mLastKeepaliveSent) > mKeepaliveDelay))\r
     {\r
       MYSQL_RES *result;\r
@@ -66,35 +47,40 @@ void PMySQL::Update()
           return;\r
       }\r
       else\r
-        FreeSQLResult(result);      \r
-    \r
+        FreeSQLResult(result);\r
+\r
       mLastKeepaliveSent = std::time(NULL);\r
 //Console->Print("%s MySQL keepalive sent", Console->ColorText(GREEN, BLACK, "[Debug]"));\r
     }\r
 }\r
 \r
+MYSQL *PMySQL::GetHandle()\r
+{\r
+    return dbHandle;\r
+}\r
+\r
 bool PMySQL::Connect()\r
 {\r
     Console->LPrint("Establishing link to MySQL Database...");\r
 \r
-       dbHandle = mysql_init(NULL);\r
+    dbHandle = mysql_init(NULL);\r
 \r
-       if(dbHandle)\r
-       {\r
-               //Console->Print("MySQL-Handle successfully initialized.");\r
-       }\r
-       else\r
-       {\r
-               Console->LPrint(RED, BLACK, "[ERROR]");\r
-               Console->LClose();\r
-               Console->Print(" MySQL-Handle couldn't be created!");\r
-               exit(0);\r
-       }\r
+    if(dbHandle)\r
+    {\r
+        //Console->Print("MySQL-Handle successfully initialized.");\r
+    }\r
+    else\r
+    {\r
+        Console->LPrint(RED, BLACK, "[ERROR]");\r
+        Console->LClose();\r
+        Console->Print(" MySQL-Handle couldn't be created!");\r
+        exit(0);\r
+    }\r
 \r
     if(!mysql_real_connect(dbHandle, host, userName, password, database, port, NULL, 0))\r
     {\r
-               Console->LPrint(RED, BLACK, "[ERROR]");\r
-               Console->LClose();\r
+        Console->LPrint(RED, BLACK, "[ERROR]");\r
+        Console->LClose();\r
         Console->Print("Unable to connect to MySQL Database. MySQL returned: %s", mysql_error(dbHandle));\r
         return false;\r
     }\r
@@ -108,7 +94,7 @@ bool PMySQL::Connect()
 \r
 MYSQL_RES *PMySQL::ResQuery(const char *query)\r
 {\r
-    int sql_result = 0;\r
+    int32_t sql_result = 0;\r
     MYSQL_RES *result;\r
 \r
     sql_result = mysql_real_query(dbHandle, query, strlen(query));\r
@@ -125,9 +111,9 @@ MYSQL_RES *PMySQL::ResQuery(const char *query)
     return result;\r
 }\r
 \r
-int PMySQL::Query(const char *query)\r
+int32_t PMySQL::Query(const char *query)\r
 {\r
-    int sql_result = 0;\r
+    int32_t sql_result = 0;\r
     sql_result = mysql_real_query(dbHandle, query, strlen(query));\r
 \r
     return sql_result;\r
@@ -143,14 +129,19 @@ void PMySQL::FreeSQLResult(MYSQL_RES *res)
   mysql_free_result(res);\r
 }\r
 \r
-u32 PMySQL::EscapeString(const char* nText, char* dText, u32 dMaxLength)\r
+uint32_t PMySQL::GetLastInsertId()\r
 {\r
-  u32 nLength = strlen(nText);\r
-  u32 tMax = (dMaxLength - 1)/2;\r
+    return mysql_insert_id(dbHandle);\r
+}\r
+\r
+uint32_t PMySQL::EscapeString(const char *nText, char *dText, uint32_t dMaxLength)\r
+{\r
+  uint32_t nLength = strlen(nText);\r
+  uint32_t tMax = (dMaxLength - 1)/2;\r
   if(nLength > tMax)\r
   {\r
     nLength = tMax;\r
   }\r
-  \r
+\r
   return mysql_real_escape_string(dbHandle, dText, nText, nLength);\r
 }\r
diff --git a/TinNS/Source/InfoServer/Sql.hxx b/TinNS/Source/InfoServer/Sql.hxx
new file mode 100644 (file)
index 0000000..c58dc27
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#ifdef MYSQL_INC_DIR\r
+#include <mysql/mysql.h>\r
+#else\r
+#include <mysql.h>\r
+#endif\r
+\r
+class PMySQL {\r
+private:\r
+    int32_t port;\r
+    char host[100];\r
+    char userName[100];\r
+    char password[100];\r
+    char database[100];\r
+    MYSQL *dbHandle;\r
+    time_t mKeepaliveDelay;\r
+    time_t mLastKeepaliveSent;\r
+\r
+public:\r
+    PMySQL();\r
+    ~PMySQL();\r
+\r
+    void Update();\r
+    MYSQL *GetHandle();\r
+\r
+    bool Connect();\r
+    int32_t Query(const char *query);\r
+    MYSQL_RES *ResQuery(const char *query);\r
+    void ShowSQLError();\r
+    void FreeSQLResult(MYSQL_RES *res);\r
+    uint32_t GetLastInsertId();\r
+    uint32_t EscapeString(const char *nText, char *dText, uint32_t dMaxLength);\r
+};\r
diff --git a/TinNS/Source/PatchServer/CMakeLists.txt b/TinNS/Source/PatchServer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0cdda9b
--- /dev/null
@@ -0,0 +1,2 @@
+ADD_EXECUTABLE          (PatchServer Client.cxx Includes.cxx PatchServer.cxx Main.cxx Server.cxx)
+TARGET_LINK_LIBRARIES   (PatchServer Common ${PCRE_LIBRARY} ${RT_LIBRARY} ${ZLIB_LIBRARY})
diff --git a/TinNS/Source/PatchServer/Client.cxx b/TinNS/Source/PatchServer/Client.cxx
new file mode 100644 (file)
index 0000000..e4b5036
--- /dev/null
@@ -0,0 +1,71 @@
+#include "PatchServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+PClient::PClient(int32_t Index)\r
+{\r
+       mIndex = Index;\r
+       mConnection = PCC_NONE;\r
+}\r
+\r
+PClient::~PClient()\r
+{\r
+    if(m_TCPConnection)\r
+    {\r
+        delete m_TCPConnection;\r
+    }\r
+}\r
+\r
+int32_t PClient::GetIndex() const\r
+{\r
+    return mIndex;\r
+}\r
+\r
+int32_t PClient::GetConnection() const\r
+{\r
+    return mConnection;\r
+}\r
+\r
+const char *PClient::GetAddress() const\r
+{\r
+    return m_TCPConnection->getRemoteAddress();\r
+}\r
+\r
+void PClient::setTCPConnection(ConnectionTCP *conn)\r
+{\r
+    m_TCPConnection = conn;\r
+    mConnection = PCC_PATCH;\r
+}\r
+\r
+ConnectionTCP *PClient::getTCPConn()\r
+{\r
+    return m_TCPConnection;\r
+}\r
+\r
+void PClient::Update()\r
+{\r
+    if(m_TCPConnection)\r
+    {\r
+        if(m_TCPConnection->timeOut())\r
+        {\r
+            Console->Print("Patchsocket: Client %i: timeout", mIndex);\r
+            PatchServer->ClientDisconnected(this);\r
+        }\r
+        else\r
+        {\r
+            if(!m_TCPConnection->update())\r
+            {\r
+                PatchServer->ClientDisconnected(this);\r
+            }\r
+        }\r
+       }\r
+}\r
+\r
+void PClient::PatchDisconnect()\r
+{\r
+    if(m_TCPConnection)\r
+    {\r
+        delete m_TCPConnection;\r
+    }\r
+    mConnection = PCC_NONE;\r
+    m_TCPConnection = 0;\r
+}\r
diff --git a/TinNS/Source/PatchServer/Client.hxx b/TinNS/Source/PatchServer/Client.hxx
new file mode 100644 (file)
index 0000000..c0abe39
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+\r
+class ConnectionTCP;\r
+\r
+enum PClientConnection {\r
+    PCC_NONE = 0,\r
+    PCC_PATCH = 1\r
+};\r
+\r
+class PClient {\r
+private:\r
+    ConnectionTCP *m_TCPConnection;\r
+    int32_t mIndex;\r
+    int32_t mConnection;\r
+\r
+public:\r
+    PClient(int32_t Index);\r
+    ~PClient();\r
+\r
+    int32_t GetIndex() const;\r
+    int32_t GetConnection() const;\r
+    const char *GetAddress() const;\r
+    void setTCPConnection(ConnectionTCP *conn);\r
+    ConnectionTCP *getTCPConn();\r
+    void Update();\r
+    void PatchDisconnect();\r
+};\r
diff --git a/TinNS/Source/PatchServer/ConfigTemplate.hxx b/TinNS/Source/PatchServer/ConfigTemplate.hxx
new file mode 100644 (file)
index 0000000..4b58417
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once\r
+\r
+static const char *PatchConfigTemplate[][2] = {\r
+  // {option_name, default_value} if default_value is empty string, it means option is mandatory\r
+  // List ends with empty string for option_name\r
+  {"server_version", "200"},\r
+  {"patchserver_port", "8040"},\r
+  {"patches_path", "./patches"},\r
+  {"file_path", "./files"},\r
+  {"max_file_xfers", "5"},\r
+  {"patch_packet_size", "512"},\r
+  {"maxclients", "5"},\r
+  {"gm_slots", "2"},\r
+\r
+  {"", ""} // do not change this line (end mark)\r
+};\r
diff --git a/TinNS/Source/PatchServer/Includes.cxx b/TinNS/Source/PatchServer/Includes.cxx
new file mode 100644 (file)
index 0000000..b6551de
--- /dev/null
@@ -0,0 +1,61 @@
+#include "PatchServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+const char ServerVersion[] = TINNS_PATCH_VERSION;\r
+const char SVNRevision[] = TINNS_SVN_REVISION;\r
+\r
+ServerSocket* ServerSock = 0;\r
+PConsole *Console = 0;\r
+PServer *Server = 0;\r
+PConfig *Config = 0;\r
+PFileSystem *Filesystem = 0;\r
+PPatchServer *PatchServer = 0;\r
+\r
+bool InitTinNS()\r
+{\r
+    Console = new PConsole("log/patchserver.log");  // Make that from config file !!!\r
+    Console->Print("Starting TinNS Patchserver...");\r
+    Console->Print(WHITE, BLUE, "/-------------------------------------------------------------------\\");\r
+    Console->Print(WHITE, BLUE, "|               TinNS (TinNS is not a Neocron Server)               |");\r
+    Console->Print(WHITE, BLUE, "|            Copyright (C) 2005 Linux Addicted Community            |");\r
+    Console->Print(WHITE, BLUE, "|                  maintainer Akiko <akiko@gmx.org>                 |");\r
+    Console->Print(WHITE, BLUE, "|             ==========================================            |");\r
+    Console->Print(WHITE, BLUE, "|      Head coders:                   The packet analyzing team:    |");\r
+    Console->Print(WHITE, BLUE, "|      - Akiko                         - MaxxJag                    |");\r
+    Console->Print(WHITE, BLUE, "|      - bakkdoor                      - Sting                      |");\r
+    Console->Print(WHITE, BLUE, "|      - Namikon                       - Balm                       |");\r
+    Console->Print(WHITE, BLUE, "|      - Hammag                                                     |");\r
+    Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
+    Console->Print(WHITE, BLUE, "|  This project would'nt be at its current stage without the help   |");\r
+    Console->Print(WHITE, BLUE, "|        from the NeoPolis team, special thanks to you guys!        |");\r
+    Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
+    Console->Print(WHITE, BLUE, "|  This project is under GPL, see any source file for more details  |");\r
+    Console->Print(WHITE, BLUE, "\\-------------------------------------------------------------------/");\r
+\r
+    //char svnrev[10];\r
+    //GetSVNRev(svnrev);\r
+    Console->LPrint("You are running TinNS Patchserver version");\r
+    Console->LPrint(GREEN, BLACK, " %s", ServerVersion);\r
+    Console->LPrint(WHITE, BLACK, " - SVN Rev");\r
+    Console->LPrint(GREEN, BLACK, " %s", SVNRevision);\r
+    Console->LClose();\r
+\r
+    Config = new PConfig();\r
+    if(!Config->LoadOptions(PatchConfigTemplate ,"./conf/patchserver.conf"))\r
+    Shutdown();\r
+\r
+    ServerSock = new ServerSocket();\r
+    Server = new PServer();\r
+    PatchServer = new PPatchServer();\r
+\r
+    return true;\r
+}\r
+\r
+void Shutdown()\r
+{\r
+    if(PatchServer) delete PatchServer;\r
+    if(Config) delete Config;\r
+    if(Console) delete Console;\r
+    if(ServerSock) delete ServerSock;\r
+    exit(0);\r
+}\r
diff --git a/TinNS/Source/PatchServer/Includes.hxx b/TinNS/Source/PatchServer/Includes.hxx
new file mode 100644 (file)
index 0000000..b6fd386
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once\r
+\r
+#include "PatchServer/Client.hxx"\r
+#include "PatchServer/ConfigTemplate.hxx"\r
+#include "PatchServer/PatchServer.hxx"\r
+#include "PatchServer/Server.hxx"\r
+\r
+extern class ServerSocket* ServerSock;\r
+extern class PConsole *Console;\r
+extern class PConfig *Config;\r
+extern class PFileSystem *Filesystem;\r
+extern class PServer *Server;\r
+extern class PPatchServer *PatchServer;\r
+\r
+extern const char ServerVersion[];\r
+extern const char SVNRevision[];\r
+\r
+bool InitTinNS();\r
+void Shutdown();\r
diff --git a/TinNS/Source/PatchServer/Main.cxx b/TinNS/Source/PatchServer/Main.cxx
new file mode 100644 (file)
index 0000000..c2d4d83
--- /dev/null
@@ -0,0 +1,36 @@
+#include <chrono>\r
+#include <csignal>\r
+#include <thread>\r
+#include "PatchServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+void signal_handler(int signal)\r
+{\r
+    if (signal == SIGINT)\r
+        Shutdown();\r
+    else\r
+        psignal(signal, "Unkown signal: ");\r
+}\r
+\r
+int main()\r
+{\r
+    signal(SIGINT, signal_handler);\r
+\r
+\r
+    if (!InitTinNS())\r
+        while (true)\r
+            std::this_thread::sleep_for(std::chrono::seconds(1));\r
+\r
+    PatchServer->Start();\r
+    Console->Print("Patchserver is now %s. Waiting for clients...", Console->ColorText(GREEN, BLACK, "Online"));\r
+\r
+    while (true)\r
+    {\r
+        ServerSock->update();\r
+        Server->Update();\r
+        PatchServer->Update();\r
+        // sched_yield();\r
+    }\r
+\r
+    return 0;\r
+}\r
similarity index 65%
rename from server/src/patch/patchserver.cpp
rename to TinNS/Source/PatchServer/PatchServer.cxx
index 01c0e86..ae4c1e7 100644 (file)
@@ -1,57 +1,11 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        patchserver.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-        MODIFIED: 06 Jan 2006 Namikon\r
-        REASON: - Added color to console outputs\r
-        \r
-        MODIFIED: 01 Jul 2006 hammag\r
-        REASON: - added set timeout to 10 msec (for ReadSetTCP select) in Start()\r
-                       to avoid useless 100% CPU use\r
-             MODIFIED: 11 Dec 2006 hammag\r
-             REASON: - Display the client id in Client connection message rather than the always increasing mNumClients\r
-                     - Removed use of mNumClients in PPatchServer. the count is done in PServer.\r
-\r
-        ToDo:\r
-          - Take main loop timeout setting from config file\r
-*/\r
-\r
-#include "main.h"\r
-\r
-struct PPatchState\r
-{\r
+#include <cstring>\r
+#include <sstream>\r
+#include "PatchServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+const uint16_t PATCH_PORT = 7000;\r
+\r
+struct PPatchState {\r
        enum State\r
        {\r
                PS_UNKNOWN,\r
@@ -64,16 +18,16 @@ struct PPatchState
                PS_SENDFILE\r
        } mState;\r
 \r
-       u16 mSerial;\r
+       uint16_t mSerial;\r
 \r
-       u32 mCurrentPatch;\r
-       u32 mPatchOffset;\r
-       u32 mPatchSize;\r
+       uint32_t mCurrentPatch;\r
+       uint32_t mPatchOffset;\r
+       uint32_t mPatchSize;\r
        std::FILE *mPatchFile;\r
 \r
        std::string mCurrentFile;\r
-       u32 mFileOffset;\r
-       u32 mFileSize;\r
+       uint32_t mFileOffset;\r
+       uint32_t mFileSize;\r
        PFile *mSendFile;\r
 \r
        bool mWaitSend; // wait-for-completition flag\r
@@ -120,7 +74,7 @@ PPatchServer::~PPatchServer()
 \r
 void PPatchServer::Start()\r
 {\r
-       u16 Port = Config->GetOptionInt("patchserver_port");\r
+       uint16_t Port = Config->GetOptionInt("patchserver_port");\r
        if(Port==0)\r
                Port=PATCH_PORT;\r
 \r
@@ -143,7 +97,7 @@ void PPatchServer::Update()
 \r
        if(ServerSock->newConnection())\r
        {\r
-               int clid = Server->NewClient();\r
+               int32_t clid = Server->NewClient();\r
                if(clid!=-1)\r
                {\r
                        Console->Print(GREEN, BLACK, "Patchserver: client [%i] connected", clid);\r
@@ -206,9 +160,9 @@ void PPatchServer::ClientDisconnected(PClient *Client)
        FinalizeClient(Client, State);\r
 }\r
 \r
-bool PPatchServer::HandleHandshake(PClient *Client, PPatchState *State, const u8 *Packet, int PacketSize)\r
+bool PPatchServer::HandleHandshake(PClient *Client, PPatchState *State, const uint8_t *Packet, int32_t PacketSize)\r
 {\r
-       static const u8 HANDSHAKE1A[6]={0xfe, 0x03, 0x00, 0x80, 0x01, 0x73};\r
+       static const uint8_t HANDSHAKE1A[6]={0xfe, 0x03, 0x00, 0x80, 0x01, 0x73};\r
 \r
        ConnectionTCP *Socket = Client->getTCPConn();\r
 \r
@@ -216,13 +170,13 @@ bool PPatchServer::HandleHandshake(PClient *Client, PPatchState *State, const u8
        {\r
                case PPatchState::PS_HANDSHAKE0 :\r
                {\r
-                       if(PacketSize==6 && *(u16*)&Packet[3]==0x0280 && Packet[5]==0x64)\r
+                       if(PacketSize==6 && *(uint16_t*)&Packet[3]==0x0280 && Packet[5]==0x64)\r
                        {\r
                                Socket->write(HANDSHAKE1A, sizeof(HANDSHAKE1A));\r
                                State->mState = PPatchState::PS_HANDSHAKE1;\r
                        } else\r
                        {\r
-                               Console->Print("Patchserver protocol error (PS_HANDSHAKE0): invalid packet [%04x]", *(u16*)&Packet[3]);\r
+                               Console->Print("Patchserver protocol error (PS_HANDSHAKE0): invalid packet [%04x]", *(uint16_t*)&Packet[3]);\r
                                return false;\r
                        }\r
 \r
@@ -231,11 +185,11 @@ bool PPatchServer::HandleHandshake(PClient *Client, PPatchState *State, const u8
 \r
                case PPatchState::PS_HANDSHAKE1 :\r
                {\r
-                       if(PacketSize==6 && *(u16*)&Packet[3]==0x0080 && Packet[5]==0x6c)\r
+                       if(PacketSize==6 && *(uint16_t*)&Packet[3]==0x0080 && Packet[5]==0x6c)\r
                                State->mState = PPatchState::PS_VERSIONREQUEST;\r
                        else\r
                        {\r
-                               Console->Print("Patchserver protocol error (PS_HANDSHAKE1): invalid packet [%04x]", *(u16*)&Packet[3]);\r
+                               Console->Print("Patchserver protocol error (PS_HANDSHAKE1): invalid packet [%04x]", *(uint16_t*)&Packet[3]);\r
                                return false;\r
                        }\r
                        break;\r
@@ -247,39 +201,39 @@ bool PPatchServer::HandleHandshake(PClient *Client, PPatchState *State, const u8
        return true;\r
 }\r
 \r
-bool PPatchServer::HandleVersionRequest(PClient *Client, PPatchState *State, const u8 *Packet, int PacketSize)\r
+bool PPatchServer::HandleVersionRequest(PClient *Client, PPatchState *State, const uint8_t *Packet, int32_t PacketSize)\r
 {\r
-       static u8 VERSIONPACKET[13]={0xfe, 0x0a, 0x00, 0x37, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
+       static uint8_t VERSIONPACKET[13]={0xfe, 0x0a, 0x00, 0x37, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
 \r
        ConnectionTCP *Socket = Client->getTCPConn();\r
-       if(PacketSize==9 && *(u16*)&Packet[3]==0x007b)\r
+       if(PacketSize==9 && *(uint16_t*)&Packet[3]==0x007b)\r
        {\r
-               State->mSerial = *(u16*)&Packet[7];\r
-               *(u16*)&VERSIONPACKET[7]=State->mSerial;\r
-               u32 ver = Config->GetOptionInt("server_version");\r
-               *(u32*)&VERSIONPACKET[9]=ver;\r
+               State->mSerial = *(uint16_t*)&Packet[7];\r
+               *(uint16_t*)&VERSIONPACKET[7]=State->mSerial;\r
+               uint32_t ver = Config->GetOptionInt("server_version");\r
+               *(uint32_t*)&VERSIONPACKET[9]=ver;\r
                Socket->write(VERSIONPACKET, 13);\r
                State->mState = PPatchState::PS_GETPATCHORFILE;\r
        } else\r
        {\r
-               Console->Print("Patchserver protocol error (PS_VERSIONREQUEST): invalid packet [%04x]", *(u16*)&Packet[3]);\r
+               Console->Print("Patchserver protocol error (PS_VERSIONREQUEST): invalid packet [%04x]", *(uint16_t*)&Packet[3]);\r
                return false;\r
        }\r
 \r
        return true;\r
 }\r
 \r
-bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const u8 *Packet, int PacketSize)\r
+bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const uint8_t *Packet, int32_t PacketSize)\r
 {\r
-       static u8 STARTPATCH[13]={0xfe, 0x0a, 0x00, 0x38, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
-       static u8 STARTFILE[13]={0xfe, 0x0a, 0x00, 0x3b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
-       static u8 FILEERROR[9]={0xfe, 0x06, 0x00, 0x3d, 0x02, 0x00, 0x00, 0x00, 0x00};\r
+       static uint8_t STARTPATCH[13]={0xfe, 0x0a, 0x00, 0x38, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
+       static uint8_t STARTFILE[13]={0xfe, 0x0a, 0x00, 0x3b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
+       static uint8_t FILEERROR[9]={0xfe, 0x06, 0x00, 0x3d, 0x02, 0x00, 0x00, 0x00, 0x00};\r
 \r
        ConnectionTCP *Socket = Client->getTCPConn();\r
        // request patch\r
-       if(PacketSize==13 && *(u16*)&Packet[3]==0x007c)\r
+       if(PacketSize==13 && *(uint16_t*)&Packet[3]==0x007c)\r
        {\r
-               int nmax = Config->GetOptionInt("max_file_xfers");\r
+               int32_t nmax = Config->GetOptionInt("max_file_xfers");\r
                if(mNumFileTransfers>=nmax)\r
                {\r
                        Console->Print("Patchserver: max file xfers exceed, killing client %i", Client->GetIndex());\r
@@ -297,20 +251,20 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const
                        State->mSendFile=0;\r
                        --mNumFileTransfers;\r
                }\r
-               State->mSerial = *(u16*)&Packet[7];\r
-               State->mCurrentPatch = *(u32*)&Packet[9];\r
+               State->mSerial = *(uint16_t*)&Packet[7];\r
+               State->mCurrentPatch = *(uint32_t*)&Packet[9];\r
                Console->Print("Patchserver: Patch request from client %i (v%i)", Client->GetIndex(), State->mCurrentPatch);\r
                if((bool)(State->mPatchSize = StartPatch(State)))\r
                {\r
                        Console->Print("Patchserver: Patch is available, %d bytes", State->mPatchSize);\r
-                       *(u16*)&STARTPATCH[7]=State->mSerial;\r
-                       *(u32*)&STARTPATCH[9]=State->mPatchSize;\r
+                       *(uint16_t*)&STARTPATCH[7]=State->mSerial;\r
+                       *(uint32_t*)&STARTPATCH[9]=State->mPatchSize;\r
                        Socket->write(STARTPATCH, 13);\r
                        State->mState = PPatchState::PS_SENDPATCH;\r
                } else\r
                {\r
                        Console->Print("Patchserver: Patch not available");\r
-                       *(u16*)&FILEERROR[7]=State->mSerial;\r
+                       *(uint16_t*)&FILEERROR[7]=State->mSerial;\r
                        Socket->write(FILEERROR, 9);\r
                        FinalizeClientDelayed(Client, State);\r
                        State->mState=PPatchState::PS_UNKNOWN;\r
@@ -318,9 +272,9 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const
                }\r
        } else\r
        // request file\r
-       if(PacketSize > 9 && *(u16*)&Packet[3]==0x004d)\r
+       if(PacketSize > 9 && *(uint16_t*)&Packet[3]==0x004d)\r
        {\r
-               int nmax = Config->GetOptionInt("max_file_xfers");\r
+               int32_t nmax = Config->GetOptionInt("max_file_xfers");\r
                if(mNumFileTransfers>=nmax)\r
                {\r
                        Console->Print("Patchserver: max file xfers exceed, killing client %i", Client->GetIndex());\r
@@ -339,7 +293,7 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const
                        --mNumFileTransfers;\r
                }\r
                // request file\r
-               State->mSerial = *(u16*)&Packet[7];\r
+               State->mSerial = *(uint16_t*)&Packet[7];\r
                char fn[256];\r
                strncpy(fn, (const char*)&Packet[10], Packet[9]);\r
                fn[Packet[9]]=0;\r
@@ -349,14 +303,14 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const
                if((bool)(State->mFileSize = StartFile(State)))\r
                {\r
                        Console->Print("Patchserver: File %s is available, %d bytes", State->mCurrentFile.c_str(), State->mFileSize);\r
-                       *(u16*)&STARTFILE[7]=State->mSerial;\r
-                       *(u32*)&STARTFILE[9]=State->mFileSize;\r
+                       *(uint16_t*)&STARTFILE[7]=State->mSerial;\r
+                       *(uint32_t*)&STARTFILE[9]=State->mFileSize;\r
                        Socket->write(STARTFILE, 13);\r
                        State->mState = PPatchState::PS_SENDFILE;\r
                } else\r
                {\r
                        Console->Print("Patchserver: Requested file %s not available", State->mCurrentFile.c_str());\r
-                       *(u16*)&FILEERROR[7]=State->mSerial;\r
+                       *(uint16_t*)&FILEERROR[7]=State->mSerial;\r
                        Socket->write(FILEERROR, 9);\r
                        FinalizeClientDelayed(Client, State);\r
                        State->mState=PPatchState::PS_UNKNOWN;\r
@@ -364,11 +318,11 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const
                }\r
        } else\r
        // send patch data\r
-       if(PacketSize==17 && *(u16*)&Packet[3]==0x007d)\r
+       if(PacketSize==17 && *(uint16_t*)&Packet[3]==0x007d)\r
        {\r
-               State->mSerial = *(u16*)&Packet[7];\r
-               State->mCurrentPatch = *(u32*)&Packet[9];\r
-               State->mPatchOffset = *(u32*)&Packet[13];\r
+               State->mSerial = *(uint16_t*)&Packet[7];\r
+               State->mCurrentPatch = *(uint32_t*)&Packet[9];\r
+               State->mPatchOffset = *(uint32_t*)&Packet[13];\r
                if(!SendPatchData(Client, State))\r
                {\r
                        Console->Print("Patchserver: SendPatchData failed on client %i", Client->GetIndex());\r
@@ -378,10 +332,10 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const
                }\r
        } else\r
        // send file data\r
-       if(PacketSize > 13 && *(u16*)&Packet[3]==0x00037)\r
+       if(PacketSize > 13 && *(uint16_t*)&Packet[3]==0x00037)\r
        {\r
-               State->mSerial = *(u16*)&Packet[7];\r
-               State->mFileOffset = *(u32*)&Packet[9];\r
+               State->mSerial = *(uint16_t*)&Packet[7];\r
+               State->mFileOffset = *(uint32_t*)&Packet[9];\r
                if(!SendFileData(Client, State))\r
                {\r
                        Console->Print("Patchserver: SendFileData failed on client %i", Client->GetIndex());\r
@@ -398,7 +352,7 @@ bool PPatchServer::HandleFileRequests(PClient *Client, PPatchState *State, const
        return true;\r
 }\r
 \r
-u32 PPatchServer::StartPatch(PPatchState *State)\r
+uint32_t PPatchServer::StartPatch(PPatchState *State)\r
 {\r
        std::stringstream path;\r
        char patchname[13];\r
@@ -409,7 +363,7 @@ u32 PPatchServer::StartPatch(PPatchState *State)
        {\r
                ++mNumFileTransfers;\r
                fseek(State->mPatchFile, 0, SEEK_END);\r
-               u32 size = ftell(State->mPatchFile);\r
+               uint32_t size = ftell(State->mPatchFile);\r
                fseek(State->mPatchFile, 0, SEEK_SET);\r
                return size;\r
        }\r
@@ -421,29 +375,29 @@ bool PPatchServer::SendPatchData(PClient *Client, PPatchState *State) const
        if(!State->mPatchFile)\r
                return false;\r
 \r
-       u16 size = Config->GetOptionInt("patch_packet_size");\r
+       uint16_t size = Config->GetOptionInt("patch_packet_size");\r
 \r
-       const int BUFFERSIZE = 4082;\r
+       const int32_t BUFFERSIZE = 4082;\r
 \r
-       size = std::min(BUFFERSIZE, std::max((s32)size, 64));\r
-       static u8 Buffer[BUFFERSIZE+13];\r
+       size = std::min(BUFFERSIZE, std::max((int32_t)size, 64));\r
+       static uint8_t Buffer[BUFFERSIZE+13];\r
 \r
        if(fseek(State->mPatchFile, State->mPatchOffset, SEEK_SET)!=0)\r
                return false;\r
 \r
        size = fread(&Buffer[13], 1, size, State->mPatchFile);\r
        Buffer[0]=0xfe;\r
-       *(u16*)&Buffer[1]=size+10;\r
+       *(uint16_t*)&Buffer[1]=size+10;\r
        Buffer[3]=0x39;\r
        Buffer[4]=0x02;\r
        Buffer[5]=0x00;\r
        Buffer[6]=0x00;\r
-       *(u16*)&Buffer[7]=State->mSerial;\r
-       *(u32*)&Buffer[9]=size;\r
+       *(uint16_t*)&Buffer[7]=State->mSerial;\r
+       *(uint32_t*)&Buffer[9]=size;\r
        return Client->getTCPConn()->write(Buffer, size+13)==size+13;\r
 }\r
 \r
-u32 PPatchServer::StartFile(PPatchState *State)\r
+uint32_t PPatchServer::StartFile(PPatchState *State)\r
 {\r
        // security checks: reject file paths containing ':', '..' or slashes/backslashes at the beginning\r
        if((State->mCurrentFile.find(':') != std::string::npos)\r
@@ -460,7 +414,7 @@ u32 PPatchServer::StartFile(PPatchState *State)
        if(State->mSendFile)\r
        {\r
                ++mNumFileTransfers;\r
-               u32 size = State->mSendFile->GetSize();\r
+               uint32_t size = State->mSendFile->GetSize();\r
                return size;\r
        }\r
        return 0;\r
@@ -471,30 +425,30 @@ bool PPatchServer::SendFileData(PClient *Client, PPatchState *State) const
        if(!State->mSendFile)\r
                return false;\r
 \r
-       u16 size = Config->GetOptionInt("patch_packet_size");\r
+       uint16_t size = Config->GetOptionInt("patch_packet_size");\r
 \r
-       const int BUFFERSIZE = 4082;\r
+       const int32_t BUFFERSIZE = 4082;\r
 \r
-       size = std::min(BUFFERSIZE, std::max((s32)size, 1));\r
-       static u8 Buffer[BUFFERSIZE+13];\r
+       size = std::min(BUFFERSIZE, std::max((int32_t)size, 1));\r
+       static uint8_t Buffer[BUFFERSIZE+13];\r
 \r
        State->mSendFile->Seek(State->mFileOffset);\r
 \r
        size = State->mSendFile->Read(&Buffer[13], size);\r
        Buffer[0]=0xfe;\r
-       *(u16*)&Buffer[1]=size+10;\r
+       *(uint16_t*)&Buffer[1]=size+10;\r
        Buffer[3]=0x3c;\r
        Buffer[4]=0x02;\r
        Buffer[5]=0x00;\r
        Buffer[6]=0x00;\r
-       *(u16*)&Buffer[7]=State->mSerial;\r
-       *(u32*)&Buffer[9]=size;\r
+       *(uint16_t*)&Buffer[7]=State->mSerial;\r
+       *(uint32_t*)&Buffer[9]=size;\r
        return Client->getTCPConn()->write(Buffer, size+13)==size+13;\r
 }\r
 \r
 bool PPatchServer::ProcessClient(PClient *Client, PPatchState *State)\r
 {\r
-       static const u8 HANDSHAKE0A[6]={0xfe, 0x03, 0x00, 0x80, 0x03, 0x6b};\r
+       static const uint8_t HANDSHAKE0A[6]={0xfe, 0x03, 0x00, 0x80, 0x03, 0x6b};\r
 \r
        if(!State)\r
        {\r
@@ -520,8 +474,8 @@ bool PPatchServer::ProcessClient(PClient *Client, PPatchState *State)
                Socket->flushSendBuffer();\r
        }\r
 \r
-       int PacketSize=0;\r
-       const u8 *Packet = Socket->read(&PacketSize);\r
+       int32_t PacketSize = 0;\r
+       const uint8_t *Packet = Socket->read(&PacketSize);\r
        if(PacketSize > 0)\r
        {\r
                switch(State->mState)\r
diff --git a/TinNS/Source/PatchServer/PatchServer.hxx b/TinNS/Source/PatchServer/PatchServer.hxx
new file mode 100644 (file)
index 0000000..9d517b2
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <map>\r
+\r
+class PClient;\r
+struct PPatchState;\r
+\r
+class PPatchServer {\r
+private:\r
+    int mNumClients;\r
+    int mNumFileTransfers;\r
+    typedef std::map<PClient *, PPatchState *> PatchStateMap;\r
+    PatchStateMap ClientStates;\r
+\r
+protected:\r
+    bool ProcessClient(PClient *Client, PPatchState *State = nullptr);\r
+//    uint32_t StartPatch(PClient *Client, PPatchState *State);\r
+    uint32_t StartPatch(PPatchState *State);\r
+    bool SendPatchData(PClient *Client, PPatchState *State) const;\r
+//    u32 StartFile(PClient *Client, PPatchState *State);\r
+    uint32_t StartFile(PPatchState *State);\r
+    bool SendFileData(PClient *Client, PPatchState *State) const;\r
+    void FinalizeClient(PClient *Client, PPatchState *State);\r
+    void FinalizeClientDelayed(PClient *Client, PPatchState *State);\r
+\r
+    bool HandleHandshake(PClient *Client, PPatchState *State, const uint8_t *Packet, int32_t PacketSize);\r
+    bool HandleVersionRequest(PClient *Client, PPatchState *State, const uint8_t *Packet, int32_t PacketSize);\r
+    bool HandleFileRequests(PClient *Client, PPatchState *State, const uint8_t *Packet, int32_t PacketSize);\r
+\r
+public:\r
+    PPatchServer();\r
+    ~PPatchServer();\r
+\r
+    void Start();\r
+    void Update();\r
+    void ClientDisconnected(PClient *Client);\r
+};\r
diff --git a/TinNS/Source/PatchServer/Server.cxx b/TinNS/Source/PatchServer/Server.cxx
new file mode 100644 (file)
index 0000000..0ee9260
--- /dev/null
@@ -0,0 +1,95 @@
+#include "PatchServer/Includes.hxx"\r
+#include "Common/Includes.hxx"\r
+\r
+PServer::PServer()\r
+{\r
+    mNumClients = 0;\r
+    mMaxClients = Config->GetOptionInt("maxclients");\r
+    mGMSlots = Config->GetOptionInt("gm_slots");\r
+\r
+    if (mMaxClients==0)\r
+        mMaxClients=1;\r
+    if (mGMSlots==0)\r
+        mGMSlots=1;\r
+    mClients.reserve(mMaxClients + mGMSlots);\r
+    for (int32_t i=0; i<mMaxClients+mGMSlots; i++)\r
+        mClients[i]=0;\r
+}\r
+\r
+PServer::~PServer()\r
+{\r
+    for (int32_t i=0; i<mMaxClients+mGMSlots; i++)\r
+        delete mClients[i];\r
+}\r
+\r
+int32_t PServer::GetMaxClients() const\r
+{\r
+    return mMaxClients;\r
+}\r
+\r
+int32_t PServer::GetGMSlots() const\r
+{\r
+    return mGMSlots;\r
+}\r
+\r
+int32_t PServer::GetNumClients() const\r
+{\r
+    return mNumClients;\r
+}\r
+\r
+int PServer::NewClient()\r
+{\r
+//Console->Print("%d %d", mMaxClients, mGMSlots);\r
+    if (mNumClients==mMaxClients+mGMSlots)\r
+        return -1;\r
+    for (int32_t i=0; i<mMaxClients+mGMSlots; i++)\r
+    {\r
+        if(!mClients[i])\r
+        {\r
+            mClients[i]=new PClient(i);\r
+            ++mNumClients;\r
+            return i;\r
+        }\r
+    }\r
+    return -1;\r
+}\r
+\r
+PClient *PServer::GetClient(int32_t Client) const\r
+{\r
+    if (Client < 0 || Client >= mMaxClients+mGMSlots)\r
+        return 0;\r
+\r
+    return mClients[Client];\r
+}\r
+\r
+void PServer::Update()\r
+{\r
+    for (int32_t i=0; i<mMaxClients+mGMSlots; i++)\r
+    {\r
+        if (mClients[i])\r
+        {\r
+            mClients[i]->Update();\r
+            if (mClients[i]->GetConnection()==PCC_NONE && mClients[i]->getTCPConn() == 0)\r
+            {\r
+                Console->Print("Removing client ...");\r
+                delete mClients[i];\r
+                mClients[i]=0;\r
+                --mNumClients;\r
+            }\r
+        }\r
+    }\r
+}\r
+\r
+void PServer::Shutdown()\r
+{\r
+    Console->Print("======================");\r
+    Console->Print("Shutting down Patchserver...");\r
+    for (int32_t i=0; i<mMaxClients+mGMSlots; i++)\r
+    {\r
+        if(mClients[i])\r
+        {\r
+            delete mClients[i];\r
+            mClients[i]=0;\r
+        }\r
+    }\r
+}\r
diff --git a/TinNS/Source/PatchServer/Server.hxx b/TinNS/Source/PatchServer/Server.hxx
new file mode 100644 (file)
index 0000000..efb1dad
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+\r
+#include <cstdint>\r
+#include <vector>\r
+\r
+class PClient;\r
+\r
+class PServer {\r
+private:\r
+    int32_t mMaxClients;\r
+    int32_t mGMSlots;\r
+    int32_t mNumClients;\r
+    std::vector<PClient *> mClients;\r
+\r
+public:\r
+    PServer();\r
+    ~PServer();\r
+\r
+    int32_t GetMaxClients() const;\r
+    int32_t GetGMSlots() const;\r
+    int32_t GetNumClients() const;\r
+    int32_t NewClient();\r
+    PClient *GetClient(int32_t Client) const;\r
+    void Update();\r
+    void Shutdown();\r
+};\r
similarity index 100%
rename from server/init.d/tinns
rename to TinNS/init.d/tinns
diff --git a/Tools/CMakeLists.txt b/Tools/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c8150eb
--- /dev/null
@@ -0,0 +1,2 @@
+ADD_SUBDIRECTORY        (PakDecompress)
+ADD_SUBDIRECTORY        (VFSviewer)
diff --git a/Tools/PakDecompress/CMakeLists.txt b/Tools/PakDecompress/CMakeLists.txt
new file mode 100644 (file)
index 0000000..333bf27
--- /dev/null
@@ -0,0 +1,2 @@
+ADD_EXECUTABLE          (PakDecompress PakDecompress.cxx)
+TARGET_LINK_LIBRARIES   (PakDecompress ${ZLIB_LIBRARY})
diff --git a/Tools/PakDecompress/PakDecompress.cxx b/Tools/PakDecompress/PakDecompress.cxx
new file mode 100644 (file)
index 0000000..b1f1776
--- /dev/null
@@ -0,0 +1,189 @@
+#include <iostream>\r
+#include <fstream>\r
+#include <cstdio>\r
+#include <cstring>\r
+#include <cassert>\r
+#include <zlib.h>\r
+\r
+#define CHUNK 262144\r
+\r
+int inf(FILE *source, FILE *dest, bool details)\r
+{\r
+    int ret;\r
+    char check;\r
+    unsigned have;\r
+    z_stream strm;\r
+    unsigned char in[CHUNK];\r
+    unsigned char out[CHUNK];\r
+\r
+    strm.zalloc = Z_NULL;\r
+    strm.zfree = Z_NULL;\r
+    strm.opaque = Z_NULL;\r
+    strm.avail_in = 0;\r
+    strm.next_in = Z_NULL;\r
+    ret = inflateInit(&strm);\r
+\r
+    if (ret != Z_OK)\r
+        return(ret);\r
+\r
+    check = fgetc(source);\r
+    if(check == 'x')\r
+    {\r
+        if(details == true) std::cout << "Found zLibfile" << std::endl;\r
+        fseek(source, 0, SEEK_SET);\r
+    }\r
+    else\r
+    {\r
+        fseek(source, 16, SEEK_SET);\r
+        check = fgetc(source);\r
+        if(check == 'x')\r
+        {\r
+            if(details == true) std::cout << "Found Neocron file" << std::endl;\r
+            fseek(source, 16, SEEK_SET);\r
+        }\r
+        else\r
+        {\r
+            if(details == true) std::cout << "Error: No compatible file!" << std::endl;\r
+            return -3;\r
+        }\r
+    }\r
+\r
+    do {\r
+        strm.avail_in = fread(in, 1, CHUNK, source);\r
+\r
+        if (ferror(source)) {\r
+            (void)inflateEnd(&strm);\r
+\r
+            return(Z_ERRNO);\r
+        }\r
+\r
+        if (strm.avail_in == 0)\r
+            break;\r
+        strm.next_in = in;\r
+\r
+        do {\r
+            strm.avail_out = CHUNK;\r
+            strm.next_out = out;\r
+            ret = inflate(&strm, Z_NO_FLUSH);\r
+            assert(ret != Z_STREAM_ERROR);\r
+\r
+            switch(ret) {\r
+                case Z_NEED_DICT:\r
+                    ret = Z_DATA_ERROR;\r
+                case Z_DATA_ERROR:\r
+                case Z_MEM_ERROR:\r
+                    (void)inflateEnd(&strm);\r
+                    return(ret);\r
+                }\r
+\r
+                have = CHUNK - strm.avail_out;\r
+\r
+                if (fwrite(out, 1, have, dest) != have || ferror(dest)) {\r
+                    (void)inflateEnd(&strm);\r
+\r
+                return(Z_ERRNO);\r
+            }\r
+        } while (strm.avail_out == 0);\r
+\r
+        assert(strm.avail_in == 0);\r
+    } while (ret != Z_STREAM_END);\r
+\r
+    (void)inflateEnd(&strm);\r
+\r
+    return(ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR);\r
+}\r
+\r
+void zerr(int ret)\r
+{\r
+    fputs("zpipe: ", stderr);\r
+\r
+    switch(ret) {\r
+        case Z_ERRNO:\r
+            if (ferror(stdin))\r
+                fputs("error reading stdin\n", stderr);\r
+            if (ferror(stdout))\r
+                fputs("error writing stdout\n", stderr);\r
+            break;\r
+        case Z_STREAM_ERROR:\r
+            fputs("invalid compression level\n", stderr);\r
+            break;\r
+        case Z_DATA_ERROR:\r
+            fputs("invalid or incomplete deflate data\n", stderr);\r
+            break;\r
+        case Z_MEM_ERROR:\r
+            fputs("out of memory\n", stderr);\r
+            break;\r
+        case Z_VERSION_ERROR:\r
+            fputs("zlib version mismatch!\n", stderr);\r
+    }\r
+}\r
+\r
+int main(int argc, char **argv) {\r
+    int ret;\r
+    long inSize;\r
+    long outSize;\r
+    bool details = false;\r
+    FILE *inFile;\r
+    FILE *outFile;\r
+    std::string src;\r
+    std::string dst;\r
+\r
+    if(argc == 2) {\r
+        src = argv[1];\r
+        dst = strcat(argv[1], ".decompressed");\r
+    }\r
+    else if(argc > 2 && strcmp(argv[1], argv[2])) {\r
+        src = argv[1];\r
+        dst = argv[2];\r
+    }\r
+    else {\r
+        std::cout << "Usage: pak_decompress source <dest != source> <detailedoutput 1/0>" << std::endl;\r
+        return(0);\r
+    }\r
+    if(argc == 4)\r
+    {\r
+        if(argv[3][0] == '1') details = true;\r
+        else if(argv[3][0] == '0') details = false;\r
+    }\r
+\r
+    inFile = fopen(src.c_str(), "rb");\r
+    outFile = fopen(dst.c_str(), "wb");\r
+\r
+    if(inFile == NULL)\r
+    {\r
+        std::cout << "Cannot open InFile" << std::endl;\r
+        return(-1);\r
+    }\r
+    if(outFile == NULL)\r
+    {\r
+        std::cout << "Cannot open OutFile" << std::endl;\r
+        return(-2);\r
+    }\r
+    ret = inf(inFile, outFile, details);\r
+\r
+    /* just to be sure - we got to the end */\r
+    fseek(inFile, 0, SEEK_END);\r
+    fseek(outFile, 0, SEEK_END);\r
+    inSize = ftell(inFile);\r
+    outSize = ftell(outFile);\r
+\r
+    fclose(outFile);\r
+    fclose(inFile);\r
+\r
+    if(ret == Z_OK && details == true)\r
+    {\r
+        std::cout << "bytes read:        " << inSize << std::endl;\r
+        std::cout << "bytes written:     " << outSize << std::endl;\r
+        std::cout << "compression ratio: " << (100-((float)inSize/(float)outSize*100)) << "%" << std::endl;\r
+    }\r
+    else if(ret == Z_OK && details == false)\r
+    {\r
+        std::cout << "[OK]    " << src.c_str() << std::endl;\r
+    }\r
+    else if(ret != Z_OK && details == false)\r
+    {\r
+        std::cout << "[ERROR] " << src.c_str() << std::endl;\r
+    }\r
+\r
+    return(ret);\r
+}\r
diff --git a/Tools/VFSviewer/CMakeLists.txt b/Tools/VFSviewer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b57f3f5
--- /dev/null
@@ -0,0 +1,2 @@
+ADD_EXECUTABLE          (VFSviewer VfsViewer.c)
+TARGET_LINK_LIBRARIES   (VFSviewer ${ZLIB_LIBRARY})
diff --git a/Tools/VFSviewer/VfsViewer.c b/Tools/VFSviewer/VfsViewer.c
new file mode 100644 (file)
index 0000000..3662ea4
--- /dev/null
@@ -0,0 +1,60 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef unsigned int u32;
+typedef unsigned char u8;
+
+int main(int argc, char *argv[]) {
+    // structure of the file informtion inside the virtual FS
+    struct t_file_header {
+        u32 id;
+        u32 offset;
+        u32 csize;
+        u32 dsize;
+        u32 len_name;
+        u8 *name;
+    };
+    // structure of the virtual FS
+    struct t_vfs_header {
+        u32 id;
+        u32 file_count;
+        struct t_file_header *files;
+        u8 *data;
+    };
+
+    if (argc == 2) {
+        FILE *fd;
+        struct t_vfs_header vfs_file;
+
+        fd = fopen(argv[1], "rb");
+
+        // reading the vfs header including the amount of files in the virtual FS
+        fread(&vfs_file.id, sizeof(u32), 1, fd);
+        fread(&vfs_file.file_count, sizeof(u32), 1, fd);
+
+        struct t_file_header files[vfs_file.file_count];
+
+        // reading all information from the vfs into an array and print some of them
+        u32 i;
+        for (i = 0; i < vfs_file.file_count; i++) {
+            fread(&files[i].id, sizeof(u32), 1, fd);
+            fread(&files[i].offset, sizeof(u32), 1, fd);
+            fread(&files[i].csize, sizeof(u32), 1, fd);
+            fread(&files[i].dsize, sizeof(u32), 1 ,fd);
+            fread(&files[i].len_name, sizeof(u32), 1, fd);
+
+            files[i].name = (u8 *)malloc(sizeof(u8)*files[i].len_name);
+            fread(files[i].name, sizeof(u8), files[i].len_name, fd);
+            //fseek(fd, files[i].len_name, SEEK_CUR);
+
+            printf("Filenumber %4i: %50s (%7i/%7i) ID-%2i\n", i, files[i].name, files[i].csize, files[i].dsize, files[i].id);
+        }
+
+        fclose(fd);
+    } else {
+        printf("Usage: vfs_viewer <nc1 vfs file>\n");
+        exit(1);
+    }
+
+    exit(0);
+}
index d0f6648..7793178 100755 (executable)
@@ -4,91 +4,45 @@ 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
+rm -rf Tools/cmake_install.cmake
+rm -rf Tools/Makefile
+rm -rf Tools/CMakeFiles/
+rm -rf Tools/PakDecompress/cmake_install.cmake
+rm -rf Tools/PakDecompress/Makefile
+rm -rf Tools/PakDecompress/CMakeFiles/
+rm -rf Tools/VFSviewer/cmake_install.cmake
+rm -rf Tools/VFSviewer/Makefile
+rm -rf Tools/VFSviewer/CMakeFiles/
 
-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
+rm -rf TinNS/cmake_install.cmake
+rm -rf TinNS/Makefile TinNS/CMakeFiles/
+rm -rf TinNS/Source/cmake_install.cmake
+rm -rf TinNS/Source/Makefile TinNS/Source/CMakeFiles/
+rm -rf TinNS/Source/Common/cmake_install.cmake
+rm -rf TinNS/Source/Common/Makefile
+rm -rf TinNS/Source/Common/CMakeFiles/
+rm -rf TinNS/Source/DevelopmentTools/cmake_install.cmake
+rm -rf TinNS/Source/DevelopmentTools/Makefile
+rm -rf TinNS/Source/DevelopmentTools/CMakeFiles/
+rm -rf TinNS/Source/GameServer/cmake_install.cmake
+rm -rf TinNS/Source/GameServer/Makefile
+rm -rf TinNS/Source/GameServer/CMakeFiles/
+rm -rf TinNS/Source/GameServer/Decoder/cmake_install.cmake
+rm -rf TinNS/Source/GameServer/Decoder/Makefile
+rm -rf TinNS/Source/GameServer/Decoder/CMakeFiles/
+rm -rf TinNS/Source/GameServer/Definitions/cmake_install.cmake
+rm -rf TinNS/Source/GameServer/Definitions/Makefile
+rm -rf TinNS/Source/GameServer/Definitions/CMakeFiles/
+rm -rf TinNS/Source/GameServer/GameCommands/cmake_install.cmake
+rm -rf TinNS/Source/GameServer/GameCommands/Makefile
+rm -rf TinNS/Source/GameServer/GameCommands/CMakeFiles/
+rm -rf TinNS/Source/InfoServer/cmake_install.cmake
+rm -rf TinNS/Source/InfoServer/Makefile
+rm -rf TinNS/Source/InfoServer/CMakeFiles/
+rm -rf TinNS/Source/PatchServer/cmake_install.cmake
+rm -rf TinNS/Source/PatchServer/Makefile
+rm -rf TinNS/Source/PatchServer/CMakeFiles/
 
-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
+# code counter
+Scripts/CodeCounter.sh
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
deleted file mode 100644 (file)
index 70ac51a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ADD_SUBDIRECTORY        (src)
diff --git a/server/src/CMakeLists.txt b/server/src/CMakeLists.txt
deleted file mode 100644 (file)
index 1ad7f2e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# move base dir to src
-INCLUDE_DIRECTORIES     (${PROJECT_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/common/CMakeLists.txt b/server/src/common/CMakeLists.txt
deleted file mode 100644 (file)
index 4b49e05..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ADD_LIBRARY             (common config.cpp console.cpp filesystem.cpp misc.cpp message.cpp netcode.cpp regex++.cpp)
diff --git a/server/src/common/message.h b/server/src/common/message.h
deleted file mode 100644 (file)
index f38f4df..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#pragma once
-
-#include <iostream>
-
-#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/regex++.h b/server/src/common/regex++.h
deleted file mode 100644 (file)
index edbff07..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-#include <iostream>
-
-#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/game/CMakeLists.txt b/server/src/game/CMakeLists.txt
deleted file mode 100644 (file)
index 64be2d1..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-INCLUDE_DIRECTORIES     (${PROJECT_SOURCE_DIR}/server/src/game ${LUA53_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}
-                                           ${LUA53_LIBRARY})
diff --git a/server/src/game/decoder/main.h b/server/src/game/decoder/main.h
deleted file mode 100644 (file)
index 0e6dd6b..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       main.h - main include file, contains all needed includes and important definitions\r
-\r
-       MODIFIED: 30 Aug 2006 Hammag\r
-       REASON: - created\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#ifndef MAIN_H\r
-#define MAIN_H\r
-\r
-//#include "version.h"\r
-\r
-//basic includes\r
-#include "include/external.h"\r
-\r
-//tinns includes\r
-#include "include/types.h"\r
-#include "common/config.h"\r
-\r
-#include "common/console.h"\r
-#include "common/misc.h"\r
-\r
-#include "common/netcode.h"\r
-\r
-#include "include/msgdecoder.h"\r
-#include "udpanalyser.h"\r
-\r
-\r
-/*\r
-#include "../gamemonkey/gmMachine.h"\r
-#include "../gamemonkey/gmCall.h"\r
-*/\r
-\r
-#include "common/filesystem.h"\r
-\r
-// MySQL Support // shouldn't be needed as DB-objects access class should do that\r
-#ifdef MYSQL_INC_DIR\r
-#include <mysql/mysql.h>\r
-#else\r
-#include <mysql.h>\r
-#endif\r
-\r
-#include "include/sql.h"\r
-\r
-#include "include/skill.h"\r
-\r
-#include "include/chars.h"\r
-#include "include/accounts.h"\r
-#include "include/defs.h"\r
-#include "include/client.h"\r
-#include "include/server.h"\r
-#include "include/gameserver.h"\r
-#include "include/globals.h"\r
-#include "include/zoning.h"\r
-#include "include/item.h"\r
-#include "include/inventory.h"\r
-\r
-#include "include/chat.h"\r
-#include "include/commands.h"\r
-#include "include/clientmanager.h"\r
-#include "include/msgbuilder.h"\r
-#include "include/worldactors.h"\r
-#include "include/npc.h"\r
-#include "include/outpost.h"\r
-#include "include/multipart.h"\r
-#include "include/terminal.h"\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/decoder/msgdecoder.cpp b/server/src/game/decoder/msgdecoder.cpp
deleted file mode 100644 (file)
index b684bd5..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-\r
-       msgdecoder.cpp - top class for NC messages decoding\r
-\r
-       CREATION: 23 Aug 2006 Hammag\r
-\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/msgdecoder.h"\r
-#include "udp_0x13.h"\r
-\r
-\r
-// PUdpMsgDecoder\r
-\r
-/*\r
-    PMsgDecodeData mDecodeData;\r
-    PUdpMsgAnalyser* mCurrentAnalyser;\r
-*/\r
-    \r
-void PUdpMsgDecoder::Init(PMessage* nMessage, PClient* nClient)\r
-{\r
-  mDecodeData.mMessage = nMessage;\r
-  mDecodeData.mClient = nClient;\r
-  mDecodeData.mState = (nMessage && nClient) ? DECODE_MORE : DECODE_UNDEF;\r
-  mDecodeData.mUnknownType = 0;\r
-  mDecodeData.mHandling0x13Sub = false;\r
-       mDecodeData.Sub0x13Start = mDecodeData.Sub0x13StartNext = 0;\r
-  mPacketName.erase();\r
-  mDecodeData.mName.str(mPacketName);\r
-  mDecodeData.mErrorDetail.erase();\r
-       mDecodeData.mTraceKnownMsg = false;\r
-       mDecodeData.mTraceUnknownMsg = false;\r
-       mDecodeData.mTraceDump = false;\r
-  if (mCurrentAnalyser)\r
-  {\r
-    delete mCurrentAnalyser;\r
-    mCurrentAnalyser = NULL;\r
-  }\r
-\r
-}\r
-  \r
-PUdpMsgDecoder::PUdpMsgDecoder()\r
-{\r
-  mCurrentAnalyser = NULL;\r
-  Reset();\r
-}\r
-\r
-PUdpMsgDecoder::PUdpMsgDecoder(PMessage* nMessage, PClient* nClient)\r
-{\r
-  mCurrentAnalyser = NULL;\r
-  Init(nMessage, nClient);\r
-}\r
-\r
-PUdpMsgDecoder::~PUdpMsgDecoder()\r
-{\r
-  if (mCurrentAnalyser)\r
-  {\r
-    delete mCurrentAnalyser;\r
-  }\r
-}\r
-\r
-bool PUdpMsgDecoder::Analyse()\r
-{\r
-  PUdpMsgAnalyser* nextAnalyser;\r
-\r
-  if ((mDecodeData.mState & DECODE_MORE) || mDecodeData.mHandling0x13Sub)\r
-  {\r
-    if (mCurrentAnalyser)\r
-    {\r
-      delete mCurrentAnalyser;\r
-      mCurrentAnalyser = NULL;\r
-    }\r
-    if (mDecodeData.mHandling0x13Sub)\r
-    {\r
-      mPacketName.erase();\r
-      mDecodeData.mName.str(mPacketName);\r
-      mCurrentAnalyser = new PUdp0x13(&mDecodeData);\r
-      mDecodeData.mState = DECODE_MORE;\r
-    }\r
-    else\r
-    {\r
-      mCurrentAnalyser = new PUdpMsgAnalyser(&mDecodeData);\r
-    }\r
-\r
-    while (mDecodeData.mState & DECODE_MORE)\r
-    {\r
-      nextAnalyser = mCurrentAnalyser->Analyse();\r
-      if (mCurrentAnalyser != nextAnalyser)\r
-      {\r
-        delete mCurrentAnalyser;\r
-        mCurrentAnalyser = nextAnalyser;\r
-      }\r
-    }\r
-  }\r
-  return (!(mDecodeData.mState & (DECODE_MORE | DECODE_ERROR | DECODE_UNKNOWN)));\r
-}\r
-\r
-bool PUdpMsgDecoder::Analyse(PMessage* nMessage, PClient* nClient)\r
-{\r
-  Init(nMessage, nClient);\r
-  return Analyse();\r
-}\r
-\r
-bool PUdpMsgDecoder::DoAction()\r
-{\r
-  if (mDecodeData.mState & DECODE_ACTION_READY)\r
-  {\r
-    return mCurrentAnalyser->DoAction();\r
-  }\r
-  else\r
-  {\r
-    return false;\r
-  }\r
-}\r
diff --git a/server/src/game/decoder/udp_0x08.cpp b/server/src/game/decoder/udp_0x08.cpp
deleted file mode 100644 (file)
index 3fd9982..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-       udp_0x08.cpp - decoder classes for UDP 0x08 messages\r
-\r
-       CREATION: 05 Jan 2007 Namikon\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-*/\r
-\r
-#include "main.h"\r
-#include "udp_0x08.h"\r
-\r
-\r
-PUdp0x08::PUdp0x08(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
-{\r
-  nDecodeData->mName << "/0x08";\r
-}\r
-\r
-PUdpMsgAnalyser* PUdp0x08::Analyse()\r
-{\r
-    mDecodeData->mName << "=Client crash";\r
-    mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;\r
-\r
-    return this;\r
-}\r
-\r
-bool PUdp0x08::DoAction()\r
-{\r
-    // Client crashed, close connection from our side\r
-    GameServer->ClientDisconnected(mDecodeData->mClient);\r
-    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;\r
-\r
-    return true;\r
-}\r
diff --git a/server/src/game/decoder/udp_0x08.h b/server/src/game/decoder/udp_0x08.h
deleted file mode 100644 (file)
index 3f3b7ef..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_0x08.h - decoder classes for UDP 0x08 messages\r
-\r
-       CREATION: 05 Jan 2007 Namikon\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-*/\r
-\r
-#ifndef UDP0X08_H\r
-#define UDP0X08_H\r
-\r
-class PUdp0x08 : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdp0x08(PMsgDecodeData* nDecodeData);\r
-    //~PUdp0x08();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_0x13.h b/server/src/game/decoder/udp_0x13.h
deleted file mode 100644 (file)
index 9dc4a21..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_0x13.h - decoder classes for UDP 0x13 messages\r
-  \r
-       CREATION: 31 Aug 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#ifndef UDP0X13_H\r
-#define UDP0X13_H\r
-\r
-class PUdp0x13 : public PUdpMsgAnalyser\r
-{ \r
-  public:\r
-    PUdp0x13(PMsgDecodeData* nDecodeData);\r
-    //~PUdp0x13();\r
-    PUdpMsgAnalyser* Analyse();\r
-    //bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_0x1f.h b/server/src/game/decoder/udp_0x1f.h
deleted file mode 100644 (file)
index 47debaa..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_udp0x1f.h - decoder classes for UDP 0x13x03x1f messages\r
-  \r
-       CREATION: 6 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#ifndef UDP0X1F_H\r
-#define UDP0X1F_H\r
-\r
-class PUdp0x1f : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdp0x1f(PMsgDecodeData* nDecodeData);\r
-    //~PUdp0x1f();\r
-    PUdpMsgAnalyser* Analyse();\r
-    //bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_0x22.cpp b/server/src/game/decoder/udp_0x22.cpp
deleted file mode 100644 (file)
index aa80a4c..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_udp0x22.cpp - decoder classes for UDP 0x13x03x22 messages\r
-  \r
-       CREATION: 6 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#include "main.h"\r
-#include "udp_0x22.h"\r
-\r
-#include "udp_reqinfo.h"\r
-#include "udp_zoning.h"\r
-#include "udp_entityposreq.h"\r
-\r
-/**** PUdp0x22 ****/\r
-\r
-PUdp0x22::PUdp0x22(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
-{\r
-  nDecodeData->mName << "/0x22";\r
-} \r
-\r
-PUdpMsgAnalyser* PUdp0x22::Analyse()\r
-{\r
-  PUdpMsgAnalyser* nextAnalyser = NULL;\r
-  mDecodeData->mState = DECODE_MORE;    \r
-  u8 MsgType = mDecodeData->mMessage->U8Data(mDecodeData->Sub0x13Start + 5); \r
-  switch(MsgType) // MsgType is probably u16 rather than u8\r
-  {\r
-    case 0x03: // Zoning phase 2\r
-    {       \r
-      nextAnalyser = new PUdpZoning2(mDecodeData);\r
-      break;\r
-    }\r
-    case 0x06: // Char/Clan/Rank/Map Info request\r
-    {       \r
-      nextAnalyser = new PUdpReqInfo(mDecodeData);\r
-      break;\r
-    }\r
-    case 0x0b: // Entity position request\r
-    {\r
-      nextAnalyser = new PUdpEntityPosRequest(mDecodeData);\r
-      break;\r
-    } \r
-    case 0x0d: // Zoning phase 1\r
-    {        \r
-      nextAnalyser = new PUdpZoning1(mDecodeData);\r
-      break;\r
-    }       \r
-    default:\r
-    {\r
-      mDecodeData->mUnknownType = MsgType;\r
-      break;\r
-    }\r
-  }\r
-  \r
-  if (! nextAnalyser)\r
-  {\r
-    nextAnalyser = new PUdpMsgUnknown(mDecodeData);\r
-  }\r
-\r
-  return nextAnalyser;\r
-}\r
diff --git a/server/src/game/decoder/udp_0x22.h b/server/src/game/decoder/udp_0x22.h
deleted file mode 100644 (file)
index 5d00741..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_udp0x22.h - decoder classes for UDP 0x13x03x22 messages\r
-  \r
-       CREATION: 6 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#ifndef UDP0X22_H\r
-#define UDP0X22_H\r
-\r
-class PUdp0x22 : public PUdpMsgAnalyser\r
-{ \r
-  public:\r
-    PUdp0x22(PMsgDecodeData* nDecodeData);\r
-    //~PUdp0x22();\r
-    PUdpMsgAnalyser* Analyse();\r
-    //bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_0x2b.cpp b/server/src/game/decoder/udp_0x2b.cpp
deleted file mode 100644 (file)
index c1b9b3d..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_udp0x2b.cpp - decoder classes for UDP 0x13x03x2b messages\r
-\r
-       CREATION: 8 Jan 2007 Namikon\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#include "main.h"\r
-#include "udp_0x2b.h"\r
-#include "udp_terminal.h"\r
-\r
-/**** PUdp0x2b ****/\r
-\r
-PUdp0x2b::PUdp0x2b(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
-{\r
-  nDecodeData->mName << "/0x2b";\r
-}\r
-\r
-PUdpMsgAnalyser* PUdp0x2b::Analyse()\r
-{\r
-  PUdpMsgAnalyser* nextAnalyser = NULL;\r
-  mDecodeData->mState = DECODE_MORE;\r
-  u8 MsgType = mDecodeData->mMessage->U8Data(mDecodeData->Sub0x13Start + 5);\r
-  switch(MsgType)\r
-  {\r
-    case 0x17: // ReceiveDB Terminal Command\r
-    {\r
-      nextAnalyser = new PUdpReceiveDB(mDecodeData);\r
-      break;\r
-    }\r
-    case 0x18: // UpdateDB Terminal Command\r
-    {\r
-      nextAnalyser = new PUdpUpdateDB(mDecodeData);\r
-      break;\r
-    }\r
-    case 0x19: // TryAccess Terminal Command\r
-    {\r
-      nextAnalyser = new PUdpTryAccessDB(mDecodeData);\r
-      break;\r
-    }\r
-    case 0x1b: // DB Query and Command\r
-    {\r
-      nextAnalyser = new PUdpQueryDB(mDecodeData);\r
-      break;\r
-    }\r
-    case 0x1f: // Citycom?\r
-    {\r
-      nextAnalyser = new PUdpTeminal0x1f(mDecodeData);\r
-      break;\r
-    }\r
-\r
-    default:\r
-    {\r
-      mDecodeData->mUnknownType = MsgType;\r
-      break;\r
-    }\r
-  }\r
-\r
-  if (! nextAnalyser)\r
-  {\r
-    nextAnalyser = new PUdpMsgUnknown(mDecodeData);\r
-  }\r
-\r
-  return nextAnalyser;\r
-}\r
diff --git a/server/src/game/decoder/udp_0x2b.h b/server/src/game/decoder/udp_0x2b.h
deleted file mode 100644 (file)
index a4d45f8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_udp0x2b.h - decoder classes for UDP 0x13x03x2b messages\r
-\r
-       CREATION: 8 Jan 2007 Namikon\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDP0X2B_H\r
-#define UDP0X2B_H\r
-\r
-class PUdp0x2b : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdp0x2b(PMsgDecodeData* nDecodeData);\r
-    //~PUdp0x2b();\r
-    PUdpMsgAnalyser* Analyse();\r
-    //bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_OOO.cpp b/server/src/game/decoder/udp_OOO.cpp
deleted file mode 100644 (file)
index 25fb335..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_OOO.cpp - decoder classe for UDP Out Of Order message\r
-\r
-       CREATION: 5 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#include "main.h"\r
-#include "udp_OOO.h"\r
-\r
-/**** PUdpOOO ****/\r
-\r
-PUdpOOO::PUdpOOO(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)\r
-{\r
-  nDecodeData->mName << "/0x01";\r
-}\r
-\r
-PUdpMsgAnalyser* PUdpOOO::Analyse()\r
-{\r
-  mDecodeData->mName << "=Out Of Order";\r
-  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;\r
-\r
-  return this;\r
-}\r
-\r
-bool PUdpOOO::DoAction()\r
-{\r
-    u16 MissingUDP_ID = mDecodeData->mMessage->U16Data(mDecodeData->Sub0x13Start+5);\r
-\r
-    mDecodeData->mClient->getUDPConn()->ReSendUDPMessage(MissingUDP_ID);\r
-    //Console->Print("%s Out of Order packet received ! (Client is missing UDPID %d) ***not managed yet***", Console->ColorText(YELLOW, BLACK, "[Notice]"), MissingUDP_ID);\r
-\r
-    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;\r
-    return true;\r
-}\r
diff --git a/server/src/game/decoder/udp_OOO.h b/server/src/game/decoder/udp_OOO.h
deleted file mode 100644 (file)
index 9dffb23..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_OOO.h - decoder classe for UDP Out Of Order message\r
-  \r
-       CREATION: 5 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#ifndef UDPOOO_H\r
-#define UDPOOO_H\r
-\r
-class PUdpOOO : public PUdpMsgAnalyser\r
-{ \r
-  public:\r
-    PUdpOOO(PMsgDecodeData* nDecodeData);\r
-    //~PUdpPing();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_appartment.cpp b/server/src/game/decoder/udp_appartment.cpp
deleted file mode 100644 (file)
index a80b6be..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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_appartment.cpp - decoder classes for Navray apt location request messages
-
-       CREATION: 23 Dec 2006 Namikon
-
-       MODIFIED: 13 may 2007 Hammag
-       REASON: corrected this header
-
-*/
-
-#include "main.h"
-#include "udp_appartment.h"
-
-/**** PUdpAptLocInfo ****/
-
-PUdpAptLocInfo::PUdpAptLocInfo(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
-{
-  nDecodeData->mName << "/0x0a";
-}
-
-PUdpMsgAnalyser* PUdpAptLocInfo::Analyse()
-{
-  mDecodeData->mName << "=Requesting appartment location for NavRay";
-
-  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-  return this;
-}
-
-bool PUdpAptLocInfo::DoAction()
-{
-Console->Print("Got request for app data");
-  PMessage* tmpMsg = MsgBuilder->BuildCharAptLocInfoMsg (mDecodeData->mClient);
-
-  if (tmpMsg)
-    mDecodeData->mClient->SendUDPMessage(tmpMsg);
-
-  mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
-  return true;
-}
diff --git a/server/src/game/decoder/udp_appartment.h b/server/src/game/decoder/udp_appartment.h
deleted file mode 100644 (file)
index fd9bc2a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_appartment.h - decoder classes for Navray apt location request messages\r
-\r
-       CREATION: 23 Dec 2006 Namikon\r
-\r
-       MODIFIED: 13 may 2007 Hammag\r
-       REASON: corrected this header\r
-\r
-*/\r
-\r
-#ifndef UDPAPPARTMENT_H\r
-#define UDPAPPARTMENT_H\r
-\r
-class PUdpAptLocInfo : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpAptLocInfo(PMsgDecodeData* nDecodeData);\r
-    //~PUdpAptLocInfo();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_charmove.h b/server/src/game/decoder/udp_charmove.h
deleted file mode 100644 (file)
index 9736fd8..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_charmove.h - decoder classes for UDP char movement messages\r
-\r
-       CREATION: 5 Sep 2006 Hammag\r
-\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#ifndef UDPCHARMOVE_H\r
-#define UDPCHARMOVE_H\r
-\r
-#include "include/msgdecoder.h"\r
-#include "udpanalyser.h"\r
-\r
-class PUdpCharPosUpdate : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u8 mInfoBitfield;\r
-    u16 mNewY;\r
-    u16 mNewZ;\r
-    u16 mNewX;\r
-    u8 mNewUD;\r
-    u8 mNewLR;\r
-    u8 mNewAct;\r
-    u8 mNewUnknown;\r
-    u32 mChairItemID; // u16 or u32 ???\r
-    u8 mChairItemSeat;\r
-\r
-  public:\r
-    PUdpCharPosUpdate(PMsgDecodeData* nDecodeData);\r
-    //~PUdpCharMoves();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpCharExitChair : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpCharExitChair(PMsgDecodeData* nDecodeData);\r
-    //~PUdpCharExitChair();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-\r
-    //nClient is optionnal, nVhc is to limit to that vhc, nForce to force exit event when cab door closed\r
-    static bool DoLeaveChair(PChar* nChar, PClient* nClient = NULL, PSpawnedVehicle* nVhc = NULL, bool nForce = false); \r
-};\r
-\r
-class PUdpCharJump : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpCharJump(PMsgDecodeData* nDecodeData);\r
-    //~PUdpCharJump();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpCharTargeting : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpCharTargeting(PMsgDecodeData* nDecodeData);\r
-    //~PUdpCharTargeting();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-#endif\r
diff --git a/server/src/game/decoder/udp_chat.h b/server/src/game/decoder/udp_chat.h
deleted file mode 100644 (file)
index 8ccd966..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_chat.h - decoder classes for UDP chat  messages\r
-  \r
-       CREATION: 15 Sep 2006 Hammag\r
-\r
-       MODIFIED: 11 Dec 2006 Hammag\r
-       REASON: - added PUdpChatChannels\r
-\r
-*/\r
-\r
-#ifndef UDPCHAT_H\r
-#define UDPCHAT_H\r
-\r
-class PUdpChatLocal : public PUdpMsgAnalyser\r
-{ \r
-  public:\r
-    PUdpChatLocal(PMsgDecodeData* nDecodeData);\r
-    //~PUdpChatLocal();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpChatGlobal : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    \r
-  public:\r
-    PUdpChatGlobal(PMsgDecodeData* nDecodeData);\r
-    //~PUdpChatGlobal();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpChatListAdd : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u8 mChatList; // 1 = Direct, 2 = Buddy List\r
-    char* mAddedCharname;\r
-    \r
-  public:\r
-    PUdpChatListAdd(PMsgDecodeData* nDecodeData);\r
-    //~PUdpChatListAdd();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpChatListRemove : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u8 mChatList;\r
-    u32 mRemovedCharID;\r
-    \r
-  public:\r
-    PUdpChatListRemove(PMsgDecodeData* nDecodeData);\r
-    //~PUdpChatListRemove();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpChatChannels : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mChannelFlags; // 1 bit per custom channel, starting from LSB, in same order as in chat i/f\r
-    \r
-  public:\r
-    PUdpChatChannels(PMsgDecodeData* nDecodeData);\r
-    //~PUdpChatChannels();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_deathrespawn.h b/server/src/game/decoder/udp_deathrespawn.h
deleted file mode 100644 (file)
index 358564e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-  TinNS (TinNS is not a Neocron Server)
-  Copyright (C) 2005 Linux Addicted Community
-  maintainer Akiko <akiko@gmx.org>
-
-  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_deathrespawn.h - decoder classes for UDP respawn selection after death message
-
-  CREATION: 10 May 2009 Hammag
-
-  MODIFIED:
-  REASON: -
-
-*/
-
-#ifndef UDPDEATHRESPAWN_H
-#define UDPDEATHRESPAWN_H
-
-class PUdpDeathRespawn : public PUdpMsgAnalyser
-{
-  private:
-    u32 mEntity;
-    u32 mWorldId;
-
-  public:
-    PUdpDeathRespawn( PMsgDecodeData* nDecodeData );
-    //~PUdpDeathRespawn();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_entityposreq.h b/server/src/game/decoder/udp_entityposreq.h
deleted file mode 100644 (file)
index f4f37bc..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_entityposreq.h - decoder classes for UDP entity position request messages\r
-\r
-       CREATION: 8 jun 2007 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPENTITYPOS_H\r
-#define UDPENTITYPOS_H\r
-\r
-class PUdpEntityPosRequest : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u16 mEntityID; // u16 or u32 ???\r
-\r
-\r
-  public:\r
-    PUdpEntityPosRequest(PMsgDecodeData* nDecodeData);\r
-    //~PUdpEntityPosRequest();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_hack.h b/server/src/game/decoder/udp_hack.h
deleted file mode 100644 (file)
index ffcb9fe..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- udp_hack.h - decoder classes for UDP hacking related messages\r
-\r
- CREATION: 30 Dec 2006 Namikon\r
-\r
- MODIFIED:\r
- REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPHACK_H\r
-#define UDPHACK_H\r
-\r
-class PUdpHackFail : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpHackFail( PMsgDecodeData* nDecodeData );\r
-    //~PUdpHackFail();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpHackSuccess : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpHackSuccess( PMsgDecodeData* nDecodeData );\r
-    //~PUdpHackSuccess();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_helditemaction.h b/server/src/game/decoder/udp_helditemaction.h
deleted file mode 100644 (file)
index 9645821..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_helditemaction.h - decoder classes for held item related messages
-
- CREATION: 20 Mar 2009 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#ifndef HELDITEMACTION_H
-#define HELDITEMACTION_H
-
-class PUdpHeldItemBasicAction : public PUdpMsgAnalyser
-{
-  public:
-    PUdpHeldItemBasicAction( PMsgDecodeData* nDecodeData );
-    //~PUdpHeldItemBasicAction();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-class PUdpHeldItemAimedAction : public PUdpMsgAnalyser
-{
-
-  private:
-    u16 mWeaponId;
-    u32 mTargetRawItemID;
-    u8 mAiming; // 0: minimal
-    u8 mTargetedHeight; // 0: bottom to 26: top
-    u8 mScore; // ??? looks quite random...
-
-  public:
-    PUdpHeldItemAimedAction( PMsgDecodeData* nDecodeData );
-    //~PUdpHeldItemAimedAction();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-class PUdpHeldItemLaunchingAction : public PUdpMsgAnalyser
-{
-  private:
-    u16 mWeaponId;
-    u16 mSourceY;
-    u16 mSourceZ;
-    u16 mSourceX;
-    u8 mSourceUD;
-    u8 mSourceLR;
-    u16 mUnknown1;
-    u32 mUnknown2; // client timestamp ? => TODO: compare with data from ping request
-    u32 mTargetRawItemID;
-
-  public:
-    PUdpHeldItemLaunchingAction( PMsgDecodeData* nDecodeData );
-    //~PUdpHeldItemLaunchingAction();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-
-class PUdpItemAddonActivation : public PUdpMsgAnalyser
-{
-  private:
-    u8 mAddonIdx;
-
-  public:
-    PUdpItemAddonActivation( PMsgDecodeData* nDecodeData );
-    //~PUdpItemAddonActivation();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-#endif
diff --git a/server/src/game/decoder/udp_itemmanualreload.h b/server/src/game/decoder/udp_itemmanualreload.h
deleted file mode 100644 (file)
index 2b296e9..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h - decoder classes for UDP item manual reload messages
-
- CREATION: 9 May 2009 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#ifndef MANUALITEMRELOAD_H
-#define MANUALITEMRELOAD_H
-
-class PUdpItemManualReload : public PUdpMsgAnalyser
-{
-  private:
-    u8 mUnknown;
-    u8 GetMaxLoadableAmmos( u8 nBeltSlotId );
-
-  public:
-      PUdpItemManualReload(PMsgDecodeData* nDecodeData);
-      //~PUdpItemManualReload();
-      PUdpMsgAnalyser* Analyse();
-      bool DoAction();
-};
-
-class PUdpReloadAnimStart : public PUdpMsgAnalyser
-{
-  public:
-    PUdpReloadAnimStart( PMsgDecodeData* nDecodeData );
-    //~PUdpReloadAnimStart();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_itemmove.h b/server/src/game/decoder/udp_itemmove.h
deleted file mode 100644 (file)
index 334d6c7..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- udp_itemmove.h - decoder classes for UDP item move related messages\r
-\r
- CREATION: 30 Dec 2006 Namikon\r
-\r
- MODIFIED:\r
- REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPITEMMOVE_H\r
-#define UDPITEMMOVE_H\r
-\r
-class PUdpItemMove : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u8 mSrcLoc;\r
-    u8 mSrcX;\r
-    u8 mSrcY;\r
-    u8 mDstLoc;\r
-    u8 mDstX;\r
-    u8 mDstY;\r
-    u8 mItemCnt;\r
-\r
-  public:\r
-      PUdpItemMove(PMsgDecodeData* nDecodeData);\r
-      //~PUdpItemMove();\r
-      PUdpMsgAnalyser* Analyse();\r
-      bool DoAction();\r
-\r
-         static PContainer* GetContainerByLoc(PChar* nChar, u8 nLoc);\r
-};\r
-\r
-class PUdpItemMoveBP : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u8 mSrcSlotId;\r
-    u8 mDumb;\r
-    u8 mDstX;\r
-    u8 mDstY;\r
-    \r
-  public:\r
-      PUdpItemMoveBP(PMsgDecodeData* nDecodeData);\r
-      //~PUdpItemMove();\r
-      PUdpMsgAnalyser* Analyse();\r
-      bool DoAction();\r
-};\r
-\r
-class PUdpItemDropOnItem : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u8 mSrcLoc;\r
-    u8 mSrcX;\r
-    u8 mSrcY;\r
-    u8 mDstLoc;\r
-    u8 mDstX;\r
-    u8 mDstY;\r
-\r
-  public:\r
-       PUdpItemDropOnItem(PMsgDecodeData* nDecodeData);\r
-       //~PUdpItemDropOnItem();\r
-       PUdpMsgAnalyser* Analyse();\r
-       bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_itemuse.h b/server/src/game/decoder/udp_itemuse.h
deleted file mode 100644 (file)
index 9b2d7e0..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_itemuse.h - decoder classes for UDP inventory item use messages
-
- CREATION: 9 May 2009 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#ifndef ITEMUSE_H
-#define ITEMUSE_H
-
-class PUdpItemUse : public PUdpMsgAnalyser
-{
-/*  private:
-    u16 mWeaponId;
-    u32 mTargetRawItemID;
-    u8 mUnknown2;
-    u8 mTargetedHeight;
-    u8 mScore; // ??? looks quite random...
-*/
-  public:
-    PUdpItemUse( PMsgDecodeData* nDecodeData );
-    //~PUdpItemUse();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_killself.cpp b/server/src/game/decoder/udp_killself.cpp
deleted file mode 100644 (file)
index 441b53d..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_killself.cpp - decoder classe for UDP /set kill_self 1 messages
-
- CREATION: 13 Apr 2009 Hammag
-
-*/
-
-
-#include "main.h"
-#include "udp_killself.h"
-
-PUdpKillSelf::PUdpKillSelf( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData )
-{
-  nDecodeData->mName << "/0x10";
-}
-
-PUdpMsgAnalyser* PUdpKillSelf::Analyse()
-{
-  mDecodeData->mName << "=Char Kill self";
-
-  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-  return this;
-}
-
-bool PUdpKillSelf::DoAction()
-{
-  PClient* nClient = mDecodeData->mClient;
-
-  PMessage* tmpMsg = MsgBuilder->BuildCharDeathMsg( nClient, 0 );
-  ClientManager->UDPBroadcast( tmpMsg, nClient );
-
-  mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
-  return true;
-
-  /* Server resp:
-  13:a8:00:a8:e2:
-  16: 03:a5:00:1b:01:10:00:80:24:ea:7c:cb:80:25:77:80:86:80:62:00:01:00: // Spwan belt object (?)
-  09: 03:a6:00:1f:01:00:25:23:1c: // "UndefinedUseMsg" with arg 0x1c
-  0b: 03:a7:00:1f:01:00:16:00:00:00:00: // Char Dead status
-  0e: 03:a8:00:1f:01:00:25:13:10:19:02:02:0d:00 // Inventory delete item (=item dropped to belt)
-  */
-}
diff --git a/server/src/game/decoder/udp_killself.h b/server/src/game/decoder/udp_killself.h
deleted file mode 100644 (file)
index 19ddf47..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_killself.h - decoder classe for UDP /set kill_self 1 messages
-
- CREATION: 13 Apr 2009 Hammag
-
-*/
-
-#ifndef UDPKILLSELF_H
-#define UDPKILLSELF_H
-
-class PUdpKillSelf : public PUdpMsgAnalyser
-{
-    public:
-        PUdpKillSelf(PMsgDecodeData* nDecodeData);
-        //~PUdpKillSelf();
-        PUdpMsgAnalyser* Analyse();
-        bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_multipart.h b/server/src/game/decoder/udp_multipart.h
deleted file mode 100644 (file)
index e338158..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_multipart.h - decoder classes for UDP multipart messages (0x07)
-
- CREATION: 25 Oct 2009 Namikon
-
- MODIFIED:
- REASON: -
-
-*/
-
-#ifndef UDPMULTIPART_H
-#define UDPMULTIPART_H
-
-class PUdpMultiPart : public PUdpMsgAnalyser
-{
-  private:
-    u16 mChunkNr;
-    u16 mChunkTotal;
-    u8 mSequence;
-    PMessage* mChunk;
-
-  public:
-    PUdpMultiPart( PMsgDecodeData* nDecodeData );
-    //~PUdpPing();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_npcdialog.h b/server/src/game/decoder/udp_npcdialog.h
deleted file mode 100644 (file)
index 5638b84..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_outfitter.cpp b/server/src/game/decoder/udp_outfitter.cpp
deleted file mode 100644 (file)
index c414e49..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_outfitter.cpp - decoder classes for UDP outfitter related messages
-
- CREATION: 20 Mar 2009 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_outfitter.h"
-
-
-/**** PUdpOutfitter ****/
-
-PUdpOutfitter::PUdpOutfitter(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
-{
-    nDecodeData->mName << "/0x2e";
-}
-
-PUdpMsgAnalyser* PUdpOutfitter::Analyse()
-{
-    mDecodeData->mName << "=Outfitter validation";
-
-       u16 tUnknown;
-       PMessage* nMsg = mDecodeData->mMessage;
-       nMsg->SetNextByteOffset(mDecodeData->Sub0x13Start + 8);
-
-       (*nMsg) >> mSkin;
-       (*nMsg) >> tUnknown;
-       (*nMsg) >> mHead;
-       (*nMsg) >> mTorso;
-       (*nMsg) >> mLegs;
-       (*nMsg) >> mHeadColor;
-       (*nMsg) >> mTorsoColor;
-       (*nMsg) >> mLegsColor;
-       (*nMsg) >> mHeadDarkness;
-       (*nMsg) >> mTorsoDarkness;
-       (*nMsg) >> mLegsDarkness;
-
-    mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-    return this;
-}
-
-bool PUdpOutfitter::DoAction()
-{
-       PClient* nClient = mDecodeData->mClient;
-    PChar* tChar = nClient->GetChar();
-       
-       /* Some validity checks against char model and equipment can be done here */
-       /* as well as payment */
-
-       tChar->SetCurrentLook(mSkin, mHead, mTorso, mLegs);
-       tChar->SetCurrentBodyColor(mHeadColor, mTorsoColor, mLegsColor, mHeadDarkness, mTorsoDarkness, mLegsDarkness);
-
-    PMessage* tmpMsg = MsgBuilder->BuildCharHelloMsg(nClient);
-    ClientManager->UDPBroadcast(tmpMsg, nClient);
-       
-
-    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
-    return true;
-}
\ No newline at end of file
diff --git a/server/src/game/decoder/udp_outfitter.h b/server/src/game/decoder/udp_outfitter.h
deleted file mode 100644 (file)
index b6c72e2..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_outfitter.h - decoder classes for UDP outfitter related messages
-
- CREATION: 20 Mar 2009 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#ifndef UDPOUTFITTER_H
-#define UDPOUTFITTER_H
-
-class PUdpOutfitter : public PUdpMsgAnalyser
-{
-       private:
-               u32 mSkin;
-               u8 mHead;
-               u8 mTorso;
-               u8 mLegs;
-               u8 mHeadColor;
-               u8 mTorsoColor;
-               u8 mLegsColor;
-               u8 mHeadDarkness;
-               u8 mTorsoDarkness;
-               u8 mLegsDarkness;
-
-    public:
-        PUdpOutfitter(PMsgDecodeData* nDecodeData);
-        //~PUdpOutfitter();
-        PUdpMsgAnalyser* Analyse();
-        bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_packet0.cpp b/server/src/game/decoder/udp_packet0.cpp
deleted file mode 100644 (file)
index f8c3b76..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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_packet0.h - decoder classes for UDP "Packet0" messages
-  
-       CREATION: 31 Aug 2006 Hammag
-
-       MODIFIED:
-       REASON: - 
-
-*/
-
-#include "main.h"
-#include "udp_packet0.h"
-
-/**** PUdpPacket0 ****/
-
-PUdpPacket0::PUdpPacket0(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
-{
-  nDecodeData->mName << "/0x2a";
-//nDecodeData->mTraceDump=true;
-//mDecodeData->mTraceKnownMsg = true;
-} 
-
-PUdpMsgAnalyser* PUdpPacket0::Analyse()
-{
-  mDecodeData->mName << "=Packet0";
-  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-  
-  return this;
-}
-
-bool PUdpPacket0::DoAction()
-{
-  if (mDecodeData->mState & DECODE_ACTION_READY)
-  {
-    PMessage* tmpMsg = MsgBuilder->BuildPacket0Msg(mDecodeData->mClient);
-    mDecodeData->mClient->SendUDPMessage(tmpMsg);
-
-    //mDecodeData->mMessage->SetNextByteOffset(mDecodeData->Sub0x13StartNext);    
-    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
-    return true;
-  }
-  else
-    return false; 
-}
diff --git a/server/src/game/decoder/udp_packet0.h b/server/src/game/decoder/udp_packet0.h
deleted file mode 100644 (file)
index cde160f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_packet0.h - decoder classes for UDP "Packet0" messages\r
-  \r
-       CREATION: 31 Aug 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#ifndef UDPPACKET0_H\r
-#define UDPPACKET0_H\r
-\r
-class PUdpPacket0 : public PUdpMsgAnalyser\r
-{ \r
-  public:\r
-    PUdpPacket0(PMsgDecodeData* nDecodeData);\r
-    //~PUdpPacket0();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_ping.cpp b/server/src/game/decoder/udp_ping.cpp
deleted file mode 100644 (file)
index 7258bf0..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_ping.cpp - decoder classes for UDP Ping messages
-
- CREATION: 31 Aug 2006 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "udp_ping.h"
-
-/**** PUdpPing ****/
-
-PUdpPing::PUdpPing( PMsgDecodeData* nDecodeData ) : PUdpMsgAnalyser( nDecodeData )
-{
-  nDecodeData->mName << "/0x0b";
-}
-
-PUdpMsgAnalyser* PUdpPing::Analyse()
-{
-  mDecodeData->mName << "=Ping";
-
-  mClientTime = mDecodeData->mMessage->U32Data( mDecodeData->Sub0x13Start + 2 );
-
-  mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-  return this;
-}
-
-bool PUdpPing::DoAction()
-{
-  if ( mDecodeData->mState & DECODE_ACTION_READY )
-  {
-       // 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 );
-    mDecodeData->mClient->SendUDPMessage( tmpMsg );
-
-    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
-    return true;
-  }
-  else
-    return false;
-}
diff --git a/server/src/game/decoder/udp_ping.h b/server/src/game/decoder/udp_ping.h
deleted file mode 100644 (file)
index 88299b2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- udp_ping.h - decoder classes for UDP Ping messages\r
-\r
- CREATION: 31 Aug 2006 Hammag\r
-\r
- MODIFIED:\r
- REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPPING_H\r
-#define UDPPING_H\r
-\r
-class PUdpPing : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mClientTime;\r
-\r
-  public:\r
-    PUdpPing( PMsgDecodeData* nDecodeData );\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_popupresponse.h b/server/src/game/decoder/udp_popupresponse.h
deleted file mode 100644 (file)
index a6106b8..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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
-
- CREATION: 14 Apr 2009 Hammag
-*/
-
-
-#ifndef UDPPOPUPRESP_H
-#define UDPPOPUPRESP_H
-
-class PUdpPopupResponse : public PUdpMsgAnalyser
-{
-  public:
-    PUdpPopupResponse( PMsgDecodeData* nDecodeData );
-    //~PUdpPopupResponse();
-    PUdpMsgAnalyser* Analyse();
-    //bool DoAction();
-};
-
-class PUdpVentureWarpConfirm : public PUdpMsgAnalyser
-{
-  private:
-    u32 mRawItemId;
-    u16 mStatus;
-    u32 mUnknown1;
-    u16 mUnknown2;
-  public:
-    PUdpVentureWarpConfirm( PMsgDecodeData* nDecodeData );
-    //~PUdpVentureWarpConfirm();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-class PUdpVhcAccessResponse : public PUdpMsgAnalyser
-{
-  private:
-    u32 mVhcAccessRequestId;
-    u16 mStatus;
-    u16 mUnknown;
-  public:
-    PUdpVhcAccessResponse( PMsgDecodeData* nDecodeData );
-    //~PUdpVhcAccessResponse();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_pvptrade.cpp b/server/src/game/decoder/udp_pvptrade.cpp
deleted file mode 100644 (file)
index bbb3554..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_pvptrade.cpp - decoder classes for UDP "Request for more information about WorldID xx"
-
- CREATION: 20 Jun 2009 Namikon
-
- MODIFIED: 4 Jul 2009 Hammag
- REASON: Corrected class name
-
-*/
-
-#include "main.h"
-#include "udp_pvptrade.h"
-
-/**** PPvPTrade ****/
-
-PUdpPvPTrade::PUdpPvPTrade(PMsgDecodeData* nDecodeData) : PUdpMsgAnalyser(nDecodeData)
-{
-    nDecodeData->mName << "/0x3e";
-}
-
-PUdpMsgAnalyser* PUdpPvPTrade::Analyse()
-{
-    mDecodeData->mName << "=Switch PvP Trading";
-
-    mDecodeData->mState = DECODE_ACTION_READY | DECODE_FINISHED;
-    return this;
-}
-
-bool PUdpPvPTrade::DoAction()
-{
-    // TODO: Handle client PvP trade switch on/off
-    mDecodeData->mState = DECODE_ACTION_DONE | DECODE_FINISHED;
-    return true;
-}
diff --git a/server/src/game/decoder/udp_pvptrade.h b/server/src/game/decoder/udp_pvptrade.h
deleted file mode 100644 (file)
index 27f7afa..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_pvptrade.h - decoder classes for UDP "Request for more information about WorldID xx"
-
- CREATION: 20 Jun 2009 Namikon
-
- MODIFIED: 4 Jul 2009 Hammag
- REASON: Corrected class name
-
-*/
-
-#ifndef UDPPVPTRADE_H
-#define UDPPVPTRADE_H
-
-class PUdpPvPTrade : public PUdpMsgAnalyser
-{
-public:
-    PUdpPvPTrade(PMsgDecodeData* nDecodeData);
-    //~PUdpPvPTrade();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_quickaccessbelt.h b/server/src/game/decoder/udp_quickaccessbelt.h
deleted file mode 100644 (file)
index 3a79c5f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_quickaccessbelt.h - decoder classes for UDP Quickaccessbelt related messages\r
-\r
-       CREATION: 30 Dec 2006 Namikon\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPITEMSLOT_H\r
-#define UDPITEMSLOT_H\r
-\r
-class PUdpItemSlotUse : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u8 mTargetSlot;\r
-    \r
-  public:\r
-    PUdpItemSlotUse(PMsgDecodeData* nDecodeData);\r
-    //~PUdpItemSlotUse();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_reqinfo.h b/server/src/game/decoder/udp_reqinfo.h
deleted file mode 100644 (file)
index 9c02e27..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_reqinfo.h - decoder classes for UDP Char info request messages\r
-  \r
-       CREATION: 6 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#ifndef UDPREQINFO_H\r
-#define UDPREQINFO_H\r
-\r
-class PUdpReqInfo : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u16 mRequestType;\r
-    u32 mInfoId;\r
-    \r
-  public:\r
-    PUdpReqInfo(PMsgDecodeData* nDecodeData);\r
-    //~PUdpCharInfo();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_subskill.h b/server/src/game/decoder/udp_subskill.h
deleted file mode 100644 (file)
index 8720ce1..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_subskill.h - decoder classes for UDP subskill increasing messages\r
-  \r
-       CREATION: 15 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: - \r
-\r
-*/\r
-\r
-#ifndef UDPSUBSKILL_H\r
-#define UDPSUBSKILL_H\r
-\r
-class PUdpSubskillInc : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u16 SubskillID;\r
-    \r
-  public:\r
-    PUdpSubskillInc(PMsgDecodeData* nDecodeData);\r
-    //~PUdpSubskillInc();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_sync.h b/server/src/game/decoder/udp_sync.h
deleted file mode 100644 (file)
index 3326de8..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- udp_sync.h - decoder classes for UDP Sync messages\r
-\r
- CREATION: 30 Aug 2006 Hammag\r
-\r
- MODIFIED:\r
- REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPSYNC_H\r
-#define UDPSYNC_H\r
-\r
-class PUdpSync0 : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpSync0( PMsgDecodeData* nDecodeData );\r
-    //~PUdpSync0();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-\r
-    static void GetToSync1( PMsgDecodeData* nDecodeData );\r
-};\r
-\r
-class PUdpSync1 : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpSync1( PMsgDecodeData* nDecodeData );\r
-    //~PUdpSync1();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpSync2 : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mClientTime;\r
-\r
-  public:\r
-    PUdpSync2( PMsgDecodeData* nDecodeData );\r
-    //~PUdpSync2();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_terminal.h b/server/src/game/decoder/udp_terminal.h
deleted file mode 100644 (file)
index 3d4870b..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_terminal.h - decoder classes for UDP terminal related messages\r
-\r
-       CREATION: 8 Jan 2007 Namikon\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPTERMINAL_H\r
-#define UDPTERMINAL_H\r
-\r
-\r
-\r
-class PUdpReceiveDB : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    static const u8 mMaxOptions = 9; // Largest: forum\forenlist.tsc(21, 114,...)\r
-    u16 mTerminalSessionId;\r
-    std::string mCommandName;\r
-    std::string mOptions[mMaxOptions];\r
-    u8 mOptionsCount;\r
-    \r
-    u16 mUnknown1;\r
-    u8 mUnknown2;\r
-    u16 mDBId;\r
-    \r
-               bool ActionVehicleListing();\r
-               bool ActionVehicleControl();\r
-               \r
-  public:\r
-    PUdpReceiveDB(PMsgDecodeData* nDecodeData);\r
-    //~PUdpReceiveDB();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpUpdateDB : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    static const u8 mMaxOptions = 7; // Largest: forum\bbcnewthread.tsc(66):\r
-    u16 mTerminalSessionId;\r
-    std::string mCommandName;\r
-    std::string mOptions[mMaxOptions];\r
-    u8 mOptionsCount;\r
-\r
-    u16 mUnknown1;\r
-    u8 mUnknown2;\r
-    u16 mDBId;\r
-\r
-  public:\r
-    PUdpUpdateDB(PMsgDecodeData* nDecodeData);\r
-    //~PUdpUpdateDB();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpTryAccessDB : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    static const u8 mMaxOptions = 9; // Largest: stockx\depot.tsc(227):\r
-    u16 mTerminalSessionId;\r
-    std::string mCommandName;\r
-    std::string mOptions[mMaxOptions];\r
-    u8 mOptionsCount;\r
-\r
-    u16 mUnknown1;\r
-    u8 mUnknown2;\r
-    u16 mDBId;\r
-\r
-  public:\r
-    PUdpTryAccessDB(PMsgDecodeData* nDecodeData);\r
-    //~PUdpTryAccessDB();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpQueryDB : public PUdpMsgAnalyser // Also called "ServerMessage" in .tsc scripts!\r
-{\r
-  private:\r
-    static const u8 mMaxOptions = 5; // Largest: politics\transcomment.tsc(36):\r
-    u16 mTerminalSessionId;\r
-       u16 mDBId;\r
-    std::string mDBCommandName;\r
-    std::string mCommandName;\r
-    std::string mOptions[mMaxOptions];\r
-    u8 mOptionsCount;\r
-\r
-               bool ActionSpawnVehicle();\r
-               bool ActionRepairVehicle();\r
-               bool ActionDismissVehicle();\r
-                 \r
-  public:\r
-    PUdpQueryDB(PMsgDecodeData* nDecodeData);\r
-    //~PUdpQueryDB();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpTeminal0x1f : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u16 mTerminalSessionId;\r
-    \r
-  public:\r
-    PUdpTeminal0x1f(PMsgDecodeData* nDecodeData);\r
-    //~PUdpTeminal0x1f();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_useobject.h b/server/src/game/decoder/udp_useobject.h
deleted file mode 100644 (file)
index f87a2b0..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udp_useobject.h - decoder classes for object use related messages\r
-\r
-       CREATION: 17 Sep 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPUSEOBJECT_H\r
-#define UDPUSEOBJECT_H\r
-\r
-class PUdpUseObject : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mRawItemID;\r
-\r
-    void OldHandler(); // Temp during migration only\r
-\r
-  public:\r
-    PUdpUseObject(PMsgDecodeData* nDecodeData);\r
-    //~PUdpUseObject();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpCloseItemContainer : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-\r
-  public:\r
-    PUdpCloseItemContainer(PMsgDecodeData* nDecodeData);\r
-    //~PUdpCloseItemContainer();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-#endif\r
diff --git a/server/src/game/decoder/udp_vhc.h b/server/src/game/decoder/udp_vhc.h
deleted file mode 100644 (file)
index bca7a2b..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- udp_vhc.h - decoder classes for UDP vehicle related messages\r
-\r
- CREATION: 5 Sep 2006 Hammag\r
-\r
- MODIFIED:\r
- REASON: -\r
-\r
-*/\r
-\r
-#ifndef UDPVHC_H\r
-#define UDPVHC_H\r
-\r
-class PSpawnedVehicle;\r
-class PVhcCoordinates;\r
-\r
-class PUdpVhcMove : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u16 mVhcLocalId;\r
-    u16 mNewY;\r
-    u16 mNewZ;\r
-    u16 mNewX;\r
-    u16 mNewLR;\r
-    u16 mNewRoll;\r
-    u16 mUnk1; // always 0x0001 ?\r
-    u8 mMoveType;\r
-    u8 mNewUD;\r
-    u8 mFF; // always 0xff ?\r
-    u8 mAction; // &1 = Left, &2 = Right, &4 = Forward, &8 = Backward\r
-  public:\r
-    PUdpVhcMove( PMsgDecodeData* nDecodeData );\r
-    //~PUdpVhcMove();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-    bool DoVhcZoning( PSpawnedVehicle* currVhc, u32 currWorldId, u32 destWorldId, PVhcCoordinates* destPos );\r
-};\r
-\r
-class PUdpVhcUse : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mVehicleID;\r
-    u8 mVehicleSeat;\r
-\r
-  public:\r
-    PUdpVhcUse( PMsgDecodeData* nDecodeData );\r
-    //~PUdpVhcUse();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-    static void DoFreeSitting(PClient* nClient,  PSpawnedVehicle* nVhc, u32 nRawVhcLocalId, u8 nSeatId = 254);\r
-};\r
-\r
-class PUdpSubwayUpdate : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mVehicleID;\r
-    u16 mPosition;\r
-    u8 mDoorOpened;\r
-\r
-  public:\r
-    PUdpSubwayUpdate( PMsgDecodeData* nDecodeData );\r
-    //~PUdpSubwayUpdate();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpRequestVhcInfo : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mVehicleID;\r
-\r
-  public:\r
-    PUdpRequestVhcInfo( PMsgDecodeData* nDecodeData );\r
-    //~PUdpRequestVhcInfo();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udp_worldIDinfo.h b/server/src/game/decoder/udp_worldIDinfo.h
deleted file mode 100644 (file)
index 8d60d3e..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_worldIDinfo.h - decoder classes for UDP "Request for more information about WorldID xx"
-
- CREATION: 20 Jun 2009 Namikon
-
- MODIFIED:
- REASON: -
-
-*/
-
-#ifndef UDPWORLDIDINFO_H
-#define UDPWORLDIDINFO_H
-
-class PWorldIDInfoReq : public PUdpMsgAnalyser
-{
-    u32 mInfoId;
-
-public:
-    PWorldIDInfoReq(PMsgDecodeData* nDecodeData);
-    //~PWorldIDInfoReq();
-    PUdpMsgAnalyser* Analyse();
-    bool DoAction();
-};
-
-#endif
diff --git a/server/src/game/decoder/udp_zoning.h b/server/src/game/decoder/udp_zoning.h
deleted file mode 100644 (file)
index 37a4b0e..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
- udp_zoning.h - decoder classes for UDP Zoning messages\r
-\r
- CREATION: 6 Sep 2006 Hammag\r
-\r
- MODIFIED: 15 Dec 2006 Hammag\r
- REASON: - added PUdpEndOfZoning management class\r
-\r
-*/\r
-\r
-#ifndef UDPZONING_H\r
-#define UDPZONING_H\r
-\r
-class PUdpZoning1 : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mNewLocation;\r
-    u16 mNewEntity;\r
-    u8 mUnknown;\r
-  public:\r
-    PUdpZoning1( PMsgDecodeData* nDecodeData );\r
-    //~PUdpZoning1();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpZoning2 : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpZoning2( PMsgDecodeData* nDecodeData );\r
-    //~PUdpZoning2();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpGenrepZoning : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mNewLocation;\r
-    u16 mNewEntity;\r
-\r
-  public:\r
-    PUdpGenrepZoning( PMsgDecodeData* nDecodeData );\r
-    //~PUdpGenrepZoning();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-    static bool DoEffectiveZoning( PClient* nClient, u32  nNewLocation, u16 nNewEntity );\r
-};\r
-\r
-class PUdpAptGRZoning : public PUdpMsgAnalyser\r
-{\r
-  public:\r
-    PUdpAptGRZoning( PMsgDecodeData* nDecodeData );\r
-    //~PUdpAptGRZoning();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-    static bool DoEffectiveZoning( PClient* nClient );\r
-};\r
-\r
-class PUdpAddGenrepToList : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u32 mLocation;\r
-    u16 mEntity;\r
-\r
-  public:\r
-    PUdpAddGenrepToList( PMsgDecodeData* nDecodeData );\r
-    //~PUdpAddGenrepToList();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-class PUdpAppartmentAccess : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-    u16 mAppartmentPlace;\r
-    char* mPassword;\r
-\r
-  public:\r
-    PUdpAppartmentAccess( PMsgDecodeData* nDecodeData );\r
-    //~PUdpAppartmentAccess();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-\r
-class PUdpEndOfZoning : public PUdpMsgAnalyser\r
-{\r
-  private:\r
-\r
-  public:\r
-    PUdpEndOfZoning( PMsgDecodeData* nDecodeData );\r
-    //~PUdpEndOfZoning();\r
-    PUdpMsgAnalyser* Analyse();\r
-    bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/decoder/udpanalyser.h b/server/src/game/decoder/udpanalyser.h
deleted file mode 100644 (file)
index 61627c2..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       udpanalyser.h - Analyser class top (used only by PUdpMsgDecoder)\r
-  Also includes the PUdpMsgUnknown derived class\r
-  and the PUdpMsgIgnore derived class\r
-  \r
-       CREATION: 23 Aug 2006 Hammag\r
-\r
-       MODIFIED: 30 Aug 2006 Hammag\r
-       REASON: - moved these two class in file distinct from PUdpMsgDecoder.\r
-\r
-*/\r
-\r
-#ifndef UDPANALYSER_H\r
-#define UDPANALYSER_H\r
-\r
-class PUdpMsgAnalyser\r
-{\r
-  friend class PUdpMsgDecoder;\r
-  \r
-       protected:\r
-    PMsgDecodeData* mDecodeData;\r
-\r
-  public:        \r
-    PUdpMsgAnalyser(PMsgDecodeData* nDecodeData);\r
-    virtual ~PUdpMsgAnalyser();\r
-    \r
-    virtual PUdpMsgAnalyser* Analyse();\r
-    virtual bool DoAction();\r
-    \r
-    static int smAnaCount; // temp for check\r
-\r
-};\r
-\r
-class PUdpMsgUnknown : public PUdpMsgAnalyser\r
-{ \r
-  public:\r
-    PUdpMsgUnknown(PMsgDecodeData* nDecodeData);\r
-    //~PUdpMsgUnknown();\r
-    \r
-    //bool DoAction();\r
-};\r
-\r
-class PUdpMsgIgnore : public PUdpMsgAnalyser\r
-{ \r
-  public:\r
-    PUdpMsgIgnore(PMsgDecodeData* nDecodeData);\r
-    //~PUdpMsgUnknown();\r
-    \r
-    //bool DoAction();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/def/def_actionmod.cpp b/server/src/game/def/def_actionmod.cpp
deleted file mode 100644 (file)
index 44dee7c..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_actionmod.h"
-
-
-PDefActionMod::PDefActionMod()
-{
-}
-
-bool PDefActionMod::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  int maxFields = 3;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-        mStartValue = atof( i->c_str() ); break;
-      case 3 :
-      {
-        mNumOfSsq = atoi( i->c_str() );
-        if( mNumOfSsq > 8 )
-          mNumOfSsq = 8;
-        maxFields = 3 + 2 * mNumOfSsq;
-        break;
-      }
-      default :
-        if( (Idx >= 4) && (Idx <= maxFields) )
-        {
-          if(Idx & 1)
-          {
-            mModFactor[(Idx - 4) / 2] = atof( i->c_str() );
-          }
-          else
-          {
-            mSsqId[(Idx - 4) / 2] = atoi( i->c_str() );
-          }
-        }
-        break;
-    }
-
-    if ( Idx >= maxFields )
-      break;
-  }
-
-  return ((Idx == maxFields));
-}
diff --git a/server/src/game/def/def_ammo.cpp b/server/src/game/def/def_ammo.cpp
deleted file mode 100644 (file)
index 218a554..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_ammo.h"
-
-
-PDefAmmo::PDefAmmo()
-{
-  mShotId = mMagSize = mWeaponShotId = mDamageId = 0;
-}
-
-bool PDefAmmo::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-        mDamageId = atoi( i->c_str() ); break;
-      case 3 :
-        mWeaponShotId = atoi( i->c_str() ); break;
-      case 4 :
-        mMagSize = atoi( i->c_str() ); break;
-      case 5 :
-        mShotId = atoi( i->c_str() ); break;
-      default :
-        break;
-    }
-
-    if ( Idx >= 5 )
-      break;
-  }
-
-  return ((Idx >= 4));
-}
diff --git a/server/src/game/def/def_appartements.cpp b/server/src/game/def/def_appartements.cpp
deleted file mode 100644 (file)
index 5e05b8f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_appartements.cpp\r
-\r
-       MODIFIED: 22 Sep 2006 Hammag\r
-       REASON: - Creation\r
-       \r
-*/\r
-\r
-#include "main.h"\r
-\r
-PDefAppartement::PDefAppartement()\r
-{\r
-}\r
-\r
-bool PDefAppartement::LoadFromDef(PTokenList *Tokens)\r
-{\r
-  mFaction = 0;\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0: // setentry\r
-                                       continue;\r
-\r
-                       case 1: // index\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-                       case 2: // name\r
-                               mName = *i; break;\r
-\r
-                       case 3: // world name\r
-                               mWorldName = *i; break;\r
-                               \r
-                       case 4: // value\r
-                               mValue = atoi(i->c_str()); break;\r
-\r
-                       case 5: // number of places\r
-                               mPlaceCount = atoi(i->c_str()); break;\r
-                                 \r
-                 case 6:\r
-                 case 7:\r
-                 case 8:\r
-                 case 9:\r
-                 case 10:\r
-                 case 11:\r
-                 case 12:\r
-                 case 13:\r
-                   mPlace[Idx-6] = atoi(i->c_str()); break;\r
-                     \r
-                       case 14: // faction if base appartement\r
-                               mFaction = atoi(i->c_str()); break;                   \r
-               }\r
-       }\r
-//Console->Print("%04d:%s file:%s val:%d places:%d pl1:%d pl2:%d pl8:%d faction:%d",\r
-//      mIndex, mName.c_str(), mWorldName.c_str(), mValue, mPlaceCount, mPlace[0], mPlace[1], mPlace[7], mFaction);\r
-       return true;\r
-}\r
diff --git a/server/src/game/def/def_appplaces.cpp b/server/src/game/def/def_appplaces.cpp
deleted file mode 100644 (file)
index 3c4797a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-       def_appplaces.cpp\r
-\r
-       Created: 21 Sep 2006 Hammag\r
-       REASON: -\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PDefAppPlace::PDefAppPlace()\r
-{\r
-}\r
-\r
-bool PDefAppPlace::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0: // setentry\r
-                                       continue;\r
-\r
-                       case 1: // index\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-                       case 2: // name\r
-                               mName = *i; break;\r
-\r
-                       case 3: // Exit World\r
-                               mExitWorldID = atoi(i->c_str()); break;\r
-                               \r
-                       case 4: // Exit World entity\r
-                               mExitWorldEntity = atoi(i->c_str()); break;\r
-\r
-                       case 5: // Sewer level\r
-                               mSewerLevel = atoi(i->c_str()); break;\r
-               }\r
-       }\r
-\r
-       return true;\r
-}\r
diff --git a/server/src/game/def/def_blueprintpieces.cpp b/server/src/game/def/def_blueprintpieces.cpp
deleted file mode 100644 (file)
index 76819ed..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_blueprintpieces.h"
-
-
-PDefBlueprintPieces::PDefBlueprintPieces()
-{
-}
-
-
-bool PDefBlueprintPieces::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  int maxFields = 3;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-        mMaxPieceNum = atoi( i->c_str() ); break;
-      case 3 :
-      {
-        mPieceNum = atoi( i->c_str() );
-        if ( mPieceNum > 20 )
-          mPieceNum = 20;
-        maxFields = 3 + mPieceNum;
-        break;
-      }
-      default :
-        if (( Idx >= 4 ) && ( Idx <= maxFields ) )
-        {
-          mPieceId[ Idx - 4 ] = atoi( i->c_str() );
-        }
-        break;
-    }
-
-    if ( Idx >= maxFields )
-      break;
-  }
-
-  return (( Idx == maxFields ) );
-}
diff --git a/server/src/game/def/def_characters.cpp b/server/src/game/def/def_characters.cpp
deleted file mode 100644 (file)
index a744265..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_characters.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-// characters.def contains all ingame characters (player types, npc's, monsters)\r
-\r
-PDefCharacter::PDefCharacter()\r
-{\r
-       mIndex = -1;\r
-       mName = "unknown";\r
-       mModel = -1;\r
-}\r
-\r
-bool PDefCharacter::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0 :        // setentry\r
-                               continue;\r
-\r
-                       case 1 :\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-                       case 2 :\r
-                               mName = *i; break;\r
-\r
-                       case 3 :\r
-                               mModel = atoi(i->c_str()); break;\r
-                                 \r
-                       case 4 : // 0\r
-                               continue;\r
-                                 \r
-                       case 5 :\r
-                               mHead = atoi(i->c_str()); break;\r
-                                 \r
-                       case 6 :\r
-                               mTorso = atoi(i->c_str()); break;\r
-                                 \r
-                       case 7 :\r
-                               mLegs = atoi(i->c_str()); break;\r
-                               \r
-                       case 8 :\r
-                               mColor = atoi(i->c_str()); break;\r
-                               \r
-                       case 9 :\r
-                               mBrightness = atoi(i->c_str()); break;\r
-               }\r
-\r
-               if(Idx==9)\r
-                       return true;\r
-       }\r
-\r
-       return false;\r
-}\r
-\r
diff --git a/server/src/game/def/def_charaction.cpp b/server/src/game/def/def_charaction.cpp
deleted file mode 100644 (file)
index 2eeb0fc..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_charaction.h"
-
-
-PDefCharAction::PDefCharAction()
-{
-}
-
-bool PDefCharAction::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  int maxFields = 2;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-      {
-        mNumOfSsq = atoi( i->c_str() );
-        if ( mNumOfSsq > 8 )
-          mNumOfSsq = 8;
-        maxFields = 2 + 2 * mNumOfSsq;
-        break;
-      }
-      default :
-        if (( Idx >= 3 ) && ( Idx <= maxFields ) )
-        {
-          if ( Idx & 1 )
-          {
-            mSsqId[( Idx - 3 ) / 2] = atoi( i->c_str() );
-          }
-          else
-          {
-            mModFactor[( Idx - 3 ) / 2] = atof( i->c_str() );
-          }
-        }
-        break;
-    }
-
-    if ( Idx >= maxFields )
-      break;
-  }
-
-  return (( Idx == maxFields ) );
-}
diff --git a/server/src/game/def/def_charkinds.cpp b/server/src/game/def/def_charkinds.cpp
deleted file mode 100644 (file)
index dc940b7..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_charkinds.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-// charkinds are character templates used for player char creation\r
-\r
-PDefCharKind::PDefCharKind()\r
-{\r
-       mSkillInfo = 0;\r
-       memset(mInventory, 0, sizeof(mInventory));\r
-}\r
-\r
-PDefCharKind::~PDefCharKind()\r
-{\r
-       delete [] mSkillInfo;\r
-       for(PSkillPtsMap::const_iterator i=mSkillPts.begin(); i!=mSkillPts.end(); i++)\r
-               delete i->second;\r
-       for(PSubSkillPtsMap::const_iterator i=mSubSkillPts.begin(); i!=mSubSkillPts.end(); i++)\r
-               delete i->second;\r
-       for(PStartLevelMap::const_iterator i=mStartLevels.begin(); i!=mStartLevels.end(); i++)\r
-               delete i->second;\r
-}\r
-\r
-bool PDefCharKind::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int NumSkills = GameDefs->Skills()->GetNumDefs();\r
-       //int NumSubSkills = GameDefs->SubSkills()->GetNumDefs();\r
-\r
-       int SkillInfoStart = 4;\r
-       int TrainPtsStart = SkillInfoStart+NumSkills*3;\r
-       int LevelsStart = TrainPtsStart + 32*2;\r
-       int MoneyStart = LevelsStart + 16*2;\r
-       int InventoryStart = MoneyStart+1;\r
-\r
-       mSkillInfo = new PSkillInfo[NumSkills];\r
-\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0 :        // setentry\r
-                               continue;\r
-\r
-                       case 1 :\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-                       case 2 :\r
-                               mName = *i; break;\r
-\r
-                       case 3 :\r
-                               mType = atoi(i->c_str()); break;\r
-\r
-               }\r
-\r
-               if((Idx >= SkillInfoStart) && (Idx < TrainPtsStart)) // skill info\r
-               {\r
-                       int SkillIdx = (Idx-SkillInfoStart)/3;\r
-                       int Value = atoi(i->c_str());\r
-\r
-                       // start, max, grow per skill\r
-                       switch((Idx-SkillInfoStart)%3)\r
-                       {\r
-                               case 0 : mSkillInfo[SkillIdx].mStart = Value; break;\r
-                               case 1 : mSkillInfo[SkillIdx].mMax = Value; break;\r
-                               case 2 : mSkillInfo[SkillIdx].mGrow = Value; break;\r
-                       }\r
-               } else\r
-               // 32 skill/subskill train pts\r
-               if((Idx >= TrainPtsStart) && (Idx < LevelsStart))\r
-               {\r
-                       static int SkillIndex = 0;\r
-                       int Index = Idx-TrainPtsStart;\r
-                       if((Index&1)==0)\r
-                       {\r
-                               SkillIndex = atoi(i->c_str());\r
-                       } else\r
-                       {\r
-                               if(SkillIndex >= 1000)  // skill\r
-                               {\r
-                                       const PDefSkill *Skill = GameDefs->Skills()->GetDef(SkillIndex-1000);\r
-                                       if(Skill)\r
-                                       {\r
-                                               int Index = Skill->GetIndex()-1;\r
-                                               PSkillPtsInfo *CurrentSkillPts = new PSkillPtsInfo();\r
-                                               CurrentSkillPts->mSkill = Index;\r
-                                               CurrentSkillPts->mPoints = atoi(i->c_str());\r
-                                               mSkillPts.insert(std::make_pair(Index, CurrentSkillPts));\r
-                                       } else\r
-                                       {\r
-                                               if(SkillIndex-1000 != 0)\r
-                                                       Console->Print("Charkind def: invalid skill index %i", SkillIndex-1000);\r
-                                       }\r
-                               } else  // subskill\r
-                               {\r
-                                       const PDefSubSkill *SubSkill = GameDefs->SubSkills()->GetDef(SkillIndex);\r
-                                       if(SubSkill)\r
-                                       {\r
-                                               int Index = SubSkill->GetIndex()-1;\r
-                                               PSubSkillPtsInfo *CurrentSubSkillPts = new PSubSkillPtsInfo();\r
-                                               CurrentSubSkillPts->mSubSkill = Index;\r
-                                               CurrentSubSkillPts->mPoints = atoi(i->c_str());\r
-                                               mSubSkillPts.insert(std::make_pair(Index, CurrentSubSkillPts));\r
-                                       } else\r
-                                       {\r
-                                               if(SkillIndex != 0)\r
-                                                       Console->Print("Charkind def: invalid subskill index %i", SkillIndex);\r
-                                       }\r
-                               }\r
-                       }\r
-               } else\r
-               // 16 subskill start levels\r
-               if((Idx >= LevelsStart) && (Idx < MoneyStart))\r
-               {\r
-                       static int LevelIndex = 0;\r
-                       int Index = Idx-NumSkills*3+4+(32*2);\r
-                       if((Index&1)==0)\r
-                       {\r
-                               LevelIndex = atoi(i->c_str());\r
-                       } else\r
-                       {\r
-                               if(LevelIndex > 0)\r
-                               {\r
-                                       const PDefSubSkill *SubSkill = GameDefs->SubSkills()->GetDef(LevelIndex);\r
-                                       if(SubSkill)\r
-                                       {\r
-                                               PStartLevelInfo *Level = new PStartLevelInfo();\r
-                                               Level->mSubSkill = SubSkill->GetIndex();\r
-                                               Level->mLevel = atoi(i->c_str());\r
-                                               mStartLevels.insert(std::make_pair(Level->mSubSkill, Level));\r
-                                       } else\r
-                                       {\r
-                                               Console->Print("Charkind def: invalid subskill index %i", LevelIndex);\r
-                                       }\r
-                               }\r
-                       }\r
-               } else\r
-               // money\r
-               if((Idx >= MoneyStart) && (Idx < InventoryStart))\r
-               {\r
-                       mMoney = atoi(i->c_str());\r
-               } else\r
-               // inventory\r
-               if((Idx >= InventoryStart) && (Idx < InventoryStart+8))\r
-               {\r
-                       mInventory[Idx-InventoryStart] = atoi(i->c_str());\r
-               }\r
-       }\r
-       \r
-       return true;\r
-}\r
-\r
diff --git a/server/src/game/def/def_factions.cpp b/server/src/game/def/def_factions.cpp
deleted file mode 100644 (file)
index 5daf3fd..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_factions.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PDefFaction::PDefFaction()\r
-{\r
-       memset(mRelations, 0, sizeof(mRelations)); // ... array members supposed to by auto-initialized by C++\r
-}\r
-\r
-bool PDefFaction::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               // setfracc 19  "Monster"   -1024   0   0   -1024   -1024   -1024   -1\r
-               switch(Idx)\r
-               {\r
-                       case 0 : // setfrac\r
-                               continue;\r
-\r
-                       case 1 :\r
-                               mIndex = atol(i->c_str()); break;\r
-\r
-            case 2 :\r
-                mName = *i;\r
-                CleanUpString(&mName);\r
-                break;\r
-\r
-                       case 3 :\r
-                               mStartValue = atol(i->c_str()); break;\r
-\r
-                       case 4:\r
-                               mAffected = atol(i->c_str())!=0; break;\r
-\r
-                       case 5:\r
-                               mSL = atol(i->c_str()); break;\r
-\r
-                       default :\r
-                       {\r
-                               if(Idx-6 < NUMFACTIONS)\r
-                                       mRelations[Idx-6] = atol(i->c_str()); break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       return true;\r
-}\r
-\r
-int PDefFaction::GetRelation(int Faction) const\r
-{\r
-       // faction 0 has no relations\r
-       if(Faction <= 0 || Faction > NUMFACTIONS)\r
-               return 0;\r
-\r
-       return mRelations[Faction-1];\r
-}\r
-\r
diff --git a/server/src/game/def/def_hack.cpp b/server/src/game/def/def_hack.cpp
deleted file mode 100644 (file)
index 63926f4..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_hack.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PDefHack::PDefHack()\r
-{\r
-}\r
-\r
-bool PDefHack::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0: // setentry\r
-                               continue ;\r
-\r
-\r
-                       case 1: // index\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-\r
-               }\r
-       }\r
-\r
-       return true;\r
-}\r
-\r
diff --git a/server/src/game/def/def_itemres.cpp b/server/src/game/def/def_itemres.cpp
deleted file mode 100644 (file)
index 1bd7047..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_itemres.h"
-
-
-PDefItemRestriction::PDefItemRestriction()
-{
-}
-
-bool PDefItemRestriction::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  int maxFields = 2;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-      {
-        mNumRestrictions = atoi( i->c_str() );
-        if( mNumRestrictions > 6 )
-          mNumRestrictions = 6;
-        maxFields = 2 + 2 * mNumRestrictions;
-        break;
-      }
-      default :
-        if( (Idx >= 3) && (Idx <= maxFields) )
-        {
-          if(Idx & 1)
-          {
-            mSsqId[(Idx - 3) / 2] = atoi( i->c_str() );
-          }
-          else
-          {
-            mMinValue[(Idx - 3) / 2] = atoi( i->c_str() );
-          }
-        }
-        break;
-    }
-
-    if ( Idx >= maxFields )
-      break;
-  }
-
-  return ((Idx == maxFields));
-}
diff --git a/server/src/game/def/def_npcarmor.cpp b/server/src/game/def/def_npcarmor.cpp
deleted file mode 100644 (file)
index dcb34ea..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_npcarmor.h"
-
-
-PDefNpcArmor::PDefNpcArmor()
-{
-}
-
-bool PDefNpcArmor::LoadFromDef ( PTokenList *Tokens )
-{
-  int Idx=0;
-  for ( PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;;
-      case 1 :
-        mIndex = atoi ( i->c_str() ); break;
-      default :
-        if ( ( Idx - 2 ) < 7 )
-        {
-          mValue[Idx - 2] = atoi ( i->c_str() );
-        }
-        break;
-    }
-  }
-
-  return ( Idx >= 8 );
-}
diff --git a/server/src/game/def/def_outposts.cpp b/server/src/game/def/def_outposts.cpp
deleted file mode 100644 (file)
index 3c1919a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_outposts.h"
-
-
-PDefOutpost::PDefOutpost()
-{
-  for ( int i = 0;  i < 8; ++i )
-    mInfluenceZone[i] = 0;
-}
-
-bool PDefOutpost::LoadFromDef ( PTokenList *Tokens )
-{
-  int Idx=0;
-  for ( PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0: // setentry
-        break;
-      case 1: // index
-        mIndex = atoi ( i->c_str() ); break;
-      case 2:
-        mName = *i; break;
-      case 3:
-        mType = atoi ( i->c_str() ); break;
-      case 4:
-        mStandardFaction = atoi ( i->c_str() ); break;
-      case 5:
-        mRevenue = atof ( i->c_str() ); break;
-      case 6:
-        mConquestReward = atof ( i->c_str() ); break;
-      case 7:
-        mMaxSecurity = atoi ( i->c_str() ); break;
-      default :
-        if ( ( Idx - 8 ) < 8 )
-        {
-          mInfluenceZone[Idx - 8] = atoi ( i->c_str() );
-        }
-        break;
-    }
-
-    if ( Idx == 15 )
-      break;
-  }
-
-  return ( Idx >= 7 );
-}
diff --git a/server/src/game/def/def_recycles.cpp b/server/src/game/def/def_recycles.cpp
deleted file mode 100644 (file)
index 7d12884..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_recycles.h"
-
-
-PDefRecycle::PDefRecycle()
-{
-}
-
-bool PDefRecycle::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  int maxFields = 4;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        //mIndex = atoi ( i->c_str() );
-        break;
-      case 2 : // We use resultitem as index
-        mIndex = mResultItemId = atoi ( i->c_str() ); break;
-      case 3:
-        mBuildTime = atoi ( i->c_str() ); break;
-      case 4 :
-      {
-        mNumParts = atoi ( i->c_str() );
-        if ( mNumParts > 8 )
-          mNumParts = 8;
-        maxFields = 4 + mNumParts;
-        break;
-      }
-      default :
-        if ( ( Idx >= 5 ) && ( Idx <= maxFields ) )
-        {
-              mPartId[ Idx - 5 ] = atoi ( i->c_str() ); break;
-        }
-        break;
-    }
-
-    if ( Idx >= 12 )
-      break;
-  }
-
-  return ( ( Idx >= 5 ) );
-}
diff --git a/server/src/game/def/def_shots.cpp b/server/src/game/def/def_shots.cpp
deleted file mode 100644 (file)
index 4b9ee0e..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_shots.h"
-
-
-PDefShot::PDefShot()
-{ }
-
-bool PDefShot::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-        mDamageId = atoi( i->c_str() ); break;
-      case 3 :
-        mMass = atoi( i->c_str() ); break;
-      case 4 :
-        mRadius = atoi( i->c_str() ); break;
-      case 5 :
-        mSpeed = atof( i->c_str() ); break;
-      default :
-        break;
-    }
-
-    if ( Idx >= 5 )
-      break;
-  }
-
-  return (( Idx >= 5 ) );
-}
diff --git a/server/src/game/def/def_skills.cpp b/server/src/game/def/def_skills.cpp
deleted file mode 100644 (file)
index f0bf1e5..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_skills.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-// skill.def includes skill names and skill/subskill mapping\r
-\r
-PDefSkill::PDefSkill()\r
-{\r
-       mSubSkills = 0;\r
-       mNumSubSkills = 0;\r
-}\r
-\r
-PDefSkill::~PDefSkill()\r
-{\r
-       delete [] mSubSkills;\r
-}\r
-\r
-bool PDefSkill::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0 :        // setentry\r
-                               continue;\r
-\r
-                       case 1 :\r
-                               mIndex = atol(i->c_str()); break;\r
-\r
-                       case 2 :\r
-                               mName = *i; break;\r
-\r
-                       case 3 :\r
-                               mShortName = *i; break;\r
-\r
-                       case 4 :\r
-                       {\r
-                               mNumSubSkills = atol(i->c_str());\r
-                               mSubSkills = new int[mNumSubSkills];\r
-                               std::memset(mSubSkills, 0, sizeof(int)*mNumSubSkills);\r
-                               break;\r
-                       }\r
-               }\r
-\r
-               if(Idx >= 5)\r
-               {\r
-                       mSubSkills[Idx-5] = atoi(i->c_str());\r
-                       if(!GameDefs->SubSkills()->GetDef(mSubSkills[Idx-5]))\r
-                       {\r
-                               Console->Print("Skill def error: skill %s refers to nonexistant subskill %i", mShortName.c_str(), mSubSkills[Idx-5]);\r
-                               return false;\r
-                       }\r
-               }\r
-       }\r
-\r
-       if(Idx-5 != mNumSubSkills)\r
-       {\r
-               Console->Print("Warning: skill %s has incorrect number of subskills", mShortName.c_str());\r
-               Console->Print("  Expected %i, available %i", mNumSubSkills, Idx-5);\r
-       }\r
-       return true;\r
-}\r
diff --git a/server/src/game/def/def_subskills.cpp b/server/src/game/def/def_subskills.cpp
deleted file mode 100644 (file)
index b414d82..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        def_subskills.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-// subskill.def, names and parameters of all subskills\r
-\r
-PDefSubSkill::PDefSubSkill()\r
-{\r
-       mActionModifiers = 0;\r
-       mNumActionModifiers = 0;\r
-}\r
-\r
-PDefSubSkill::~PDefSubSkill()\r
-{\r
-       delete [] mActionModifiers;\r
-}\r
-\r
-bool PDefSubSkill::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0 :        // setentry\r
-                               continue;\r
-\r
-                       case 1 :\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-                       case 2 :\r
-                               mName = *i; break;\r
-\r
-                       case 3 :\r
-                               mShortName = *i; break;\r
-\r
-                       case 4 :\r
-                               mStrengthenFactor = static_cast<float>(atof(i->c_str())); break;\r
-\r
-                       case 5 :\r
-                       {\r
-                               mNumActionModifiers = atoi(i->c_str());\r
-                               mActionModifiers = new int[mNumActionModifiers];\r
-                               std::memset(mActionModifiers, 0, sizeof(int)*mNumActionModifiers);\r
-                               break;\r
-                       }\r
-               }\r
-\r
-               if(Idx>=6)\r
-                       mActionModifiers[Idx-6] = atoi(i->c_str());\r
-       }\r
-\r
-       return true;\r
-}\r
-\r
diff --git a/server/src/game/def/def_vehicles.cpp b/server/src/game/def/def_vehicles.cpp
deleted file mode 100644 (file)
index ac21e2a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem 
-*/
-
-
-#include "main.h"
-
-#include "include/def_vehicles.h"
-
-
-PDefVhc::PDefVhc()
-{
-    mNumSeats = mArmor = mHealth = mModel = 0;
-    mName = "undefined";
-    for(int i=0; i<8; ++i)
-      mSeatId[i] = -1;
-}
-
-bool PDefVhc::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-        mModel = atoi( i->c_str() ); break;
-      case 3 :
-        mName = *i; break;
-      case 34 :
-        mHealth = atoi( i->c_str() ); break;
-      case 35 :
-        mArmor = atoi( i->c_str() ); break;
-      default :
-        if( (Idx >= 16) && (Idx <= 23) )
-        {
-          mSeatId[Idx - 16] = atoi( i->c_str() );
-          if(mSeatId[Idx - 16] >= 0) // In theroy, we should check that it is a valid VhcSeat Index
-            ++mNumSeats;
-        }
-        break;
-    }
-
-    if ( Idx >= 36 )
-      break;
-  }
-
-  return ((Idx >= 35));
-}
diff --git a/server/src/game/def/def_weather.cpp b/server/src/game/def/def_weather.cpp
deleted file mode 100644 (file)
index eff7858..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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
-
-       CREATED: 04 Apr 2009 Hammag
-
-       MODIFIED: 10 Jun 2009 Akiko
-       REASON: - adjusted includes for new buildsystem
-*/
-
-
-#include "main.h"
-
-#include "include/def_weather.h"
-
-
-PDefWeather::PDefWeather()
-{
-  mNumWeathers = mSectionId = 0;
-  for(int i=0; i<8; ++i)
-      mDuration[i] = mWeatherId[i] = 0;
-}
-
-bool PDefWeather::LoadFromDef( PTokenList *Tokens )
-{
-  int Idx = 0;
-  for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ )
-  {
-    switch ( Idx )
-    {
-      case 0 : // setentry
-        break;
-      case 1 :
-        mIndex = atoi( i->c_str() ); break;
-      case 2 :
-        mSectionId = atoi( i->c_str() ); break;
-      case 3 :
-        mNumWeathers = atoi( i->c_str() ); break;
-      default :
-        if( (Idx >= 4) && (Idx <= (3 + 2*mNumWeathers))  && (Idx <= 19) )
-        {
-          if(Idx & 1)
-          {
-            mDuration[int((Idx - 4)/2)] = atoi( i->c_str() );
-          }
-          else
-          {
-            mWeatherId[int((Idx - 4)/2)] = atoi( i->c_str() );
-          }
-        }
-        break;
-    }
-
-    if ( Idx >= 19 )
-      break;
-  }
-
-  return ((Idx >= (3 + 2*mNumWeathers)));
-}
diff --git a/server/src/game/def/def_worldmodels.cpp b/server/src/game/def/def_worldmodels.cpp
deleted file mode 100644 (file)
index f5de348..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-       def_WorldModels.cpp\r
-\r
-       Created: 21 Sep 2006 Hammag\r
-       REASON: -\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PDefWorldModel::PDefWorldModel()\r
-{\r
-}\r
-\r
-bool PDefWorldModel::LoadFromDef(PTokenList *Tokens)\r
-{\r
-       int Idx=0;\r
-       for(PTokenList::iterator i=Tokens->begin(); i!=Tokens->end(); i++, Idx++)\r
-       {\r
-               switch(Idx)\r
-               {\r
-                       case 0: // setentry\r
-                                       continue;\r
-\r
-                       case 1: // index\r
-                               mIndex = atoi(i->c_str()); break;\r
-\r
-                       case 2: // name\r
-                               mName = *i; break;\r
-\r
-                       case 3: // use flag\r
-                               mUseFlags = atoi(i->c_str()); break;\r
-                               \r
-                       case 4: // function type\r
-                               mFunctionType = atoi(i->c_str()); break;\r
-\r
-                       case 5: // function value\r
-                               mFunctionValue = atoi(i->c_str()); break;\r
-                                 \r
-                       case 6: // hack difficulty\r
-                               mHackDifficulty = atoi(i->c_str()); break;\r
-\r
-                       case 7: // hack penalty\r
-                               mHackPenalty = atoi(i->c_str()); break;\r
-               }\r
-       }\r
-\r
-       return true;\r
-}\r
diff --git a/server/src/game/def/defparser.cpp b/server/src/game/def/defparser.cpp
deleted file mode 100644 (file)
index b1288a3..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        defparser.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PDefParser::PDefParser()\r
-{\r
-}\r
-\r
-PDefParser::~PDefParser()\r
-{\r
-       for(PDefTokenList::iterator i=mTokens.begin(); i!=mTokens.end(); i++)\r
-               delete *i;\r
-}\r
-\r
-bool PDefParser::Parse(const char *File)\r
-{\r
-       PFile *f = Filesystem->Open("", File, Config->GetOption("nc_data_path"));\r
-       enum { NOPE, MAYBE, LINE, BLOCK, MAYBE_END } Comment = NOPE;\r
-\r
-       if(f)\r
-       {\r
-               while(!f->Eof())\r
-               {\r
-                       std::string Str = f->ReadString();\r
-                       int Len = Str.length();\r
-                       if(Len <= 0)\r
-                               continue;\r
-\r
-                       if(Str.substr(0, 3)!="set")\r
-                               continue;\r
-\r
-                       //Console->Print("%s", Str.c_str());//NEW was commented , just to be sure of what we are reading\r
-\r
-                       PTokenList *List = new PTokenList();\r
-                       int Start=0, Tokens=0;\r
-                       bool Quote=false;\r
-                       for(int i=0; i<Len; i++)\r
-                       {\r
-                               if(Str[i]=='\r' || Str[i]=='\n' || Str[i]=='|' || Str[i]==';')\r
-                               {\r
-                                       if(Comment < LINE)\r
-                                       {\r
-                                               int End=i-1;\r
-                                               if(End >= Start)\r
-                                               {\r
-                                                       List->push_back(std::string(Str.substr(Start, (End-Start)+1)));\r
-                                                       Tokens++;\r
-                                                       break;\r
-                                               }\r
-                                               Quote=false;\r
-                                       }\r
-                                       if(Comment != BLOCK)\r
-                                               Comment=NOPE;\r
-                                       break;\r
-                               }\r
-\r
-                               if(!Quote)\r
-                               {\r
-                                       if(Comment < LINE && (Str[i]=='\t' || Str[i]==',' || Str[i]==' ' || Str[i]==';' || Str[i]=='|' || i==Len-1))\r
-                                       {\r
-                                               int End=i-1;\r
-                                               if(End >= Start)\r
-                                               {\r
-                                                       List->push_back(std::string(Str.substr(Start, (End-Start)+1)));\r
-                                                       Tokens++;\r
-                                               }\r
-                                               Start=i+1;\r
-                                       }\r
-\r
-                                       if(Str[i] <= ' ')\r
-                                               continue;\r
-\r
-                                       if(Str[i]=='*')\r
-                                       {\r
-                                               if(Comment==MAYBE)\r
-                                                       Comment=BLOCK;\r
-                                               else\r
-                                               if(Comment==BLOCK)\r
-                                                       Comment=MAYBE_END;\r
-                                       } else\r
-                                       if(Str[i]=='/')\r
-                                       {\r
-                                               if(Comment==MAYBE)\r
-                                               {\r
-                                                       // second slash, skip rest of line\r
-                                                       Comment=LINE;\r
-                                                       break;\r
-                                               } else\r
-                                               if(Comment==MAYBE_END)\r
-                                               {\r
-                                                       Comment=NOPE;   // comment block ends\r
-                                                       Start=i+1;\r
-                                               } else\r
-                                                       if(Comment != BLOCK)\r
-                                                               Comment=MAYBE;  // first slash\r
-                                       } else\r
-                                       {\r
-                                               if(Comment==MAYBE)\r
-                                                       Comment=NOPE;   // stand-alone slash\r
-                                               else\r
-                                               if(Comment==MAYBE_END)\r
-                                                       Comment=BLOCK;  // comment block did not end\r
-                                       }\r
-                               }\r
-\r
-                               if(Str[i]=='"')\r
-                                       Quote ^= true;\r
-                       }\r
-\r
-                       if(Tokens > 0)\r
-                               mTokens.push_back(List);\r
-                       else\r
-                               delete List;\r
-               }\r
-       } else\r
-       {\r
-               Console->Print("%s PDefParser::Parse: could not open file %s", Console->ColorText( RED, BLACK, "[ERROR]" ), File);\r
-               return false;\r
-       }\r
-\r
-       return true;\r
-}\r
diff --git a/server/src/game/def/main.h b/server/src/game/def/main.h
deleted file mode 100644 (file)
index d70e4f9..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       main.h - main include file, contains all needed includes and important definitions\r
-\r
-       MODIFIED: 30 Aug 2006 Hammag\r
-       REASON: - created       \r
-       MODIFIED: 21 Sep 2006 Hammag\r
-       REASON: - added def_worldmodels related stuff   \r
-       MODIFIED: 22 Sep 2006 Hammag\r
-       REASON: - added def_appartements related stuff\r
-               - added def_appplaces related stuff\r
-               - added def_respawn related stuff\r
-       MODIFIED: 28 Sep 2006 Hammag\r
-       REASON: - added def_worldfile (worlds.ini) related stuff                  \r
-       MODIFIED: 10 Jun 2009 Akiko     \r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#ifndef MAIN_H\r
-#define MAIN_H\r
-\r
-//#include "version.h"\r
-\r
-//basic includes\r
-#include "include/external.h"\r
-\r
-//tinns includes\r
-#include "include/types.h"\r
-#include "common/config.h"\r
-\r
-#include "common/console.h"\r
-#include "common/misc.h"\r
-\r
-#include "include/globals.h"\r
-\r
-#include "common/filesystem.h"\r
-#include "include/defparser.h"\r
-#include "include/defs.h"\r
-\r
-\r
-// The following defines are NOT used anymore\r
-#define DEF_CHARACTERS "defs/characters.def"\r
-#define DEF_SKILLS "defs/skills.def"\r
-#define DEF_SUBSKILLS "defs/subskill.def"\r
-#define DEF_CHARKINDS "defs/charkinds.def"\r
-#define DEF_WORLDINFO "defs/worldinfo.def"\r
-#define DEF_FRACTIONS "defs/fractions.def"\r
-#define DEF_HACK "defs/hack.def"\r
-#define DEF_ITEMS "defs/items.def"\r
-#define DEF_WORLDMODEL "defs/worldmodel.def"\r
-#define DEF_APPPLACES "defs/appplaces.def"\r
-#define DEF_APPARTEMENTS "defs/appartements.def"\r
-#define DEF_RESPAWN "defs/respawn.def"\r
-#define DEF_WEAPONS "defs/weapons.def"\r
-#define DEF_AMMO "defs/ammo.def"\r
-#define DEF_BLUEPRINTPIECES "defs/blueprintpieces.def"\r
-#define DEF_DAMMAGE "defs/dammage.def"\r
-#define DEF_DRUGS "defs/drugs.def"\r
-#define DEF_IMPLANTS "defs/implants.def"\r
-#define DEF_ITEMMOD "defs/itemmod.def"\r
-#define DEF_ITEMRES "defs/itemres.def"\r
-#define DEF_NPC "defs/npc.def"\r
-#define DEF_NPCARMOR "defs/npcarmor.def"\r
-#define DEF_NPCGROUPSPAWN "defs/npcgroupspawn.def"\r
-#define DEF_NPCLOOT "defs/npcloot.def"\r
-#define DEF_OUTPOSTS "defs/outposts.def"\r
-#define DEF_RECYCLES "defs/recycles.def"\r
-#define DEF_TRADER "defs/trader.def"\r
-#define DEF_VEHICLES "defs/vehicles.def"\r
-#define DEF_VEHICLESEATS "defs/vehiclesits.def"\r
-#define WRLD_WORLDFILE "worlds/worlds.ini"\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/def/world_datstruct.h b/server/src/game/def/world_datstruct.h
deleted file mode 100644 (file)
index d686d5d..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*\r
-   TinNS (TinNS is not a Neocron Server)\r
-   Copyright (C) 2005 Linux Addicted Community\r
-   maintainer Akiko <akiko@gmx.org>\r
-\r
-   This program is free software; you can redistribute it and/or\r
-   modify it under the terms of the GNU General Public License\r
-   as published by the Free Software Foundation; either version 2\r
-   of the License, or (at your option) any later version.\r
-\r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-   GNU General Public License for more details.\r
-\r
-   You should have received a copy of the GNU General Public License\r
-   along with this program; if not, write to the Free Software\r
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-   02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-   world_datstruct.h\r
-   .dat world files internal structures\r
-\r
-   MODIFIED: 29 Sep 2006 Hammag\r
-   REASON: - Creation\r
-*/\r
-\r
-#ifndef WORLD_DATSTRUCT_H\r
-#define WORLD_DATSTRUCT_H\r
-\r
-struct PWorldFileHeader\r
-{\r
-    u32 mHeaderSize; // must be 08 00 00 00, = header size after this field\r
-    u32 mHeaderSig; // must be CF CF 0F 00\r
-    u32 mSection; // must be 01 00 00 00\r
-};\r
-\r
-struct PSectionHeader\r
-{\r
-    u32 mHeaderSize; // must be 0C 00 00 00\r
-    u32 mHeaderSig; // must be CF FF 00 00\r
-    u32 mSection; // 00 00 00 00 means end\r
-    u32 mDataSize;\r
-};\r
-\r
-struct PSec2ElemHeader\r
-{\r
-    u32 mHeaderSize; // must be 0C 00 00 00\r
-    u32 mHeaderSig; // must be F1 FE FE 0F\r
-    u32 mElementType; // 1000003, 1000005 or 1000014\r
-    u32 mDataSize;\r
-};\r
-\r
-struct PSec2ElemType3a //static object ?\r
-{\r
-    f32 mPosY; //= u16 PosY - 32000\r
-    f32 mPosZ;\r
-    f32 mPosX;\r
-    f32 mRotY;\r
-    f32 mRotZ;\r
-    f32 mRotX;\r
-    f32 mScale; //00 00 80 3F ? = float(1.000000) !!! => scale factor ?????\r
-    u32 mUnknown2; //01 00 00 00 ?\r
-    u16 mModelID; // points to models.ini\r
-    u32 mUnknown3; //00 00 00 00 ?\r
-    u32 mUnknown4; //00 00 00 00 ?\r
-    u16 mWorldmodelID; // points to worldmodel.def\r
-    u16 mUnknown5; //12 00 ?\r
-    u32 mObjectID;\r
-};\r
-struct PSec2ElemType3b //this part is optional\r
-{\r
-    f32 mBoxLowerY; //Bounding box, for useflag "64 - selfconstructing colisionbox"\r
-    f32 mBoxLowerZ; // s32 or u32 ?\r
-    f32 mBoxLowerX;\r
-    f32 mBoxUpperY;\r
-    f32 mBoxUpperZ;\r
-    f32 mBoxUpperX;\r
-};\r
-\r
-struct PSec2ElemType5Start //door\r
-{\r
-    u16 mUnknown1; //18 00\r
-    u16 mUnknown1bis; //00 00 ? varies\r
-    f32 mPosY;\r
-    f32 mPosZ;\r
-    f32 mPosX;\r
-    u8 mActorStringSize; //string size with ending 0\r
-    u8 mParamStringSize; //string size with ending 0\r
-    u16 mUnknown5; //00 00 ? second byte varies\r
-    u16 mDoorID; // but what is the link with ObjectID sent in Use message (can't find the base offset .. or 0x80 for doors ???)\r
-    u16 mWorldmodelID; //door type from worldmodel.def\r
-};\r
-//Actor As String //null terminated string\r
-//Params As String //null terminated string - for DDOOR, 2nd param is the ID of the other (half)door (*)\r
-//param1 = 2 => simple lateral move ?, 3 => door frontal+lateral move (as at Typherra memorial) ?\r
-//last param = 0/1 for lateral move direction ? no ...\r
-//(*) here is the bug(?) that makes open only one half of a double door\r
-\r
-/*\r
-struct PSec2ElemType6Start //npc\r
-{\r
-  u16 mUnknown1; //20 00 ?\r
-  u16 mUnknown2; //12 00 ?\r
-  f32 mPosY;\r
-  f32 mPosZ;\r
-  f32 mPosX;\r
-  u32 mNPCTypeID; //npc type in npc.def\r
-  u8 mActorStringSize; //string size with ending 0\r
-  u8 mParamStringSize; //string size with ending 0\r
-  u16 mNpcID; // kind of ?\r
-  u32 mUnknown3; //01 00 00 00 ?\r
-  u16 mUnknown4; //00 00 ?\r
-  u16 mUnknown5; //04 00 ?\r
-};\r
-  //Actor As String //null terminated string\r
-  //Params As String //null terminated string - Seem to be the facing angle in degres\r
-struct PSec2ElemType6End\r
-{\r
-  f32 mPosY2; //second position for movement ?\r
-  f32 mPosZ2; //\r
-  f32 mPosX2; //\r
-};\r
-*/\r
-struct PSec2NPC_EntryPart1\r
-{\r
-    u32       mUnknown1; // Is always 0x20001200, in every log. maybe header for NPCs?\r
-    f32       mPosY;\r
-    f32       mPosZ;\r
-    f32       mPosX;\r
-    u32       mNPCTypeID; //npc type in npc.def\r
-    u8        mActorStringSize; //string size with ending 0\r
-    u8        mAngleStringSize; //string size with ending 0\r
-    u16       mNpcID;\r
-    u8        mHasAdditionalCoords;\r
-    u8        mUnknown2a;\r
-    u8        mUnknown2b;\r
-    u8        mUnknown2c;\r
-    u16       mTradeID; //mUnknown3; //00 00 ?\r
-    u16       mUnknown4; //04 00 ?\r
-};\r
-\r
-//    u8    mActorName[mActorStringSize];\r
-//    u8    mAngle[mAngleStringSize];\r
-\r
-struct PSec2NPC_EntryPart2  // Waypoints! or something like that...\r
-{\r
-    f32       mPosY;\r
-    f32       mPosZ;\r
-    f32       mPosX;\r
-};\r
-\r
-\r
-//  u16 mStrSize; //non-zero terminated string size\r
-//  Name As String //non-zero terminated string\r
-struct PSec2ElemType15End //area definition/sound ?\r
-{\r
-    f32 mUnknown1;\r
-    f32 mUnknown2;\r
-    f32 mUnknown3;\r
-    f32 mUnknown4;\r
-    f32 mUnknown5;\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/doortemplate.cpp b/server/src/game/doortemplate.cpp
deleted file mode 100644 (file)
index d3e5321..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-  doortemplate.cpp - world door template class\r
-\r
-       MODIFIED: 05 Nov 2006 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-       \r
-       TODO: - mem corruption occurs if mDoorParameters[] is given a size of 6, and that 6 max param can be accepted\r
-               This bug occurs in world 105. Reason not found yet :-x\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/doortemplate.h"\r
-\r
-PDoorTemplate::PDoorTemplate()\r
-{\r
-  mDoorID = 0;\r
-  mWorldmodelID = 0;\r
-  mDefWorldModel = NULL;\r
-  mIsDoubleDoor = false;\r
-  mIsTriggeredDoor = false;\r
-}\r
-\r
-PDoorTemplate::~PDoorTemplate()\r
-{\r
-  \r
-}\r
-\r
-void PDoorTemplate::SetDoorParameters(char* nDoorParametersString)\r
-{\r
-  char* SepPos;\r
-  int ParamNum = 0;\r
-//Console->Print("door parameter: %s", nDoorParametersString);\r
-  while ( *nDoorParametersString && (SepPos = strchr(nDoorParametersString, ',')) && (ParamNum < 4))\r
-  {\r
-    *SepPos = 0;\r
-    mDoorParameters[ParamNum++] = atoi(nDoorParametersString);\r
-    nDoorParametersString = SepPos + 1;\r
-  }\r
-  if (*nDoorParametersString)\r
-  {\r
-    if (ParamNum < 4)\r
-      mDoorParameters[ParamNum] = atoi(nDoorParametersString);\r
-    //else\r
-    //  Console->Print(RED, BLACK, "[ERROR] More than 4 parameters in Sec2ElemType5 ParamString");\r
-  }\r
-}\r
-\r
-void PDoorTemplate::SetDoorTypeName(char* nDoorTypeName)\r
-{\r
-  mDoorTypeName = nDoorTypeName;\r
-\r
-  if (mDoorTypeName == "DDOOR")\r
-  {\r
-    mIsDoubleDoor = true;\r
-  }\r
-  else if (mDoorTypeName == "TRIGDD")\r
-  {\r
-    mIsDoubleDoor = true;\r
-    mIsTriggeredDoor = true;\r
-  }\r
-  else if (mDoorTypeName == "TRIGDOOR")\r
-  {\r
-    mIsTriggeredDoor = true;\r
-  }\r
-  else if (mDoorTypeName == "NBUTTON")\r
-  {\r
-    mIsTriggeredDoor = false;\r
-  }\r
-}\r
diff --git a/server/src/game/furnituretemplate.cpp b/server/src/game/furnituretemplate.cpp
deleted file mode 100644 (file)
index 4525aaa..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-       furnituretemplate.cpp - world furniture template class\r
-\r
-       MODIFIED: 04 Oct 2006 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/furnituretemplate.h"\r
-\r
-PFurnitureItemTemplate::PFurnitureItemTemplate()\r
-{\r
-  mObjectID = 0;\r
-  mModelID = 0;\r
-  mWorldmodelID = 0;\r
-  mDefWorldModel = NULL;\r
-  mLinkedObjectID = 0;\r
-}\r
-\r
-PFurnitureItemTemplate::~PFurnitureItemTemplate()\r
-{\r
-  \r
-}\r
diff --git a/server/src/game/gamecommands/broadcast.cpp b/server/src/game/gamecommands/broadcast.cpp
deleted file mode 100644 (file)
index 301dcad..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdbroadcast()\r
-{\r
-    if(DumbMade == false)\r
-    {\r
-        Console->Print("%s Missing packetdumb in PCommands::doCmdbroadcast for declared broadcast function!", Console->ColorText(RED, BLACK, "[PANIC]"));\r
-        return;\r
-    }\r
-\r
-    Chat->sendBroadcast(OrgPacketDumb+11);\r
-}\r
diff --git a/server/src/game/gamecommands/color.cpp b/server/src/game/gamecommands/color.cpp
deleted file mode 100644 (file)
index 1d861f4..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdcolor()\r
-{\r
-    bool SyntaxError = false;\r
-    if(ArgC < 1)\r
-    {\r
-        SyntaxError = true;\r
-    }\r
-\r
-    if(SyntaxError == true)\r
-    {\r
-        Chat->send(source, CHAT_DIRECT, "Usage", "@color -|<head color: 0..255> [-|<torso color>]  [-|<legs color>]");\r
-        return;\r
-    }\r
-\r
-    char tmp_v1[30];\r
-    char tmp_v2[30];\r
-    char tmp_v3[30];\r
-\r
-    GetArgText(1, tmp_v1, 30);\r
-    GetArgText(2, tmp_v2, 30);\r
-    GetArgText(3, tmp_v3, 30);\r
-\r
-    u8 val1, val2, val3, val4, val5, val6;\r
-    char effStr[128];\r
-    PMessage* tmpMsg;\r
-\r
-    source->GetChar()->GetCurrentBodyColor(val1, val2, val3, val4, val5, val6);\r
-    if(tmp_v1[0] != '-')\r
-    val1 = (u8)(atoi(tmp_v1) & 0xff);\r
-    if((tmp_v2[0] != '-') && (tmp_v2[0] != '\0'))\r
-    val2 = (u8)(atoi(tmp_v2) & 0xff);\r
-    if((tmp_v3[0] != '-') && (tmp_v3[0] != '\0'))\r
-    val3 = (u8)(atoi(tmp_v3) & 0xff);\r
-    source->GetChar()->SetCurrentBodyColor(val1, val2, val3, val4, val5, val6);\r
-\r
-    tmpMsg = MsgBuilder->BuildCharHelloMsg(source);\r
-    ClientManager->UDPBroadcast(tmpMsg, source);\r
-    snprintf(effStr, 127, "Body color set to values %d %d %d", val1, val2, val3);\r
-    effStr[127] = '\0';\r
-    Chat->send(source, CHAT_DIRECT, "System", effStr);\r
-}\r
diff --git a/server/src/game/gamecommands/effect.cpp b/server/src/game/gamecommands/effect.cpp
deleted file mode 100644 (file)
index 8f602c6..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdeffect()\r
-{\r
-    bool SyntaxError = false;\r
-    if(ArgC < 1)\r
-    {\r
-        SyntaxError = true;\r
-    }\r
-\r
-    if(IsArgNumeric(1) == false)\r
-        SyntaxError = true;\r
-\r
-    if(SyntaxError == true)\r
-    {\r
-        Chat->send(source, CHAT_DIRECT, "Usage", "@effect <effect: 0=none, 1 .. 17> [<density: 0=max .. 255=min>]");\r
-        return;\r
-    }\r
-\r
-    u8 val1, val2;\r
-    char effStr[128];\r
-    PMessage* tmpMsg;\r
-\r
-    val1 = (u8)(GetArgInt(1) & 0xff);\r
-    val2 = (u8)(GetArgInt(2) & 0xff);\r
-\r
-    source->GetChar()->SetBodyEffect(val1, val2);\r
-\r
-    tmpMsg = MsgBuilder->BuildCharHelloMsg(source);\r
-    ClientManager->UDPBroadcast(tmpMsg, source);\r
-    snprintf(effStr, 127, "Body effect set to value %d with density %d (but you can see it yourself)", val1, val2);\r
-    effStr[127] = '\0';\r
-    Chat->send(source, CHAT_DIRECT, "System", effStr);\r
-}\r
diff --git a/server/src/game/gamecommands/listbans.cpp b/server/src/game/gamecommands/listbans.cpp
deleted file mode 100644 (file)
index e82f97f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdlistbans()\r
-{\r
-    Chat->send(source, CHAT_DIRECT, "System", "Sorry, namikon was too lazy to code that ^^");\r
-    Chat->send(source, CHAT_DIRECT, "System", "Please wait until the ban is removed automaticly or edit your sqlDB");\r
-    return;\r
-}\r
diff --git a/server/src/game/gamecommands/main.h b/server/src/game/gamecommands/main.h
deleted file mode 100644 (file)
index 349dce9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       main.h - main include file, contains all needed includes and important definitions\r
-\r
-       MODIFIED: 30 Aug 2006 Hammag\r
-       REASON: - created\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#ifndef MAIN_H\r
-#define MAIN_H\r
-\r
-//#include "version.h"\r
-\r
-//basic includes\r
-#include "include/external.h"\r
-\r
-//tinns includes\r
-#include "include/types.h"\r
-#include "common/config.h"\r
-\r
-#include "common/console.h"\r
-#include "common/misc.h"\r
-\r
-#include "common/netcode.h"\r
-\r
-#include "include/globals.h"\r
-\r
-/*\r
-#include "../gamemonkey/gmMachine.h"\r
-#include "../gamemonkey/gmCall.h"\r
-*/\r
-\r
-// MySQL Support // shouldn't be needed as DB-objects access class should do that\r
-#ifdef MYSQL_INC_DIR\r
-#include <mysql/mysql.h>\r
-#else\r
-#include <mysql.h>\r
-#endif\r
-\r
-#include "include/sql.h"\r
-\r
-#include "common/filesystem.h"\r
-#include "include/defparser.h"\r
-\r
-#include "include/skill.h"\r
-\r
-#include "include/chars.h"\r
-#include "include/accounts.h"\r
-#include "include/defs.h"\r
-#include "include/client.h"\r
-#include "include/server.h"\r
-#include "include/gameserver.h"\r
-#include "include/zoning.h"\r
-#include "include/item.h"\r
-#include "include/inventory.h"\r
-\r
-#include "include/chat.h"\r
-#include "include/commands.h"\r
-#include "include/clientmanager.h"\r
-#include "include/msgbuilder.h"\r
-#include "include/worlds.h"\r
-#include "include/worldactors.h"\r
-#include "include/npc.h"\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/gamecommands/online.cpp b/server/src/game/gamecommands/online.cpp
deleted file mode 100644 (file)
index a7080cb..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdconlist()\r
-{\r
-    if (gDevDebug) Console->Print("IngameCommand: Sending connected-player-list to charID %d", source->GetCharID());\r
-    Chat->sendConnectedList(source, false);\r
-}\r
diff --git a/server/src/game/gamecommands/settime.cpp b/server/src/game/gamecommands/settime.cpp
deleted file mode 100644 (file)
index 4d67ed8..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdsettime()\r
-{\r
-    if(ArgC < 1 && GetArgInt(1) == 0)\r
-    {\r
-       Chat->send(source, CHAT_DIRECT, "Usage", "@settime <raw timevalue>");\r
-       return;\r
-    }\r
-\r
-    int newtime = 0;\r
-    newtime = GetArgInt(1);\r
-\r
-    GameServer->SetGameTime(newtime);\r
-    Console->Print("IngameCommand: CharID %d set ingametime to %d", source->GetCharID(), newtime);\r
-}\r
diff --git a/server/src/game/gamecommands/speed.cpp b/server/src/game/gamecommands/speed.cpp
deleted file mode 100644 (file)
index a3a4e58..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdspeed()\r
-{\r
-// Speed override setting.\r
-// Usage: @speed <newspeed> | #\r
-//  with <speed> = 0 (no move).. 254 , 255 or # meaning "no speed override"\r
-\r
-    bool SyntaxError = false;\r
-    if(ArgC < 1)\r
-    {\r
-        SyntaxError = true;\r
-    }\r
-\r
-    if(SyntaxError == true)\r
-    {\r
-        Chat->send(source, CHAT_DIRECT, "Usage", "@speed <newspeed: 0 .. 254 > | 255 | #");\r
-        return;\r
-    }\r
-    char tmpval[30];\r
-    GetArgText(1, tmpval, 30);\r
-\r
-    u8 val1;\r
-    char effStr[128];\r
-    PMessage* tmpMsg;\r
-\r
-    val1 = ((tmpval[0] == '#') ? 255 : (u8)(atoi(tmpval) & 0xff));\r
-    source->GetChar()->SetSpeedOverride(val1);\r
-\r
-    tmpMsg = MsgBuilder->BuildCharHelloMsg(source);\r
-    ClientManager->UDPBroadcast(tmpMsg, source);\r
-    snprintf(effStr, 127, "Speed override set to value %d ", val1);\r
-    effStr[127] = '\0';\r
-    Chat->send(source, CHAT_DIRECT, "System", effStr);\r
-}\r
diff --git a/server/src/game/gamecommands/unban.cpp b/server/src/game/gamecommands/unban.cpp
deleted file mode 100644 (file)
index ce0a0b0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdunban()\r
-{\r
-    Chat->send(source, CHAT_DIRECT, "System", "Unban is not yet possible, sorry.");\r
-}\r
diff --git a/server/src/game/gamecommands/v.cpp b/server/src/game/gamecommands/v.cpp
deleted file mode 100644 (file)
index 0e8c8e7..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmd_dev_v()\r
-{\r
-    if(IsAdmin() == false)\r
-      return;\r
-    \r
-    char Arg1[30];\r
-\r
-    Arg1[0] = '\0';\r
-\r
-    if(ArgC > 0)\r
-    {\r
-        GetArgText(1, Arg1, 30);\r
-    }\r
-\r
-    char tmpStr[128];\r
-    int testmode = 1; // change here only for u8/u16/u32 testvalue use\r
-\r
-    if(Arg1[0] != '\0')\r
-    {\r
-        switch(testmode)\r
-        {\r
-            case 0: source->testval8 = (u8)(atoi(Arg1) & 0xff); break;\r
-            case 1: source->testval16 = (u16)(atoi(Arg1) & 0xffff); break;\r
-            case 2: source->testval32 = (u32)(atoi(Arg1) & 0xffffffff); break;\r
-        }\r
-    }\r
-    else\r
-    {\r
-        source->testval8 = 0;\r
-        source->testval16 = 0;\r
-        source->testval32 = 0;\r
-    }\r
-\r
-    switch(testmode)\r
-    {\r
-        case 0: snprintf(tmpStr, 127, "Test value u8 set to 0x%02x (%d)", source->testval8, source->testval8); break;\r
-        case 1: snprintf(tmpStr, 127, "Test value u16 set to 0x%04x (%d)", source->testval16, source->testval16); break;\r
-        case 2: snprintf(tmpStr, 127, "Test value u32 set to 0x%08x (%d)", source->testval32, source->testval32); break;\r
-        default: tmpStr[0] = '\0';\r
-    }\r
-    tmpStr[127] = '\0';\r
-    Chat->send(source, CHAT_DIRECT, "System", tmpStr);\r
-\r
-}\r
diff --git a/server/src/game/gamecommands/version.cpp b/server/src/game/gamecommands/version.cpp
deleted file mode 100644 (file)
index 104f172..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-#include "main.h"\r
-\r
-void PCommands::doCmdversion()\r
-{\r
-    char tmpChatMsg[300];\r
-    snprintf(tmpChatMsg, 299, "You are on TinNS server %s runnig version %s - SVN Rev. %s", Config->GetOption("server_name").c_str(), ServerVersion, SVNRevision);\r
-    tmpChatMsg[299] = '\0';\r
-\r
-    Chat->send(source, CHAT_DIRECT, "System", tmpChatMsg);\r
-}\r
diff --git a/server/src/game/include/accounts.h b/server/src/game/include/accounts.h
deleted file mode 100644 (file)
index 92c3402..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       accounts.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 26 Dec 2005 Namikon\r
-       REASON: - Added load/save functions for SQL DB\r
-       MODIFIED: 01 Jan 2005 Namikon\r
-       REASON: - Added bool var for ingame debug outputs for administrators\r
-       MODIFIED: 06 Jan 2005 Namikon\r
-       REASON: - Added SetBannedStatus(<unix timestamp>) to ban/unban an account (use SetBannedStatus(0) to unban a player)\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#ifndef ACCOUNTS_H\r
-#define ACCOUNTS_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-#include "common/regex++.h"\r
-\r
-/*\r
-0 = unregistered user\r
-1 = Registered user\r
-30 = volunteer\r
-50 = GM\r
-100 = Admin\r
-*/\r
-\r
-// New way of AccountLevel handling:\r
-// Every level is possible, the following values are only edge values. We need a bit control about that\r
-#define PAL_BANNED -1\r
-#define PAL_UNREGPLAYER 0\r
-#define PAL_REGPLAYER 1\r
-#define PAL_VOLUNTEER 30 // Special Rank: 50/50\r
-#define PAL_GM 50 // Special Rank: 120/120\r
-#define PAL_ADMIN 100 // Special Rank: 127/127\r
-\r
-// Max number of char slots per account\r
-#define MAX_CHARS_PER_ACCOUNT  4\r
-\r
-/*\r
-0 = Offline\r
-1 = Online\r
-2 = Banned\r
-*/\r
-\r
-enum PAccountStatus\r
-{\r
-    PAS_OFFLINE = 0,\r
-    PAS_ONLINE = 1,\r
-    PAS_BANNED = 2\r
-};\r
-  \r
-class PAccount\r
-{\r
-       private :\r
-    // SQL Layout\r
-    enum {\r
-        a_id,\r
-        a_username,\r
-        a_password,\r
-        a_priv,\r
-        a_status,\r
-        a_bandate\r
-    };\r
-    \r
-    // static members\r
-         static RegEx* mUsernameRegexFilter;\r
-         static RegEx* mPasswordRegexFilter;\r
-         \r
-         // instance members\r
-         u32 mID;\r
-         std::string mName;\r
-         std::string mPassword;\r
-    int mLevel;\r
-    PAccountStatus mStatus;\r
-    std::time_t mBannedUntil;\r
-\r
-    bool LoadFromQuery(char* query);\r
-    bool DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key, char* ClearPassword);\r
-    \r
-       public :\r
-         PAccount();\r
-         PAccount(const u32 AccountId);\r
-         PAccount(const char *Username);\r
-         \r
-         static bool SetUsernameRegexFilter(const char* RegexStr);\r
-               static bool SetPasswordRegexFilter(const char* RegexStr);\r
-               static bool IsUsernameWellFormed(const char *Username);\r
-               static bool IsPasswordWellFormed(const char *Password);\r
-               \r
-               inline u32 GetID() const { return mID; }\r
-               bool SetName(const std::string &Pass);\r
-               inline const std::string &GetName() const { return mName; }\r
-               bool SetPassword(const std::string &Pass);\r
-               bool SetPasswordEncoded(const u8* PasswordData, int PassLen, const u8 *Key);\r
-               inline const std::string &GetPassword() const { return mPassword; }\r
-    bool SetLevel(int newLevel);\r
-               inline int GetLevel() const { return mLevel; }\r
-               std::string GetLevelString() const;\r
-    bool SetStatus(PAccountStatus Status);\r
-               inline PAccountStatus GetStatus() const { return mStatus; }\r
-               bool SetBannedUntilTime(std::time_t BannedUntil);\r
-    inline bool IsBanned() const { return (mBannedUntil > std::time(NULL)); }\r
-    std::string GetBannedTime() const;\r
-\r
-               bool Authenticate(const u8* PasswordData, int PassLen, const u8 *Key);\r
-               bool Authenticate(const char *Password) const;\r
-                   \r
-               bool Create();\r
-    bool Save(bool CreateMode = false);\r
-\r
-    u32 GetCharIdBySlot(const u32 SlotId);\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/appartements.h b/server/src/game/include/appartements.h
deleted file mode 100644 (file)
index 7978c5d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-  appartements.h - appartements class\r
-\r
-       MODIFIED: 20 Nov 2006 Hammag\r
-       REASON: - creation\r
-       \r
-*/\r
-\r
-#ifndef APPARTEMENTS_H\r
-#define APPARTEMENTS_H\r
-\r
-class PChar;\r
-\r
-class PAppartements\r
-{\r
-  private:\r
-    \r
-  public:\r
-    PAppartements();\r
-    //~PAppartements();\r
-    \r
-    u32 CreateBaseAppartement(u32 nCharID, std::string nPassword, u8 nFactionID);\r
-    void DeleteCharAppartements(u32 nCharID);\r
-    bool CanFreelyEnter(PChar* nChar, u32 nLocation);\r
-    int GetAptID(unsigned int AptLoc, const u8 *pass);\r
-    int GetAptType(int AptID);\r
-    int GetAptOwner(int loc);\r
-    int GetAptLocation(int loc);\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/buddylist.h b/server/src/game/include/buddylist.h
deleted file mode 100644 (file)
index 5a1f464..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-  buddylist.h - classe for chat buddylist\r
-\r
-       MODIFIED: 19 Sep 2006 Hammag\r
-       REASON: - creation\r
-\r
-*/\r
-\r
-#ifndef BUDDYLIST_H\r
-#define BUDDYLIST_H\r
-\r
-#define BUDDYLIST_ALLOC_SIZE 4 // atomicity of list entries allocation\r
-\r
-class PBuddyList\r
-{\r
-  private:\r
-    enum { // buddy_list DB Table fields\r
-        bud_id = 0,\r
-        bud_charid,\r
-        bud_buddyid\r
-    };\r
-\r
-    u32 mOwnerCharID;\r
-    u8 mListMaxSize;\r
-    u8 mListSize;\r
-    u32* mCharIDList;\r
-\r
-    void IncreaseMaxSize(u8 nNewMax = 0);\r
-    u8 FindEntry(u32 CharID);\r
-\r
-  public:\r
-    PBuddyList(u32 nOwnerCharID);\r
-    ~PBuddyList();\r
-    bool AddChar(u32 nBuddyCharID);\r
-    bool RemoveChar(u32 nBuddyCharID);\r
-    inline u8 Count() { return mListSize; }\r
-    u16 GetListDataSize() { return (sizeof(u32) * mListSize); }\r
-    const void* GetListData() { return (const void*)mCharIDList; }\r
-    bool SQLLoad();\r
-\r
-    bool IsInBuddy(u32 CharID);\r
-//    bool SQLSave();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/chars.h b/server/src/game/include/chars.h
deleted file mode 100644 (file)
index e3e42d5..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       chars.h - this is the main file with the main function\r
-\r
-       Authors:\r
-       - Namikon\r
-       - Akiko\r
-\r
-       MODIFIED: 22 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 01 Jan 2006 Namikon\r
-       REASON: - Added SQLLoad() function to PChar and PChars\r
-               - Added enum for charlist SQL Database\r
-               - Added IsOnline var and inline func for Onlinestatus of char\r
-       MODIFIED: 26 Jul 2006 Namikon\r
-       REASON: - Added Health/MaxHealth, idem for Mana & Stamin\r
-       TODO:   - fix real current Health vs MaxHealth, also in char load/save\r
-\r
-       MODIFIED: 03 Oct 2006 Hammag\r
-       REASON: - PChar::CreateNewChar() and moved effective char creation from PChars to PChar\r
-               - added PChar::SQLDelete()\r
-                 This method is put here because we want the char to be loaded when deleted from DB to avoid\r
-                 any player to use it at the same time.\r
-               - added use of auto_save_period config option in PChars::update()\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new build system\r
-               - clean ups\r
-*/\r
-\r
-#ifndef CHARS_H\r
-#define CHARS_H\r
-\r
-#ifdef _MSC_VER\r
-#pragma once\r
-#endif\r
-\r
-#define MAXCASH 1000000000\r
-\r
-#include "inventory.h"\r
-#include "buddylist.h"\r
-#include "genreplist.h"\r
-#include "common/regex++.h"\r
-class PVhcAccessRequestList;\r
-\r
-enum PSeatType\r
-{\r
-  seat_none = 0,\r
-  seat_chair,\r
-  seat_subway,\r
-  seat_vhc\r
-};\r
-\r
-class PCharCoordinates\r
-{\r
-  public:\r
-    u16 mY;     // Y-Position in world // Y increases when going East\r
-    u16 mZ;     // Z-Position in world // Z increases when going up\r
-    u16 mX;     // X-Position in world // X increases when going South\r
-    u8 mUD;     // Up - Mid - Down (d6 - 80 - 2a)\r
-    u8 mLR;     // Compass direction (S..E..N..W..S [0-45-90-135-179])\r
-    u8 mAct;    // Last user action state\r
-    u8 mUnknown;// sometime sent by client with value != 0 (usual case)\r
-    // mAct:\r
-    // 0x00 NC has no focus (player alt+tab'ed out)\r
-    // 0x04 Char on ground/dead   00000100\r
-    // 0x20 Char does nothing     00100000\r
-    // 0x22 kneeing               00100010\r
-    // 0x28 left step             00101000\r
-    // 0x30 right step            00110000\r
-    // 0x40 walking (not running) 01000000 // Seems to mean Running ? - to be verfied, with default walk/run mode !!!\r
-    // 0x60 forward               01100000\r
-    // 0xA0 backward              10100000\r
-    // bits:                      BFWRL.K.\r
-\r
-    u8 mJumpingState;\r
-\r
-    //inline PCharCoordinates() { mX = mY = mZ = mUD = mLR = mAct = mUnknown = mJumpingState = 0;}\r
-    void SetPosition( u16 nY, u16 nZ, u16 nX, u8 nUD = 0x80, u8 nLR = 0 );\r
-    void SetInterpolate( PCharCoordinates& Pos1, PCharCoordinates& Pos2, f32 nCoef );\r
-    \r
-    //Temp\r
-    u16 minPos[3];\r
-    u16 maxPos[3];\r
-    inline PCharCoordinates() { mX = mY = mZ = mUD = mLR = mAct = mUnknown = mJumpingState = 0; for(int i=0; i<3; ++i) { minPos[i] = 0xffff; maxPos[i] = 0; } }\r
-};\r
-\r
-class PChar\r
-{\r
-  private :\r
-    // static members\r
-    static RegEx* mCharnameRegexFilter;\r
-\r
-    // instance members\r
-    u32 mID;\r
-    u32 mAccount;\r
-    u8 mSlot;\r
-    std::string mName;\r
-    u32 mGender;\r
-    u32 mClass;\r
-    //u32 mType; // Removed that and only keep GetType()\r
-    u32 mProfession;\r
-    u32 mFaction;\r
-    u32 mRealHead;  // Base Skin elements, in complement of (computed) mType\r
-    u32 mRealTorso; // " Head shouldn't be changeable, except in case of surgery !!!\r
-    u32 mRealLegs;  // "\r
-    u32 mSkin;  // Current Skin elements. *** Not saved in DB atm ***\r
-    u32 mHead;  // "\r
-    u32 mTorso; // "\r
-    u32 mLegs;  // "\r
-    u8 mHeadColor;  // "\r
-    u8 mTorsoColor; // "\r
-    u8 mLegsColor;  // "\r
-    u8 mHeadDarkness;  // " // 0=Bright, 255=dark\r
-    u8 mTorsoDarkness; // "\r
-    u8 mLegsDarkness;  // "\r
-    // Skin scale factor setting remain to discover, provided they are somewhere for player chars ...\r
-\r
-    bool mLocationLeased; // temp until char on-demand load/unload\r
-    u32 mLocation;\r
-    u32 mCash;\r
-    u32 mStartApt; // set same as PrimaryApt atm\r
-    u32 mPrimaryApt;\r
-\r
-    // not saved in DB atm\r
-    PSeatType mSeatInUseType;\r
-    u32 mSeatInUseObjectId;\r
-    u8 mSeatInUseSeatId;\r
-    PVhcAccessRequestList* mVhcAccessRequestList;\r
-\r
-    PContainer* mContainerInExclusiveUse;\r
-\r
-    u16 mHealth;\r
-    u16 mMana;\r
-    u16 mStamina;\r
-\r
-    s8 mSoullight;\r
-    u8 mCombatRank; // *** Not got/saved from DB atm ***\r
-    u8 mSynaptic; // *** Not got/saved from DB atm ***\r
-    bool mIsDead; // *** Not got/saved from DB atm ***\r
-\r
-    // Only one body effect supported atm. Should be extended later to multiple effects\r
-    u8 mBodyEffect; // *** Not got/saved from DB atm ***\r
-    u8 mBodyEffectDensity; // *** Not got/saved from DB atm ***\r
-\r
-    u8 mSpeedOverride; // a hack to control move speed. Not saved in DB\r
-\r
-    u32 mDirectCharID; // for Direct Chat // *** Not got/saved from DB atm ***\r
-    PBuddyList* mBuddyList; // For Buddy list Chat\r
-    u32 mActiveChatChannels; // Active chat channels flags // *** Not got/saved from DB atm ***\r
-\r
-    PGenrepList* mGenrepList; // Character's GR list\r
-\r
-    u8 mQuickBeltActiveSlot; // QB SlotID of item "in hand", or INV_WORN_QB_HAND or INV_WORN_QB_NONE\r
-\r
-    u16 mLookingAt;  // Zone charID of currently targeted player\r
-    std::time_t mLookAtTimestamp; // Lifetimer of lookat var\r
-    u32 mLastUsedWorldObjectId; // Last world object clicked on\r
-\r
-    u8 mClanLevel; // 1-15\r
-    u16 mClanID;\r
-\r
-    bool mIsOnline;\r
-    bool mDirtyFlag;\r
-\r
-    bool mShunned;\r
-    bool mJailed;\r
-\r
-    u32 mDialogNPC; // NPCID the player talks to\r
-    u16 mCurrentDialogNode; // Node in .lua file we're at right now\r
-\r
-    class PInventory mInventory;\r
-\r
-  protected :\r
-    friend class PChars;\r
-    inline void SetID( u32 ID ) { mID = ID; }\r
-    inline void SetAccount( u32 Account ) { mAccount = Account; }\r
-    inline void SetCharSlot( u8 Slot ) { if ( Slot < 4 ) mSlot = Slot;} // TODO: set max slot according to server config\r
-    inline void SetName( const std::string &Name ) { mName = Name; }\r
-    inline void SetGender( u32 Gender ) { mGender = Gender; }\r
-    void SetProfession( u32 Profession );\r
-    //inline void SetClass(u32 nClass) { mClass = nClass; } // mClass is defined by setting Profession\r
-    //inline void SetType(u32 Type) { mType = Type; } // Removed. Type is computed from Gender & Profession (??? is it not Gender + Class ???)\r
-    inline void SetFaction( u32 Faction ) { mFaction = Faction; }\r
-    //inline void SetModel(u32 Model) { mModel = Model; } // Inhibited for the moment. Base model is deduced from from Gender & Class (Profession)\r
-    void SetRealLook( u32 nHead, u32 nTorso, u32 nLegs );\r
-    void SetBaseSkills();\r
-    void SetBaseSubskills( u8 NZSNb, const char* NonZeroSubskills );\r
-    void SetBaseInventory();\r
-\r
-    bool SQLCreate();\r
-\r
-  public :\r
-    PChar();\r
-    ~PChar();\r
-\r
-    static bool SetCharnameRegexFilter( const char* RegexStr );\r
-    static bool IsCharnameWellFormed( const char *Username );\r
-\r
-    PSkillHandler *Skill;\r
-    PCharCoordinates Coords;\r
-\r
-    void SetCurrentLook( u32 nSkin, u32 nHead = 0, u32 nTorso = 0, u32 nLegs = 0 );\r
-    void SetCurrentLookFromCharType( u32 nType );\r
-    void ResetCurrentLook();\r
-\r
-    void SetCurrentBodyColor( u8 nHeadColor, u8 nTorsoColor, u8 nLegsColor, u8 nHeadDarkness = 0, u8 nTorsoDarkness = 0, u8 nLegsDarkness = 0 );\r
-    inline void SetBodyEffect( u8 nEffect, u8 nDensity = 0 ) { mBodyEffect = nEffect; mBodyEffectDensity = nDensity; }\r
-    inline void SetSpeedOverride( u8 nSpeed = 255 ) { mSpeedOverride = nSpeed; }\r
-\r
-    void SetLookingAt( u16 nLocalCharID );\r
-    u16 GetLookingAt( u16 nMaxDelaySec = 1 );\r
-    inline void SetLastUsedObject ( u32 nRawItemId ) { mLastUsedWorldObjectId = nRawItemId; }\r
-    inline u32 GetLastUsedObject () const { return mLastUsedWorldObjectId; }\r
-\r
-    inline PInventory* GetInventory() { return &mInventory; }\r
-    inline u32 GetID() const { return mID; }\r
-    inline u32 GetAccount() const { return mAccount; }\r
-    inline const std::string &GetName() const { return mName; }\r
-    inline u32 GetGender() const { return mGender; }\r
-    inline u32 GetClass() const { return mClass; }\r
-    inline u32 GetType() const { return 2 * mClass + mGender; }\r
-    u32 GetSkinFromCharType( u32 nType );\r
-    void GetRealLook( u32 &nSkin, u32 &nHead, u32 &nTorso, u32 &nLegs );\r
-    void GetCurrentLook( u32 &nSkin, u32 &nHead, u32 &nTorso, u32 &nLegs );\r
-    inline void GetBodyEffect( u8 &nEffect, u8 &nDensity ) { nEffect = mBodyEffect; nDensity = mBodyEffectDensity; }\r
-\r
-    inline u8 GetQuickBeltActiveSlot() { return mQuickBeltActiveSlot; }\r
-    bool SetQuickBeltActiveSlot( u8 nSlotID );\r
-\r
-    void GetCurrentBodyColor( u8 &nHeadColor, u8 &nTorsoColor, u8 &nLegsColor, u8 &nHeadDarkness, u8 &nTorsoDarkness, u8 &nLegsDarkness );\r
-    inline u8 GetSpeedOverride() { return mSpeedOverride; }\r
-    inline u32 GetBaseModel();\r
-    inline u32 GetProfession() const { return mProfession; }\r
-    inline u16 GetMaxHealth() { return mHealth; }\r
-    inline u16 GetMaxMana() { return mMana; }\r
-    inline u16 GetMaxStamina() { return mStamina; }\r
-    inline u16 GetHealth() { return mHealth; }\r
-    inline u16 GetMana() { return mMana; }\r
-    inline u16 GetStamina() { return mStamina; }\r
-    inline u32 GetFaction() const { return mFaction; }\r
-    inline u32 GetLocation() const { return mLocation; }\r
-\r
-    inline u32 GetCash() const { return mCash; }\r
-    u32 SetCash( u32 nCash );  // Does return the new cashvalue, NO udpmessage is sent out!!\r
-       u32 AddCash( u32 nAmount );\r
-       u32 TakeCash( u32 nAmount );\r
-\r
-    inline u32 GetBaseApartment() const { return mPrimaryApt; }\r
-\r
-    inline void SetJail( bool val ) { mJailed = val; };\r
-    inline void SetShun( bool val ) { mShunned = val; };\r
-\r
-    inline bool IsJailed() { return mJailed; };\r
-    inline bool IsShunned() { return mShunned; };\r
-\r
-    inline void SetDialogNPC( u32 nNPC ) { mDialogNPC = nNPC; };\r
-    inline u32 GetDialogNPC() const { return mDialogNPC; };\r
-\r
-    inline void SetDialogNode( u16 nNode ) { mCurrentDialogNode = nNode; };\r
-    inline u16 GetDialogNode() const { return mCurrentDialogNode; };\r
-\r
-    inline u8 GetClanLevel() const { return mClanLevel; };\r
-    inline u16 GetClan() const { return mClanID; };\r
-    void LoadClanLevel();\r
-\r
-    inline s8 GetSoullight() const { return mSoullight; }\r
-    u8 GetMainRank();\r
-    u8 GetCombatRank();\r
-    inline u8 GetSynaptic() const { return mSynaptic; }\r
-    inline bool IsDead() const { return mIsDead; }\r
-\r
-    inline bool SetDirectChat( u32 nBuddyCharID ) { mDirectCharID = nBuddyCharID; return true; }\r
-    inline u32 GetDirectChat() { return mDirectCharID; }\r
-    inline void SetActiveChannels( u32 nChannels ) { mActiveChatChannels = nChannels; }\r
-    inline u32 GetActiveChannels() { return mActiveChatChannels; }\r
-\r
-    inline bool AddBuddy( u32 nBuddyCharID ) { return mBuddyList->AddChar( nBuddyCharID ); }\r
-    inline bool RemoveBuddy( u32 nBuddyCharID ) { return mBuddyList->RemoveChar( nBuddyCharID ); }\r
-    inline u16 GetBuddyListDataSize() { return mBuddyList->GetListDataSize(); }\r
-    inline const void* GetBuddyListData() { return mBuddyList->GetListData(); }\r
-    inline u8 GetBuddyCount() { return mBuddyList->Count(); }\r
-    inline bool IsBuddy( u32 CharID ) { return mBuddyList->IsInBuddy( CharID ); };\r
-\r
-    inline bool AddGenrep( u16 nWorldID, u16 nStationID ) { return mGenrepList->AddGenrep( nWorldID, nStationID ); }\r
-    inline u16 GetGenrepListDataSize() { return mGenrepList->GetListDataSize(); }\r
-    inline const void* GetGenrepListData() { return mGenrepList->GetListData(); }\r
-    inline u8 GetGenrepCount() { return mGenrepList->Count(); }\r
-\r
-    inline bool IsDirty() const { return mDirtyFlag; }\r
-    inline bool IsAnyDirty() const { return mDirtyFlag || mInventory.IsDirty(); }\r
-    inline bool IsOnline() { return mIsOnline; }\r
-    void SetOnlineStatus( bool IsOnline );\r
-\r
-    bool CreateNewChar( u32 Account, const std::string &Name, u32 Gender, u32 Profession, u32 Faction,\r
-                        u32 Head, u32 Torso, u32 Legs, u8 NZSNb, const char *NonZeroSubskills, u32 Slot );\r
-    bool SQLLoad( int CharID );\r
-    bool SQLSave();\r
-    inline bool SQLSaveFull() { return SQLSave() && mInventory.SQLSave(); }\r
-    bool SQLDelete(); // not implemented yet\r
-\r
-    inline void SetLocation( u32 Location ) { mLocation = Location; }\r
-    inline void SetDirtyFlag( bool Dirty = true ) { mDirtyFlag = Dirty; }\r
-\r
-    // temp until char on-demand load/unload\r
-    inline void SetLocationLeased( bool nState = true ) { mLocationLeased = nState; }\r
-    inline bool GetLocationLeased() { return mLocationLeased; }\r
-\r
-    PSeatType GetSeatInUse( u32* nObjectId = NULL, u8* nSeatId = NULL );\r
-    void SetSeatInUse( PSeatType nSeatType, u32 nObjectId = 0, u8 nSeatId = 0 );\r
-\r
-    PVhcAccessRequestList* GetVhcAccessRequestList();\r
-\r
-    inline PContainer* GetContainerInExclusiveUse() { return mContainerInExclusiveUse; }\r
-    inline void SetContainerInExclusiveUse( PContainer* nContainer ) { mContainerInExclusiveUse = nContainer; }\r
-};\r
-\r
-struct PCharProfile\r
-{\r
-  u32 CharID;\r
-  u16 Type;\r
-  u16 Color0;\r
-  u16 Unknown1;\r
-  u8 Head;\r
-  u8 Torso;\r
-  u8 Legs;\r
-  u32 Location;\r
-  u8 NameLen;\r
-  u8 Unknown3;\r
-  u8 Unknown4;\r
-  u8 Unknown5;\r
-  u8 Unknown6;\r
-  u8 Unknown7;\r
-  u8 Unknown8;\r
-  u8 Unknown9;\r
-  u8 Unknown10;\r
-  u8 Unknown11;\r
-  u8 Unknown12;\r
-  std::string Name;\r
-  bool in_use;\r
-};\r
-\r
-class PChars\r
-{\r
-  private :\r
-    typedef std::map<u32, PChar*> CharMap;\r
-    CharMap mChars;\r
-    u32 mLastID;\r
-\r
-    std::time_t mAutoSavePeriod;\r
-    std::time_t mLastSave;\r
-\r
-  public :\r
-    PChars();\r
-    ~PChars();\r
-\r
-    bool LoadChar( u32 CharID );\r
-    bool AddChar( PChar* nChar );\r
-    PChar* RemoveChar( u32 CharID );\r
-\r
-    PChar* GetChar( u32 CharID ) const;\r
-    PChar* GetChar( const std::string &Name ) const;\r
-    bool CharExist( const std::string &Name ) const;\r
-\r
-    void SQLSave();\r
-    void Update();\r
-\r
-    int GetCharProfiles( const u32 AccountID, PCharProfile* CharSlotsArray, const u8 ArraySize ); // return effective entries nb\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/chat.h b/server/src/game/include/chat.h
deleted file mode 100644 (file)
index 80595c5..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        chat.h\r
-\r
-        Authors:\r
-        - Namikon\r
-        - bakkdoor\r
-\r
-        MODIFIED: 30 Nov 2005 Namikon/Akiko\r
-        REASON: - initial release by Namikon\r
-\r
-        MODIFIED: 11 Dec 2005 Namikon\r
-        REASON: - Added function SendDChat(Client, <text>, <nick>) to send a Direct to player\r
-                - Added Channel IDs for GameMaster (/gm) and Administrator (/admin) chat\r
-                - Added channel const's for sending chat packets\r
-                - Added function SendChat(Client, <channel>, <text>, <nick>) to send chat messages\r
-                 For <channel>, use one of the u8 constants listet below\r
-\r
-        MODIFIED: 17 Dec 2005 bakkdoor\r
-        REASON: - introduced new structure for chatsystem\r
-                - -> PChat class\r
-*/\r
-\r
-#ifndef CHAT_H\r
-#define CHAT_H\r
-#define LOCALCHAT_MAXDISTANCE 1433\r
-\r
-class PChat\r
-{\r
-    private:\r
-\r
-    public:\r
-            PChat();\r
-            ~PChat();\r
-\r
-            // INCOMING CHAT\r
-            bool HandleGameChat(PClient *Client, const u8 *Packet);\r
-            bool cmpr(const u8 *Array1, const u8 *Array2);\r
-\r
-            // this function is called by the other more specific functions and simply sends the data to the receiver-client\r
-            bool send(PClient* receiver, const u8* Channel, const char* AuthorNickName, const char* text, bool debugOut=false);\r
-\r
-            // this is for debugging and sends the current connected playerlist to the receiver-client\r
-            void sendConnectedList(PClient* receiver, bool debugOut=false);\r
-\r
-            // specific channel functions:\r
-            void sendBuddy(PClient* author, const char* text, bool debugOut=false);\r
-            void sendLocal(PClient* author, const char* text, bool debugOut=false);\r
-            void sendClan(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTeam(PClient* author, const char* text, bool debugOut=false);\r
-            void sendDirect(PClient* author, PClient* receiver, const char* text, bool debugOut=false);\r
-            void sendZone(PClient* author, const char* text, bool debugOut=false);\r
-            void sendFrak(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTradeCS(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTradeMB(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTradeNC(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTradeTH(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTradeWL(PClient* author, const char* text, bool debugOut=false);\r
-            void sendOOC(PClient* author, const char* text, bool debugOut=false);\r
-            void sendHelp(PClient* author, const char* text, bool debugOut=false);\r
-            void sendClanSearch(PClient* author, const char* text, bool debugOut=false);\r
-            void sendServicesCS(PClient* author, const char* text, bool debugOut=false);\r
-            void sendServicesMB(PClient* author, const char* text, bool debugOut=false);\r
-            void sendServicesNC(PClient* author, const char* text, bool debugOut=false);\r
-            void sendServicesTH(PClient* author, const char* text, bool debugOut=false);\r
-            void sendServicesWL(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTeam10(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTeam30(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTeam50(PClient* author, const char* text, bool debugOut=false);\r
-            void sendTeam70(PClient* author, const char* text, bool debugOut=false);\r
-            void sendAdmin(PClient* author, const char* text, bool debugOut=false);\r
-            void sendGM(PClient* author, const char* text, bool debugOut=false);\r
-            void sendGMAdmin(PClient* author, const char* text, bool debugOut=false);\r
-\r
-            void sendBroadcast(const char* text, bool debugOut=false);\r
-            void sendOOCBroadcast(const char* text, bool debugOut=false);\r
-            void sendPlayerDirect(PClient* author, const char* text, u32 destination, bool debugOut=false);\r
-            void sendLocalchat(PClient* receiver, PClient* author, const char* text, bool debugOut=false);\r
-            bool chanEnabled(PClient* Client, u32 channel);\r
-\r
-};\r
-\r
-/** A WARNING: DO >N O T< (!!!) CHANGE >ANY< OF THE FOLLOWING VARIABLES UNLESS YOU KNOW EXACT WHAT YOU'RE DOING! **/\r
-/** You can easily mess up the entire chat subsystem. If you're unsure, ask Namikon first! **/\r
-/*\r
-####################\r
-   CHANNEL-CODES:\r
-     (INCOMING)\r
-####################\r
-*/\r
-static const u32 CHANNEL_BUDDY = 0x00000000;                // Buddy\r
-static const u32 CHANNEL_CLAN = 0x00000002;                 // Clan\r
-static const u32 CHANNEL_TEAM = 0x00000003;                 // Team\r
-static const u32 CHANNEL_DIRECT = 0xFFFFFFFF;               // Direct UNKNOWN YET\r
-static const u32 CHANNEL_CUS_ZONE = 0x00000105;             // Custom -> Zone\r
-static const u32 CHANNEL_CUS_FRAKTION = 0x00000205;         // Custom -> Fraktion\r
-static const u32 CHANNEL_CUS_TRADE_CANYON = 0x00002005;     // Custom -> Trade Canyon\r
-static const u32 CHANNEL_CUS_TRADE_MB = 0x00000805;         // Custom -> Trade MB\r
-static const u32 CHANNEL_CUS_TRADE_NC = 0x00000405;         // Custom -> Trade NC\r
-static const u32 CHANNEL_CUS_TRADE_TH = 0x00001005;         // Custom -> Trade TH\r
-static const u32 CHANNEL_CUS_TRADE_WASTE = 0x00004005;      // Custom -> Trade Wastelands\r
-static const u32 CHANNEL_CUS_OOC = 0x04000005;              // Custom -> OOC\r
-static const u32 CHANNEL_CUS_PLAYERHELP = 0x02000005;       // Custom -> Player 2 Player help\r
-static const u32 CHANNEL_CUS_CLANSEARCH = 0x01000005;       // Custom -> Searching Clan\r
-static const u32 CHANNEL_CUS_SERVICES_CANYON = 0x00040005;  // Custom -> Runner Services Canyon\r
-static const u32 CHANNEL_CUS_SERVICES_MB = 0x00010005;      // Custom -> Runner Services MB\r
-static const u32 CHANNEL_CUS_SERVICES_NC = 0x00008005;      // Custom -> Runner Services NC\r
-static const u32 CHANNEL_CUS_SERVICES_TH = 0x00020005;      // Custom -> Runner Services TH\r
-static const u32 CHANNEL_CUS_SERVICES_WASTE = 0x00080005;   // Custom -> Runner Services Wastelands\r
-static const u32 CHANNEL_CUS_TEAM_10 = 0x00100005;          // Custom -> Searching Team ~10\r
-static const u32 CHANNEL_CUS_TEAM_30 = 0x00200005;          // Custom -> Searching Team ~30\r
-static const u32 CHANNEL_CUS_TEAM_50 = 0x00400005;          // Custom -> Searching Team ~50\r
-static const u32 CHANNEL_CUS_TEAM_70 = 0x00800005;          // Custom -> Searching Team ~70\r
-static const u32 CHANNEL_ADMIN = 0x000000FF;                // Admin chat\r
-static const u32 CHANNEL_GMADMIN = 0x000000FE;                // Admin chat\r
-static const u32 CHANNEL_GMCHAT = 0x000000FD;               // GameMaster chat\r
-/*\r
-####################\r
-   CHANNEL-CODES:\r
-     (OUTGOING)\r
-####################\r
-*/\r
-static const u8 CHAT_BUDDY[] = {0x00, 0x10};\r
-static const u8 CHAT_LOCAL[] =  {0x01, 0x10};\r
-static const u8 CHAT_CLAN[] = {0x02, 0x10};\r
-static const u8 CHAT_TEAM[] = {0x03, 0x10};\r
-static const u8 CHAT_DIRECT[] = {0x04, 0x10};\r
-static const u8 CHAT_ZONE[] = {0x05, 0x00};\r
-static const u8 CHAT_FRAK[] = {0x05, 0x01};\r
-static const u8 CHAT_TRADECS[] = {0x05, 0x05};\r
-static const u8 CHAT_TRADEMB[] = {0x05, 0x03};\r
-static const u8 CHAT_TRADENC[] = {0x05, 0x02};\r
-static const u8 CHAT_TRADETH[] = {0x05, 0x04};\r
-static const u8 CHAT_TRADEWL[] = {0x05, 0x06};\r
-static const u8 CHAT_OOC[] = {0x05, 0x12};\r
-static const u8 CHAT_HELP[] = {0x05, 0x11};\r
-static const u8 CHAT_CLANSEARCH[] = {0x05, 0x10};\r
-static const u8 CHAT_SERVICECS[] =  {0x05, 0x0A};\r
-static const u8 CHAT_SERVICESMB[] = {0x05, 0x08};\r
-static const u8 CHAT_SERVICESNC[] = {0x05, 0x07};\r
-static const u8 CHAT_SERVICESTH[] = {0x05, 0x09};\r
-static const u8 CHAT_SERVICESWL[] = {0x05, 0x0B};\r
-static const u8 CHAT_TEAM10[] = {0x05, 0x0C};\r
-static const u8 CHAT_TEAM30[] = {0x05, 0x0D};\r
-static const u8 CHAT_TEAM50[] = {0x05, 0x0E};\r
-static const u8 CHAT_TEAM70[] = {0x05, 0x0F};\r
-static const u8 CHAT_ADMIN[] = {0xFF, 0x10};\r
-static const u8 CHAT_GMADMIN[] = {0xFE, 0x10};\r
-static const u8 CHAT_GM[] = {0xFD, 0x10};\r
-\r
-/*\r
-####################\r
-   CHANNEL-CODES:\r
-(EN/DISABLE-ABLE CHANNELS)\r
-####################\r
-*/\r
-static const u32 C_ZONE = 1;\r
-static const u32 C_FRAK = 2;\r
-static const u32 C_TRADENC = 4;\r
-static const u32 C_TRADEMB = 8;\r
-static const u32 C_TRADETH = 16;\r
-static const u32 C_TRADECS = 32;\r
-static const u32 C_TRADEWL = 64;\r
-static const u32 C_SERVICENC = 128;\r
-static const u32 C_SERVICEMB = 256;\r
-static const u32 C_SERVICETH = 512;\r
-static const u32 C_SERVICECS = 1024;\r
-static const u32 C_SERVICEWL = 2048;\r
-static const u32 C_TEAM10 = 4096;\r
-static const u32 C_TEAM30 = 8192;\r
-static const u32 C_TEAM50 = 16384;\r
-static const u32 C_TEAM70 = 32768;\r
-static const u32 C_CLANSEARCH = 65536;\r
-static const u32 C_HELP = 131072;\r
-static const u32 C_OOC = 262144;\r
-#endif\r
diff --git a/server/src/game/include/client.h b/server/src/game/include/client.h
deleted file mode 100644 (file)
index 832eb25..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
- client.h\r
-\r
- Authors:\r
- - v00d00\r
- - Akiko\r
- - Namikon\r
- - bakkdoor\r
-\r
- MODIFIED: 30 Nov 2005 Akiko\r
- REASON: - added GPL\r
-        - added stuff from Namikon\r
-  MODIFIED: 13 Dec 2005 bakkdoor\r
-  REASON: - added multiuser chat\r
-  MODIFIED: 27 Jul 2006 Hammag\r
-  REASON: - added mTransactionID member\r
-          - re-added IncreaseUDP_ID() // but I don't understand well what SetUDP_ID() does ...\r
-  MODIFIED: 05 Aug 2006 Hammag\r
-  REASON: - changed TMP_UDP_PORT/SetTMPUDPPort()/GetTMPUDPPort() to mRemotePort/SetRemoteUDPPort()/GetRemoteUDPPort()\r
-              which corresponds to the real purpose of these members\r
-          - added GetID() as an alias os GetIndex() for better coherency with other classes\r
-  MODIFIED: 09 Oct 2006 Hammag\r
-  REASON: - added GetDebugMode() and SetDebugMode() methods\r
-\r
-\r
-  TODO:   - check that SetUDP_ID, and the mSessionID(UDP_ID_HIGH) real use,\r
-              and if UDP_ID and mSessionID must be synced (like in NeoX) or not\r
-\r
-*/\r
-\r
-#ifndef CLIENT_H\r
-#define CLIENT_H\r
-\r
-enum PClientConnection\r
-{\r
-  PCC_NONE = 0,\r
-  PCC_GAME = 1\r
-};\r
-\r
-// AccountLevel handling is part of accounts.cpp\r
-/*\r
-enum PClientLevel\r
-{\r
- PCL_BANNED = -1,\r
- PCL_UNREGPLAYER = 0,\r
- PCL_REGPLAYER = 1,\r
- PCL_VOLUNTEER = 30,\r
- PCL_GM = 50,\r
- PCL_ADMIN = 100\r
-};\r
-*/\r
-#define DEBUG_MODES 3\r
-enum PDebugMode\r
-{\r
-  DBG_LOCATION = 0,\r
-  DBG_ITEMID = 1,\r
-  DBG_SUBWAY = 2,\r
-  DBG_ALL = DEBUG_MODES // must always be last, with DEBUG_MODES updated as needed\r
-};\r
-\r
-\r
-class PClient\r
-{\r
-  private :\r
-    ConnectionTCP* m_TCPConnection;\r
-    ConnectionUDP* m_UDPConnection;\r
-\r
-    u32 mAccountID;\r
-    int mAccountLevel;\r
-    u32 mIndex;\r
-    u32 mCharID;\r
-\r
-//  u16 mUDP_ID;\r
-//  u16 mSessionID;\r
-//  u16 mTransactionID;\r
-\r
-    // AccountLevel handling is part of accounts.cpp\r
-    //PClientLevel mLevel;\r
-    int mConnection;\r
-    int mRemotePort;\r
-\r
-    bool mDebugMode[DEBUG_MODES];\r
-    // new multiuser-chat implementation //\r
-    int m_ZoneID;\r
-    //int[4] m_IP;\r
-\r
-    //*******\r
-    bool mActorRemoveMode;\r
-    //*******\r
-    bool mAwaitingWarpto;\r
-    u16 mTargetX;\r
-    u16 mTargetY;\r
-    u16 mTargetZ;\r
-    //*******\r
-    bool mAcceptNPCUpdates;\r
-    bool mZoning;\r
-    bool mVhcZoning;\r
-    \r
-\r
-  protected :\r
-  public :\r
-    PClient( int Index );\r
-    ~PClient();\r
-\r
-    inline bool GetDebugMode( PDebugMode nDebugID ) { return mDebugMode[nDebugID]; }\r
-    void SetDebugMode( PDebugMode nDebugID, bool nVal = true );\r
-\r
-    inline bool IsAcceptingNPCUpdates() { return mAcceptNPCUpdates; }\r
-    inline void SetAcceptNPCUpdates( bool nVal ) { mAcceptNPCUpdates = nVal; }\r
-    inline bool IsZoning() { return mZoning; }\r
-    inline void SetZoning( bool nVal = true ) { mZoning = nVal; if ( !nVal ) mVhcZoning = false; }\r
-    inline bool IsVhcZoning() { return mVhcZoning; }\r
-    inline void SetVhcZoning( bool nVal = true ) { mVhcZoning = nVal; }\r
-\r
-    inline u32 GetIndex() const { return mIndex; } // better use GetID()\r
-    inline u32 GetID() const { return mIndex; } // for better coherency with other classes\r
-    inline u32 GetLocalID() const { return mIndex + 1; }\r
-    inline u32 GetCharID() const { return mCharID; }\r
-    PChar* GetChar() const;\r
-    bool ChangeCharLocation( u32 nLocation, bool DoForce = false );\r
-\r
-    inline int GetRemoteUDPPort() const { return mRemotePort; } // Temp solution\r
-\r
-    inline bool IsInRemoveActorMode() { return mActorRemoveMode; }\r
-    inline void SetRemoveActorMode( bool nNewValue ) { mActorRemoveMode = nNewValue; }\r
-\r
-    inline void SetRemoteUDPPort( int port ) { mRemotePort = port; } // Temp solution\r
-    inline void SetCharID( int id ) { mCharID = id; }//NEW added\r
-\r
-    /*\r
-        inline u16 GetUDP_ID() const { return mUDP_ID; }\r
-        inline u16 GetSessionID() const { return SESSION_UDP_OFFSET + mUDP_ID ; }\r
-        inline u16 GetTransactionID() {return mTransactionID; }\r
-        void SetUDP_ID(int id);\r
-        inline void IncreaseUDP_ID() { SetUDP_ID(mUDP_ID + 1); }\r
-        inline void ResetTransactionID() { mTransactionID = 10170; }\r
-\r
-        inline void IncreaseTransactionID(u8 nInc = 1) { mTransactionID += nInc; }\r
-    */\r
-\r
-    // All outgoing ID's and stuff is now part of the ConnectionUDP class itself!\r
-    //    (which is not so good.... comment from Hammag)\r
-    // However, we still have full access to it through these functions\r
-    u16 GetUDP_ID();\r
-    void SetUDP_ID( int id );\r
-    void IncreaseUDP_ID();\r
-\r
-    u16 GetSessionID();\r
-\r
-    u16 GetTransactionID();\r
-    void ResetTransactionID();\r
-    void IncreaseTransactionID( u8 nInc = 1 );\r
-\r
-    void FillInUDP_ID( PMessage* nMessage );\r
-\r
-// ************************************************************************ //\r
-    // AccountLevel handling is part of accounts.cpp\r
-    //inline PClientLevel GetLevel() const { return mLevel; }\r
-\r
-    inline void setTCPConnection( ConnectionTCP* conn ) { m_TCPConnection = conn; m_UDPConnection = 0; mConnection = PCC_GAME;  }\r
-    inline void setUDPConnection( ConnectionUDP* conn ) { m_UDPConnection = conn; }\r
-\r
-    inline ConnectionTCP* getTCPConn() { return m_TCPConnection; }\r
-    inline ConnectionUDP* getUDPConn() { return m_UDPConnection; }\r
-\r
-    inline void SendTCPMessage( PMessage* nMessage ) { if ( m_TCPConnection ) { m_TCPConnection->SendMessage( nMessage ); } else { delete nMessage; } }\r
-    void FragmentAndSendUDPMessage( PMessage* nMessage, u8 nType );\r
-    inline void SendUDPMessage( PMessage* nMessage, bool nVIP = false ) { if ( m_UDPConnection ) { m_UDPConnection->SendMessage( nMessage, nVIP ); }  else { delete nMessage; } }\r
-\r
-    inline int GetConnection() const { return mConnection; }\r
-    inline const char *GetAddress() const { return m_TCPConnection->getRemoteAddress(); }\r
-    inline u32 GetAccountID() const { return mAccountID; }\r
-    inline int GetAccountLevel() const { return mAccountLevel; }\r
-\r
-    void GameDisconnect();\r
-\r
-    void RefreshAccountInfo( PAccount* Account );\r
-    inline void LoggedIn( PAccount* Account ) { RefreshAccountInfo( Account ); }\r
-    void Update();\r
-\r
-    // new multiuser-chat implementation //\r
-    inline int getZoneID() const { return m_ZoneID; } // example: canyon 650 (for local-channel...every client with same AreaID get the chatmsg)\r
-    //inline int* getIP() const { return (int*) m_IP; }\r
-\r
-    inline void SetAwaitingWarpto( bool yesno, u16 NewX, u16 NewY, u16 NewZ )\r
-    {\r
-      mAwaitingWarpto = yesno;\r
-      mTargetX = NewX;\r
-      mTargetY = NewY;\r
-      mTargetZ = NewZ;\r
-    }\r
-    bool GetCharAwaitingWarpto( u16* PosX = NULL, u16* PosY = NULL, u16* PosZ = NULL );\r
-\r
-    // Char broadcasted effects\r
-    void InitWarpCircle();\r
-    void InitCharVanish();\r
-\r
-    // used for dynamic ingame testing\r
-    u8 testval8;\r
-    u16 testval16;\r
-    u32 testval32;\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/clientmanager.h b/server/src/game/include/clientmanager.h
deleted file mode 100644 (file)
index 6f6cb77..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
- clientmanager.h\r
-\r
- Authors:\r
- - bakkdoor\r
-\r
- MODIFIED: 13 Dec 2005 bakkdoor\r
- REASON: - introduced\r
- MODIFIED: 29 Jul 2006 Hammag\r
- REASON: - added UDP broadcast fonction\r
-         - added "zone players say Hello" fonction\r
-         - changed type ClientMap to PClientMap, changed members name prefix m_ to m\r
-\r
- MODIFIED: 12 Aug 2006 Hammag\r
- REASON: - duplicated UDPBroadcast() in two prototypes\r
-\r
-*/\r
-\r
-#ifndef CLIENTMANAGER_H\r
-#define CLIENTMANAGER_H\r
-\r
-typedef std::map<u32, PClient*> PClientMap;\r
-\r
-class PClientManager\r
-{\r
-  private:\r
-    //int       mLastID;\r
-    PClientMap mClientList;\r
-\r
-  public:\r
-    PClientManager();\r
-    ~PClientManager();\r
-\r
-    PClientMap::iterator   getClientListBegin() { return mClientList.begin(); }\r
-    PClientMap::iterator   getClientListEnd() { return mClientList.end(); }\r
-\r
-    bool addClientToList( PClient* newClient );\r
-    //void deleteClientFromListByID(int id);\r
-    void deleteClientFromList( u32 id );\r
-    //bool deleteClientFromList(PClient* delClient); // maybe no use for this...\r
-    PClient* getClientByID( u32 u32 ) const; // returns pointer to a client for further use\r
-    PClient* getClientByChar( u32 CharID ) const;\r
-    PClient* getClientByChar( const std::string &Name ) const;\r
-    // int getClientID(PClient* _client); do _client->GetLocalID()\r
-    bool IsWorldInUse( u32 nWorldID ) const; // Temp until world content fully managed by world\r
-    PClient* GetClientByCharLocalId( u32 rawObjectId, u32 nWorldID  ) const; // Temp (called by world) until world content fuly managed by world\r
-\r
-    // each function return the number of messages sent.\r
-    int UDPBroadcast( PMessage* nMessage, u32 nZoneID, u16 nX = 0, u16 nY = 0, u16 nZ = 0, u16 nMaxDist = 0, u32 nSkipCharId = 0, bool nNPCPing = false );\r
-    int UDPBroadcast( PMessage* nMessage, PClient* nClient, u16 nMaxDist = 0, bool nSkipSource = false, bool nNPCPing = false );\r
-    int SendUDPZoneWelcomeToClient( PClient* nClient );\r
-\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/container.h b/server/src/game/include/container.h
deleted file mode 100644 (file)
index aae6f87..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-  container.h - base classe for containers\r
-               \r
-\r
- MODIFIED: 28 Jul 2008 Hammag\r
- REASON: - creation\r
-\r
-*/\r
-\r
-#ifndef CONTAINER_H\r
-#define CONTAINER_H\r
-\r
-#define CONTAINER_MAX_SIZE 254\r
-\r
-class PItem;\r
-\r
-class PContainerEntry\r
-{\r
-  friend class PContainer;\r
-  friend class PContainer2D;\r
-  friend class PMsgBuilder;\r
-  \r
-  friend class PContainer2DWorkaround;\r
-  \r
-  private:\r
-    enum {\r
-      i_invid = 0,\r
-      i_charid,\r
-      i_invloc,\r
-      i_x,\r
-      i_y,\r
-      i_itemid,\r
-      //i_type,\r
-         i_flag,\r
-      i_qty,\r
-         i_sqty,\r
-      i_curdur,\r
-      i_dmg,\r
-      i_freq,\r
-      i_hand,\r
-      i_rng,\r
-      i_maxdur,\r
-      i_slots,\r
-      i_slt1,\r
-      i_slt2,\r
-      i_slt3,\r
-      i_slt4,\r
-      i_slt5,\r
-      i_atype,\r
-      i_conatin\r
-    };\r
-    \r
-    PItem* mItem;\r
-    u8  mPosX;\r
-    u8  mPosY;\r
-    u32 mInvID;\r
-    bool mDirtyFlag;\r
-\r
-    PContainerEntry(PItem* nItem, u8 X, u8 Y, u32 nInvID = 0, bool SetDirty = true);\r
-    PContainerEntry(MYSQL_ROW row);\r
-    \r
-    bool SQLSave(u32 CharID, u32 InvLoc);\r
-    bool SQLDelete();\r
-    \r
-    inline void Set2DPos(u8 nPosX, u8 nPosY) { mDirtyFlag = mDirtyFlag || (mPosX != nPosX) || (mPosY != nPosY) ; mPosX = nPosX; mPosY = nPosY; }\r
-    \r
-  public:\r
-    ~PContainerEntry();\r
-    \r
-    inline void Get2DPos(u8* oPosX, u8* oPosY) { *oPosX = mPosX; *oPosY = mPosY; }\r
-};\r
-\r
-\r
-\r
-class PContainer // Holes allowed, no autofind free slots\r
-{    \r
-       protected:\r
-    u8 mMaxSlots;\r
-    std::vector< PContainerEntry* >* mContContent;\r
-    u32 mCharID;\r
-    u32 mInvLoc;\r
-    u32 mExclusiveUseCharID;\r
-    bool mDirtyFlag;\r
-    \r
-    inline bool IsSlotAllowed(u8 nSlotId) { return ((nSlotId < CONTAINER_MAX_SIZE) && (!mMaxSlots || (nSlotId < mMaxSlots))); }\r
-    virtual bool AddEntry(PContainerEntry* NewEntry, u8 nSlotId = 0);\r
-    virtual PContainerEntry* RemoveEntry(u8 nSlotId);\r
-    virtual bool GetFreeSlot(u8* nSlotId);\r
-               void Compact(u8 startSlotId = 0);\r
-    \r
-  public:\r
-    PContainer(u8 nMaxSlots = 0);\r
-    virtual ~PContainer();\r
-\r
-    inline void SetInfo(u32 CharID, u32 InvLoc) { mCharID = CharID; mInvLoc = InvLoc; }\r
-    inline u32 GetOwnerId() { return mCharID; }\r
-    \r
-    inline bool IsDirty() { return mDirtyFlag; }\r
-    inline void SetDirty() { mDirtyFlag = true; }\r
-    \r
-    bool StartUse(u32 nExclusiveUseCharID = 0);\r
-    virtual bool EndUse(u32 nExclusiveUseCharID = 0);\r
-\r
-    bool SQLLoad();\r
-    bool SQLSave();\r
-    \r
-    bool IsSlotFree(u8 nSlotId);\r
-    virtual bool AddItem(PItem* NewItem, u32 nInvID = 0, u8 nPosX = 0, u8 nPosY = 0, bool SetDirty = true);\r
-    \r
-    virtual bool MoveItem(u8 srcSlotId, u8 nCount, u8 dstSlotId);\r
-    bool MoveItem(u8 srcSlotId, u8 nCount, PContainer* dstContainer, u8 dstSlotId = 0, u8 nPosX = 0, u8 nPosY = 0);\r
-         virtual void SetEntryPosXY(PContainerEntry* nEntry, u8 nSlotId, u8 nPosX = 0, u8 nPosY = 0);\r
-\r
-    virtual u8 RandomFill(u8 nItemCount = 0, int nItemContainerDefIndex = -1);\r
-    \r
-    PContainerEntry* GetEntry(u8 nSlotId);\r
-    std::vector< PContainerEntry* >* GetEntries();\r
-    PItem* GetItem(u8 nSlotId);\r
-    \r
-    virtual void Dump();\r
-};\r
-\r
-\r
-class PContainerWithHoles : public PContainer // Holes allowed, no autofind free slots\r
-{   \r
-  public:\r
-    PContainerWithHoles(u8 nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
-    virtual ~PContainerWithHoles() {}\r
-};\r
-\r
-\r
-class PContainerAutoCompact : public PContainer // No holes allowed, automatic add to end slot (no control on insertion slot)\r
-{\r
-       protected:\r
-    virtual PContainerEntry* RemoveEntry(u8 nSlotId);\r
-    virtual bool GetFreeSlot(u8* nSlotId);\r
-    \r
-  public:\r
-    PContainerAutoCompact(u8 nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
-    virtual ~PContainerAutoCompact() {}\r
-               \r
-    virtual bool MoveItem(u8 srcSlotId, u8 nCount, u8 dstSlotId); \r
-};\r
-\r
-\r
-class PContainer2D : public PContainerAutoCompact // + slotId not used, non-significant XY used (no XY check yet)\r
-{   \r
-  public:\r
-    PContainer2D(u8 nMaxSlots = 0) : PContainerAutoCompact(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
-    virtual ~PContainer2D() {}\r
-\r
-               virtual void SetEntryPosXY(PContainerEntry* nEntry, u8 nSlotId, u8 nPosX = 0, u8 nPosY = 0);\r
-};\r
-\r
-class PContainer2DWorkaround : public PContainerWithHoles // Holes allowed, autofind free slot (always increasing id)\r
-{\r
-  private:\r
-    u8 mNextFreeSlot;\r
-    std::vector< std::vector<bool>* > mContSpace;\r
-    u8 mMaxCols;\r
-    u8 mMaxRows;\r
-    u8 mRows;\r
-    \r
-    void AddRow();\r
-      \r
-    inline bool Is2DPosAllowed(u8 PosX, u8 PosY, u8 SizeX, u8 SizeY)\r
-    {\r
-      return ((PosX < mMaxCols-SizeX+1) && (PosY < mMaxRows-SizeY+1));\r
-    }\r
-    bool Is2DFree(u8 PosX, u8 PosY, u8 SizeX, u8 SizeY);\r
-    bool FindValid2DPos(PContainerEntry* nEntry);\r
-    \r
-\r
-  protected:\r
-    bool AddEntry(PContainerEntry* NewEntry, u8 nSlotId = 0);\r
-    PContainerEntry* RemoveEntry(u8 nSlotId);\r
-    bool GetFreeSlot(u8* nSlotId);\r
-    \r
-  public:\r
-    PContainer2DWorkaround(u8 nMaxSlots = 0);\r
-    ~PContainer2DWorkaround();\r
-    \r
-    bool MoveItem(u8 srcSlotId, u8 nCount, u8 dstSlotId);\r
-    \r
-    void Set2DPosMax(u8 MaxPosX, u8 MaxPosY = 254) { mMaxCols = MaxPosX; mMaxRows = MaxPosY; }\r
-    void SetEntryPosXY(PContainerEntry* nEntry, u8 nSlotId, u8 nPosX = 0, u8 nPosY = 0);\r
-    void SetUsed(PContainerEntry* nEntry, bool Value = true);\r
-    void Dump();\r
-};\r
-\r
-class PContainerAutoFindFree : public PContainerWithHoles // No holes kept after EndUse, automatic find first free slots (no control on insertion slot)\r
-{\r
-  protected:\r
-    virtual bool GetFreeSlot(u8* nSlotId);\r
-    \r
-  public:\r
-    PContainerAutoFindFree(u8 nMaxSlots = 0) : PContainerWithHoles(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
-    virtual ~PContainerAutoFindFree() {}\r
-};\r
-\r
-class PContainerAutoCompactOnClose : public PContainerAutoFindFree // No holes kept after EndUse, automatic find first free slots (no control on insertion slot)\r
-{    \r
-  public:\r
-    PContainerAutoCompactOnClose(u8 nMaxSlots = 0) : PContainerAutoFindFree(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
-    virtual ~PContainerAutoCompactOnClose() {}\r
-\r
-    virtual bool EndUse(u32 nExclusiveUseCharID = 0);\r
-}; \r
-\r
-#endif\r
diff --git a/server/src/game/include/def.h b/server/src/game/include/def.h
deleted file mode 100644 (file)
index ed95d6f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_H
-#define DEF_H
-
-extern const std::string EmptyString;
-
-/* mother class for PDef* classes */
-/* provides default members required for def file loading */
-class PDef
-{
-  protected :
-    int mIndex;
-
-  public :
-    PDef() : mIndex(0) {};
-    //~PDef() {};
-
-    inline bool LoadFromDef( PTokenList *Tokens ) { Tokens = Tokens; return false; };
-
-    inline int GetIndex() const { return mIndex; }
-    inline const std::string &GetName() const { return EmptyString; }
-};
-
-#endif
-
diff --git a/server/src/game/include/def_actionmod.h b/server/src/game/include/def_actionmod.h
deleted file mode 100644 (file)
index 277f620..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 31 Mar 2009 Hammag
-*/
-
-#ifndef DEF_ACTIONMOD_H
-#define DEF_ACTIONMOD_H
-
-#include "def.h"
-
-class PDefActionMod : public PDef
-{
-  private :
-    //int mIndex;
-    float mStartValue;
-    int mNumOfSsq;
-    int mSsqId[8];
-    float mModFactor[8];
-
-  public :
-    PDefActionMod();
-    //~PDefActionMod();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline float GetStartValue() const { return mStartValue; }
-    inline int GetNumOfSsq() const { return mNumOfSsq; }
-    inline int GetSsqId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mSsqId[nIdx] : 0) ; }
-       inline float GetModFactor(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mModFactor[nIdx] : 0) ; }
-};
-
-#endif
diff --git a/server/src/game/include/def_ammo.h b/server/src/game/include/def_ammo.h
deleted file mode 100644 (file)
index a9425e5..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 02 Apr 2009 Hammag
-*/
-
-#ifndef DEF_AMMO_H
-#define DEF_AMMO_H
-
-#include "def.h"
-
-class PDefAmmo : public PDef
-{
-  private :
-    //int mIndex;
-       int mDamageId; // related to damage.def
-       int mWeaponShotId; // related to shots.def ?
-       int mMagSize;
-    int mShotId; // related to shots.def ??? strange: hardly ever set in ammo.def
-
-  public :
-    PDefAmmo();
-    //~PDefAmmo();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetDamageId() const { return mDamageId; }
-       inline int GetWeaponShotId() const { return mWeaponShotId; }
-    inline int GetMagSize() const { return mMagSize; }
-       inline int GetShotId() const { return mShotId; }
-};
-
-#endif
diff --git a/server/src/game/include/def_appartements.h b/server/src/game/include/def_appartements.h
deleted file mode 100644 (file)
index fd8f93b..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_appartements.h\r
-\r
-       MODIFIED: 22 Sep 2006 Hammag\r
-       REASON: - Creation\r
-       \r
-*/\r
-\r
-#ifndef DEF_APPARTEMENTS_H\r
-#define DEF_APPARTEMENTS_H\r
-\r
-#include "def.h"\r
-\r
-class PDefAppartement : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               std::string mWorldName;\r
-               int mValue;\r
-               int mPlaceCount;\r
-               int mPlace[8];\r
-               int mFaction;\r
-\r
-       public :\r
-               PDefAppartement();\r
-               //~PDefAppartement();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline int GetID() const { return mIndex; }\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline const std::string &GetWorldName() const { return mWorldName; }\r
-               inline int GetValue() const { return mValue; }\r
-               inline int GetPlaceCount() const { return mPlaceCount; }\r
-               inline int GetPlace(int nIdx) const { return ( (nIdx < mPlaceCount) ? mPlace[nIdx] : 0 ); }\r
-               inline int GetFaction() const { return mFaction; }\r
-};\r
-\r
-\r
-class PDefAppartementsMap : public PDefMap<PDefAppartement>\r
-{\r
-  public:\r
-    inline std::map<int, PDefAppartement*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }\r
-    inline std::map<int, PDefAppartement*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/def_appplaces.h b/server/src/game/include/def_appplaces.h
deleted file mode 100644 (file)
index ce35c33..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-       def_appplaces.h\r
-\r
-       Created: 21 Sep 2006 Hammag\r
-       REASON: -\r
-*/\r
-\r
-#ifndef DEF_APPPLACES_H\r
-#define DEF_APPPLACES_H\r
-\r
-#include "def.h"\r
-\r
-class PDefAppPlace : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               int mExitWorldID;\r
-               int mExitWorldEntity;\r
-               int mSewerLevel;\r
-               \r
-       public :\r
-               PDefAppPlace();\r
-               //~PDefAppPlace();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline int GetExitWorldID() const { return mExitWorldID; }\r
-               inline int GetExitWorldEntity() const { return mExitWorldEntity; }\r
-               inline int GetSewerLevel() const { return mSewerLevel; }\r
-\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/def_blueprintpieces.h b/server/src/game/include/def_blueprintpieces.h
deleted file mode 100644 (file)
index c08fceb..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 31 Mar 2009 Hammag
-*/
-
-#ifndef DEF_BLUEPRINTPIECES_H
-#define DEF_BLUEPRINTPIECES_H
-
-#include "def.h"
-
-class PDefBlueprintPieces : public PDef
-{
-  private :
-    //int mIndex; // related Item Type
-    int mMaxPieceNum;
-    int mPieceNum;
-    int mPieceId[20];
-
-  public :
-    PDefBlueprintPieces();
-    //~PDefBlueprintPieces();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetMaxPieceNum() const { return mMaxPieceNum; }
-    inline int GetPieceNum() const { return mPieceNum; }
-    inline int GetPieceId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mPieceNum)) ? mPieceId[nIdx] : 0) ; }
-};
-
-#endif
diff --git a/server/src/game/include/def_characters.h b/server/src/game/include/def_characters.h
deleted file mode 100644 (file)
index ac83801..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_characters.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       \r
-       MODIFIED: 29 Jul 2006 Hammag\r
-       REASON:  - Added skin modifiers fields\r
-*/\r
-\r
-#ifndef DEF_CHARACTERS_H\r
-#define DEF_CHARACTERS_H\r
-\r
-#include "def.h"\r
-\r
-class PDefCharacter : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               int mModel;\r
-               int mHead;\r
-               int mTorso;\r
-               int mLegs;\r
-               int mColor;\r
-               int mBrightness;\r
-               \r
-       public :\r
-               PDefCharacter();\r
-               //~PDefCharacter();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline int GetModel() const { return mModel; }\r
-               inline int GetHead() const { return mHead; }\r
-               inline int GetTorso() const { return mTorso; }\r
-               inline int GetLegs() const { return mLegs; }\r
-               inline int GetColor() const { return mColor; }\r
-               inline int GetBrightness() const { return mBrightness; }\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/def_charaction.h b/server/src/game/include/def_charaction.h
deleted file mode 100644 (file)
index d78cd7d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 31 Mar 2009 Hammag
-*/
-
-#ifndef DEF_CHARACTION_H
-#define DEF_CHARACTION_H
-
-#include "def.h"
-
-class PDefCharAction : public PDef
-{
-  private :
-    //int mIndex;
-    int mNumOfSsq;
-    int mSsqId[8];
-    float mModFactor[8];
-
-  public :
-    PDefCharAction();
-    //~PDefCharAction();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetNumOfSsq() const { return mNumOfSsq; }
-    inline int GetSsqId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mSsqId[nIdx] : 0) ; }
-       inline int GetModFactor(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumOfSsq)) ? mModFactor[nIdx] : 0) ; }
-};
-
-#endif
diff --git a/server/src/game/include/def_charkinds.h b/server/src/game/include/def_charkinds.h
deleted file mode 100644 (file)
index ce2fd7e..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_charkinds.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef DEF_CHARKINDS_H\r
-#define DEF_CHARKINDS_H\r
-\r
-#include "def.h"\r
-\r
-struct PSkillInfo\r
-{\r
-       int mStart;\r
-       int mMax;\r
-       int mGrow;\r
-\r
-       inline PSkillInfo()\r
-       {\r
-               mStart = mMax = mGrow = 0;\r
-       }\r
-};\r
-\r
-struct PSkillPtsInfo\r
-{\r
-       int mSkill;\r
-       int mPoints;\r
-\r
-       inline PSkillPtsInfo()\r
-       {\r
-               mSkill = mPoints = 0;\r
-       }\r
-};\r
-\r
-struct PSubSkillPtsInfo\r
-{\r
-       int mSubSkill;\r
-       int mPoints;\r
-\r
-       inline PSubSkillPtsInfo()\r
-       {\r
-               mSubSkill = mPoints = 0;\r
-       }\r
-};\r
-\r
-struct PStartLevelInfo\r
-{\r
-       int mSubSkill;\r
-       int mLevel;\r
-\r
-       inline PStartLevelInfo()\r
-       {\r
-               mSubSkill = mLevel = 0;\r
-       }\r
-\r
-};\r
-\r
-class PDefCharKind : public PDef\r
-{\r
-       private :\r
-               typedef std::map<int, PSkillPtsInfo*> PSkillPtsMap;\r
-               typedef std::map<int, PSubSkillPtsInfo*> PSubSkillPtsMap;\r
-               typedef std::map<int, PStartLevelInfo*> PStartLevelMap;\r
-\r
-               //int mIndex;\r
-               std::string mName;\r
-               int mType;\r
-\r
-               // TODO: shouldnt this be a map?\r
-               PSkillInfo *mSkillInfo;\r
-\r
-               PSkillPtsMap mSkillPts;\r
-               PSubSkillPtsMap mSubSkillPts;\r
-               PStartLevelMap mStartLevels;\r
-               int mMoney;\r
-               u32 mInventory[8];\r
-       public :\r
-               PDefCharKind();\r
-               ~PDefCharKind();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline int GetType() const { return mType; }\r
-               inline const PSkillInfo &GetSkillInfo(int Skill) const { return mSkillInfo[Skill-1]; }\r
-\r
-    inline int GetStartMoney() const { return mMoney; }\r
-    inline u32 GetStartInventory(u8 Index) const { return ((Index < 7) ?  mInventory[Index] : 0); }\r
-               // TODO: mission get() functions\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/def_damage.h b/server/src/game/include/def_damage.h
deleted file mode 100644 (file)
index 3ee337f..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 31 Mar 2009 Hammag
-*/
-
-#ifndef DEF_DAMAGE_H
-#define DEF_DAMAGE_H
-
-#include "def.h"
-
-class PDefDamage : public PDef
-{
-  private :
-    //int mIndex;
-    //int mSoundIndex; // no use
-    int mDamageNum;
-    int mDamageValue[4];
-    int mDamageEffect[4];
-    int mDamageType[4];
-    /* int mEffectNum; // Are effects needed ? (server or client triggered ?)
-       int mEffectId[4]; // ?
-       int mEffectTarget[4]; // float ?
-       int mEffectValue[4]; // float ?
-       int mEffectamorId[4]; // ????
-    */
-  public :
-    PDefDamage();
-    //~PDefDamage();
-
-    bool LoadFromDef ( PTokenList *Tokens );
-
-    inline int GetDamageNum() const { return mDamageNum; }
-    inline int GetDamageValue ( int nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < mDamageNum ) ) ? mDamageValue[nIdx] : 0 ) ; }
-    inline int GetDamageEffect ( int nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < mDamageNum ) ) ? mDamageEffect[nIdx] : 0 ) ; }
-    inline int GetDamageType ( int nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < mDamageNum ) ) ? mDamageType[nIdx] : 0 ) ; }
-    /* inline int GetEffectNum() const { return mEffectNum; }
-        inline int GetEffectId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectId[nIdx] : 0) ; }
-       inline int GetEffectTarget(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectTarget[nIdx] : 0) ; }
-       inline int GetEffectValue(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectValue[nIdx] : 0) ; }
-       inline int GetEffectamorId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mEffectNum)) ? mEffectamorId[nIdx] : 0) ; }
-       */
-};
-
-#endif
diff --git a/server/src/game/include/def_drugs.h b/server/src/game/include/def_drugs.h
deleted file mode 100644 (file)
index 17c80c6..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 31 Mar 2009 Hammag
-*/
-
-#ifndef DEF_DRUG_H
-#define DEF_DRUG_H
-
-#include "def.h"
-
-class PDefDrug : public PDef
-{
-  protected :
-    //int mIndex;
-       int mType;
-       //int mUseSound;
-       int mDuration;
-       int mChangeNum;
-    int mChangeType[8]; // 1: bonus, 2:malus, ... other ?
-    float mChangeScale[8];
-       int mChangeTarget[8];
-
-  public :
-    PDefDrug();
-    //~PDefDrug();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetType() const { return mType; }
-       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 ) ; }
-    inline int GetChangeTarget( int nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < mChangeNum ) ) ? mChangeTarget[nIdx] : 0 ) ; }
-};
-
-//type of drug:
-//1 normal Drug
-//2 Skill ver�ndernder PSI Spruch K�mpfer
-//3 Skill ver�ndernder PSI Spruch Supporter
-//4 Skill ver�ndernder PSI Spruch Resists
-//6+A274  PSI entferne Sprcuh
-
-// drugeffects  < 1000  Subskill
-//  <2000 Skill
-//  <2100 Energy  (permanent)
-//  <2200 Maxenergy
-//  <2300 Armor
-//  <2400 Subskills
-//  3000-3500 Actionmods
-
-#endif
diff --git a/server/src/game/include/def_factions.h b/server/src/game/include/def_factions.h
deleted file mode 100644 (file)
index 51e0ffa..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_factions.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef DEF_FACTIONS_H\r
-#define DEF_FACTIONS_H\r
-\r
-#include "def.h"\r
-\r
-static const int NUMFACTIONS = 20;     // for faction relations only\r
-\r
-class PDefFaction : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               int mStartValue;\r
-               bool mAffected;\r
-               int mSL;\r
-               int mRelations[NUMFACTIONS];\r
-       public :\r
-               PDefFaction();\r
-               //~PDefFaction();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline int GetStartValue() const { return mStartValue; }\r
-               inline bool GetAffected() const { return mAffected; }\r
-               inline int GetSL() const { return mSL; };\r
-               int GetRelation(int Faction) const;\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/def_hack.h b/server/src/game/include/def_hack.h
deleted file mode 100644 (file)
index de074d3..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_hack.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef DEF_HACK_H\r
-#define DEF_HACK_H\r
-\r
-#include "def.h"\r
-\r
-class PDefHack : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               //qui aggiungere valori\r
-       public :\r
-               PDefHack();\r
-               //~PDefHack();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               //qui aggiungere funzioni per i gets\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/def_implants.h b/server/src/game/include/def_implants.h
deleted file mode 100644 (file)
index a3e4e7a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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_implants.h
-
-    CREATED: 02 Apr 2009 Hammag
-*/
-
-#ifndef DEF_IMPLANTS_H
-#define DEF_IMPLANTS_H
-
-#include "def_drugs.h"
-
-// Implants Id 1 to 5 correspond to OP Zone bonus: mine, factory, lab, fort and comlink respectively
-
-class PDefImplant : public PDefDrug
-{
-  public:
-    bool LoadFromDef( PTokenList *Tokens );
-};
-
-#endif
diff --git a/server/src/game/include/def_itemcontainer.h b/server/src/game/include/def_itemcontainer.h
deleted file mode 100644 (file)
index 7e9796c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 02 Apr 2009 Hammag
-*/
-
-#ifndef DEF_ITEMCONTAINER_H
-#define DEF_ITEMCONTAINER_H
-
-#include "def.h"
-
-class PDefItemContainer : public PDef
-{
-  private :
-    //int mIndex;
-       int mNumItemsAtOnce;
-       int mRespawnTime;
-       int mNumItems;
-    int mItemId[6]; // <0: Group, >0: Item
-    float mQuality[6]; // usually <1, <=> % ?
-       int mChance[6]; // a weight, not a %
-
-    int mCumulatedChance[6]; // Computed data in order to select random item entry
-
-    void BuildCumulatedChance();
-
-  public :
-    PDefItemContainer();
-    //~PDefItemContainer();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-       inline int GetNumItemsAtOnce() const { return mNumItemsAtOnce; }
-       inline int GetRespawnTime() const { return mRespawnTime; }
-    inline int GetNumItems() const { return mNumItems; }
-    inline int GetItemId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumItems)) ? mItemId[nIdx] : 0) ; }
-       inline float GetQuality(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumItems)) ? mQuality[nIdx] : 0) ; }
-       inline int GetChance(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumItems)) ? mChance[nIdx] : 0) ; }
-    int GetRandomItemIdx() const; // Return Idx based on Entry chance
-};
-
-#endif
diff --git a/server/src/game/include/def_itemmod.h b/server/src/game/include/def_itemmod.h
deleted file mode 100644 (file)
index 40f6e21..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 31 Mar 2009 Hammag
-*/
-
-#ifndef DEF_ITEMMOD_H
-#define DEF_ITEMMOD_H
-
-#include "def.h"
-
-class PDefItemMod : public PDef
-{
-  private :
-    //int mIndex;
-       int mType; // if mType > 0, it refers to a weapon type from weapons.def +1
-       //int mDuration; // "implant base build time" = ???? always 0 anyway...
-       int mChangeNum;
-    int mChangeTarget[4]; // qualifier id      0 - 7   item qualifier id       4=range 
-    float mChangeValue[4];
-       float mChangeScale[4];
-       std::string mName;
-       //int mIconId;
-
-  public :
-    PDefItemMod();
-    //~PDefItemMod();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline const std::string &GetName() const { return mName; }
-    inline int GetType() const { return mType; }
-       //inline int GetDuration() const { return mDuration; }
-    inline int GetChangeNum() const { return mChangeNum; }
-    inline int GetChangeTarget(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mChangeNum)) ? mChangeTarget[nIdx] : 0) ; }
-       inline float GetChangeValue(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mChangeNum)) ? mChangeValue[nIdx] : 0) ; }
-       inline float GetChangeScale(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mChangeNum)) ? mChangeScale[nIdx] : 0) ; }
-};
-
-#endif
diff --git a/server/src/game/include/def_itemres.h b/server/src/game/include/def_itemres.h
deleted file mode 100644 (file)
index d599861..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 02 Apr 2009 Hammag
-*/
-
-#ifndef DEF_ITEMRESTRICTION_H
-#define DEF_ITEMRESTRICTION_H
-
-#include "def.h"
-
-class PDefItemRestriction : public PDef
-{
-  private :
-    //int mIndex;
-       int mNumRestrictions;
-    int mSsqId[6]; // Skill/Subs
-       int mMinValue[6];
-
-  public :
-    PDefItemRestriction();
-    //~PDefItemRestriction();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-       inline int GetNumRestrictions() const { return mNumRestrictions; }
-    inline int GetSsqId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumRestrictions)) ? mSsqId[nIdx] : 0) ; }
-       inline float GetMinValue(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumRestrictions)) ? mMinValue[nIdx] : 0) ; }
-};
-
-#endif
diff --git a/server/src/game/include/def_items.h b/server/src/game/include/def_items.h
deleted file mode 100644 (file)
index 88db9b9..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_items.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       \r
-  MODIFIED: 10 Jul Hammag\r
-  REASON: - Full Item Def implementation\r
-*/\r
-\r
-#ifndef DEF_ITEMS_H\r
-#define DEF_ITEMS_H\r
-\r
-#include "def.h"\r
-\r
-class PDefItems : public PDef\r
-{\r
-       private :\r
-\r
-    //int mIndex;//1\r
-    std::string mName;//2\r
-    int mModel; // used for IG display\r
-    int mType;\r
-    int mValue1;\r
-    int mValue2;\r
-    int mValue3;\r
-    // int mBmNum; // used IG for inventory display\r
-    // int mmBmNumIndex; // used IG for inventory display\r
-    int mSizeX;\r
-    int mSizeY;        \r
-    // int mSmallbmnum; // used IG for inventory display\r
-    float mWeight;\r
-    int mStackable;\r
-    float mFillWeight;\r
-    int mQualifier;\r
-    int mGfxMods;\r
-    int mItemGroupID;  \r
-    int mTextDescID;\r
-    int mBasePrice;\r
-    int mTechlevel;\r
-    int mItemflags;\r
-    // std::mShortname; // used IG for display on inventories Icons\r
-\r
-       public :\r
-               PDefItems();\r
-               //~PDefItems();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-        inline int GetModel() const { return mModel; }\r
-               inline int GetType() const { return mType; }\r
-               inline int GetValue1() const { return mValue1; }\r
-               inline int GetValue2() const { return mValue2; }\r
-               inline int GetValue3() const { return mValue3; }\r
-               inline int GetSizeX() const { return mSizeX; }\r
-               inline int GetSizeY() const { return mSizeY; }\r
-               inline float GetWeight() const { return mWeight; }\r
-               inline bool IsStackable() const { return (mStackable == 1); }\r
-               inline float GetFillWeight() const { return mFillWeight; }\r
-               inline int GetQualifier() const { return mQualifier; }\r
-               inline int GetGfxMods() const { return mGfxMods; }\r
-               inline int GetItemGroupID() const { return mItemGroupID; }      \r
-               inline int GetTextDescID() const { return mTextDescID; }\r
-               inline int GetBasePrice() const { return mBasePrice; }\r
-               inline int GetTechlevel() const { return mTechlevel; }\r
-               inline int GetItemflags() const { return mItemflags; }\r
-};\r
-\r
-\r
-class PDefItemsMap : public PDefMap<PDefItems>\r
-{\r
-  private:\r
-    std::map<int, PDefItems*>::const_iterator* mMapItCache;\r
-    int mMapItCacheCount;\r
-    std::map<int, std::vector<int> > mItemGroups;\r
-    int mMaxItemGroupId;\r
-    void BuildMapItCache();\r
-    void BuildItemGroups();\r
-\r
-  public:\r
-    PDefItemsMap();\r
-    ~PDefItemsMap();\r
-    bool Load(const char* nName, const char* nFilename);\r
-    const PDefItems* GetDefBySeqIndex( int nSeqIndex ) const;\r
-    int GetRandomItemIdFromGroup( int nGroupId ) const;\r
-\r
-       inline std::map<int, PDefItems*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }\r
-       inline std::map<int, PDefItems*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/def_mission.h b/server/src/game/include/def_mission.h
deleted file mode 100644 (file)
index 7ff31b7..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 02 Apr 2009 Hammag
-*/
-
-#ifndef DEF_MISSION_H
-#define DEF_MISSION_H
-
-#include "def.h"
-
-class PDefMission : public PDef
-{
-  private :
-    //int mIndex;
-       int mSourceId;
-    std::string mStartDialog;
-       int mDescTextId;
-       int mNpcType[4];
-    std::string mNpcDialog[4];
-       int mNpcDialogStartState[4];
-    int mTargetType[4];
-    int mTargetValue[4][3];
-    int mEndMoney;
-    int mEndXp;
-    int mMaxTime;
-    int mDifficulty;
-    int mMinFactionValue;
-    int mPoints;
-    int mFlags;
-
-  public :
-    PDefMission();
-    //~PDefMission();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetSourceId() const { return mSourceId; }
-    inline const std::string &GetStartDialog() const { return mStartDialog; }
-    inline int GetDescTextId() const { return mDescTextId; }
-    inline int GetNpcType(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 4)) ? mNpcType[nIdx] : 0) ; }
-       inline const std::string &GetNpcDialog(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 4)) ? mNpcDialog[nIdx] : EmptyString) ; }
-    inline int GetNpcDialogStartState(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 4)) ? mNpcDialogStartState[nIdx] : 0) ; }
-       inline int GetTargetType(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 4)) ? mTargetType[nIdx] : 0) ; }
-    inline int GetTargetValue(int nIdx, int nValIdx) const { return ( ((nIdx >= 0) && (nIdx < 4) && (nValIdx >= 0) && (nValIdx < 3)) ? mTargetValue[nIdx][nValIdx] : 0) ; }
-       inline int GetEndMoney() const { return mEndMoney; }
-    inline int GetEndXp() const { return mEndXp; }
-       inline int GetMaxTime() const { return mMaxTime; }
-    inline int GetDifficulty() const { return mDifficulty; }
-    inline int GetMinFactionValue() const { return mMinFactionValue; }
-       inline int GetPoints() const { return mPoints; }
-    inline int GetFlags() const { return mFlags; }
-};
-
-/*
-//mission source ID    > 0 NPC Type for mission source < 0 Terminal ID for mission source
-       
-//mission NPC Type     > 0 NPC Type for mission NPC    < 0 Fraction ID for mission NPC         
-//mission target Type  1 - kill NPC    2 - kill NPC type       "3 - dialogtrigger"     4 - kill NPC type range 5-dialogtrigger + counter       "6 - conquer outpost"   7 - conquer outpost + counter   8 - conquer + hold outpost              9-KillPlayer    10 - LootNPC    11 - LootNPCType
-
-//target value 1       ID of related mission NPC       > 0 NPC Type of NPCs to kill    < 0 FractionID of NPCs to kill  "ID of related mission NPC"     > 0 NPC Type of NPCs to kill    ID of related mission NPC       "> 0 outpost Type < 0 current outpost factionid"        > 0 outpost type < 0 original outpost faction type      > 0 outpost Type < 0 current outpost factionid          PlayerFaction   ID of related Mission NPC(0-4)  > 0 NPC Type of NPCs to kill    < 0 FractionID of NPCs to kill
-       
-//target value 2               Count of NPCs to kill   "ID of DialogTrigger"   Count of NPCs to kill   ID of DialogTrigger             Count of outposts to conquer    time to hold outpost            Kill Cnt        ItemID  NPC Cnt
-
-//target value 3                               Range of NPC Type       Trigger Counter - must reach 0 to be successfull                                        Max Leveldiff           Item ID
-//missionflags (bit field)
-// NPC0 No Search      1       
-// NPC1 No Search      2       
-// NPC2 No Search      4
-// NPC3 No Search      8
-*/
-#endif
diff --git a/server/src/game/include/def_npc.h b/server/src/game/include/def_npc.h
deleted file mode 100644 (file)
index e3b3069..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_NPC_H
-#define DEF_NPC_H
-
-#include "def.h"
-
-class PDefNpc : public PDef
-{
-  private :
-    //int mIndex;
-    int mModel; // <0: from characters.def, >0: from models.ini, [players] section (?)
-    //int mSoundId; // always 0: not used
-    int mNGT; // ? 1 - 4
-    int mGender; // 0 - 1
-    int mFaction;
-    int mHealth;
-    int mArmorId; // -1 or ref to NpcArmor
-    int mWeaponId;
-    std::string mDialogScript;
-    int mCombat; // ? 20 - 800
-    int mLoot; // 0 or ref to ItemContained
-    int mMovementEnd; // 0 - 4
-    int mFunctionType; // 0 - 4
-    float mModelScaling; // 0 - 0.9
-    int mMoneyLoose; // 0 - 190
-    float mSkillScale; // 0 - 120
-    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();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetModel() const { return mModel; }
-    inline int GetNGT() const { return mNGT; }
-    inline int GetGender() const { return mGender; }
-    inline int GetFaction() const { return mFaction; }
-    inline int GetHealth() const { return mHealth; }
-    inline int GetArmorId() const { return mArmorId; }
-    inline int GetWeaponId() const { return mWeaponId; }
-    inline const std::string &GetDialogScript() const { return mDialogScript; }
-    inline int GetCombat() const { return mCombat; }
-    inline int GetLoot() const { return mLoot; }
-    inline int GetMovementEnd() const { return mMovementEnd; }
-    inline int GetFunctionType() const { return mFunctionType; }
-    inline float GetModelScaling() const { return mModelScaling; }
-    inline int GetMoneyLoose() const { return mMoneyLoose; }
-    inline float GetSkillScale() const { return mSkillScale; }
-    inline const std::string &GetStandardScript() const { return mStandardScript; }
-    inline const std::string &GetStandardParameter() const { return mStandardParameter; }
-    inline int GetMass() const { return mMass; }
-    inline int GetFlags() const { return mFlags; }
-};
-
-#endif
-
diff --git a/server/src/game/include/def_npcarmor.h b/server/src/game/include/def_npcarmor.h
deleted file mode 100644 (file)
index 6e48e5b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 04 Apr 2009 Hammag
-*/
-
-#ifndef DEF_NPCARMOR_H
-#define DEF_NPCARMOR_H
-
-#include "def.h"
-
-class PDefNpcArmor : public PDef
-{
-  private :
-    //int mIndex;
-    int mValue[7]; // force piercing fire energy xray psi poison
-
-  public :
-    PDefNpcArmor();
-    //~PDefNpcArmor();
-
-    bool LoadFromDef ( PTokenList *Tokens );
-
-    inline int GetValue ( int nIdx ) const { return ( ( ( nIdx >= 0 ) && ( nIdx < 7 ) ) ? mValue[nIdx] : 0 ) ; }
-};
-
-#endif
diff --git a/server/src/game/include/def_npcgroupspawn.h b/server/src/game/include/def_npcgroupspawn.h
deleted file mode 100644 (file)
index 9f4f5e2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_NPCGROUPSPAWN_H
-#define DEF_NPCGROUPSPAWN_H
-
-#include "def.h"
-
-class PDefNpcGroupSpawn : public PDef
-{
-  private :
-    //int mIndex;
-    int mIgnoreNearPC;
-    int mNumNpc; // Size of the list. But that should be the size of the group...
-    int mNpcType[8];
-    std::string mScript[8];
-    std::string mScriptParameter[8];
-    int mFunctionValue[8];
-    int mSpawnChance[8];
-
-  public :
-    PDefNpcGroupSpawn();
-    //~PDefNpcGroupSpawn();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetIgnoreNearPC() const { return mIgnoreNearPC; }
-    inline int GetNumNpc() const { return mNumNpc; }
-    inline int GetNpcType(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mNpcType[nIdx] : 0) ; }
-    inline const std::string& GetScript(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mScript[nIdx] : EmptyString) ; }
-    inline const std::string& GetScriptParameter(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mScriptParameter[nIdx] : EmptyString) ; }
-    inline int GetFunctionValue(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mFunctionValue[nIdx] : 0) ; }
-    inline int GetSpawnChance(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumNpc)) ? mSpawnChance[nIdx] : 0) ; }
-};
-
-#endif
-
diff --git a/server/src/game/include/def_outposts.h b/server/src/game/include/def_outposts.h
deleted file mode 100644 (file)
index ba626f7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_OUTPOSTS_H
-#define DEF_OUTPOSTS_H
-
-#include "def.h"
-
-class PDefOutpost : public PDef
-{
-  private :
-    //int mIndex;
-    std::string mName;
-    int mType;
-    int mStandardFaction;
-    float mRevenue;
-    float mConquestReward;
-    int mMaxSecurity;
-    int mInfluenceZone[8]; // ex: 12 for zone A12, 112 for B12
-
-  public :
-    PDefOutpost();
-    //~PDefOutpost();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline const std::string &GetName() const { return mName; }
-    inline int GetType() const { return mType; }
-    inline int GetStandardFaction() const { return mStandardFaction; }
-    inline float GetRevenue() const { return mRevenue; }
-    inline float GetConquestReward() const { return mConquestReward; }
-    inline int GetMaxSecurity() const { return mMaxSecurity; }
-    inline int GetInfluenceZone(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 8)) ? mInfluenceZone[nIdx] : 0) ; }
-};
-
-#endif
-
diff --git a/server/src/game/include/def_recycles.h b/server/src/game/include/def_recycles.h
deleted file mode 100644 (file)
index b03b8ae..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_RECYCLES_H
-#define DEF_RECYCLES_H
-
-#include "def.h"
-
-class PDefRecycle : public PDef
-{
-  private :
-    //int mIndex;
-    int mResultItemId; // We use resultitem as mIndex
-    int mBuildTime;
-    int mNumParts;
-    int mPartId[8];
-
-  public :
-    PDefRecycle();
-    //~PDefRecycle();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetResultItemId() const { return mResultItemId; }
-    inline int GetBuildTime() const { return mBuildTime; }
-    inline int GetNumParts() const { return mNumParts; }
-    inline int GetPartId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumParts)) ? mPartId[nIdx] : 0 ) ; }
-};
-
-#endif
-
diff --git a/server/src/game/include/def_respawn.h b/server/src/game/include/def_respawn.h
deleted file mode 100644 (file)
index 3ede3f9..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_respawn.h\r
-\r
-       MODIFIED: 22 Sep 2006 Hammag\r
-       REASON: - Creation\r
-       \r
-*/\r
-\r
-#ifndef DEF_RESPAWN_H\r
-#define DEF_RESPAWN_H\r
-\r
-#include "def.h"\r
-\r
-class PDefRespawn : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               int mWorldID;\r
-               int mEntityID; // Station ID\r
-               int mHazardLevel;\r
-               std::string mName; // Description\r
-               std::string mFlag; // ???\r
-\r
-       public :\r
-               PDefRespawn();\r
-               //~PDefRespawn();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline int GetWorldID() const { return mWorldID; }\r
-               inline int GetEntityID() const { return mEntityID; }\r
-               inline int GetHazardLevel() const { return mHazardLevel; }\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline const std::string &GetFlag() const { return mFlag; }\r
-\r
-};\r
-\r
-\r
-class PDefRespawnsMap : public PDefMap<PDefRespawn>\r
-{\r
-  public:\r
-    int GetRespawnEntity( u32 nWorldID, u16 nGROrder ) const;\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/def_scripts.h b/server/src/game/include/def_scripts.h
deleted file mode 100644 (file)
index 04bc0b5..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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<PDefScripts>
-{
-  public:
-    //bool Load(const char* nName, const char* nFilename);
-    inline std::map<int, PDefScripts*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }
-    inline std::map<int, PDefScripts*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }
-};
-
-#endif
diff --git a/server/src/game/include/def_shots.h b/server/src/game/include/def_shots.h
deleted file mode 100644 (file)
index 128b12c..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_SHOTS_H
-#define DEF_SHOTS_H
-
-#include "def.h"
-
-class PDefShot : public PDef
-{
-  private :
-    //int mIndex;
-    int mDamageId;
-    int mMass;
-    int mRadius;
-    float mSpeed;
-    //int mHitSound;
-    //int mCustomType;
-    //std::string mCustomFrameFx;
-    //std::string mCustomHitFx;
-
-  public :
-    PDefShot();
-    //~PDefShot();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetDamageId() const { return mDamageId; }
-    inline int GetMass() const { return mMass; }
-    inline int GetRadius() const { return mRadius; }
-    inline int GetSpeed() const { return mSpeed; }
-};
-
-#endif
-
diff --git a/server/src/game/include/def_skills.h b/server/src/game/include/def_skills.h
deleted file mode 100644 (file)
index b70675b..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_skills.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef DEF_SKILLS_H\r
-#define DEF_SKILLS_H\r
-\r
-#include "def.h"\r
-\r
-class PDefSkill : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               std::string mShortName;\r
-               int mNumSubSkills;\r
-               int *mSubSkills;\r
-       public :\r
-               PDefSkill();\r
-               ~PDefSkill();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline const std::string &GetShortName() const { return mShortName; }\r
-               inline int GetNumSubSkills() const { return mNumSubSkills; }\r
-               inline int GetSubSkill(int Index) const { return mSubSkills[Index]; }\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/def_subskills.h b/server/src/game/include/def_subskills.h
deleted file mode 100644 (file)
index f7d0390..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_subskill.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef DEF_SUBSKILLS_H\r
-#define DEF_SUBSKILLS_H\r
-\r
-#include "def.h"\r
-\r
-class PDefSubSkill : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               std::string mShortName;\r
-               float mStrengthenFactor;\r
-               int mNumActionModifiers;\r
-               int *mActionModifiers;\r
-       public :\r
-               PDefSubSkill();\r
-               ~PDefSubSkill();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline const std::string &GetShortName() const { return mShortName; }\r
-               inline float GetStrengthenFactor() const { return mStrengthenFactor; }\r
-               inline int GetNumActionModifiers() const { return mNumActionModifiers; }\r
-               inline int GetActionModifier(int Index) const { return mActionModifiers[Index]; }\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/def_trader.h b/server/src/game/include/def_trader.h
deleted file mode 100644 (file)
index bbb246d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_TRADER_H
-#define DEF_TRADER_H
-
-#include "def.h"
-#define DEF_TRADER_MAXENTRIES 17
-
-class PDefTrader : public PDef
-{
-  private :
-    //int mIndex;
-    int mType;
-    float mMaxWealth;
-    float mWealthRespawn;
-    int mQuality;
-    int mItemId[DEF_TRADER_MAXENTRIES]; // <0: item group
-    float mItemPriceScale[DEF_TRADER_MAXENTRIES]; // sometime string like "1/5" ??? <=> 0.2 or Sell:1 / Buy 5 ????
-
-  public :
-    PDefTrader();
-    //~PDefTrader();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetType() const { return mType; }
-    inline float GetMaxWealth() const { return mMaxWealth; }
-    inline float GetWealthRespawn() const { return mWealthRespawn; }
-    inline int GetQuality() const { return mQuality; }
-    inline int GetItemId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < DEF_TRADER_MAXENTRIES)) ? mItemId[nIdx] : 0 ) ; }
-    inline float GetItemPriceScale(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < DEF_TRADER_MAXENTRIES)) ? mItemPriceScale[nIdx] : 0 ) ; }
-};
-/* Trader/Buyer mType
-//     1       weapons 
-//     2       ammo    
-//     3       armor   
-//     4       tools   
-//     5       psi equipment   
-//     
-//     10      chemicals       
-//     11      item parts      
-//     12      implants        
-//     13      bone enforcements       
-//     
-//     16      Buy anything    
-//     
-//     20      refreshments    
-//     21      drugs   
-//     22      medicaments     
-//     23      real estates    
-//     24      vehicles        
-//     
-*/
-#endif
-
diff --git a/server/src/game/include/def_vehicles.h b/server/src/game/include/def_vehicles.h
deleted file mode 100644 (file)
index 9ffcca2..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_VEHICLES_H
-#define DEF_VEHICLES_H
-
-#include "def.h"
-
-class PDefVhc : public PDef
-{
-  private :
-    //int mIndex; // field 1
-    int mModel;
-    std::string mName;
-    /*
-    float mLeftFront; // field 4
-    float mFront;
-    float mRightBack;
-    float mBack;
-    float mSideFriction;
-    float mDownFriction;
-    float mForwardFriction;
-    float mAcceleration;
-    float mBrakeFactor;
-    float mTurnSpeed;
-    float mFullTurnDelay;
-    int mAnimClass; // field 15
-    */
-    int mSeatId[8]; // fields 16 - 23
-    /*
-    float mSpeedTiltFactor; // field 24
-    float mSpeedGlideFactor;
-    float mMinHover;
-    float mMaxHover;
-    float mHoverLoopLen;
-    int mWheelCnt;
-    float mWheelSpeed;
-    float mMaxDive;
-    int mEffectsID;
-    int mShowDebugBouncer; // field 33
-    */
-    int mHealth;
-    int mArmor;
-    //int mSoundStartindex; // field 36
-
-    // Additionnal info
-    int mNumSeats;
-    
-  public :
-    PDefVhc();
-    //~PDefVhc();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetModel() const { return mModel; }
-    inline const std::string &GetName() const { return mName; }
-    inline int GetSeatId( int nIdx ) const { return ((( nIdx >= 0 ) && ( nIdx < 8 ) ) ? mSeatId[nIdx] : -1) ; }
-    inline int GetHealth() const { return mHealth; }
-    inline int GetArmor() const { return mArmor; }
-    inline int GetNumSeats() const { return mNumSeats; }
-};
-
-#endif
-
diff --git a/server/src/game/include/def_vehiclesits.h b/server/src/game/include/def_vehiclesits.h
deleted file mode 100644 (file)
index 310ff77..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_VEHICLESEATS_H
-#define DEF_VEHICLESEATS_H
-
-#include "def.h"
-
-class PDefVhcSeat : public PDef
-{
-  private :
-    //int mIndex; //Field 1
-    int mType;
-    std::string mName; //Field 3
-    //BasePosX Y Z
-    //BaseAngleX Y Z
-    float mLeavePos[3]; //X Y Z - Fields 10-12
-    float mLeaveAngle[3]; //X Y Z - Fields 13-15
-    //FirePosX Y Z //Field 16
-    //XLock Ylock MinX MaxX TurnSpeed ForceExternalCam ShowActor 
-    //SitBone RotXBone RotYBone WeaponBone
-    int mWeaponId; //Field 30
-    int mTL;
-    float mDamageFactor;
-    //SitAnimType SitYOffset //Field 33
-    //SitFlags
-
-  public :
-    PDefVhcSeat();
-    //~PDefVhcSeat();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetType() const { return mType; }
-    inline const std::string &GetName() const { return mName; }
-    inline float GetLeavePos(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 3)) ? mLeavePos[nIdx] : 0) ; }
-    inline float GetLeaveAngle(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 3)) ? mLeaveAngle[nIdx] : 0) ; }
-    inline int GetWeaponId() const { return mWeaponId; }
-    inline int GetTL() const { return mTL; }
-    inline float GetDamageFactor() const { return mDamageFactor; }
-};
-/*
-mType:
-0 - Driver                     (Ground vhc)
-1 - Gunner
-2 - Passenger
-3 - Driver/Gunner
-4 - Pilot                      (Flying vhc)
-5 - Pilot/Gunner               (Flying vhc)
-6 - Pilot                      (Senkrechtstarter ????)
-
-mFlags:
-1 - Winkel f�r Spieler und Waffe wird auf Fahrzeugrichtung gelockt. Zielrichtung darf nur leicht von der Fahrzeugrichtung abweichen
-2 - Spieler wird gelockt
-4 - Waffe ist nicht um X Achse drehbar
-8 - Waffe ist nicht um Y Achse drehbar
-16 - Spielermodel um 180 Grad gedreht
-*/
-#endif
-
diff --git a/server/src/game/include/def_weapons.h b/server/src/game/include/def_weapons.h
deleted file mode 100644 (file)
index bebdab7..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 29 Mar 2009 Hammag
-*/
-
-#ifndef DEF_WEAPONS_H
-#define DEF_WEAPONS_H
-
-#include "def.h"
-
-class PDefWeapon : public PDef
-{
-  private :
-    //int mIndex;
-    std::string mName;
-    //int mFpsmodel;
-    //int mAttachmodel;
-    //int mMunactor;
-    //float mDroptime; // useful ?
-    int mItemIndex;
-    //int effectcolor[3]; // R,G,B
-    //int dynamiclight;
-    //float lighttime;
-    //int soundindex;
-    //float mShotTime; // useful ?
-    int mAmmoUse;
-    int mPSIuse;
-    float mStaminaUse;
-    //float upthrow;
-    //int weaponHold; // ???
-    int mWeaponType;
-    int mDiscardable;
-    float mSkillFactor;
-    //int mintgtRad;
-    //int maxtgtRad;
-    int mMaxRange;
-    int mAggressiveWeapon;
-    float mDamageMultiplicator;
-    int mAmmoTypes[8];
-    int mAmmoStartFlags; // ???
-    //int customclasstype; // ?
-    //int unknown // ?
-    int mShotCnt;
-    //float shotduration; // maybe useful later ?
-    //std::string shotfx;
-    //float attachposx;
-    //float attachposy;
-    //float attachposz;
-    //float fpposx;
-    //float fpposy;
-    //float fpposz;
-    int mBaseWeaponId;
-    //int weaponcolor;
-    //int reloadsound;
-    int mItemModGroup;
-    int mItemModGroupFlags;
-    int mRareWeaponFx;
-
-  public :
-    PDefWeapon();
-    //~PDefWeapon();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline const std::string &GetName() const { return mName; }
-    inline int GetItemID() const { return mItemIndex; }
-    inline int GetAmmoUse() const { return mAmmoUse; }
-    inline int GetPsiUse() const { return mPSIuse; }
-    inline float GetStaminaUse() const { return mStaminaUse; }
-    inline int GetWeaponType() const { return mWeaponType; }
-    inline bool IsDiscardable() const { return mDiscardable; }
-    inline float GetSkillFactor() const { return mSkillFactor; }
-    inline int GetMaxRange() const { return mMaxRange; }
-    inline bool IsAggressiveWeapon() const { return mAggressiveWeapon; }
-    inline float GetDamageMultiplicator() const { return mDamageMultiplicator; }
-    inline int GetAmmoType(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < 8)) ? mAmmoTypes[nIdx] : 0) ; }
-    inline int GetAmmoStartFlags() const { return mAmmoStartFlags; } 
-    inline int GetShotCnt() const { return mShotCnt; }
-    inline int GetBaseWeaponId() const { return mBaseWeaponId; }
-    inline int GetItemModGroup() const { return mItemModGroup; }
-    inline int GetItemModGroupFlags() const { return mItemModGroupFlags; }
-    inline int GetRareWeaponFx() const { return mRareWeaponFx; }
-};
-
-#endif
diff --git a/server/src/game/include/def_weather.h b/server/src/game/include/def_weather.h
deleted file mode 100644 (file)
index 5d7a016..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.h
-
-    CREATED: 03 Apr 2009 Hammag
-*/
-
-#ifndef DEF_WEATHER_H
-#define DEF_WEATHER_H
-
-#include "def.h"
-//weathersectionid weathercnt weatherid length end
-class PDefWeather : public PDef
-{
-  private :
-    //int mIndex;
-    int mSectionId;
-    int mNumWeathers;
-    int mWeatherId[8];
-    int mDuration[8];
-
-  public :
-    PDefWeather();
-    //~PDefWeather();
-
-    bool LoadFromDef( PTokenList *Tokens );
-
-    inline int GetSectionId() const { return mSectionId; }
-    inline int GetNumWeathers() const { return mNumWeathers; }
-    inline int GetWeatherId(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumWeathers)) ? mWeatherId[nIdx] : 0 ) ; }
-    inline int GetDuration(int nIdx) const { return ( ((nIdx >= 0) && (nIdx < mNumWeathers)) ? mDuration[nIdx] : 0 ) ; }
-};
-
-/* mWeatherId
-//BRIGHTSKY            (1)
-//SINGLECLOUDS         (2)
-//CLOUDY               (3)
-
-//LIGHTRAIN            (4)
-//HEAVYRAIN            (5)
-//THUNDERSTORM         (6)
-
-//SNOW                 (7)
-//SANDSTORM            (8)
-//FALLOUT              (9)
-
-//SEA_BRIGHTSKY                (100)
-*/
-#endif
-
diff --git a/server/src/game/include/def_worldfile.h b/server/src/game/include/def_worldfile.h
deleted file mode 100644 (file)
index b5dfbd3..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_worldfile.h (infos from worlds/worlds.ini)\r
-\r
-       MODIFIED: 28 Sep 2007 Hammag\r
-       REASON: - Creation\r
-*/\r
-\r
-#ifndef DEF_WORLDFILE_H\r
-#define DEF_WORLDFILE_H\r
-\r
-#include "def.h"\r
-\r
-class PDefWorldFile : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName; // dat filename with ending extension and starting ./ or ./worlds/ REMOVED\r
-               bool mFileInWorldsDir; // TRUE if worlds/ must be appendend before mName to get real file name (dat file at least)\r
-               \r
-       public :\r
-               PDefWorldFile();\r
-               //~PDefWorldFile();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline const std::string GetBasicFileName() const { return (mFileInWorldsDir ? (std::string("worlds/") + mName) : mName); };\r
-};\r
-\r
-\r
-class PDefWorldFilesMap : public PDefMap<PDefWorldFile>\r
-{\r
-  public:\r
-    bool Load(const char* nName, const char* nFilename);\r
-    inline std::map<int, PDefWorldFile*>::const_iterator ConstIteratorBegin() const { return mDefs.begin(); }\r
-    inline std::map<int, PDefWorldFile*>::const_iterator ConstIteratorEnd() const { return mDefs.end(); }\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/def_worldmodels.h b/server/src/game/include/def_worldmodels.h
deleted file mode 100644 (file)
index 3d4ff27..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-       def_WorldModels.h\r
-\r
-       Created: 21 Sep 2006 Hammag\r
-       REASON: -\r
-*/\r
-\r
-#ifndef DEF_WORLDMODELS_H\r
-#define DEF_WORLDMODELS_H\r
-\r
-#include "def.h"\r
-\r
-class PDefWorldModel : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               int mUseFlags;\r
-               int mFunctionType;\r
-               int mFunctionValue;\r
-               int mHackDifficulty;\r
-               int mHackPenalty;\r
-               \r
-       public :\r
-               PDefWorldModel();\r
-               //~PDefWorldModel();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline int GetID() const { return mIndex; }\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline int GetUseFlags() const { return mUseFlags; }\r
-               inline int GetFunctionType() const { return mFunctionType; }\r
-               inline int GetFunctionValue() const { return mFunctionValue; }\r
-               inline int GetHackDifficulty() const { return mHackDifficulty; }\r
-               inline int GetHackPenalty() const { return mHackPenalty; }\r
-\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/def_worlds.h b/server/src/game/include/def_worlds.h
deleted file mode 100644 (file)
index 3b94bf6..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       def_worlds.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef DEF_WORLDS_H\r
-#define DEF_WORLDS_H\r
-\r
-#include "def.h"\r
-\r
-class PDefWorld : public PDef\r
-{\r
-       private :\r
-               //int mIndex;\r
-               std::string mName;\r
-               std::string mDatFile;\r
-               int mFlags;\r
-       public :\r
-               PDefWorld();\r
-               //~PDefWorld();\r
-\r
-               bool LoadFromDef(PTokenList *Tokens);\r
-\r
-               inline const std::string &GetName() const { return mName; }\r
-               inline const std::string &GetDatFile() const { return mDatFile; }\r
-               inline int GetFlags() const { return mFlags; }\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/defmap.h b/server/src/game/include/defmap.h
deleted file mode 100644 (file)
index 9bc5038..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.
-*/
-
-
-
-/*
- defmap.h
- Definiton of template class for def maps.
-
-    CREATED: 30 Mar 2009 Hammag
-*/
-
-template <class T> class PDefMap
-{
-  protected:
-    std::string mName;
-    std::map<int, T*> mDefs;
-
-    void Clear();
-
-  public:
-    PDefMap () {};
-    ~PDefMap ();
-
-    bool Load(const char* nName, const char* nFilename);
-    inline int GetNumDefs() const { return mDefs.size(); }
-    const T* GetDef( int Index ) const;
-};
-
-template <class T> PDefMap<T>::~PDefMap()
-{
-  Clear();
-}
-
-template <class T> void PDefMap<T>::Clear()
-{
-  for ( typename std::map<int, T*>::iterator i = mDefs.begin(); i != mDefs.end(); i++ )
-    delete i->second;
-  mDefs.clear();
-}
-
-template <class T> bool PDefMap<T>::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;
-
-  if ( parser.Parse( nFilename ) )
-  {
-    const PDefTokenList &t = parser.GetTokens();
-
-    for ( PDefTokenList::const_iterator i = t.begin(); i != t.end(); i++ )
-    {
-      T* entry = new T();
-      bool insertfail = false;
-      bool loadfail = ! entry->LoadFromDef( *i );
-
-      if ( !loadfail )
-        insertfail = ! mDefs.insert( std::make_pair( entry->GetIndex(), entry ) ).second;
-
-      if ( loadfail || insertfail )
-      {
-        if ( insertfail )
-          Console->Print( "%s %s def error (duplicate id %i): %s", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ),  mName.c_str(), entry->GetIndex(), entry->GetName().c_str() );
-        else
-          Console->Print( "%s def load error @ %i", Console->ColorText( YELLOW, BLACK, "[NOTICE]" ), mName.c_str(), nDefs + nErrors );
-        ++nErrors;
-        delete entry;
-      }
-      else
-        ++nDefs;
-    }
-  }
-  else
-  {
-    Console->Print( "%s Error loading %s defs", Console->ColorText( YELLOW, BLACK, "[WARNING]" ),  mName.c_str() );
-    return (false);
-  }
-
-  if ( nErrors > 0 )
-    Console->Print( "%s Loaded %i %s defs, %i error(s).", Console->ColorText( RED, BLACK, "[WARNING]" ), nDefs,  mName.c_str(), nErrors );
-  else
-    Console->Print( "%s Loaded %i %s defs, %i error(s).", Console->ColorText( GREEN, BLACK, "[Success]" ), nDefs,  mName.c_str(), nErrors );
-
-  return ( true );
-}
-
-template <class T> const T* PDefMap<T>::GetDef( int Index ) const
-{
-  T* Result;
-
-  typename std::map<int, T*>::const_iterator i = mDefs.find( Index );
-  Result = ( ( i != mDefs.end() ) ? i->second : NULL );
-
-  return ( Result );
-}
diff --git a/server/src/game/include/defparser.h b/server/src/game/include/defparser.h
deleted file mode 100644 (file)
index 332662c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       defparser.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef DEFPARSER_H\r
-#define DEFPARSER_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-typedef std::list<std::string> PTokenList;\r
-typedef std::list<PTokenList*> PDefTokenList;\r
-\r
-class PDefParser\r
-{\r
-       private :\r
-               PDefTokenList mTokens;\r
-       public :\r
-               PDefParser();\r
-               ~PDefParser();\r
-               bool Parse(const char *File);\r
-               inline const PDefTokenList &GetTokens() const { return mTokens; }\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/defs.h b/server/src/game/include/defs.h
deleted file mode 100644 (file)
index 64bb6ed..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       defs.h - include file for all def_* files related stuff used by all modules\r
-  \r
-       MODIFIED: 21 Sep 2006 Hammag\r
-       REASON: - created\r
-       \r
-*/\r
-\r
-#ifndef DEFS_H\r
-#define DEFS_H\r
-\r
-#include "defparser.h"\r
-#include "defmap.h"\r
-\r
-#include "def_actionmod.h"\r
-#include "def_ammo.h"\r
-#include "def_appartements.h"\r
-#include "def_appplaces.h"\r
-#include "def_blueprintpieces.h"\r
-#include "def_characters.h"\r
-#include "def_charaction.h"\r
-#include "def_charkinds.h"\r
-#include "def_damage.h"\r
-#include "def_drugs.h"\r
-#include "def_factions.h"\r
-#include "def_hack.h"\r
-#include "def_implants.h"\r
-#include "def_itemcontainer.h"\r
-#include "def_itemmod.h"\r
-#include "def_itemres.h"\r
-#include "def_items.h"\r
-#include "def_mission.h"\r
-#include "def_npcarmor.h"\r
-#include "def_npcgroupspawn.h"\r
-#include "def_npc.h"\r
-#include "def_outposts.h"\r
-#include "def_recycles.h"\r
-#include "def_respawn.h"\r
-#include "def_shots.h"\r
-#include "def_skills.h"\r
-#include "def_subskills.h"\r
-#include "def_trader.h"\r
-#include "def_vehicles.h"\r
-#include "def_vehiclesits.h"\r
-#include "def_weapons.h"\r
-#include "def_weather.h"\r
-#include "def_worlds.h"\r
-#include "def_worldfile.h"\r
-#include "def_worldmodels.h"\r
-#include "def_scripts.h"\r
-\r
-#include "gamedefs.h"\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/doortemplate.h b/server/src/game/include/doortemplate.h
deleted file mode 100644 (file)
index fc8f9d1..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-  doortemplate.h - world door template class\r
-\r
-       MODIFIED: 05 Nov 2006 Hammag\r
-       REASON: - creation\r
-       \r
-*/\r
-\r
-\r
-#ifndef DOORTEMPLATE_H\r
-#define DOORTEMPLATE_H\r
-\r
-#include "def_worldmodels.h"\r
-\r
-class PDoorTemplate\r
-{\r
-  friend class PWorldDatParser;\r
-  \r
-  private:\r
-    u16 mDoorID;\r
-\r
-    // The commented out values are not loaded from dat file atm because they are not used yet.\r
-    //u16 mUnknown1; //18 00\r
-    //u16 mUnknown1bis; //00 00 ? varies\r
-    f32 mPosY;\r
-    f32 mPosZ;\r
-    f32 mPosX;\r
-    //u16 mUnknown5; //00 00 ? second byte varies\r
-    u16 mWorldmodelID; //door type from worldmodel.def\r
-\r
-    std::string mDoorTypeName;  \r
-    int mDoorParameters[4];\r
-    bool mIsDoubleDoor;\r
-    bool mIsTriggeredDoor;\r
-    \r
-    const PDefWorldModel* mDefWorldModel;\r
-\r
-  public:\r
-    PDoorTemplate();\r
-    ~PDoorTemplate();\r
-\r
-    inline u16 GetID() { return mDoorID; }\r
-    inline u16 GetUseFlags() { return (mDefWorldModel ? mDefWorldModel->GetUseFlags() : 0); }\r
-    inline u16 GetFunctionType() { return (mDefWorldModel ? mDefWorldModel->GetFunctionType() : 0); }\r
-    inline int GetFunctionValue() { return (mDefWorldModel ?  mDefWorldModel->GetFunctionValue() : 0); }\r
-    inline const std::string& GetName() const { return (mDefWorldModel ?  mDefWorldModel->GetName() : EmptyString ); } /// !!!!\r
-    inline const PDefWorldModel* GetDefWorldModel() const { return mDefWorldModel; }\r
-    \r
-    inline void GetPos(f32* nPosX, f32* nPosY, f32* nPosZ) const { *nPosY = mPosY; *nPosZ = mPosZ; *nPosX = mPosX;}\r
-    inline u16 GetOtherDoorID() { return ( mIsDoubleDoor ? mDoorParameters[1] : 0 ); }\r
-    inline bool IsDoubleDoor() const { return mIsDoubleDoor; }\r
-    inline bool IsTriggeredDoor() const { return mIsTriggeredDoor; }\r
-    \r
-    void SetDoorTypeName(char* nDoorTypeName);\r
-    void SetDoorParameters(char* nDoorParametersString);\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/furnituretemplate.h b/server/src/game/include/furnituretemplate.h
deleted file mode 100644 (file)
index 9f84ebb..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-  furnituretemplate.h - world furniture template class\r
-\r
- MODIFIED: 04 Oct 2006 Hammag\r
- REASON: - creation\r
-\r
-*/\r
-\r
-\r
-#ifndef FURNITURETEMPLATE_H\r
-#define FURNITURETEMPLATE_H\r
-\r
-#include "def_worldmodels.h"\r
-\r
-enum // Furniture Use flags (cumlative)\r
-{\r
-  ufTouchable = 1,\r
-  ufUsable = 2,\r
-  ufNoCollision = 4,\r
-  ufChair = 8,\r
-  ufToolTarget = 16,\r
-  ufSelfCollisionBox = 64,\r
-  ufGraphicalEffect = 128,\r
-  ufNoSelectionBox = 256\r
-};\r
-\r
-class PFurnitureItemTemplate\r
-{\r
-    friend class PWorldDatParser;\r
-\r
-  private:\r
-    u32 mObjectID;\r
-\r
-    // The commented out values are not loaded from dat file atm because they are not used yet.\r
-    f32 mPosY; //= mPosY from dat file + 32000, to be coherent with char Pos scale\r
-    f32 mPosZ;\r
-    f32 mPosX;\r
-    //f32 mRotY;\r
-    f32 mRotZ;\r
-    //f32 mRotX;\r
-    //u32 mScale; //00 00 80 3F ?  = float(1.0000) scale factor ? // mostly used by holoscreens (passiv object)\r
-    //u32 mUnknown2; //01 00 00 00 ?\r
-    u16 mModelID; // points to models.ini\r
-    //u32 mUnknown3; //00 00 00 00 ?\r
-    //u32 mUnknown4; //00 00 00 00 ?\r
-    u16 mWorldmodelID; // points to worldmodel.def\r
-    //u16 mUnknown5; //12 00 ? // changes sometime (ex: c288 ...)\r
-\r
-    //f32 mBoxLowerY; //Bounding box, for use when ufSelfCollisionBox is set in mUseFlags.\r
-    //f32 mBoxLowerZ;\r
-    //f32 mBoxLowerX;\r
-    //f32 mBoxUpperY;\r
-    //f32 mBoxUpperZ;\r
-    //f32 mBoxUpperX;\r
-\r
-    u16 mFrontPosY;\r
-    u16 mFrontPosZ;\r
-    u16 mFrontPosX;\r
-    u8 mFrontLR;\r
-\r
-    const PDefWorldModel* mDefWorldModel;\r
-\r
-    u32 mLinkedObjectID; // for buttons, stores the corresponding triggered door\r
-    // fo GR, stores order of the GR entity (spawn point) to later choose from respawn.def data\r
-\r
-  public:\r
-    PFurnitureItemTemplate();\r
-    ~PFurnitureItemTemplate();\r
-\r
-    inline u32 GetID() const { return mObjectID; }\r
-    inline u16 GetUseFlags() const { return ( mDefWorldModel ? mDefWorldModel->GetUseFlags() : 0 ); }\r
-    inline u16 GetFunctionType() const { return ( mDefWorldModel ? mDefWorldModel->GetFunctionType() : 0 ); }\r
-    inline int GetFunctionValue() const{ return ( mDefWorldModel ?  mDefWorldModel->GetFunctionValue() : 0 ); }\r
-    inline const std::string& GetName() const { return ( mDefWorldModel ?  mDefWorldModel->GetName() : EmptyString ); } /// !!!!\r
-    inline const PDefWorldModel* GetDefWorldModel() const { return mDefWorldModel; }\r
-    inline u8 GetFrontLR() const { return mFrontLR; }\r
-    inline void GetFrontPos( u16* nFrontPosX, u16* nFrontPosY, u16* nFrontPosZ ) const { *nFrontPosY = mFrontPosY; *nFrontPosZ = mFrontPosZ; *nFrontPosX = mFrontPosX;}\r
-    inline void GetPos( f32* nPosX, f32* nPosY, f32* nPosZ ) const { *nPosY = mPosY; *nPosZ = mPosZ; *nPosX = mPosX;}\r
-\r
-    inline void SetLinkedObjectID( u32 nID ) { mLinkedObjectID = nID; }\r
-    inline u32 GetLinkedObjectID() const { return mLinkedObjectID; }\r
-\r
-};\r
-\r
-#endif\r
-\r
-// *** from worldmodel.def ***\r
-\r
-//function Type\r
-// 0 - none\r
-//  1 - Itemcontainer\r
-// 2 - Terminal\r
-// 3 - Outfitter\r
-// 4 - Trader\r
-// 5 - Mineral\r
-// 6 - Respawn Station\r
-// 7 - GoGuardian\r
-// 8 - Hackterminal\r
-// 9 - Appartement Eingang\r
-// 10 - Appartement Ein/Ausgang\r
-// 11 - Appartement Klingel/�ffner\r
-// 12 - Standard Button\r
-// 13 - Hack Button\r
-// 14 - HOLOMATCH ENTRANCE\r
-// 15 - HOLOMATCH EXIT\r
-// 16 - HOLOMATCH REFRESH\r
-// 17 - HOLOMATCH HEAL\r
-// 18 - WORLDCHANGEACTOR\r
-// 19 - CLANTERMINAL\r
-// 20 - DATFILE WORLDCHANGE ACTOR\r
-// 21 - LOCATION FOR 20\r
-// 22 -\r
-// 23 - EINTRITTSGELD BUTTON\r
-// 24- TUTORIALEXIT\r
-// 25 - EXPLOSIVE\r
-// 26 - Outpost Switch\r
-// 27 - Old goguardian\r
-// 28 - Fahrzeug Depot Interface\r
-// 29 - Underground Exit\r
-// 30 - Static FX (Value=Type. 1=Fire 2=Smoke 3=Steam 4=Sparkle)\r
-// 31 - Venture Warp Station\r
-// 32 - functionvalue+100 gibt eine Meldung aus der Text.ini [MISC] an.\r
-//\r
diff --git a/server/src/game/include/gamescript.h b/server/src/game/include/gamescript.h
deleted file mode 100644 (file)
index 382bbe7..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef GAMESCRIPT_H\r
-#define GAMESCRIPT_H\r
-\r
-enum PHookTypes\r
-{\r
-    HOOK_CHAT,\r
-    HOOK_TRADE,\r
-    HOOK_ZONE\r
-};\r
-\r
-class PGameScript\r
-{\r
-    private:\r
-               typedef std::map<PHookTypes, std::string> HookMap;\r
-               HookMap mHooks;\r
-\r
-    public:\r
-        PGameScript();\r
-        ~PGameScript();\r
-\r
-        bool LoadScripts();\r
-        bool Rehash();\r
-        void TriggerHook(PHookTypes hook);\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/genreplist.h b/server/src/game/include/genreplist.h
deleted file mode 100644 (file)
index 043945d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-  genreplist.h - classe for character genrep list\r
-\r
-       MODIFIED: 20 Sep 2006 Hammag\r
-       REASON: - creation\r
-       \r
-*/\r
-\r
-#ifndef GENREPLIST_H\r
-#define GENREPLIST_H\r
-\r
-#define GENREPLIST_ALLOC_SIZE 4 // atomicity of list entries allocation\r
-\r
-class PGenrepList\r
-{\r
-  private:\r
-    enum { // genrep DB Table fields\r
-        g_id = 0,\r
-        g_worldid,\r
-        g_stationid,\r
-        g_charid\r
-    };\r
-    struct PGenrepEntry\r
-    {\r
-      u16 mWorldID;\r
-      u16 mStationID;\r
-    };\r
-    \r
-    u32 mOwnerCharID;\r
-    u8 mListMaxSize;\r
-    u8 mListSize;\r
-    PGenrepEntry* mGenrepList;\r
-    \r
-    void IncreaseMaxSize(u8 nNewMax = 0);\r
-    u8 FindEntry(u16 nWorldID, u16 nStationID);\r
-    \r
-  public:\r
-    PGenrepList(u32 nOwnerCharID);\r
-    ~PGenrepList();\r
-    bool AddGenrep(u16 nWorldID, u16 nStationID);\r
-    //bool RemoveChar(u32 nBuddyCharID);    \r
-    inline u8 Count() { return mListSize; }\r
-    u16 GetListDataSize() { return (sizeof(PGenrepEntry) * mListSize); }\r
-    const void* GetListData() { return (const void*)mGenrepList; }\r
-    bool SQLLoad();\r
-//    bool SQLSave();\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/globals.h b/server/src/game/include/globals.h
deleted file mode 100644 (file)
index 634f328..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-       globals.h\r
-\r
-       MODIFIED: 12 September 2005 Akiko\r
-       REASON: - exchanged Pretender Strings by TinNS\r
-                - removed some Windows specific code\r
-       MODIFIED: 16 Dec 2005 bakkdoor\r
-       REASON: - Added global ClientManager and Chat Interface\r
-       MODIFIED: 22 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-\r
-*/\r
-\r
-#ifndef GLOBALS_H\r
-#define GLOBALS_H\r
-\r
-extern class PLuaEngine *LuaEngine;\r
-\r
-extern class ServerSocket *ServerSock;\r
-extern class PConsole *Console;\r
-//extern class PRConsole *RemoteConsole;\r
-extern class PConfig *Config;\r
-extern class PConfig *CmdAccess;\r
-\r
-extern class PGameDefs *GameDefs;\r
-extern class PFileSystem *Filesystem;\r
-extern class PServer *Server;\r
-\r
-extern class PGameServer *GameServer;\r
-extern class PChars *Chars;\r
-\r
-extern class PMsgBuilder *MsgBuilder;\r
-extern class PWorlds *Worlds;\r
-extern class PAppartements* Appartements;\r
-extern class PWorldActors* WorldActors;\r
-extern class PTerminal* Terminal;\r
-//extern class gmMachine machine;   // Virtual Machine instance\r
-\r
-//multiuser chat\r
-extern class PClientManager *ClientManager;\r
-extern class PNPCManager* NPCManager;\r
-extern class PChat *Chat;\r
-extern class PCommands *GameCommands;\r
-\r
-extern class POutpost *Outposts;\r
-extern class PMultiPart *MultiPartHandler;\r
-\r
-// Development debug output control\r
-extern bool gDevDebug;\r
-\r
-//MySQL-Support\r
-extern class PMySQL* MySQL;\r
-\r
-//Vehicles\r
-extern class PVehicles *Vehicles;\r
-extern class PSubway* Subway;\r
-\r
-//Infoserver update\r
-extern class PISC *ISC;\r
-\r
-//Empty string\r
-extern const std::string EmptyString;\r
-\r
-extern const char ServerVersion[];\r
-extern const char SVNRevision[];\r
-\r
-bool InitTinNS();\r
-void Shutdown();\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/inventory.h b/server/src/game/include/inventory.h
deleted file mode 100644 (file)
index 6c20906..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-  inventory.h - classes for inventories\r
-                  (inventory, belt, armor, implants, gogo, processor(?), maybe other containers(?) )\r
-\r
-       MODIFIED: 10 Jul 2006 Hammag\r
-       REASON: - creation\r
-\r
-\r
-*/\r
-\r
-#ifndef INVENTORY_H\r
-#define INVENTORY_H\r
-\r
-//NC containers message locations\r
-#define INV_LOC_GROUND 1\r
-#define INV_LOC_WORN 2\r
-#define INV_LOC_BACKPACK 3\r
-#define INV_LOC_BOX 4\r
-#define INV_LOC_NPCTRADE 5\r
-#define INV_LOC_GOGO 18\r
-#define INV_LOC_BOX2 255\r
-//PC-Trade window = ?\r
-\r
-//Inventory containers info\r
-#define INV_WORN_QB_START 0\r
-#define INV_WORN_QB_END 9\r
-#define INV_WORN_QB_NONE 99\r
-#define INV_WORN_QB_HAND 11\r
-\r
-#define INV_WORN_PROC_START 12\r
-#define INV_WORN_PROC_END 24\r
-\r
-#define INV_WORN_IMP_START 26\r
-#define INV_WORN_IMP_END 38\r
-\r
-#define INV_WORN_ARMOR_START 39\r
-#define INV_WORN_ARMOR_END 43\r
-\r
-#define INV_WORN_COLS 44\r
-#define INV_WORN_MAXSLOTS 44\r
-\r
-\r
-#define INV_BACKPACK_COLS 10\r
-\r
-#define INV_GOGO_COLS 5\r
-#define INV_GOGO_MAXSLOTS 50\r
-\r
-#define INV_CABINET_COLS 5\r
-#define INV_CABINET_MAXSLOTS 33\r
-\r
-// inv_loc values in database\r
-#define INV_DB_LOC_GOGO 1\r
-#define INV_DB_LOC_WORN 2\r
-#define INV_DB_LOC_BACKPACK 3\r
-\r
-class PItem;\r
-class PContainer;\r
-class PContainerWithHoles;\r
-class PContainer2DWorkaround;\r
-class PContainerAutoFindFree;\r
-\r
-class PInventory\r
-{\r
-  private:\r
-    PContainerWithHoles* mWorn; // PContainerLinearSlots\r
-    PContainer2DWorkaround* mBackpack; // PContainer2DAreas\r
-    PContainerAutoFindFree* mGogo; // PContainerLinearSlots\r
-    \r
-  public:\r
-\r
-    PInventory();\r
-    ~PInventory();\r
-    \r
-    void SetCharId(u32 CharID);\r
-    bool SQLLoad();\r
-    bool SQLSave();\r
-    PContainer* GetContainer(u8 nInvLoc);\r
-    inline PContainer2DWorkaround* GetBackpackContainer() { return mBackpack; }\r
-\r
-    bool IsDirty() const;\r
-      \r
-    bool AddItem(PItem* NewItem, u8 nInvLoc = INV_LOC_BACKPACK, u32 nInvID = 0, u8 nPosX = 0, u8 nPosY = 0, bool SetDirty = true);\r
-    //bool CheckItem(u32 ItemID, u8 StackSize = 1);\r
-    //PItem *GetItem(u32 ItemID, u8 StackSize = 1);\r
-    //PItem *GetItemByPos(u8 nPosX, u8 nPosY, u8 StackSize = 1);\r
-    //bool MoveItem(u8 oPosX, u8 oPosY, u8 dPosX, u8 dPosY);\r
-\r
-    //bool QB_IsFree(u8 nSlot);\r
-    //void QB_SetSlot(u8 nSlot, u16 nItemID);\r
-    //u16 QB_GetSlot(u8 nSlot);\r
-    //void QB_Move(u8 nSlotSRC, u8 nSlotDST);\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/item.h b/server/src/game/include/item.h
deleted file mode 100644 (file)
index aaed849..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-  item.h - item class\r
-\r
-       MODIFIED: 11 Jul 2006 Hammag\r
-       REASON: - creation\r
-       \r
-        TODO: Add CreatorID (for "named" item), CurrentMunitionID, CurrentMunitionNb (for weapons & charge-items: muns, medkit, etc.) to DB, equipped/free slots, & corresponding code\r
-*/\r
-\r
-#ifndef ITEM_H\r
-#define ITEM_H\r
-\r
-#define MAX_ITEMSTACK_SIZE 250\r
-\r
-//Type\r
-#define ITEM_TYPE_VARIOUS 0\r
-#define ITEM_TYPE_WEAPON 1\r
-#define ITEM_TYPE_AMMO 2\r
-#define ITEM_TYPE_HEALTH 3\r
-#define ITEM_TYPE_IMPLANT 4\r
-#define ITEM_TYPE_DRUG 5\r
-#define ITEM_TYPE_MOD 6\r
-#define ITEM_TYPE_GFXMOD 7\r
-#define ITEM_TYPE_BLUEPRINT 8\r
-#define ITEM_TYPE_ARMOR 9\r
-#define ITEM_TYPE_PSIMOD 10\r
-#define ITEM_TYPE_PSIMODREADY 11\r
-#define ITEM_TYPE_REPAIR 12\r
-#define ITEM_TYPE_RECYCLER 13\r
-#define ITEM_TYPE_DATACUBE 14\r
-#define ITEM_TYPE_CONSTRUCTOR 15\r
-#define ITEM_TYPE_RESEARCHER 16\r
-#define ITEM_TYPE_IMPLANTER 17\r
-#define ITEM_TYPE_APARTMENTKEY 18\r
-#define ITEM_TYPE_CLANKEY 19\r
-#define ITEM_TYPE_CASHCUBE 20\r
-#define ITEM_TYPE_AUTOWEAPON 21\r
-#define ITEM_TYPE_VHCKEY 22\r
-#define ITEM_TYPE_UNIDENTPART 24\r
-#define ITEM_TYPE_WRECKEDPART 25\r
-#define ITEM_TYPE_SALVAGE 26\r
-#define ITEM_TYPE_VHCCOMPONENT 27\r
-#define ITEM_TYPE_RECORDABLE 28\r
-\r
-                                                                                                                                               \r
-\r
-// gfxmodflags                                                                                                                                                                         \r
-#define ITEM_MOD_FLASHLIGHT 1  \r
-#define ITEM_MOD_SCOP 2\r
-#define ITEM_MOD_SILENCER 4\r
-#define ITEM_MOD_LASERPOINTER 8\r
-\r
-// itemflags:\r
-#define ITEM_FLAG_RESEARCHABLE 1\r
-#define ITEM_FLAG_NO_DROP 2\r
-#define ITEM_FLAG_NO_MAX_REPAIRE_DECAY 4\r
-#define ITEM_FLAG_AMMO 8 // for loadable ammo\r
-// not sure for ITEM_FLAG_AMMO\r
-\r
-class PItem\r
-{\r
-  friend class PContainerEntry;\r
-  friend class PMsgBuilder;\r
-\r
-  private:\r
-    u32 mItemID;\r
-    const PDefItems* mDefItem;\r
-    \r
-    bool mStackable;\r
-    u8 mStackSize;\r
-    \r
-    u32 mLoadedAmmoId;\r
-    u8 mLoadedAmmoNb;\r
-\r
-    u8 mPropertiesFlags;\r
-    \r
-    u8 mCurDuration;\r
-    u8 mMaxDuration;\r
-    u8 mDamages;\r
-    u8 mFrequency;\r
-    u8 mHandling;\r
-    u8 mRange;\r
-    \r
-    u8 mUsedSlots;\r
-    u8 mMaxSlots;\r
-    u8 mSlot[5];\r
-    u8 mModificators;\r
-    \r
-    u32 mConstructorId;\r
-    \r
-  public:\r
-    PItem(u32 ItemID, u8 nStackSize = 1, u8 CurDur = 0, u8 MaxDur = 0, u8 Dmg = 0, u8 Freq = 0, u8 Hand = 0, u8 Rng = 0);\r
-    //~PItem();\r
-    void MakeItemStandard(u8 GlobalQualityMin = 120, u8 GlobalQualityMax = 180);\r
-        \r
-    inline u32 GetItemID() {return mItemID; }\r
-    \r
-    inline int GetType() { return mDefItem->GetType(); }\r
-    inline u8 GetItemflags() { return mDefItem->GetItemflags(); }\r
-    inline const std::string &GetName() const { return mDefItem->GetName(); }\r
-    inline u8 GetSizeX() { return mDefItem->GetSizeX(); }\r
-    inline u8 GetSizeY() { return mDefItem->GetSizeY(); }\r
-    inline float GetWeight() { return mStackSize * mDefItem->GetWeight(); }\r
-    inline float GetSingleUnitWeight() { return mDefItem->GetWeight(); }\r
-    inline float GetFillWeight() { return mDefItem->GetFillWeight(); }\r
-    inline u32 GetBasePrice() { return mDefItem->GetBasePrice(); }\r
-    inline u16 GetTechlevel() { return mDefItem->GetTechlevel(); }\r
-    inline int GetValue1() { return mDefItem->GetValue1(); }\r
-    inline int GetValue2() { return mDefItem->GetValue2(); }\r
-    inline int GetValue3() { return mDefItem->GetValue3(); }\r
-    inline int GetQualifier() { return mDefItem->GetQualifier(); }        \r
-    \r
-    inline bool IsStackable() { return mDefItem->IsStackable(); }\r
-    inline u8 GetStackSize() { return mStackSize; }\r
-    u8 AddToStack(u8 ItemNb); // return the nb of items NOT added\r
-    u8 TakeFromStack(u8 ItemNb); // return the nb of retreived items        \r
-\r
-    //mItemGroupID = def->GetItemGroupID();\r
-    \r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/lua_engine.h b/server/src/game/include/lua_engine.h
deleted file mode 100644 (file)
index 0d4e146..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-TinNS (TinNS is not a Neocron Server)
-Copyright (C) 2005 Linux Addicted Community
-maintainer Akiko <akiko@gmx.org>
-
-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 <lua.h>
-  #include <lauxlib.h>
-  #include <lualib.h>
-}
-
-#define PLUAENGINE_DEFAULT      0
-#define PLUAENGINE_GETANSWER    4096
-#define PLUAENGINE_EXECUTENODE  8192
-
-class PLuaEngine
-{
-    private:
-        PClient* mTargetClient;
-
-        bool mRunning;
-        lua_State *mLua;
-
-        std::vector<int> 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
deleted file mode 100644 (file)
index eed5da4..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.
-*/
-
-/*
-
- msgbuilder.h - a classes to build NC messages
-
- CREATION: 30 Aug 2006 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#ifndef MSGBUILDER_H
-#define MSGBUILDER_H
-
-class PClient;
-class PMessage;
-class PContainerEntry;
-class PContainer;
-class PSpawnedVehicle;
-
-class PMsgBuilder
-{
-private:
-
-public:
-    PMsgBuilder() {};
-    ~PMsgBuilder() {};
-
-// Following methods for broadcasted messages do NOT include UDP_ID increment
-// when needed, nor UDP_ID / SessionID setting
-// as these must be set on a destination client basis
-    PMessage* BuildCharHelloMsg( PClient* nClient );
-    PMessage* BuildCharHealthUpdateMsg( PClient* nClient );
-    PMessage* BuildCharDeathMsg( PClient* nClient, u32 nKillerCharId = 0 );
-    PMessage* BuildCharPosUpdateMsg( PClient* nClient );
-    PMessage* BuildCharPosUpdate2Msg( PClient* nClient, u8 InfoBitfield = 0x7f );
-    //PMessage* BuildCharSittingMsg( PClient* nClient ); // Not used anymore, done by BuildCharPosUpdateMsg
-    PMessage* BuildCharExitSeatMsg( PClient* nClient );
-    PMessage* BuildDoorOpenMsg( u32 nRawItemID, bool nDoubleDoor = false );
-    PMessage* BuildCharUseSeatMsg( PClient* nClient, u32 nRawObjectId, u8 nSeatId = 0 );
-    PMessage* BuildCharShowGlowCircleMsg( PClient* nClient );
-
-    PMessage* BuildSpawnWorldObjectMsg( u16 nModelID, u16 nFunctionID, u32 nWOID, u16 nPosX, u16 nPosY, u16 nPosZ, u8 nRotX, u8 nRotY, u8 nRotZ );
-    PMessage* BuildRemoveWorldObjectMsg( u32 nWOID );
-    PMessage* BuildWeatherControlMsg( u16 nWeatherId );
-
-    PMessage* BuildSubwaySingleUpdateMsg( u32 nVehicleID, u16 nPosition, u8 nDoorOpened );
-    PMessage* BuildVhcHealthUpdateMsg( PSpawnedVehicle* nVehicle );
-    PMessage* BuildVhcPosUpdateMsg( PSpawnedVehicle* nVehicle );
-    PMessage* BuildVhcPosUpdate2Msg( PSpawnedVehicle* nVehicle );
-
-    PMessage* BuildStartWeaponReloadAnimMsg( PClient* nClient );
-    PMessage* BuildHeldItemUseMsg( u16 nUserCharLocalId, u16 nWeaponId, u32 nTargetRawItemID, u8 nAiming, u8 nTargetedHeight, u8 nScore = 0 );
-    PMessage* BuildHeldItemUse2Msg( u16 nUserCharLocalId, u32 nTargetRawItemID );
-    PMessage* BuildHeldItemUse4Msg( u16 nUserCharLocalId, u32 nTargetRawItemID, u16 nUnknown1, u16 nUnknown2, u8 nTargetedHeight );
-    PMessage* BuildHeldItemAddonActivationMsg( PClient* nClient, u8 nState );
-
-    // 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, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName);\r
-    PMessage* BuildNPCMassAliveMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction );\r
-    PMessage* BuildNPCMassUpdateMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction );\r
-    // Moved here since its a zone broadcast!\r
-    PMessage* BuildNpcCleanupMsg( u32 nNpcId, u8 nCmd = 6 ); // see implementation about nCmd\r
-
-// Following methods for unicast messages DO include UDP_ID increment and
-// UDP_ID / SessionID setting when needed (at least for now)
-    PMessage* BuildOutpostClanInfoMsg( PClient* nClient, u32 nClanID, u8 nFaction );\r
-    PMessage* BuildTryAccessAnswerMsg(PClient* nClient, char *nArea, bool nAllowed);\r
-    PMessage* BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nResultBuffer, std::string* nCommandName, u16 nNumRows, u16 nNumFields);\r
-    PMessage* BuildYouGotEmailsMsg( PClient* nClient, u8 nMailCount );\r
\r
-    PMessage* BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID, std::string *nDialogScript  );\r
-    PMessage* BuildNPCDialogReplyMsg( PClient* nClient, u16 nNextNode, std::vector<int>*nResultBuffer);\r
-    PMessage* BuildReqNPCScriptAnswerMsg( u32 nInfoId, std::string *nNPCScript );\r
-    PMessage* BuildNPCShoppingListMsg( PClient* nClient, PMessage* nContentList, int nWorldID, u8 nItemQuality);\r
-    PMessage* BuildNPCBeginAllBuyerTradeMsg( PClient* nClient, int nWorldID );\r
\r
-    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);\r
-    PMessage* BuildNPCSingleAliveMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction );\r
-    PMessage* BuildNPCSingleUpdateMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction );\r
\r
-    // NEW for testing. Combined update message\r
-    PMessage* BuildNPCUpdateMsg(u32 nWorldID, u16 nPosY, u16 nPosZ, u16 nPosX, u8 nActionBM, u16 nHealth, u8 nWeaponState, u8 nUnknown, u32 nTargetID = 0);\r
\r
-    PMessage* BuildReqInfoAnswerMsg( PClient* nClient, u16 nReqType, u32 nInfoId, void* nResponse, u16 nResponseLength );
-
-    PMessage* BuildPacket0Msg( PClient* nClient );
-    PMessage* BuildPingMsg( PClient* nClient, u32 nClientTime );
-    PMessage* BuildBaselineMsg( PClient* nClient );
-    PMessage* BuildAliveRepMsg( PClient* nClient );
-
-    PMessage* BuildZoning1Msg( PClient* nClient, u16 nEntity, u8 nUnknown = 0 );
-    PMessage* BuildZoningTCPReadyMsg();
-    PMessage* BuildSendZoneTCPMsg( u32 nLocation, std::string* nWorldName );
-    PMessage* BuildZoning2Msg( PClient* nClient, u32 nClientTime );
-    PMessage* BuildGenrepZoningMsg( PClient* nClient, u32 nLocation, u16 nEntity );
-
-    PMessage* BuildGenrepAddToListMsg( PClient* nClient, u32 nLocation, u16 nEntity );
-
-    PMessage* BuildAptLiftUseMsg( PClient* nClient, u32 nLocation, u16 nEntity, u8 nEntityType = 0 );
-    PMessage* BuildAptLiftFailedMsg( PClient* nClient );
-    PMessage* BuildChangeLocationMsg( PClient* nClient, u32 nLocation, u16 nEntity, u8 nEntityType = 0, u32 nRawItemID = 0 );
-    PMessage* BuildEntityPositionMsg( PClient* nClient, u16 pX, u16 pY, u16 pZ );
-
-    PMessage* BuildCharAptLocInfoMsg( PClient* nClient );
-
-    PMessage* BuildLevelUpMessage( PClient* nClient, u8 nMainSkill, u8 nNewLevel, u16 nFreeSkillPoints);
-    PMessage* BuildSubskillIncMsg( PClient* nClient, u8 nSubskill, u16 nSkillPoints );
-    PMessage* BuildChatAddMsg( PClient* nClient, u32 nAddedCharID, u8 nMode ); // mode = 1 for Direct, 2 for Buddy
-
-    PMessage* BuildText100Msg( PClient* nClient, u8 nTxtMsgId, u32 nRawObjectID );
-    PMessage* BuildTextIniMsg( PClient* nClient, u8 nTxtGroupID, u16 nTxtID );
-
-    PMessage* BuildCharInteractionMenuMsg( PClient* nClient, u32 nRawTargetID );
-
-    PMessage* BuildFurnitureActivateMsg( PClient* nClient, u32 nRawObjectID, u8 nActionValue );
-    PMessage* BuildCharUseFurnitureMsg( PClient* nClient, u32 nRawObjectID );
-    PMessage* BuildCharUseVhcTerminalMsg( PClient* nClient, u32 nRawObjectID );
-    PMessage* BuildCharUseGogoMsg( PClient* nClient );
-    PMessage* BuildCharUseVentureWarpMsg( PClient* nClient, u32 nRawObjectID );
-    PMessage* BuildVhcAccessRequestMsg (PClient* nClient, u32 nRequestId, u32 nRequesterCharId, u32 nRequesterLocalId, u32 nVhcRawObjectID );
-    PMessage* BuildCharUseGenrepMsg( PClient* nClient, u32 nRawObjectID, u32 nLocation, u16 nEntity );
-    PMessage* BuildCharUseLiftMsg( PClient* nClient, u32 nRawObjectID, u16 nAptPlace );
-    PMessage* BuildCharUseVhcMsg( PClient* nClient, u32 nRawObjectID, u16 nVhcType, u16 nAvailableSeats );
-
-    PMessage* BuildCharMoneyUpdateMsg( PClient* nClient, u32 nCredits );
-    PMessage* BuildUndefineduseMsg( PClient* nClient, u8 nValue );
-    PMessage* BuildCharUseQBSlotMsg2( PClient* nClient, u16 nV1 = 100, u16 nV2 = 100, u16 nV3 = 100, u16 nV4 = 100, u16 nV5 = 100, u16 nV6 = 100, u16 nV7 = 0 );
-    PMessage* BuildCharUseQBSlotMsg3( PClient* nClient, u8 nSlot );
-    PMessage* BuildCharUseQBSlotMsg4( PClient* nClient, u16 nWeaponId );
-    PMessage* BuildContainerContentList( PContainer* nContainer, u8 nLocType );
-    PMessage* BuildContainerContentEntry( PContainerEntry* nEntry, u8 nLocType );
-
-    PMessage* BuildCharOpenContainerMsg( PClient* nClient, u32 nContainerID, PContainer* nContainer );
-    PMessage* BuildItemMoveMsg( PClient* nClient, u8 nSource, u8 nSrcX, u8 nSrcY, u8 nDestination, u8 nDestX, u8 nDestY, u8 nItemCnt );
-    PMessage* BuildBoxItemMoveMsg( PClient* nClient, PContainerEntry* nEntry, u8 nSrcX, u8 nSrcY, u8 nDestination, u8 nDestX, u8 nDestY, u8 nItemCnt );
-    PMessage* BuildStartWeaponReloadMsg( PClient* nClient );
-
-    PMessage* BuildStartHackGameMsg( PClient* nClient, u32 nWorldObjID, u8 nHackDifficult );
-
-    PMessage* BuildSubwaySpawnMsg( PClient* nClient, bool IsSecondMessage );
-    //PMessage* BuildSubwayFullUpdateMsg(PClient* nClient);
-    PMessage* BuildVhcInfoMsg( PClient* nClient, PSpawnedVehicle* nVehicle );
-
-    PMessage* BuildDBRequestStatusMsg( PClient* nClient, std::string* nCommandName, u8 nStatus, u16 nErrCode );
-    PMessage* BuildDBAnswerMsg( PClient* nClient, std::string* nCommandName, std::string* nAnswerData, u16 nRows, u16 nCols );
-
-    PMessage* BuildTraderItemListMsg( PClient* nClient, u32 nTraderNpcID );
-
-    PMessage* BuildHeldItemUse3Msg(  PClient* nClient, u16 nUnknown1, u16 nUnknown2, u16 nUnknown3, u16 nUnknown4  );
-
-    PMessage* BuildCharUseTimedDrugMsg( PClient* nClient, const PDefDrug* nDrugDef, u16 nItemId );
-    PMessage* BuildCharUseInstantDrugMsg( PClient* nClient, const PDefDrug* nDrugDef );
-    PMessage* BuildCharUseRecreationUnitMsg( PClient* nClient, u32 nObjectId );
-};
-
-#endif
diff --git a/server/src/game/include/msgdecoder.h b/server/src/game/include/msgdecoder.h
deleted file mode 100644 (file)
index a1a03cf..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       msgdecoder.h - top class for NC messages decoding\r
-\r
-       CREATION: 23 Aug 2006 Hammag\r
-\r
-       MODIFIED:\r
-       REASON: -\r
-\r
-*/\r
-\r
-#ifndef MSGDECODER_H\r
-#define MSGDECODER_H\r
-\r
-struct PGameState;\r
-class PClient;\r
-class PMessage;\r
-class PUdpMsgAnalyser;\r
-\r
-#define DECODE_UNDEF 0\r
-#define DECODE_ERROR 1 // one error occured on the current decoding step\r
-#define DECODE_UNKNOWN 2 // the current decoded (sub)message is unkown\r
-#define DECODE_MORE 4 // more decoding needed for the (sub)message\r
-#define DECODE_FINISHED 8 // decoding if finished for the whole message\r
-#define DECODE_ACTION_READY 16 // an action is ready to be done\r
-#define DECODE_ACTION_DONE 32 // the action triggered hasn't to be triggered again\r
-#define DECODE_ACTION_IGNORED 64 // the action wasn't performed for some (good) reason (to combine or not with DONE)\r
-#define DECODE_ACTION_FAILED 128 // the action failed totally or partially (to combine or not with DONE)\r
-\r
-\r
-struct PMsgDecodeData\r
-{\r
-         PMessage* mMessage;\r
-         PClient* mClient;\r
-         u8 mState;\r
-         u8 mUnknownType;\r
-         bool mHandling0x13Sub;\r
-         u16 Sub0x13Start;\r
-         u16 Sub0x13StartNext;\r
-         std::stringstream mName;\r
-         std::string mErrorDetail;\r
-         bool mTraceKnownMsg;\r
-         bool mTraceUnknownMsg;\r
-         bool mTraceDump;\r
-         PGameState* mClientState; // Temporary until State is put back in Client object\r
-};\r
-\r
-// UDP Message decoder\r
-// boolean methods return true if successful\r
-\r
-class PUdpMsgDecoder\r
-{\r
-       private:\r
-    PMsgDecodeData mDecodeData;\r
-    PUdpMsgAnalyser* mCurrentAnalyser;\r
-    std::string mPacketName;\r
-    std::string mTmpName;\r
-\r
-    void Init(PMessage* nMessage, PClient* nClient);\r
-\r
-       public:\r
-         PUdpMsgDecoder();\r
-    PUdpMsgDecoder(PMessage* nMessage, PClient* nClient);\r
-    ~PUdpMsgDecoder();\r
-    \r
-    bool Analyse();\r
-    bool Analyse(PMessage* nMessage, PClient* nClient); // Can be used on non initialized or already used object\r
-    // Temporary form until State is put back in Client object\r
-    inline void Init(PMessage* nMessage, PClient* nClient, PGameState *nClientState) { mDecodeData.mClientState = nClientState; Init(nMessage, nClient); }\r
-    inline u8 GetState() { return mDecodeData.mState; }\r
-    inline bool IsError() { return (mDecodeData.mState & DECODE_ERROR); }\r
-    inline bool IsKnown() { return (!(mDecodeData.mState & DECODE_UNKNOWN)); }\r
-    inline bool MoreSubMsg() { return mDecodeData.mHandling0x13Sub; }\r
-    inline bool IsActionReady() { return (mDecodeData.mState & DECODE_ACTION_READY); }\r
-    inline bool IsActionDone() { return (mDecodeData.mState & DECODE_ACTION_DONE); }\r
-    inline bool IsTraceKnownMsg() { return mDecodeData.mTraceKnownMsg; }\r
-         inline bool IsTraceUnknownMsg() { return mDecodeData.mTraceUnknownMsg; }\r
-         inline bool IsTraceDump() { return mDecodeData.mTraceDump; }\r
-         inline void DumpMsg() { if (mDecodeData.mMessage) mDecodeData.mMessage->Dump(); }\r
-    inline std::string const &GetName() { return (mTmpName = mDecodeData.mName.str()); }\r
-    inline std::string const &GetError() { return mDecodeData.mErrorDetail; }\r
-    bool DoAction();\r
-    inline void Reset() { Init(NULL, NULL); }\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/multipart.h b/server/src/game/include/multipart.h
deleted file mode 100644 (file)
index 10f16fd..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.
-*/
-
-/*
- multipart.h - Handling of incomming multipart messages
-
- CREATION: 31 Aug 2006 Hammag
-
- MODIFIED:
- REASON: -
-*/
-
-#ifndef MULTIPART_H
-#define MULTIPART_H
-
-#define MAX_SEQUENCE_LIFE   10 // In seconds
-
-typedef struct // A single chunk of any multipart sequence
-{
-    u16 smChunkNr;
-    //u16 smChunkTotal;
-    PMessage* smChunk;
-} s_MessageChunk;
-
-typedef std::vector<s_MessageChunk> vecMsgChunk; // The vector of an specific multipart sequence, containing all chunks
-typedef struct
-{
-    time_t smTimeStamp;      // To keep track of sequence's lifetimer
-    u16 smChunkTotal;       // Total amount of chunks for this sequence
-    vecMsgChunk smvChunk;       // The chunkvector
-    PClient *smClient;      // Required to call terminal class
-} s_SequenceEntry;
-
-typedef std::map<u8, s_SequenceEntry> PMultipartMap; // Map of all vectors, indexed by sequencenumber <u8>
-
-
-class PMultiPart
-{
-  private:
-    PMultipartMap MsgMap;
-    void AssembleChunk(u16 nSequence);
-    void ProcessPacket(PClient *nClient, PMessage *tmpMsg);
-
-// Required to process packets here
-    static const u8 mMaxOptions = 7;
-    std::string mCommandName;
-    std::string mOptions[mMaxOptions];
-    u8 mOptionsCount;
-    u16 mDBId;
-// ---------------------------------
-
-  public:
-    PMultiPart();
-    ~PMultiPart();
-
-    void Update(); // Check for complete/timed out sequences
-    // Adds an multipart frame
-    void AddMultiPartChunk(PClient *nClient, PMessage *nChunk, u16 nChunkNumber, u16 nChunkTotal, u8 nSequence);
-};
-
-#endif
diff --git a/server/src/game/include/npctemplate.h b/server/src/game/include/npctemplate.h
deleted file mode 100644 (file)
index c90ac67..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
-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.
-*/
-
-
-/*
-npctemplate.h - NPC template class
-
-MODIFIED: 21 Jun 2009 Namikon
-REASON: - creation
-
-*/
-
-#ifndef NPCTEMPLATE_H
-#define NPCTEMPLATE_H
-struct s_f32coords
-{
-    f32 mX;
-    f32 mY;
-    f32 mZ;
-};
-typedef std::map<u32, s_f32coords*> PWaypointMap;
-
-class PNPCTemplate
-{
-    friend class PWorldDatParser;
-
-private:
-
-    PWaypointMap mWayPoints;
-
-    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; // Seems to be the NUMBER OF additional Coords for the NPC ("Coords" = X/Y/Z in f32, not u16!!)
-    u8        mUnknown2a;
-    u8        mUnknown2b;
-    u8        mUnknown2c;
-    u16       mTradeID;  //mUnknown3; //00 00 ?
-    u16       mUnknown4; //04 00 ?
-    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;
-    f32 mWaypoint1_Z;
-    f32 mWaypoint1_X;
-    f32 mWaypoint2_Y;
-    f32 mWaypoint2_Z;
-    f32 mWaypoint2_X;
-    f32 mWaypoint3_Y;
-    f32 mWaypoint3_Z;
-    f32 mWaypoint3_X;
-    f32 mWaypoint4_Y;
-    f32 mWaypoint4_Z;
-    f32 mWaypoint4_X;
-    f32 mWaypoint5_Y;
-    f32 mWaypoint5_Z;
-    f32 mWaypoint5_X;
-    */
-
-public:
-    PNPCTemplate();
-    ~PNPCTemplate();
-
-    void AddWayPoint(f32 nX, f32 nY, f32 nZ, u8 nID);
-    // TODO: Add GetWaypoint function
-
-    inline u32 GetUnknown1() const
-    {
-        return mUnknown1;
-    };
-    inline f32 GetPosX() const
-    {
-        return mPosY;
-    };
-    inline f32 GetPosY() const
-    {
-        return mPosZ;
-    };
-    inline f32 GetPosZ() const
-    {
-        return mPosX;
-    };
-    inline u32 GetNPCTypeID() const
-    {
-        return mNPCTypeID;
-    };
-    inline u8 GetActorStrSize() const
-    {
-        return mActorStringSize;
-    };
-    inline u8 GetAngleStrSize() const
-    {
-        return mAngleStringSize;
-    };
-    inline u16 GetNpcID() const
-    {
-        return mNpcID;
-    };
-    inline u8 GetHasAdditionalCoords() const
-    {
-        return mHasAdditionalCoords;
-    };
-    inline u8 GetUnknown2a() const
-    {
-        return mUnknown2a;
-    };
-    inline u8 GetUnknown2b() const
-    {
-        return mUnknown2b;
-    };
-    inline u8 GetUnknown2c() const
-    {
-        return mUnknown2c;
-    };
-    inline u16 /*GetUnknown3*/GetTradeID() const
-    {
-        return mTradeID;//mUnknown3;
-    };
-    inline u16 GetUnknown4() const
-    {
-        return mUnknown4;
-    };
-    inline std::string GetActorName() const
-    {
-        return mActorName;
-    };
-    inline std::string GetAngle() const
-    {
-        return mAngle;
-    };
-
-
-    inline void SetUnknown1( u32 nValue )
-    {
-        mUnknown1 = nValue;
-    };
-    inline void SetPosX( f32 nValue )
-    {
-        mPosY = nValue;
-    };
-    inline void SetPosY( f32 nValue )
-    {
-        mPosZ = nValue;
-    };
-    inline void SetPosZ( f32 nValue )
-    {
-        mPosX = nValue;
-    };
-    inline void SetNPCTypeID( u32 nValue )
-    {
-        mNPCTypeID = nValue;
-    };
-    inline void SetActorStrSize( u8 nValue )
-    {
-        mActorStringSize = nValue;
-    };
-    inline void SetAngleStrSize( u8 nValue )
-    {
-        mAngleStringSize = nValue;
-    };
-    inline void SetNpcID( u16 nValue )
-    {
-        mNpcID = nValue;
-    };
-    inline void SetHasAdditionalCoords( u8 nValue )
-    {
-        mHasAdditionalCoords = nValue;
-    };
-    inline void SetUnknown2a( u8 nValue )
-    {
-        mUnknown2a = nValue;
-    };
-    inline void SetUnknown2b( u8 nValue )
-    {
-        mUnknown2b = nValue;
-    };
-    inline void SetUnknown2c( u8 nValue )
-    {
-        mUnknown2c = nValue;
-    };
-    inline void /*SetUnknown3*/SetTradeID( u16 nValue )
-    {
-        /*mUnknown3*/mTradeID = nValue;
-    };
-    inline void SetUnknown4( u16 nValue )
-    {
-        mUnknown4 = nValue;
-    };
-    inline void SetActorName( std::string nValue )
-    {
-        mActorName = nValue;
-    };
-    inline void SetAngle( std::string nValue )
-    {
-        mAngle = nValue;
-    };
-};
-
-#endif
diff --git a/server/src/game/include/outpost.h b/server/src/game/include/outpost.h
deleted file mode 100644 (file)
index 22e5c50..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-TinNS (TinNS is not a Neocron Server)
-Copyright (C) 2005 Linux Addicted Community
-maintainer Akiko <akiko@gmx.org>
-
-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.
-*/
-
-/*
-
-outpost.h - TinNS outpost handling
-
-CREATION: 24 Oct 2009 Namikon
-
-*/
-
-class POutpost
-{
-    private:
-
-    public:
-        POutpost();
-        ~POutpost();
-
-        bool IsZoneOPArea(u32 nZoneID);     // checks if given zoneID is either outpost zone or underground of OP
-        void SendOPAreaData(PClient* nClient); // Sends OP data to client (Owning clan/faction)
-        u32 GetCurrentClan(u32 nOutpostID); // Get current ClanID of given Outpost
-};
-
diff --git a/server/src/game/include/rconsole.h b/server/src/game/include/rconsole.h
deleted file mode 100644 (file)
index 21a59dd..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       rconsole.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef RCONSOLE_H\r
-#define RCONSOLE_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-class PRConsole\r
-{\r
-       private :\r
-               typedef std::list<struct PRConClient*> ClientList;\r
-               ClientList mClients;\r
-\r
-               void ProcessClient(PRConClient* Client);\r
-               void Prompt(PRConClient *Client);\r
-       public :\r
-               PRConsole();\r
-               ~PRConsole();\r
-\r
-               void Start();\r
-               void Update();\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/server.h b/server/src/game/include/server.h
deleted file mode 100644 (file)
index 7bb29f0..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       server.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef SERVER_H\r
-#define SERVER_H\r
-\r
-class PServer\r
-{\r
-       private :\r
-               int mMaxClients;\r
-               int mGMSlots;\r
-               int mNumClients;\r
-               std::vector<PClient*> mClients;\r
-       protected :\r
-       public :\r
-               PServer();\r
-               ~PServer();\r
-\r
-               inline int GetMaxClients() const { return mMaxClients; }\r
-               inline int GetGMSlots() const { return mGMSlots; }\r
-               inline int GetNumClients() const { return mNumClients; }\r
-               int NewClient();\r
-               PClient *GetClient(int Client) const;\r
-               void Update();\r
-               void Shutdown();\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/include/sql.h b/server/src/game/include/sql.h
deleted file mode 100644 (file)
index dbb8dc2..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       sql.h - handles all mysql interactions\r
-\r
-       Authors:\r
-       - Namikon\r
-       - bakkdoor\r
-\r
-        MODIFIED: 24 Dec 2005 Namikon\r
-        REASON: - initial release by Namikon\r
-        MODIFIED: 26 Dec 2005 Namikon\r
-        REASON: - Added GetWorldDoorType() for door interaction\r
-                - Added GetWorldItemType() for item interaction\r
-                - Added FmtTxt() for printf() like parsing of text\r
-                - Added GetWorldItemOption() for item interaction\r
-        MODIFIED: 30 Dec 2005 bakkdoor\r
-        REASON: - changed mysql_init() parameter to null to prevent segfault\r
-                - added checking for dbHandle to prevent segfault\r
-        MODIFIED: 07 Jul 2006 Hammag                \r
-        REASON: - Added GetLastGameInsertId() and GetLastInfoInsertId()        \r
-        MODIFIED: 26 Jul 2006 Hammag                \r
-        REASON: - Added CheckResCount() for DB Res memory leak tracking (to be done in the main loop)\r
-                    rather than through Info/GameResQuery()\r
-                - fixed InfoDBInuse and GameDBInuse updating\r
-                - inhibited Info/GameDBInuse warning message in Info/GameResQuery()\r
-        MODIFIED: 27 Sep 2006 Hammag                \r
-        REASON: - Added GetAptLocation() method\r
-        MODIFIED: 12 Oct 2006 Hammag                \r
-        REASON: - Added Update() method\r
-                - added mKeepaliveDelay and mLastKeepaliveSent members\r
-        MODIFIED: 25 Jun 2007 Hammag\r
-        REASON: - Moved all Appartements related methods to PAppartements class\r
-                \r
-        TODO: take all non-pure SQL DB access stuff out of this class        \r
-*/\r
-\r
-#ifndef MYSQL_H\r
-#define MYSQL_H\r
-\r
-class PMySQL\r
-{\r
-    private:\r
-        int info_port;\r
-        char info_host[100];\r
-         char info_userName[100];\r
-        char info_password[100];\r
-        char info_database[100];\r
-        MYSQL *info_dbHandle;\r
-        std::time_t mKeepaliveDelay;\r
-        std::time_t mLastKeepaliveSent;\r
-\r
-        int game_port;\r
-        char game_host[100];\r
-       char game_userName[100];\r
-        char game_password[100];\r
-        char game_database[100];\r
-        MYSQL *game_dbHandle;\r
-\r
-        int GameDBInuse;\r
-        int InfoDBInuse;\r
-\r
-    public:\r
-        PMySQL();\r
-        ~PMySQL();\r
-\r
-        void Update();\r
-        void CheckResCount();\r
-        \r
-        inline MYSQL *GetInfoHandle() { return info_dbHandle; };\r
-        inline MYSQL *GetGameHandle() { return game_dbHandle; };\r
-\r
-        bool Connect();\r
-\r
-        int InfoQuery(const char *query);\r
-        MYSQL_RES *InfoResQuery(const char *query);\r
-        int GameQuery(const char *query);\r
-        MYSQL_RES *GameResQuery(const char *query);\r
-\r
-        /*int GetWorldItemType(unsigned short ID, int Location);\r
-        int GetWorldItemOption(unsigned short ID, int Location, int option);\r
-        int GetWorldDoorType(unsigned int ID, int Location);*/\r
-        \r
-        void ShowInfoSQLError();\r
-        void ShowGameSQLError();\r
-        void FreeGameSQLResult(MYSQL_RES *res);\r
-        void FreeInfoSQLResult(MYSQL_RES *res);\r
-        \r
-        inline u32 GetLastGameInsertId() { return mysql_insert_id(game_dbHandle); };\r
-        inline u32 GetLastInfoInsertId() { return mysql_insert_id(info_dbHandle); };\r
-        \r
-        u32 EscapeString(const char* nText, char* dText, u32 dMaxLength);\r
-};\r
-#endif\r
diff --git a/server/src/game/include/subway.h b/server/src/game/include/subway.h
deleted file mode 100644 (file)
index a5de337..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-  subway.h - subway class\r
-\r
-       MODIFIED: 9 Nov 2007 Hammag\r
-       REASON: - creation\r
-       \r
-*/\r
-\r
-#ifndef SUBWAY_H\r
-#define SUBWAY_H\r
-\r
-class PSubway\r
-{\r
-  friend class PMsgBuilder;\r
-\r
-  struct PSubwayInfo\r
-  {\r
-    u16 mVhcId;\r
-    u16 mPosition;\r
-    u8 mDoorOpened;\r
-    u32 mSeatUsersId[4];\r
-  };\r
-\r
-  public:\r
-    static const u16 mCabsNumber = 11;\r
-    static const u32 mCabsBaseId = 0x03f2;\r
-    static const u32 mCabsBaseHealth = 100; //should take that from .def instead...\r
-    static const u8 mStationsNumber = 8;\r
-    \r
-  private:\r
-    static const u16 mSubwayInitData [];\r
-    static const u32 mCabLoopTime;\r
-    static const u32 mCab0TimeOffset;\r
-    static const s32 mTimingAdjust;\r
-    static const u32 mCabIntervalTime;\r
-    static const u32 mOpenDoorOffset [];\r
-    static const u32 mOpenDoorDuration [];\r
-    static const char* mSubwayStationName [];\r
-    static PCharCoordinates mCabExitPositions [2][mStationsNumber];\r
-    \r
-    PSubwayInfo mSubways[mCabsNumber];\r
-\r
-public:    \r
-    bool GetInfoIndex(u32 nVhcId, u8 *Index = NULL);\r
-    \r
-  public:\r
-    PSubway();\r
-    //~PSubway();\r
-    \r
-    inline bool IsValidSubwayCab(u32 nVhcId) {return GetInfoIndex(nVhcId); }\r
-    bool UpdateInfo(u32 nVhcId, u16 nPosition, u8 nDoorOpened);\r
-    u16 GetPosition(u32 nVhcId);\r
-    \r
-    u32 GetTimeOffset(u32 nVhcId, u32 nTime);\r
-    u8 GetStation(u32 nVhcId, u32 nTime, u32* TimeOffset = NULL);\r
-    bool IsDoorOpen(u32 nVhcId, u32 nTime);\r
-    std::string* GetStationName(u8 nStationId);\r
-    bool GetStationExitPosition(PCharCoordinates* nPosition, u8 nStationId, f32 nCoef = 0.5);\r
-    \r
-    u8 GetFreeSeat(u32 nVhcId);\r
-    bool SetSeatUser(u32 nVhcId, u8 nSeat, u32 nCharId);\r
-    bool UnsetSeatUser(u32 nVhcId, u8 nSeat, u32 nCharId);\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/terminal.h b/server/src/game/include/terminal.h
deleted file mode 100644 (file)
index d94ec97..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       terminal.h - Management class for Terminal actions (Citycom, keys, vehicledepot, ...)\r
-\r
-       MODIFIED: 08 Jan 2007 Namikon\r
-       REASON: - Created\r
-\r
-*/\r
-\r
-#ifndef TERMINAL_H\r
-#define TERMINAL_H\r
-\r
-class PTerminal\r
-{\r
-    private:\r
-        void SendTryAccessAnswer(PClient* nClient, char *nArea, bool nAllowed);\r
-        char mSQLQuery[500];\r
-\r
-        int mResultFields;\r
-        void EraseVars();\r
-\r
-        char mConPrefix[50];\r
-\r
-        inline bool ChkOpt(u8 nNumOptions, u8 nReqOpt) { if(nNumOptions < nReqOpt) return false; else return true; };\r
-        bool DoStockXCheck(PClient* nClient, int nAmountEntered, int nNewAmount);\r
-\r
-    public:\r
-        PTerminal();\r
-        //~PTerminal();\r
-        // Check accesslevel of Player for various Terminal actions\r
-        bool CheckAccess(PClient* nClient, char *nArea, u16 nCmdNr, char *nOption1, char *nOption2, char *nOption3);\r
-        u8 GetNewEmailCount(PClient* nClient, bool nNoticeClient = true);\r
-        // Handle ReceiveDB queries\r
-        bool HandleQueryDB(PClient* nClient, std::string *nDBCommandName, std::string *nCommandName, std::string *nOptions, u8 nNumOptions);\r
-        bool HandleReceiveDB(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown);\r
-        bool HandleTryAccess(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown, bool nCheckOnly = false);\r
-        bool HandleUpdateDB(PClient* nClient, u16 mTerminalSessionId, std::string *nCommandName, std::string *nOptions, u8 nNumOptions, u16 nDBID, u8 nUnknown);\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/vehicle.h b/server/src/game/include/vehicle.h
deleted file mode 100644 (file)
index fb08a9a..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*\r
- TinNS (TinNS is not a Neocron Server)\r
- Copyright (C) 2005 Linux Addicted Community\r
- maintainer Akiko <akiko@gmx.org>\r
-\r
- This program is free software; you can redistribute it and/or\r
- modify it under the terms of the GNU General Public License\r
- as published by the Free Software Foundation; either version 2\r
- of the License, or (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
- vehicle.h - Vehicle handling\r
-\r
- Authors:\r
- - Namikon\r
-\r
-        MODIFIED: 08 Jan 2006 Namikon\r
-        REASON: - initial release by Namikon\r
-*/\r
-\r
-#ifndef VEHICLE_H\r
-#define VEHICLE_H\r
-\r
-class PDefVhc;\r
-\r
-class PVhcCoordinates\r
-{\r
-    friend class PSpawnedVehicle;\r
-\r
-  private:\r
-    u16 mY;     // Y-Position in world\r
-    u16 mZ;     // Z-Position in world\r
-    u16 mX;     // X-Position in world\r
-    u8 mUD;     // Up - Mid - Down (d6 - 80 - 2a) // Pitch\r
-    u16 mLR;     // Yaw\r
-    u16 mRoll;\r
-    u16 mUnknown; // Usually 0x0001\r
-    u8 mFF; // Usually 0xff ...\r
-    u8 mAct;    // Last user action state\r
-    // mAct: bit field\r
-    //0x00 = not moving\r
-    //0x01 = Left\r
-    //0x02 = Right\r
-    //0x04 = Forward\r
-    //0x08 = Back\r
-    //0x20 = Pushing down\r
-    //0x40 = Pulling up\r
-\r
-  public:\r
-    inline PVhcCoordinates() { mX = mY = mZ = mAct = 0; mUD = 128; mLR = 34683; mRoll = 32403;}\r
-\r
-    void SetPosition( u16 nY, u16 nZ, u16 nX, u8 nUD, u16 nLR, u16 nRoll, u8 nAct = 0, u16 nUnknown = 1, u8 nFF = 0xff );\r
-    void SetInterpolate( const PVhcCoordinates& Pos1, const PVhcCoordinates& Pos2, f32 nCoef );\r
-    inline u16 GetX() const { return mX; }\r
-    inline u16 GetY() const { return mY; }\r
-    inline u16 GetZ() const { return mZ; }\r
-    inline u8 GetUD() const { return mUD; }\r
-    inline u16 GetLR() const { return mLR; }\r
-    inline u16 GetRoll() const { return mRoll; }\r
-    inline u8 GetAct() const { return mAct; }\r
-    inline u8 GetUnknown() const { return mUnknown; }\r
-    inline u8 GetFF() const { return mFF; }\r
-};\r
-\r
-class PVehicleInformation\r
-{\r
-    friend class PSpawnedVehicle;\r
-    friend class PVehicles;\r
-\r
-  private:\r
-    u32 mVehicleId;\r
-    u32 mOwnerCharId;\r
-    u32 mHealth; // or f32 ???\r
-    u8 mVehicleType;\r
-    u8 mStatus; //vhcStatus 0:parking, 1:in_service, 2:destroyed\r
-\r
-  public:\r
-    inline PVehicleInformation( u32 nVehicleId = 0, u32 nOwnerCharId = 0, u32 nHealth = 0, u8 nVehicleType = 0, u8 nStatus = 0 ) :\r
-        mVehicleId( nVehicleId ),\r
-        mOwnerCharId( nOwnerCharId ),\r
-        mHealth( nHealth ),\r
-        mVehicleType( nVehicleType ),\r
-        mStatus( nStatus )\r
-    { }\r
-\r
-    inline u32 GetVehicleId() const { return mVehicleId; }\r
-    inline u32 GetOwnerCharId() const { return mOwnerCharId; }\r
-    inline u32 GetHealth() const { return mHealth; } // or f32 ???\r
-    inline u8 GetVehicleType() const { return mVehicleType; }\r
-    inline u8 GetStatus() const { return mStatus; }\r
-    bool SetStatus( u8 nStatus );\r
-\r
-    bool Load( u32 nVehicleId );\r
-    bool Save();\r
-    bool Destroy();\r
-};\r
-\r
-class PSpawnedVehicle\r
-{\r
-  private:\r
-    static const u8 mSeatsFlags[];\r
-\r
-  private:\r
-    u32 mLocalId;\r
-    PVehicleInformation mInfo;\r
-    u32 mLocation;\r
-    PVhcCoordinates mCoords;\r
-    const PDefVhc* mVhcDef;\r
-\r
-    u32 mSeatUserId[8];\r
-    u8 mFreeSeatsFlags;\r
-    u8 mNbFreeSeats;\r
-\r
-    u16 minmax[4][2]; //Temp\r
-\r
-  public:\r
-    PSpawnedVehicle( u32 nLocalId, PVehicleInformation const* nVhcInfo, u32 nLocation, PVhcCoordinates const* nVhcPos );\r
-\r
-    inline u32 GetVehicleId() const { return mInfo.mVehicleId; }\r
-    inline u32 GetLocalId() const { return mLocalId; }\r
-    inline const PVhcCoordinates& GetPosition() const { return mCoords; }\r
-    inline const PVehicleInformation& GetInformation() const { return mInfo; }\r
-    inline bool SetStatus( u8 nStatus ) { return mInfo.SetStatus( nStatus ); }\r
-\r
-    void SetLocation( u32 nLocation );\r
-    inline u32 GetLocation() const { return mLocation; }\r
-    void SetPosition( PVhcCoordinates const* nVhcPos );\r
-\r
-    inline bool Save() { return mInfo.Save(); }\r
-\r
-    int GetNumSeats() const;\r
-    inline u32 GetSeatUser( u8 nSeatId ) const { return (( nSeatId < 8 ) ? mSeatUserId[nSeatId] : 0 ); }\r
-    bool SetSeatUser( u8 nSeatId, u32 nCharId );\r
-    bool UnsetSeatUser( u8 nSeatId, u32 nCharId );\r
-    bool IsCharInside( u32 nCharId ) const;\r
-    inline u8 GetFreeSeatsFlags() const { return mFreeSeatsFlags; }\r
-    inline u8 GetNbFreeSeats() const { return mNbFreeSeats; }\r
-    u8 GetFirstFreeSeat() const;\r
-\r
-    //SetHealth(const u32 nHealth);\r
-    //u32 DoDamage(const u32 nHealthDec);\r
-    //u32 DoRepair(const u32 nHealthInc);\r
-};\r
-\r
-typedef std::map<u32, PSpawnedVehicle*> PSpawnedVhcMap;\r
-typedef std::queue<PVehicleInformation*> PVhcInfoList;\r
-class PVehicles\r
-{\r
-  private:\r
-    PSpawnedVhcMap mSpawnedVehicles;\r
-\r
-    bool RegisterSpawnedVehicle( PSpawnedVehicle*  nSpawnedVehicle );\r
-    bool UnregisterSpawnedVehicle( u32 nVehicleId );\r
-\r
-  public:\r
-    PVehicles();\r
-    ~PVehicles();\r
-\r
-    //u32 CreateVehicle(u32 nOwnerChar, u8 mVehicleType);\r
-    //bool RegisterVehicleOwner(u32 nVehiculeId, u32 nOwnerChar);\r
-    //bool DestroyVehicle(u32 nVehiculeId);\r
-    bool IsValidVehicle( u32 nVehicleId, bool nCheckOwner = false, u32 nOwnerId = 0 ) const;\r
-    inline bool IsSpawned( u32 nVehicleId ) const { return ( mSpawnedVehicles.find( nVehicleId ) != mSpawnedVehicles.end() ); }\r
-    PSpawnedVehicle* GetSpawnedVehicle( u32 nVehicleId ) const;\r
-    bool GetVehicleInfo( u32 nVehicleId, PVehicleInformation* nInfo ) const;\r
-    PSpawnedVehicle* SpawnVehicle( u32 nVehicleId, u32 nLocation, PVhcCoordinates const* nVhcPos ); // Refuses for subway zone atm\r
-    bool UnspawnVehicle( u32 nVehicleId );\r
-\r
-    PVhcInfoList* GetCharVehicles( u32 nCharId, u16 nMaxCount = 0, u16 nStartIndex = 0 );\r
-\r
-};\r
-\r
-typedef std::vector<PSpawnedVehicle*> PSpawnedVhcVector;\r
-typedef std::queue<PSpawnedVehicle*> PSpawnedVhcList;\r
-\r
-class PSpawnedVehicles\r
-{\r
-    friend class PWorld;\r
-\r
-  public:\r
-    static const u32 mVhcBaseLocalId = 0x03fd; //Vhc local Id are allocated downward from this value. Could br 0x3ff, but 0x3fe is used as "target" when shooting nowhere\r
-    static const u16 mMaxLocalVhc = 127;\r
-\r
-    inline static bool IsPotentialSpawnedVehicle( u32 nLocalId )\r
-    { return (( nLocalId <= mVhcBaseLocalId ) && (( mVhcBaseLocalId - nLocalId ) < mMaxLocalVhc ) ); }\r
-\r
-  private:\r
-    PSpawnedVhcVector mSpawnedVehicles;\r
-    u16 mNextFreeHint;\r
-    u32 mLocation;\r
-\r
-    inline void SetLocation( u32 nLocation ) { mLocation = nLocation; }\r
-\r
-  public:\r
-    PSpawnedVehicles();\r
-    ~PSpawnedVehicles();\r
-\r
-    inline bool IsSpawned( u32 nLocalId ) const { return (( nLocalId <= mVhcBaseLocalId ) && (( mVhcBaseLocalId - nLocalId ) < mSpawnedVehicles.size() ) && mSpawnedVehicles[mVhcBaseLocalId-nLocalId] ); }\r
-    PSpawnedVehicle* SpawnVehicle( PVehicleInformation const* nVhcInfo, PVhcCoordinates const* nVhcPos );\r
-    PSpawnedVehicle* GetVehicle( u32 nLocalId );\r
-    PSpawnedVehicle* GetVehicleByGlobalId( u32 nVehicleId ) const;\r
-    bool UnspawnVehicle( u32 nVehicleId );\r
-\r
-    PSpawnedVhcList* GetSpawnedVehicles() const;\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/vhcaccessrequest.h b/server/src/game/include/vhcaccessrequest.h
deleted file mode 100644 (file)
index 7769488..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-       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.h - classe for pendinf vhc access requests
-               
-
- CREATION: 14 Apr 2009 Hammag
-
-*/
-
-#ifndef VHCACCESSREQ_H
-#define VHCACCESSREQ_H
-
-class PVhcAccessRequest
-{
-       public:
-               //u32 mRequestId;
-               std::time_t mTimestamp;
-               u32 mCharId;
-               u32 mVhcGlobalId;
-               u8 mStatus; // 0: no answer yet, 1: access allowed (refused req are dropped) 2: result checked
-
-               PVhcAccessRequest();
-               PVhcAccessRequest(u32 nRequesterCharId, u32 nVhcGlobalId);
-};
-
-class PVhcAccessRequestList
-{
-       typedef std::map<u32, PVhcAccessRequest> PVhcAccessRequestMap; 
-
-       private:
-               PVhcAccessRequestMap mActiveRequests;
-               u32 mNextRequestId;
-
-               std::time_t mResponseWaitTime; // How long do we wait for owner answer
-               std::time_t mCheckWaitTime; // How long do we wait for user access check (0: remaining time from mResponseWaitTime)
-               std::time_t mReuseWaitTime; // How long do we allow user to re-use the autorization after first check
-
-               void DropTimedOut();
-
-       public:
-               PVhcAccessRequestList() ;
-               ~PVhcAccessRequestList();
-
-               void SetParameters(std::time_t nResponseWaitTime, std::time_t nCheckWaitTime, std::time_t nReuseWaitTime);
-               
-               u32 Add(u32 nRequesterCharId, u32 nVhcGlobalId);
-        bool GetInfo(u32 nRequestId, u32* oRequesterCharId, u32* oVehicleId) const;
-               bool RegisterResponse(u32 nRequestId, bool nStatus);
-               bool Check(u32 nRequestId, u32 nRequesterCharId = 0, u32 nVhcGlobalId = 0);
-};
-
-#endif
diff --git a/server/src/game/include/world_datparser.h b/server/src/game/include/world_datparser.h
deleted file mode 100644 (file)
index 5da7924..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*\r
-   TinNS (TinNS is not a Neocron Server)\r
-   Copyright (C) 2005 Linux Addicted Community\r
-   maintainer Akiko <akiko@gmx.org>\r
-\r
-   This program is free software; you can redistribute it and/or\r
-   modify it under the terms of the GNU General Public License\r
-   as published by the Free Software Foundation; either version 2\r
-   of the License, or (at your option) any later version.\r
-\r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-   GNU General Public License for more details.\r
-\r
-   You should have received a copy of the GNU General Public License\r
-   along with this program; if not, write to the Free Software\r
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-   02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-   world_datparser.h\r
-   Class to parse .dat world files\r
-\r
-   MODIFIED: 29 Sep 2006 Hammag\r
-   REASON: - Creation\r
-*/\r
-\r
-#ifndef WORLD_DATPARSER_H\r
-#define WORLD_DATPARSER_H\r
-\r
-class PFile;\r
-class PWorldDataTemplate;\r
-\r
-class PWorldDatParser\r
-{\r
-private :\r
-    PFile* f;\r
-    std::string mNCDataPath;\r
-\r
-    PWorldDataTemplate* mWorld;\r
-    bool mDiscardPassiveObjects;\r
-\r
-    bool ProcessSec2ElemType3(u32 nSize);\r
-    bool ProcessSec2ElemType5(u32 nSize);\r
-    bool ProcessSec2NPCEntry(u32 nSize);\r
-\r
-public :\r
-    PWorldDatParser();\r
-    ~PWorldDatParser();\r
-\r
-    int LoadDatFile(const std::string& nFilename, PWorldDataTemplate* nWorld, const bool nDiscardPassiveObjects = true, const bool nTestAccesOnly = false);\r
-\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/worlddatatemplate.h b/server/src/game/include/worlddatatemplate.h
deleted file mode 100644 (file)
index 6720870..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*\r
-   TinNS (TinNS is not a Neocron Server)\r
-   Copyright (C) 2005 Linux Addicted Community\r
-\r
-   This program is free software; you can redistribute it and/or\r
-   modify it under the terms of the GNU General Public License\r
-   as published by the Free Software Foundation; either version 2\r
-   of the License, or (at your option) any later version.\r
-\r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-   GNU General Public License for more details.\r
-\r
-   You should have received a copy of the GNU General Public License\r
-   along with this program; if not, write to the Free Software\r
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-   02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-  worlddatatemplate.cpp - world data template (from worlds .dat files) class\r
-\r
-   MODIFIED: 04 Oct 2006 Hammag\r
-   REASON: - creation\r
-\r
-    MODIFIED: 21 Jun 2009 Namikon\r
-    REASON: - Added NPC Template stuff\r
-\r
-*/\r
-\r
-\r
-#ifndef WORLDDATATEMPLATE_H\r
-#define WORLDDATATEMPLATE_H\r
-\r
-#define WORLDDATATEMPLATE_MAXPOSITEMS 11\r
-\r
-class PFurnitureItemTemplate;\r
-typedef std::map<u32, PFurnitureItemTemplate*> PFurnitureItemsMap;\r
-\r
-class PDoorTemplate;\r
-typedef std::map<u32, PDoorTemplate*> PDoorsMap;\r
-\r
-class PNPCTemplate;\r
-typedef std::map<u32, PNPCTemplate*> PNPCsMap;\r
-\r
-class PWorldDataTemplate\r
-{\r
-private:\r
-    std::string mName; // (datfile) relative path+filename without leading ./ or ./worlds/ nor .dat extension\r
-    std::string mBspName; // (bsp file) relative path+filename without leading ./ or ./worlds/ nor .bsp extension\r
-    PFurnitureItemsMap mFurnitureItems;\r
-    PDoorsMap mDoors;\r
-    PNPCsMap mNPCs;\r
-    PFurnitureItemTemplate* mPositionItems[WORLDDATATEMPLATE_MAXPOSITEMS];\r
-\r
-    int mUseCount;\r
-\r
-    void DatFileDataCleanup();\r
-    void SetLinkedObjects(); // This method implements some workarouds for some world objects on which we lack info.\r
-\r
-public:\r
-    PWorldDataTemplate();\r
-    ~PWorldDataTemplate();\r
-\r
-    bool LoadDatFile(const std::string& WorldTemplateName, const std::string& nFilename, const bool nTestAccesOnly = false);\r
-    inline const std::string& GetName()\r
-    {\r
-        return mName;\r
-    }\r
-    inline const std::string& GetBspName()\r
-    {\r
-        return mBspName;\r
-    }\r
-\r
-    inline void IncreaseUseCount()\r
-    {\r
-        ++mUseCount;\r
-    }\r
-    inline int DecreaseUseCount()\r
-    {\r
-        return (mUseCount ? --mUseCount : 0);\r
-    }\r
-    inline int GetUseCount()\r
-    {\r
-        return mUseCount;\r
-    }\r
-\r
-    u32 AddFurnitureItem(PFurnitureItemTemplate* nItem);\r
-    const PFurnitureItemTemplate* GetFurnitureItem(u32 ItemID);\r
-    bool getPositionItemPosition(u8 PosID, f32* pX, f32* pY, f32* pZ);\r
-\r
-    u32 AddDoor(PDoorTemplate* nDoor);\r
-    const PDoorTemplate* GetDoor(u32 DoorID);\r
-\r
-    u32 AddNPC(PNPCTemplate* nNPC);\r
-\r
-    // External functions for NPCManager\r
-    const PNPCTemplate* GetNPC(u32 NPCID);\r
-    inline const PNPCsMap *GetNPCMap() const\r
-    {\r
-        return &mNPCs;\r
-    }; // called by class PNPCWorld to get all NPCs for this world\r
-};\r
-\r
-#endif\r
diff --git a/server/src/game/include/worlds.h b/server/src/game/include/worlds.h
deleted file mode 100644 (file)
index 3906779..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- 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.h - world class and world map class
-
- MODIFIED: 06 Oct 2006 Hammag
- REASON: - creation
-
-*/
-
-
-#ifndef WORLDS_H
-#define WORLDS_H
-
-#include "worlddatatemplate.h"
-#include "vehicle.h"
-
-typedef std::map<u32, int> PChairsInUseMap;
-
-class PWorld
-{
-    friend class PWorlds;
-
-public:
-    static u16 const mZoneOutLimitOffset;
-    static u16 const mBottomZoneOutLimit;
-    static u16 const mBottomZoneInLimit;
-    static u16 const mTopZoneOutLimit;
-    static u16 const mTopZoneInLimit;
-
-private:
-    u32 mID;
-    bool mIsAppartment;
-    int mUseCount;
-    PWorldDataTemplate* mWorldDataTemplate;
-    PChairsInUseMap mChairsInUseMap;
-    PSpawnedVehicles mSpawnedVehicles;
-
-    inline void IncreaseUseCount()
-    {
-        ++mUseCount;
-    }
-    inline int DecreaseUseCount()
-    {
-        return ( mUseCount ? --mUseCount : 0 );
-    }
-    inline int GetUseCount()
-    {
-        return mUseCount;
-    }
-    bool Load( u32 nWorldID );
-
-public:
-    PWorld();
-    ~PWorld();
-
-    inline std::string GetName()
-    {
-        return ( mWorldDataTemplate ? mWorldDataTemplate->GetName() : EmptyString );
-    }
-    inline std::string GetBspName()
-    {
-        return ( mWorldDataTemplate ? mWorldDataTemplate->GetBspName() : EmptyString );
-    }
-    inline bool IsAppartment()
-    {
-        return mIsAppartment;
-    }
-    inline const PFurnitureItemTemplate* GetFurnitureItemTemplate( u32 nItemID )
-    {
-        return ( mWorldDataTemplate ? mWorldDataTemplate->GetFurnitureItem( nItemID ) : NULL ) ;
-    }
-    const PDefWorldModel* GetFurnitureItemModel( u32 nItemID );
-    inline const PDoorTemplate* GetDoor( u32 nDoorID )
-    {
-        return ( mWorldDataTemplate ? mWorldDataTemplate->GetDoor( nDoorID ) : NULL );
-    }
-    inline bool getPositionItemPosition( u8 PosID, f32* pX, f32* pY, f32* pZ )
-    {
-        return ( mWorldDataTemplate ? mWorldDataTemplate->getPositionItemPosition( PosID, pX, pY, pZ ) : false );
-    }
-
-    bool CharUseChair( int CharLocalID, u32 nItemID );
-    void CharLeaveChair( int CharLocalID, u32 nItemID );
-
-    PClient* GetClientByCharLocalId( u32 rawObjectId ) const; // returns Client if object is a PC char, and 0 if not.
-
-    inline PSpawnedVehicles* GetSpawnedVehicules()
-    {
-        return &mSpawnedVehicles;
-    }
-    bool CheckVhcNeedZoning( PVhcCoordinates const* nPos ) const;
-    u32 GetVhcZoningDestination( PSpawnedVehicle const* nVhc, PVhcCoordinates* nPos = 0 ) const;
-
-    // Evil thing... bounced through stuff :| wasnt able to find a better solution for this
-    inline const PNPCsMap       *GetNPCMap() const
-    {
-        return (mWorldDataTemplate ? mWorldDataTemplate->GetNPCMap() : NULL);
-    };
-    inline const PNPCTemplate   *GetNPCTemplate( u32 nNPCID ) const
-    {
-        return (mWorldDataTemplate ? mWorldDataTemplate->GetNPC( nNPCID ) : NULL );
-    };
-};
-
-
-typedef std::map<u32, PWorld*> PWorldsMap;
-typedef std::map<std::string, PWorldDataTemplate*> PWorldDataTemplatesMap;
-
-class PWorlds
-{
-    friend class PWorld;
-
-public:
-    static u32 const mNcSubwayWorldId;
-    static u32 const mAptBaseWorldId;
-    static u32 const mOutdoorBaseWorldId;
-    static u32 const mOutdoorWorldIdVIncrement;
-    static u8 const mOutdoorWorldmapHSize;
-    static u8 const mOutdoorWorldmapVSize;
-    static u32 const mOutdoorMaxWorldId;
-
-private:
-    bool mPreloadWorldsTemplates;
-    bool mPreloadStaticWorlds;
-
-    PWorldsMap mStaticWorldsMap; // lists all valid static worlds, with second=NULL if not loaded
-    PWorldsMap mOnDemandWorldsMap; // mostly appartments. Could be used for instance dungeons too, but instance dungeons are crap :p
-    PWorldDataTemplatesMap mWorldDataTemplatesMap;
-
-    bool LeaseWorldDataTemplate( const std::string& nBspName, const std::string& nFileName, const bool nPreloadPhase = false );
-    void ReleaseWorldDataTemplate( const std::string& nFileName );
-    void UnloadWorldDataTemplate( const std::string& nFileName );
-    PWorldDataTemplate* GetWorldDataTemplate( const std::string& nFileName );
-    PWorld* LeaseWorld( u32 nWorldID, const bool nPreloadPhase );
-
-public:
-    PWorlds();
-    ~PWorlds();
-
-    bool LoadWorlds();
-    bool IsValidWorld( u32 nWorldID ) const;
-    inline PWorld* LeaseWorld( u32 nWorldID )
-    {
-        return LeaseWorld( nWorldID, false );
-    }
-    PWorld* GetWorld( u32 nWorldID );
-    void ReleaseWorld( u32 nWorldID );
-    bool IsAppartment( u32 nWorldID );
-    inline bool IsPotentialAppartement( u32 nWorldID )
-    {
-        return ( nWorldID > PWorlds::mAptBaseWorldId );
-    }
-
-    void Update();
-    void Shutdown();
-
-    u32 GetWorldIdFromWorldmap( u8 mapH, u8 mapV ) const;  // H & V pos are 0-based
-    bool GetWorldmapFromWorldId( u32 nWorldId, u8& mapH, u8& mapV ) const;
-};
-
-#endif
diff --git a/server/src/game/include/zoning.h b/server/src/game/include/zoning.h
deleted file mode 100644 (file)
index b79007d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       zoning.h\r
-\r
-       Authors:\r
-       - Namikon\r
-\r
-       MODIFIED: XX Dec 2005 Namikon\r
-       REASON: - Initial Release\r
-       MODIFIED: 23 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 28 Jul 2005 Hammag\r
-       REASON: - changed loc parameter type from int to u32\r
-       \r
-*/\r
-\r
-#ifndef ZONING_H\r
-#define ZONING_H\r
-\r
-//void SendZone(PClient *Client, PGameState *State,int loc);\r
-void SendZone(PClient *Client, u32 loc);\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/item.cpp b/server/src/game/item.cpp
deleted file mode 100644 (file)
index ca80477..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       item.cpp - item class\r
-\r
-       MODIFIED: 11 Jul 2006 Hammag\r
-       REASON: - creation\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/item.h"\r
-#include "include/gamedefs.h"\r
-#include "include/def_items.h"\r
-\r
-\r
-PItem::PItem(u32 ItemID, u8 nStackSize, u8 CurDur, u8 MaxDur, u8 Dmg, u8 Freq, u8 Hand, u8 Rng)\r
-{\r
-  mDefItem = GameDefs->Items()->GetDef(ItemID);\r
-  if (mDefItem) {\r
-    mItemID = ItemID;\r
-    mStackable = mDefItem->IsStackable();\r
-    mStackSize = mStackable ? nStackSize : 1;\r
-\r
-    mLoadedAmmoId = 0;\r
-    mLoadedAmmoNb = 0;\r
-\r
-    mPropertiesFlags = 0;\r
-\r
-    mUsedSlots = mMaxSlots = 0;\r
-    mModificators = 0;\r
-    \r
-    mConstructorId = 0;\r
-    //mType = mDefItem->GetType();\r
-    //mValue1 = mDefItem->GetValue1();\r
-    //mValue2 = mDefItem->GetValue2();\r
-    //mValue3 = mDefItem->GetValue3();\r
-    //mSizeX = mDefItem->GetSizeX();\r
-    //mSizeY = mDefItem->GetSizeY();   \r
-    //mWeight = mDefItem->GetWeight();\r
-    //mFillWeight = mDefItem->GetFillWeight();\r
-    //mQualifier = mDefItem->GetQualifier();\r
-    //mItemGroupID = mDefItem->GetItemGroupID();       \r
-    //mBasePrice = mDefItem->GetBasePrice();\r
-    //mTechlevel = mDefItem->GetTechlevel();\r
-    //mItemflags = mDefItem->GetItemflags();\r
-\r
-    //if (!mStackable) // only non-stackable items can have quality stats (?)\r
-    //{\r
-    //  mStackSize = 1;\r
-      mCurDuration = CurDur;\r
-      mMaxDuration = MaxDur;\r
-      mDamages = Dmg;\r
-      mFrequency = Freq;\r
-      mHandling = Hand;\r
-      mRange = Rng;\r
-    //}\r
-  }\r
-  else\r
-  {\r
-    mItemID = 0;\r
-    Console->Print(YELLOW, BLACK, "PItem::PItem: Invalid item ID %d", ItemID);\r
-  }\r
-}\r
-\r
-void PItem::MakeItemStandard(u8 GlobalQualityMin, u8 GlobalQualityMax)\r
-{\r
-  if(GlobalQualityMin > GlobalQualityMax) GlobalQualityMin = GlobalQualityMax;\r
-\r
-  mCurDuration = 255;\r
-  mMaxDuration = 255;\r
-  if(GlobalQualityMin == GlobalQualityMax)\r
-  {\r
-       mDamages = GlobalQualityMin;\r
-       mFrequency = GlobalQualityMin;\r
-       mHandling = GlobalQualityMin;\r
-       mRange = GlobalQualityMin;\r
-  }\r
-  else\r
-  {\r
-       mDamages = (u8) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
-       mFrequency = (u8) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
-       mHandling = (u8) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
-       mRange = (u8) GetRandom(GlobalQualityMax, GlobalQualityMin);\r
-  }\r
-  \r
-}\r
-\r
-u8 PItem::AddToStack(u8 ItemNb) // returns nb of items not added\r
-{\r
-  u8 addedItems = 0;\r
-  if (mStackable)\r
-  {\r
-    addedItems = (ItemNb <= (MAX_ITEMSTACK_SIZE - mStackSize)) ? ItemNb : (MAX_ITEMSTACK_SIZE - mStackSize);\r
-    mStackSize += addedItems;\r
-  }\r
-  return (ItemNb - addedItems);\r
-}\r
-\r
-u8 PItem::TakeFromStack(u8 ItemNb)\r
-{\r
-  u8 retreivedItems = 0;\r
-  if (mStackable)\r
-  {\r
-       retreivedItems = std::min(mStackSize, ItemNb);\r
-       mStackSize -= retreivedItems;\r
-  }\r
-  return retreivedItems; \r
-}\r
diff --git a/server/src/game/main.cpp b/server/src/game/main.cpp
deleted file mode 100644 (file)
index 0fcb977..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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 <csignal> & 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;
-}
diff --git a/server/src/game/main.h b/server/src/game/main.h
deleted file mode 100644 (file)
index 8ee6e00..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       main.h - main include file, contains all needed includes and important definitions\r
-\r
-       MODIFIED: 31 Aug 2005 Akiko\r
-       REASON: - updating def file definitions to match the changes in gamedefs.cpp\r
-               - added define for charfiles path\r
-               - added define for database path\r
-       MODIFIED: 26 Sep 2005 Akiko\r
-       REASON: - reformated code\r
-               - added GPL\r
-               - added infoserver default port as define\r
-               - added my threading model (mutex.h, semaphore.h, thread.h)\r
-               - added basic includes pthread.h, semaphore.h and errno.h\r
-       MODIFIED: 28 Sep 2005 Akiko\r
-       REASON: - added define for game server port\r
-       MODIFIED: 30 Nov 2005 Akiko\r
-       REASON: - added chat.h for the chat part from Namikon\r
-       MODIFIED: 02 Dec 2005 Akiko\r
-       REASON: - commented out mutex.h, thread.h, semaphore.h\r
-       MODIFIED: 22 Dec 2005 Namikon/bakkdoor\r
-       REASON: - Added commands.h, skill.h, clientmanager.h\r
-       MODIFIED: 23 Dec 2005 bakkdoor\r
-       REASON: - Added <csignal> for main.cpp -> catch strg-c and shutdown nicely\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added mysql.h, sql.h for MySQL support\r
-       MODIFIED: 01 Jan 2006 Namikon\r
-       REASON: - Moved skill.h before chars.h (char.h needs skill.h now)\r
-       MODIFIED: 30 May 2006 Namikon\r
-       REASON: - Removed all useless includes to complete the server splitup; Also renamed tinns.h to main.h\r
-       MODIFIED: 6 Jul 2006 Hammag\r
-       REASON: - moved include "types.h" before include "../netcode/main.h" to permit compile\r
-       MODIFIED: 10 Jul 2006 Hammag\r
-       REASON: - added inventory.h\r
-       REASON: - added item.h\r
-       MODIFIED: 26 Jul 2006 Hammag\r
-       REASON: - removed       #define GAME_PORT which is not used anymore (now in config file)\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-               - cleaned up a bit\r
-*/\r
-\r
-#ifndef MAIN_H\r
-#define MAIN_H\r
-\r
-//#include "version.h"\r
-\r
-//basic includes\r
-#include "include/external.h"\r
-\r
-//tinns includes\r
-#include "include/types.h"\r
-#include "common/netcode.h"\r
-/*\r
-#include "../gamemonkey/gmMachine.h"\r
-#include "../gamemonkey/gmCall.h"\r
-*/\r
-#include "common/console.h"\r
-#include "common/misc.h"\r
-\r
-// MySQL Support\r
-#ifdef MYSQL_INC_DIR\r
-#include <mysql/mysql.h>\r
-#else\r
-#include <mysql.h>\r
-#endif\r
-\r
-#include "include/sql.h"\r
-\r
-#include "common/config.h"\r
-#include "common/filesystem.h"\r
-#include "include/defparser.h"\r
-\r
-#include "include/skill.h"\r
-#include "include/chars.h"\r
-#include "include/accounts.h"\r
-#include "include/client.h"\r
-#include "include/server.h"\r
-#include "include/gameserver.h"\r
-#include "include/globals.h"\r
-#include "include/defs.h"\r
-#include "include/zoning.h"\r
-#include "include/item.h"\r
-#include "include/inventory.h"\r
-#include "include/worldactors.h"\r
-#include "include/npc.h"\r
-#include "include/outpost.h"\r
-#include "include/multipart.h"\r
-#include "include/terminal.h"\r
-\r
-#include "include/lua_engine.h"\r
-#include "include/chat.h"\r
-#include "include/commands.h"\r
-#include "include/clientmanager.h"\r
-\r
-#endif\r
-\r
diff --git a/server/src/game/msgbuilder.cpp b/server/src/game/msgbuilder.cpp
deleted file mode 100644 (file)
index 285f64e..0000000
+++ /dev/null
@@ -1,3701 +0,0 @@
-/*
- TinNS (TinNS is not a Neocron Server)
- Copyright (C) 2005 Linux Addicted Community
- maintainer Akiko <akiko@gmx.org>
-
- 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.
-*/
-
-/*
-
- msgbuilder.h - a classes to build NC messages
-
- CREATION: 30 Aug 2006 Hammag
-
- MODIFIED:
- REASON: -
-
-*/
-
-#include "main.h"
-#include "include/msgbuilder.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 )
-{
-        PMessage* tmpMsg = new PMessage();
-        nClient->IncreaseUDP_ID();
-
-        *tmpMsg << (u8)0x13;
-       *tmpMsg << (u16)nClient->GetUDP_ID();
-       *tmpMsg << (u16)nClient->GetSessionID();
-       *tmpMsg << (u8)0x13; // Message length
-       *tmpMsg << (u8)0x03;
-       *tmpMsg << (u16)nClient->GetUDP_ID();
-       *tmpMsg << (u8)0x23;
-
-       //*tmpMsg << (u16)GetArgInt(2);
-       *tmpMsg << (u16)14;
-       *tmpMsg << (u8)0x00;
-       *tmpMsg << (f32)nClanID; // ClanID f32
-       *tmpMsg << (u8)nFaction;  // Faction
-       // The next 3 bytes are unknown.
-       // However, with this combination, the OP and its bonuses are
-       // set correctly; eg Own clan full bonus, friend clan 75%, etc
-       *tmpMsg << (u8)0x06; // 6? 0x06
-       *tmpMsg << (u8)0x14; // 0? 0x14
-       *tmpMsg << (u8)0x0b; // 11? 0x0b
-        *tmpMsg << (u32)nClanID; // ClanID u32
-
-        ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-        return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharHelloMsg( PClient* nClient )
-{
-    PChar *nChar = nClient->GetChar();
-    u32 nSkin, nHead, nTorso, nLegs;
-    u8 nHeadColor, nTorsoColor, nLegsColor, nHeadDarkness, nTorsoDarkness, nLegsDarkness;
-
-    nChar->GetCurrentLook( nSkin, nHead, nTorso, nLegs );
-    nChar->GetCurrentBodyColor( nHeadColor, nTorsoColor, nLegsColor, nHeadDarkness, nTorsoDarkness, nLegsDarkness );
-
-    PMessage* tmpMsg = new PMessage( );
-
-    u8 currentActiveSlot = nChar->GetQuickBeltActiveSlot();
-    u16 weaponId = 0;
-    switch ( currentActiveSlot )
-    {
-    case INV_WORN_QB_NONE:
-        //weaponId = 0;
-        break;
-    case INV_WORN_QB_HAND:
-        weaponId = 5; // <= TODO: set it somewhere
-        break;
-    default:
-        PItem* currentItem = nChar->GetInventory()->GetContainer( INV_LOC_WORN )->GetItem( INV_WORN_QB_START + currentActiveSlot );
-        //Todo : item addons & effects
-        //ItemInHandID = currentItem->GetItemID():
-        if ( currentItem )
-            weaponId = currentItem->GetValue1();
-        //else
-        //ItemInHandID = 0;
-        break;
-    }
-
-    //nClient->IncreaseUDP_ID(); // This must be done outside
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x00; // size placeholder, set later in the function
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x25;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u32 )nChar->GetID();
-
-    *tmpMsg << ( u8 )0x60; // 0x40 if current faction epic done (master), | 0x80 to display [afk] | 0x20 if LE in
-    *tmpMsg << ( u8 )(( nChar->GetSpeedOverride() == 255 ) ? 10 : nChar->GetSpeedOverride() ); // move speed, reset by client (and for him only) when getting fall damage
-    *tmpMsg << ( u8 )0x08; // ??? something to do with speed ?
-    *tmpMsg << ( u16 )weaponId; // WeaponID of the weapon in hand
-    *tmpMsg << ( u8 )0x01; // ???
-    *tmpMsg << ( u8 )0x01; // ???
-    *tmpMsg << ( u8 )( 128 + nChar->GetSoullight() );
-
-    *tmpMsg << ( u8 )nChar->GetMainRank(); // in fact, Ranks are of type s8, but it doesn't matter much
-    *tmpMsg << ( u8 )nChar->GetCombatRank();
-    *tmpMsg << ( u8 )nChar->GetFaction();
-
-    *tmpMsg << ( u8 )0x00; // This was 0x21 for an GM, with faction 0x00. However, no visible change when set...
-    *tmpMsg << ( u8 )0x0f; // size of the next bloc (skin + ?clan?)
-    // Current skin
-    *tmpMsg << ( u16 )nSkin;
-    *tmpMsg << ( u8 )nHead;
-    *tmpMsg << ( u8 )nTorso;
-    *tmpMsg << ( u8 )nLegs;
-    // Skin colors
-    *tmpMsg << ( u8 )nHeadColor;
-    *tmpMsg << ( u8 )nTorsoColor;
-    *tmpMsg << ( u8 )nLegsColor;
-    *tmpMsg << ( u8 )nHeadDarkness; // (0=bright 255=dark)
-    *tmpMsg << ( u8 )nTorsoDarkness;
-    *tmpMsg << ( u8 )nLegsDarkness;
-    *tmpMsg << ( u8 )0x00; // ??? << not sure at all // eg: 0x3e
-    *tmpMsg << ( u8 )0x00; // eg: 0x03
-    *tmpMsg << ( u8 )0x00; // eg: 0xa3
-    *tmpMsg << ( u8 )0x00; // eg: 0x03
-
-    //Name
-    *tmpMsg << ( u8 )(( nChar->GetName() ).length() + 1 );
-    *tmpMsg << ( nChar->GetName() ).c_str();
-    //Body effects
-    u8 cBodyEffect, cEffectDensity;
-    nChar->GetBodyEffect( cBodyEffect, cEffectDensity );
-    if ( cBodyEffect )
-    {
-        *tmpMsg << ( u8 )0x06; // size of effect list : 6 bytes/effect. Only one supported atm
-        *tmpMsg << ( u8 )cBodyEffect; // effect type (0=none, effecive values 1 - 17)
-        *tmpMsg << ( u8 )cEffectDensity; // density: 0=max, 0xff=min (for some effects only)
-        *tmpMsg << ( u8 )0x00; // ???
-        *tmpMsg << ( u8 )0x00; // ???
-        *tmpMsg << ( u8 )0x00; // ???
-        *tmpMsg << ( u8 )0x00; // ???
-    }
-    else
-    {
-        *tmpMsg << ( u8 )0x00; // size of empty effect list
-    }
-
-    // Clans working, yeah :D
-    u16 tClanVal = nChar->GetClan();
-    if(tClanVal > 0)
-    {
-        u8 tClanLevel = nChar->GetClanLevel();
-        u32 tmpVal;
-        tmpVal = tClanVal << 4;
-        tmpVal |= tClanLevel;
-        *tmpMsg << ( u8 )0x04;
-        *tmpMsg << ( u32 )tmpVal;
-    }
-    else
-        *tmpMsg << ( u8 )0x00; // ending null
-    // alternate interpretation to this "ending null"/optional bloc:
-    /* *tmpMsg << (u8)0x04; // size of unknown bloc ... 0x00 when empty (aka the "ending null")
-     *tmpMsg << (u8)0x0b; // vary ... ??? 0b, eb, ee, ...
-     *tmpMsg << (u8)0x44; // vary ... ???
-     *tmpMsg << (u8)0x00; // these two seem always null
-     *tmpMsg << (u8)0x00; */
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildReqNPCScriptAnswerMsg( u32 nInfoId, std::string *nNPCScript )\r
- {\r
-    PMessage* tmpMsg;\r
\r
-    tmpMsg = new PMessage();\r
\r
-    *tmpMsg << ( u8 )0x19;\r
-    *tmpMsg << ( u16 )0x0006; // InfoQuery\r
-    *tmpMsg << ( u16 )0x0003; // NPC Script\r
-    *tmpMsg << ( u32 )nInfoId;\r
-    *tmpMsg << nNPCScript->c_str();\r
\r
-    return tmpMsg;\r
\r
- }\r
\r
-PMessage* PMsgBuilder::BuildYouGotEmailsMsg( PClient* nClient, u8 nMailCount )\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();\r
-    *tmpMsg << ( u8 )0x0c;\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u8 )0x1f;\r
-    *tmpMsg << ( u16 )nClient->GetLocalID();\r
-    *tmpMsg << ( u8 )0x3d;\r
-    *tmpMsg << ( u8 )0x0c;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )nMailCount;\r
\r
-    return tmpMsg;\r
- }\r
\r
-PMessage* PMsgBuilder::BuildReceiveDBAnswerMsg( PClient* nClient, PMessage* nResultBuffer, std::string *nCommandName, u16 nNumRows, u16 nNumFields)\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
-/*    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u8 )0x2b;\r
-    *tmpMsg << ( u8 )0x1a;\r
-    if(nCommandName->length() > 0)\r
-        *tmpMsg << ( u8 )0x01;\r
-    else\r
-        *tmpMsg << ( u8 )0x00;\r
\r
-     *tmpMsg << ( u8 )0x00;\r
-     *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << *nCommandName;\r
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
\r
-    // 2nd message\r
-    *tmpMsg << ( u16 )(13 + nCommandName->length() + nResultBuffer->GetSize()); // ??\r
- */\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u8 )0x2b;\r
-    *tmpMsg << ( u8 )0x17;\r
-    *tmpMsg << ( u16 )(nCommandName->length()+1);\r
-    *tmpMsg << ( u16 )nNumRows;\r
-    *tmpMsg << ( u16 )nNumFields;\r
-    *tmpMsg << *nCommandName;\r
-    *tmpMsg << *nResultBuffer;\r
\r
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
\r
\r
-    return tmpMsg;\r
-                       //len = (unsigned int)strlen(DB);\r
-                       //SendBuffer[0] = 0x13;\r
-                       //SendBuffer[5] = 11 + len;\r
-                       //SendBuffer[6] = 0x03;\r
-                       //Network_IncrementUDP (ClientNum);\r
-                       //*(unsigned short*)&SendBuffer[7] = Client_Sockets[ClientNum].UDP_ID;\r
-       //              SendBuffer[9] = 0x2b;\r
-       //              SendBuffer[10] = 0x1a;\r
-       //              *(unsigned short*)&SendBuffer[11] = len;\r
-       //              if (num == 0)\r
-       //                      SendBuffer[13] = 0x00;\r
-       //              else\r
-       //                      SendBuffer[13] = 0x01;\r
-       //              SendBuffer[14] = 0x00;\r
-       //              SendBuffer[15] = 0x00;\r
-       //              strcpy (SendBuffer+16, DB);\r
-       //              plen = 17+len;\r
\r
-       //              SendBuffer[plen] = 13+len+slen;\r
-       //              SendBuffer[plen+1] = 0x03;\r
-       //              Network_IncrementUDP (ClientNum);\r
-       //              *(unsigned short*)&SendBuffer[plen+2] = Client_Sockets[ClientNum].UDP_ID;\r
-       //              *(unsigned short*)&SendBuffer[1] = Client_Sockets[ClientNum].UDP_ID;\r
-       //              *(unsigned short*)&SendBuffer[3] = Client_Sockets[ClientNum].UDP_ID_HIGH;\r
-       //              SendBuffer[plen+4] = 0x2b;\r
-       //              SendBuffer[plen+5] = 0x17;\r
-       //              *(unsigned short*)&SendBuffer[plen+6] = len+1;\r
-       //              *(unsigned short*)&SendBuffer[plen+8] = num;\r
-       //              *(unsigned short*)&SendBuffer[plen+10] = Fields;\r
-       //              //Fieldnum is defined in each DB below\r
-       //              strcpy (SendBuffer+plen+12, DB);\r
-       //              plen += 13+len;\r
\r
-       //              for (i=0;i<slen;i++)\r
-       //                      SendBuffer[plen+i] = TempBuffer[i];\r
\r
\r
- }\r
\r
\r
-PMessage* PMsgBuilder::BuildTryAccessAnswerMsg(PClient* nClient, char *nArea, bool nAllowed)\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
-    //u8 i = (u8)strlen(nArea);\r
\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << (u8)0x13;\r
-    *tmpMsg << (u16)nClient->GetUDP_ID();\r
-    *tmpMsg << (u16)nClient->GetSessionID();\r
-    *tmpMsg << (u8)0x00;\r
-    *tmpMsg << (u8)0x03;\r
-    *tmpMsg << (u16)nClient->GetUDP_ID();\r
-    *tmpMsg << (u8)0x2b;\r
-    *tmpMsg << (u8)0x1a;\r
-    *tmpMsg << (u16)(strlen(nArea)+1);\r
\r
-    if(nAllowed)\r
-        *tmpMsg << (u8)0x01;\r
-    else\r
-        *tmpMsg << (u8)0x00;\r
\r
-    *tmpMsg << (u8)0x00;\r
-    *tmpMsg << (u8)0x00;\r
-    *tmpMsg << nArea;\r
\r
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
-    return tmpMsg;\r
- }\r
-
-PMessage* PMsgBuilder::BuildReqInfoAnswerMsg( PClient* nClient, u16 nReqType, u32 nInfoId, void* nResponse, u16 nResponseLength )
-{
-    PMessage* tmpMsg;
-
-    tmpMsg = new PMessage( 18 + nResponseLength );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x23;
-    *tmpMsg << ( u16 )0x0006; // cmd
-    *tmpMsg << ( u16 )nReqType; // wrong size here (u32) for buffer size u16 in NeoX
-    *tmpMsg << ( u32 )nInfoId;
-    tmpMsg->Write( nResponse, nResponseLength );
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharHealthUpdateMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 14 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x30;
-    *tmpMsg << ( u8 )0x64; //Head Heath =Head HP/(3 *0.45)(with max Head HP = 45% of total)
-    *tmpMsg << ( u8 )0x64; //Body Heath =Body HP/(3 *0.35)(for max 35% of total)
-    *tmpMsg << ( u8 )0x64; //Feet Heath =Feet HP/(3 *0.20)(for max 20% of total)
-    *tmpMsg << ( u8 )0x01; // Sta/Mana ?
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharDeathMsg( PClient* nClient, u32 nKillerCharId )
-{
-    PMessage* tmpMsg = new PMessage( 17 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x16;
-    *tmpMsg << ( u32 )nKillerCharId;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharPosUpdateMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 32 );
-    PChar* nChar = nClient->GetChar();
-
-    u32 cSeatObjectId;
-    u8 cSeatId;
-    PSeatType cSeatType = nChar->GetSeatInUse( &cSeatObjectId, &cSeatId );
-    if ( cSeatType == seat_chair )   // temp ! Must migrate to RAW
-    {
-        cSeatObjectId = ( cSeatObjectId + 1 ) * 1024;
-    }
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x1b;
-    *tmpMsg << ( u32 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x03;
-    if ( cSeatType )
-    {
-        *tmpMsg << ( u32 )cSeatObjectId;
-        *tmpMsg << ( u16 )cSeatId; // testing... else 0x0000
-    }
-    else
-    {
-        *tmpMsg << ( u16 )(( nChar->Coords ).mY );
-        *tmpMsg << ( u16 )(( nChar->Coords ).mZ );
-        *tmpMsg << ( u16 )(( nChar->Coords ).mX );
-    }
-    *tmpMsg << ( u16 )( 31910 + ( nChar->Coords ).mUD - 50 );  // Up - Mid - Down  mUD=(d6 - 80 - 2a) NeoX original offset: 31910
-    *tmpMsg << ( u16 )( 31820 + ( nChar->Coords ).mLR*2 - 179 ); // Compass direction mLR=(S..E..N..W..S [0-45-90-135-179]) There still is a small buggy movement when slowly crossing the South axis from the right
-    if ( cSeatType )
-    {
-        *tmpMsg << ( u8 )0x00;
-        *tmpMsg << ( u8 )0x10;
-    }
-    else
-    {
-        *tmpMsg << ( u8 )(( nChar->Coords ).mAct );
-        *tmpMsg << ( u8 )0x00;
-    }
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharPosUpdate2Msg( PClient* nClient, u8 InfoBitfield )
-{
-    PMessage* tmpMsg = new PMessage( 32 );
-    PChar* nChar = nClient->GetChar();
-
-    if ( InfoBitfield == 0x80 )
-    {
-        Console->Print( RED, BLACK, "[ERROR] PMsgBuilder::BuildCharPosUpdate2Msg : using InfoBitfield=0x80 forbidden. Using 0x7f instead." );
-        InfoBitfield = 0x7f;
-    }
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x20;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )InfoBitfield;
-
-    if ( InfoBitfield & 0x01 )
-    {
-        *tmpMsg << ( u16 )(( nChar->Coords ).mY );
-    }
-    if ( InfoBitfield & 0x02 )
-    {
-        *tmpMsg << ( u16 )(( nChar->Coords ).mZ );
-    }
-    if ( InfoBitfield & 0x04 )
-    {
-        *tmpMsg << ( u16 )(( nChar->Coords ).mX );
-    }
-    if ( InfoBitfield & 0x08 )
-    {
-        *tmpMsg << ( u8 )(( nChar->Coords ).mUD );
-    }
-    if ( InfoBitfield & 0x10 )
-    {
-        *tmpMsg << ( u8 )(( nChar->Coords ).mLR );
-    }
-    if ( InfoBitfield & 0x20 )
-    {
-        *tmpMsg << ( u8 )(( nChar->Coords ).mAct );
-    }
-    /*if(InfoBitfield & 0x40) // Not used (?)
-    {
-      *tmpMsg << (u8)((nChar->Coords).mUnknown);
-    }*/
-    /*if(InfoBitfield & 0x80) // mRoll ????
-    {
-      *tmpMsg << (u8)((nChar->Coords).mUnknown);
-    }*/
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-/*
-PMessage* PMsgBuilder::BuildCharSittingMsg( PClient* nClient )
-{
-  PMessage* tmpMsg = new PMessage( 24 );
-  PChar* nChar = nClient->GetChar();
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-  *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-  *tmpMsg << ( u8 )0x00; // Message length placeholder;
-  *tmpMsg << ( u8 )0x32;
-  *tmpMsg << ( u16 )nClient->GetLocalID();
-  *tmpMsg << ( u8 )0x00; // Type = chair/subway ???
-  *tmpMsg << ( u8 )0x00;
-  *tmpMsg << ( u8 )0x03; // Type = chair ???
-  *tmpMsg << ( u16 )(( nChar->Coords ).mY );
-  *tmpMsg << ( u16 )(( nChar->Coords ).mZ );
-  *tmpMsg << ( u16 )(( nChar->Coords ).mX );
-  *tmpMsg << ( u16 )( 31910 + ( nChar->Coords ).mUD - 50 );  // Up - Mid - Down  mUD=(d6 - 80 - 2a) NeoX original offset: 31910
-  *tmpMsg << ( u16 )( 31820 + ( nChar->Coords ).mLR*2 - 179 ); // Compass direction mLR=(S..E..N..W..S [0-45-90-135-179]) There still is a small buggy movement when slowly crossing the South axis from the right
-  *tmpMsg << ( u8 )(( nChar->Coords ).mAct );
-  *tmpMsg << ( u8 )0x00;
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-  return tmpMsg;
-}
-*/
-
-PMessage* PMsgBuilder::BuildCharUseSeatMsg( PClient* nClient, u32 nRawObjectId, u8 nSeatId )
-{
-    PMessage* tmpMsg = new PMessage( 18 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // nClient->GetUDP_ID() placeholder
-    *tmpMsg << ( u16 )0x0000; // nClient->GetSessionID()placeholder
-
-    *tmpMsg << ( u8 )0x0c; // Sub message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // ++ nClient->GetUDP_ID() placeholder
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x21;
-    *tmpMsg << ( u32 )nRawObjectId;
-    *tmpMsg << ( u8 )nSeatId; // 0x00 for real chair, 1+ for subway cab
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharExitSeatMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 22 );
-    PChar* nChar = nClient->GetChar();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // nClient->GetUDP_ID() placeholder
-    *tmpMsg << ( u16 )0x0000; // nClient->GetSessionID()placeholder
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // nClient->GetUDP_ID() placeholder
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x22;
-    *tmpMsg << ( u16 )(( nChar->Coords ).mY + 768 ) ;
-    *tmpMsg << ( u16 )(( nChar->Coords ).mZ + 768 ) ;
-    *tmpMsg << ( u16 )(( nChar->Coords ).mX + 768 ) ;
-    *tmpMsg << ( u8 )( nChar->Coords ).mUD;
-    *tmpMsg << ( u8 )( nChar->Coords ).mLR;
-    *tmpMsg << ( u8 )( nChar->Coords ).mAct;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildPacket0Msg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 70 );
-    PChar* nChar = nClient->GetChar();
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x2c;
-    *tmpMsg << ( u8 )0x01; // ??
-    *tmpMsg << ( u8 )0x01; // ??
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( f32 )(( nChar->Coords ).mY - 32000 );
-    *tmpMsg << ( f32 )(( nChar->Coords ).mZ - 32000 );
-    *tmpMsg << ( f32 )(( nChar->Coords ).mX - 32000 );
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u8 )0x01; // ????
-    *tmpMsg << ( u8 )0x00;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u8 )0x07;
-    *tmpMsg << ( u8 )0x02;
-    *tmpMsg << ( u8 )0x00;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u32 )0x00000000;
-
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildPingMsg( PClient* nClient, u32 nClientTime )
-{
-    PMessage* tmpMsg = new PMessage( 15 );
-    u32 LocalTime = GameServer->GetGameTime();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x0b;
-    *tmpMsg << ( u32 )LocalTime;
-    *tmpMsg << ( u32 )nClientTime;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildBaselineMsg( PClient* nClient )
-{
-    PMessage* BaselineMsg = new PMessage( 512 );
-    PMessage SectionMsg( 256 );
-
-    PChar *nChar = nClient->GetChar();
-    const PDefCharKind *def = GameDefs->CharKinds()->GetDef( nChar->GetProfession() );
-    PSkillHandler *Skill = nChar->Skill;
-
-    nClient->IncreaseTransactionID( 3 );
-
-    // Head
-    *BaselineMsg << ( u8 )0x22;
-    *BaselineMsg << ( u8 )0x02; // ?
-    *BaselineMsg << ( u8 )0x01; // ?
-
-    // ---- Section 1 ----
-    *BaselineMsg << ( u8 )0x01; // section id
-
-    SectionMsg << ( u8 )0xfa; // ?  // // section content at offset 3
-    SectionMsg << ( u8 )nChar->GetProfession();
-    SectionMsg << ( u16 )nClient->GetTransactionID(); // Transaction ID ? 0x8aa0
-    SectionMsg << ( u32 )nChar->GetID();
-    SectionMsg << ( u8 )0x0e; // ? 0x0e in NeoX, 0x10 in Tinns ... doesn't seem to matter
-    SectionMsg << ( u8 )0x00; // ?
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 2 ----
-    *BaselineMsg << ( u8 )0x02; // section id
-    SectionMsg << ( u8 )0x04; // ?  // section content at offset 3
-    SectionMsg << ( u8 )0x50; // ?
-    SectionMsg << ( u16 )500; // nChar->GetHealth();
-    SectionMsg << ( u16 )500; // nChar->GetMaxHealth();
-    SectionMsg << ( u16 )500; // nChar->GetMana();
-    SectionMsg << ( u16 )500; // nChar->GetMaxMana();
-    SectionMsg << ( u16 )500; // nChar->GetStamina();
-    SectionMsg << ( u16 )500; // nChar->GetMaxStamina();
-    SectionMsg << ( u16 )0x00ff; // ?
-    SectionMsg << ( u16 )0x00ff; // ?
-    SectionMsg << ( u16 )0x00e1; // (nChar->GetHealth() + 1); // ? Probably Head Health (45% of total) 0x0065
-    SectionMsg << ( u16 )0x0147; // (nChar->GetHealth() + 1); // ? Torso Health (35% of total)
-    SectionMsg << ( u16 )0x0147; // (nChar->GetHealth() + 1); // ? Legs Health (20% of total)
-    SectionMsg << ( u8 )100; // 100 - SI
-    SectionMsg << ( u8 )0x80; // The lower this value is, the more your char has a "drug effect" on it 0x00 = unmoveable
-    SectionMsg << ( u16 )0x0000;
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 3 ----
-    *BaselineMsg << ( u8 )0x03; // section id
-
-    SectionMsg << ( u8 )0x06; // ?  // section content at offset 3
-    SectionMsg << ( u8 )0x09; // ?
-    SectionMsg << ( u32 )0x00000000; // ?
-    SectionMsg << ( u32 )0x00000000; // ?
-    SectionMsg << ( u8 )0x01; // ?
-
-    SectionMsg << ( u8 )Skill->GetMainSkill( MS_STR );
-    SectionMsg << ( u16 )Skill->GetSP( MS_STR );
-    SectionMsg << ( u32 )Skill->GetXP( MS_STR );
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_STR ).mGrow;
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_STR ).mMax;
-
-    SectionMsg << ( u8 )Skill->GetMainSkill( MS_DEX );
-    SectionMsg << ( u16 )Skill->GetSP( MS_DEX );
-    SectionMsg << ( u32 )Skill->GetXP( MS_DEX );
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_DEX ).mGrow;
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_DEX ).mMax;
-
-    SectionMsg << ( u8 )Skill->GetMainSkill( MS_CON );
-    SectionMsg << ( u16 )Skill->GetSP( MS_CON );
-    SectionMsg << ( u32 )Skill->GetXP( MS_CON );
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_CON ).mGrow;
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_CON ).mMax;
-
-    SectionMsg << ( u8 )Skill->GetMainSkill( MS_INT );
-    SectionMsg << ( u16 )Skill->GetSP( MS_INT );
-    SectionMsg << ( u32 )Skill->GetXP( MS_INT );
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_INT ).mGrow;
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_INT ).mMax;
-
-    SectionMsg << ( u8 )Skill->GetMainSkill( MS_PSI );
-    SectionMsg << ( u16 )Skill->GetSP( MS_PSI );
-    SectionMsg << ( u32 )Skill->GetXP( MS_PSI );
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_PSI ).mGrow;
-    SectionMsg << ( u8 )def->GetSkillInfo( MS_PSI ).mMax;
-
-    SectionMsg << ( u16 )0x0000; // ?
-    SectionMsg << ( u8 )0x00; // ?
-    SectionMsg << ( u8 )0x08; // ?
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 4 ----
-    *BaselineMsg << ( u8 )0x04; // section id
-
-    SectionMsg << ( u8 )0x2e; // ?  // section content at offset 3
-    SectionMsg << ( u8 )0x02; // ?
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_MC );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_MC );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_HC );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_HC );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_TRA );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_TRA );
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_PC );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_PC );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_RC );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_RC );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_TC );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_TC );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_VHC );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_VHC );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_AGL );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_AGL );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_REP );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_REP );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_REC );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_REC );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_RCL );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_RCL );
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_ATL );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_ATL );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_END );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_END );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_FOR );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_FOR );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_FIR );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_FIR );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_ENR );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_ENR );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_XRR );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_XRR );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_POR );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_POR );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_HLT );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_HLT );
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_HCK );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_HCK );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_BRT );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_BRT );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_PSU );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_PSU );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_WEP );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_WEP );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_CST );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_CST );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_RES );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_RES );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_IMP );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_IMP );
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )0x00; // spare
-    SectionMsg << ( u8 )0x01; // cost
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_PPU );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_PPU );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_APU );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_APU );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_MST );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_MST );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_PPW );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_PPW );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_PSR );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_PSR );
-    SectionMsg << ( u8 )Skill->GetSubSkill( SK_WPW );
-    SectionMsg << ( u8 )Skill->GetSKPCost( SK_WPW );
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 5 ----
-    *BaselineMsg << ( u8 )0x05; // section id
-
-    PMessage* ContentList = BuildContainerContentList( nChar->GetInventory()->GetContainer( INV_LOC_BACKPACK ), INV_LOC_BACKPACK );
-    SectionMsg << *ContentList;
-    delete ContentList;
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 6 ----
-    *BaselineMsg << ( u8 )0x06; // section id
-
-    ContentList = BuildContainerContentList( nChar->GetInventory()->GetContainer( INV_LOC_WORN ), INV_LOC_WORN );
-    SectionMsg << *ContentList;
-    delete ContentList;
-
-    /*    SectionMsg << (u8)0x04; // QB/Armor/Implants items nb  // section content at offset 3
-
-        // THIS IS A TEMP SOLUTION UNTIL WE HAVE ITEM STUFF WORKING ===== BEGIN
-        SectionMsg << (u16)0x06;     // Size of item
-        SectionMsg << (u16)0x00;     // Location: Quickbelt slot 0
-        SectionMsg << (u16)0x0051;   // ItemID: 81, Flashlight
-        SectionMsg << (u8)0x01;      // Datatype
-        SectionMsg << (u8)0x00;      // Data
-    */
-
-    /****
-    SectionMsg << (u8)0x04; // QB/Armor/Implants items nb  // section content at offset 3
-
-    // THIS IS A TEMP SOLUTION UNTIL WE HAVE ITEM STUFF WORKING ===== BEGIN
-    SectionMsg << (u16)0x001b;     // Size of item
-    SectionMsg << (u8)0x00;     // Location: Quickbelt slot 0
-    SectionMsg << (u8)0x00; // nop (Y)
-    SectionMsg << (u16)0x0003;   // ItemID: 3, assault riffle
-    SectionMsg << (u8)(0x01|0x02|0x10|0x40);      // Datatype
-
-    //SectionMsg << (u8)0x01; // for 0x80. Use ???
-
-    SectionMsg << (u8)0x00; // Qty / remaining ammos
-
-    SectionMsg << (u8)0x06; // Qual entries
-    SectionMsg << (u8)0x40; // current qual
-    SectionMsg << (u8)0x80; // dmg
-    SectionMsg << (u8)0xc0; // freq
-    SectionMsg << (u8)0xa0; // handl
-    SectionMsg << (u8)0xb0; // range
-    SectionMsg << (u8)0xff; // max qual <= always last
-
-    SectionMsg << (u8)0x07; // addons bitflag: flashlight=1, scope, silencer, laserpointer
-
-    SectionMsg << (u8)0x02; // used slots
-    SectionMsg << (u8)0x05; // max slots
-    SectionMsg << (u16)1526; // slots / explo ammo
-    SectionMsg << (u16)21; // riffle-barrel
-    SectionMsg << (u16)0x0000;
-    SectionMsg << (u16)0x0000;
-    SectionMsg << (u16)0x0000;
-    *****/
-    /*
-    SectionMsg << (u16)0x06;     // Size of item
-    SectionMsg << (u8)0x01;     // Location: Quickbelt slot 1
-    SectionMsg << (u8)0x00; // nop (Y)
-    SectionMsg << (u16)0x0023;   // ItemID: 35, Med Kit
-    SectionMsg << (u8)0x01;      // Data=ammo count
-    SectionMsg << (u8)0x03;      // Data
-    */
-    /*
-        SectionMsg << (u16)0x06;     // Size of item
-        SectionMsg << (u16)0x01;     // Location: Quickbelt slot 0
-        SectionMsg << (u16)0x0055;   // ItemID: 81, Flashlight
-        SectionMsg << (u8)0x01;      // Datatype
-        SectionMsg << (u8)0x00;      // Data
-
-        SectionMsg << (u16)0x06;     // Size of item
-        SectionMsg << (u16)0x02;     // Location: Quickbelt slot 0
-        SectionMsg << (u16)0x176F;   // ItemID: 81, Flashlight
-        SectionMsg << (u8)0x01;      // Datatype
-        SectionMsg << (u8)0x00;      // Data
-
-
-        SectionMsg << (u16)0x08;      // Size of item
-        SectionMsg << (u16)0x1a;      // Location: Brain #1
-        SectionMsg << (u16)0x08fc;    // ItemID: Law enforcer
-        SectionMsg << (u8)0x02;       // Datatype. 02: Item Duration information follows
-        SectionMsg << (u8)0x02;       // SubDatatype02: Full itemdetails follow
-        SectionMsg << (u8)0x2a;       // Current duration
-        SectionMsg << (u8)0x2a;       // Max duration
-    */
-//    nChar->GetInventory()->QB_SetSlot(0, 81); // Add Flashlight to QB slot 1
-//    nChar->GetInventory()->QB_SetSlot(1, 85); // Add Flashlight to QB slot 1
-//    nChar->GetInventory()->QB_SetSlot(2, 5999); // Add Flashlight to QB slot 1
-    // THIS IS A TEMP SOLUTION UNTIL WE HAVE ITEM STUFF WORKING ===== END
-    /*
-     StatsBuffer[len+3] = 0; //Number of items
-     plen = 4;
-     for (i=0;i<MAX_INVENTORY;i++)
-     {
-      for (t=0;t<128;t++)
-      {
-       if (CurrentChar.QuickBelt[t]-1 != i)
-        continue;
-       *(unsigned short*)&StatsBuffer[len+plen] = 6;    //Data size of item
-       *(unsigned short*)&StatsBuffer[len+plen+2] = t;  //X position in Inventory
-       *(unsigned short*)&StatsBuffer[len+plen+4] = CurrentChar.ItemList[CurrentChar.QuickBelt[t]-1].ItemID; //Item ID
-       *(unsigned short*)&StatsBuffer[len+plen+6] = CurrentChar.ItemList[CurrentChar.QuickBelt[t]-1].Qty;   //Quantity
-       plen += 8;
-       *(unsigned short*)&StatsBuffer[len+3] += 1;      //Add to item
-       break;
-      }
-    */
-    /*if (CurrentChar.Inventory[i].ItemID == 0)     //Last Item
-     break;
-    if (CurrentChar.Inventory[i].Location != 2)     //Not Quickbelt, skip it
-     continue;
-    if (Def_GetItemType(CurrentChar.Inventory[i].ItemID) == 1)
-    {
-     //18 00 01 00 08 00 63 00 06 ff c8 c8 c8 c8 ff 00 01 00 28 04 00 01 04 ff 01
-     //12 00 11    5f 07 23 00 06 eb a4 99 a3 a5 ff 04 00 01 04 ff 01
-     //13 00 05 00 03 02 23 00 06 6d c4 c4 c4 c4 ff 04 00 01 04 ff 00
-     //17 00 05    9d 01 73 28 06 13 c1 c1 c1 c1 ff 00 01 01 f1 05 04
-     //|Size|Slot|ItemID|???  |? |Du|    Stats  |MD|?????????????????|
-     *(unsigned short*)&StatsBuffer[len+plen] = 19; //Size
-     *(unsigned short*)&StatsBuffer[len+plen+2] = CurrentChar.Inventory[i].LocX; //Slot
-     *(unsigned short*)&StatsBuffer[len+plen+4] = CurrentChar.Inventory[i].ItemID;//Item ID
-     StatsBuffer[len+plen+6] = 0x23;            //0x73 = Ranged, 0x63 = close/spell
-     StatsBuffer[len+plen+7] = CurrentChar.Inventory[i].Qty;      //Quantity
-     StatsBuffer[len+plen+8] = 0x06;            //0x06
-     StatsBuffer[len+plen+9] = CurrentChar.Inventory[i].CurDur;     //Current Durability
-     StatsBuffer[len+plen+10] = CurrentChar.Inventory[i].Damage;     //Stats
-     StatsBuffer[len+plen+11] = CurrentChar.Inventory[i].Freq;     //Stats
-     StatsBuffer[len+plen+12] = CurrentChar.Inventory[i].Hand;     //Stats
-     StatsBuffer[len+plen+13] = CurrentChar.Inventory[i].Rng;     //Stats
-     StatsBuffer[len+plen+14] = CurrentChar.Inventory[i].MaxDur;     //Max Durability
-     StatsBuffer[len+plen+15] = 0x04;           //Size or part
-     StatsBuffer[len+plen+16] = 0x00;           //follow or ?
-     StatsBuffer[len+plen+17] = 0x01;           //Ammo loaded?
-     StatsBuffer[len+plen+18] = 0x04;           //0x04 if not named, 0x0a if named
-     StatsBuffer[len+plen+19] = 0x05;           //0x06 if named, 0xff for no ammo needed, no idea otherwise
-     StatsBuffer[len+plen+20] = 0x0f;           //Binary representation of ammo allowed 0x01 = normal
-     plen+=21;
-    }
-    else
-    {
-     *(unsigned short*)&StatsBuffer[len+plen] = 6;         //Size of Item Data
-     *(unsigned short*)&StatsBuffer[len+plen+2] = CurrentChar.Inventory[i].LocX;  //Slot
-     *(unsigned short*)&StatsBuffer[len+plen+4] = CurrentChar.Inventory[i].ItemID; //Item ID
-     *(unsigned short*)&StatsBuffer[len+plen+6] = CurrentChar.Inventory[i].Qty;  //Quantity
-     plen+= 8;
-    }
-    StatsBuffer[len+3] += 1;*/
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 7 ----
-    *BaselineMsg << ( u8 )0x07; // section id
-
-    SectionMsg << ( u8 )0x00; // ?? // section content at offset 3
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 0c ----
-    *BaselineMsg << ( u8 )0x0c; // section id
-
-    ContentList = BuildContainerContentList( nChar->GetInventory()->GetContainer( INV_LOC_GOGO ), INV_LOC_GOGO );
-    SectionMsg << *ContentList;
-
-    delete ContentList;
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 8 ----
-    *BaselineMsg << ( u8 )0x08; // section id
-
-    u32 nSkin, nHead, nTorso, nLegs;
-    nChar->GetRealLook( nSkin, nHead, nTorso, nLegs );
-
-    SectionMsg << ( u8 )0x0a; // ? // section content at offset 3
-    SectionMsg << ( u32 )nChar->GetCash();
-
-    // Genrep list
-    SectionMsg << ( u16 )nChar->GetGenrepCount(); //Number of GR tagged (Tinns value on u8 only)
-    SectionMsg << ( u8 )0x04;
-    if ( nChar->GetGenrepCount() ) // For each entry : (u16)genrep.g_worldid, (u16)genrep.g_stationid
-    {
-        SectionMsg.Write( nChar->GetGenrepListData(), nChar->GetGenrepListDataSize() );
-    }
-
-    SectionMsg << ( u8 )0x04;
-    SectionMsg << ( u8 )0x04;
-    SectionMsg << ( u8 )0x00;
-
-    // Direct chat
-    if ( nChar->GetDirectChat() )
-    {
-        SectionMsg << ( u8 )1;
-        SectionMsg << ( u32 )nChar->GetDirectChat();
-    }
-    else
-    {
-        SectionMsg << ( u8 )0;
-    }
-
-    // Buddy Chat
-    SectionMsg << ( u8 )nChar->GetBuddyCount(); //Number of Buddies
-    if ( nChar->GetBuddyCount() ) // For each buddy (u32)buddy CharID
-    {
-        SectionMsg.Write( nChar->GetBuddyListData(), nChar->GetBuddyListDataSize() );
-    }
-    SectionMsg << ( u8 )0x00;
-
-    SectionMsg << ( u16 )nClient->GetTransactionID(); // ??
-    //SectionMsg << (u32)0x00000000;
-    SectionMsg << ( u32 )0x00000000;
-    SectionMsg << ( u32 )0x00000000; // Epic status ?
-    SectionMsg << ( u16 )nSkin;
-    SectionMsg << ( u8 )nHead;
-    SectionMsg << ( u8 )nTorso;
-    SectionMsg << ( u8 )nLegs;
-    SectionMsg << ( u8 )0x00; // Rank
-    SectionMsg << ( u32 )( nChar->GetBaseApartment() + PWorlds::mAptBaseWorldId ); // 0x22, 0x00, 0x00, 0x00, //Primary Apartment (GR activated) ???
-    SectionMsg << ( u8 )0x01; // ?
-    SectionMsg << ( u8 )0x00; // ?
-    SectionMsg << ( u8 )0x00; // ?
-    SectionMsg << ( u8 )0x00; // ?
-    SectionMsg << ( u8 )0x00; // ?
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 9 ----
-    *BaselineMsg << ( u8 )0x09; // section id
-
-    SectionMsg << ( u16 )0x15; // Nb of factions // section content at offset 3
-    SectionMsg << ( u16 )nChar->GetFaction();
-    SectionMsg << ( u8 )0x04; // ?
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // 96.0f*9000.0f; // SL
-    // Faction Sympathies Points effective sympathie is Square root of these points, abs value rounded down (beware of the sign ! :p)
-    SectionMsg << ( f32 ) 1000.0f*1250.0f; // City Admin => 111
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Diamond => 100
-    SectionMsg << ( f32 ) 1000.0f* -750.0f; // Next => -86
-    SectionMsg << ( f32 ) 1000.0f*500.0f; // Tangent => 70
-    SectionMsg << ( f32 ) 1000.0f* -250.0f; // Biotech => -50
-    SectionMsg << ( f32 ) 1000.0f*0.0f; // ProtoPharm => 0
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Trader's Union
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Tsunami
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Black Dragons
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // City Mercs
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Crahn Sect
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Dome Of York
-    SectionMsg << ( f32 ) 1000.0f* -1000.0f; // Anarchy Breed
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Fallen Angels
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Twilight Guardian
-    SectionMsg << ( f32 ) 1000.0f* -1000.0f; // Regeant's Legacy
-    SectionMsg << ( f32 ) 1000.0f* -1000.0f; // Regeant's Mutants
-    SectionMsg << ( f32 ) 1000.0f* -1000.0f; // Insects
-    SectionMsg << ( f32 ) 1000.0f* -1000.0f; // Monsters
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Unknown
-    SectionMsg << ( f32 ) 1000.0f*1000.0f; // Highest SL?
-
-    SectionMsg << ( u32 )0x00000000; // Epic done Data : bit 2^FactionID set <=> Epic done
-    SectionMsg << ( u8 )nChar->GetFaction(); // Faction ??? wrong size ...
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 0a ----
-    *BaselineMsg << ( u8 )0x0a; // section id
-
-    // Clan data ?
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 0b ----
-    *BaselineMsg << ( u8 )0x0b; // section id
-
-    SectionMsg << ( u8 )0x00; // ?? // section content at offset 3
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    // ---- Section 0d ----
-    *BaselineMsg << ( u8 )0x0d; // section id
-
-    SectionMsg << ( u8 )0xfa; // ?? // section content at offset 3
-    SectionMsg << ( u8 )nChar->GetProfession();
-    SectionMsg << ( u16 )nClient->GetTransactionID(); // ?? TransactionID ? 0x8aa0
-    SectionMsg << ( u32 )nChar->GetID();
-
-    *BaselineMsg << ( u16 )SectionMsg.GetSize();
-    *BaselineMsg << SectionMsg;
-    SectionMsg.Reset();
-
-    return BaselineMsg;
-}
-
-PMessage* PMsgBuilder::BuildAliveRepMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 7 );
-
-    // u8 up[] = {0x04, 0x01, 0x00, 0xe3, 0x6b, 0xe6, 0xee};
-    *tmpMsg << ( u8 )0x04;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0xe3; // ? not always...
-    *tmpMsg << ( u8 )0x6b; // ? not always...
-    *tmpMsg << ( u16 )( nClient->getUDPConn()->getPort() ); // really ?
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildZoning1Msg( PClient* nClient, u16 nEntity, u8 nUnknown )
-{
-    PMessage* tmpMsg = new PMessage( 42 );
-
-    nClient->IncreaseUDP_ID();
-    nClient->IncreaseTransactionID(); // from NeoX
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x0c; // Message length place;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID(); // from NeoX
-    *tmpMsg << ( u8 )0x25; // ??
-    *tmpMsg << ( u8 )0x13; // ??
-    *tmpMsg << ( u16 )nClient->GetTransactionID(); // from NeoX / ?? right ???
-    // In case of apt GR or NC2.2 ?
-    // *tmpMsg << (u8)0x04; // len ?
-    // *tmpMsg << (u32)AptWorldID; // len ?
-    // nClient->IncreaseTransactionID();
-    // *tmpMsg << (u16)nClient->GetTransactionID();
-    *tmpMsg << ( u8 )0x0e; // cmd => but not for zoning, because used in non-zoning situation
-    *tmpMsg << ( u8 )0x02; // ?? from NeoX
-    //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x17; // Message length place;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x23;
-    *tmpMsg << ( u16 )0x0004; // cmd
-    *tmpMsg << ( u32 )0x00000000; // from NeoX
-    *tmpMsg << ( u32 )0x00000000; // from NeoX
-    *tmpMsg << ( u8 )nUnknown;
-    *tmpMsg << ( u16 )nEntity;
-    *tmpMsg << ( u16 )0x0000; // from NeoX
-    *tmpMsg << ( u16 )nClient->GetTransactionID(); // from NeoX
-    *tmpMsg << ( u16 )0x0000; // from NeoX
-
-    // We DO need this! This is a multiframe packet, and the first UDP/SessionID set *HAS* to be
-    // as high as the last UDP/SessionID set in the frame!
-    tmpMsg->U16Data( 1 ) = nClient->GetUDP_ID();
-    tmpMsg->U16Data( 3 ) = nClient->GetSessionID();
-
-    //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildZoningTCPReadyMsg()
-{
-    PMessage* tmpMsg = new PMessage( 7 );
-
-    //static const u8 READY[7] = {0xfe, 0x04, 0x00, 0x83, 0x0d, 0x00, 0x00};
-    *tmpMsg << ( u8 )0xfe;
-    *tmpMsg << ( u16 )0x0004; //length
-    *tmpMsg << ( u8 )0x83; //cmd
-    *tmpMsg << ( u8 )0x0d; // sub-cmd
-    *tmpMsg << ( u16 )0x0000;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildSendZoneTCPMsg( u32 nLocation, std::string *nWorldName )
-{
-    PMessage* tmpMsg = new PMessage( 14 + nWorldName->size() );
-
-    *tmpMsg << ( u8 )0xfe;
-    *tmpMsg << ( u16 )0x0000; // size placeholder
-    *tmpMsg << ( u8 )0x83;
-    *tmpMsg << ( u8 )0x0c;
-    *tmpMsg << ( u32 )nLocation;
-    *tmpMsg << ( u32 )0x00000000;
-    tmpMsg->Write( nWorldName->c_str(), nWorldName->size() + 1 );
-
-    tmpMsg->U16Data( 1 ) = ( u16 )( tmpMsg->GetSize() - 3 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildZoning2Msg( PClient* nClient, u32 nClientTime )
-{
-    PMessage* tmpMsg = new PMessage( 22 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x0d;
-    *tmpMsg << ( u32 )GameServer->GetGameTime();
-
-    *tmpMsg << ( u32 )nClientTime;
-
-    *tmpMsg << ( u8 )0xe5; // ??? varies
-    *tmpMsg << ( u8 )0x0a; // ??? varies
-    *tmpMsg << ( u8 )0xbb; // ??? varies
-    *tmpMsg << ( u8 )0x00; // ??? usually 0
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildGenrepZoningMsg( PClient* nClient, u32 nLocation, u16 nEntity )
-{
-    PMessage* tmpMsg = new PMessage( 50 );
-
-    nClient->IncreaseUDP_ID();
-
-    tmpMsg->Fill( 0 );
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x23;
-    *tmpMsg << ( u16 )0x000c; // cmd
-    tmpMsg->SetNextByteOffset( 38 );
-    *tmpMsg << ( u32 )0xffffffff;
-    *tmpMsg << ( u32 )nLocation;
-    *tmpMsg << ( u16 )nEntity;
-    *tmpMsg << ( u16 )0x0000;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildGenrepAddToListMsg( PClient* nClient, u32 nLocation, u16 nEntity )
-{
-    PMessage* tmpMsg = new PMessage( 23 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x3d;
-    *tmpMsg << ( u32 )0x00000002;
-    *tmpMsg << ( u32 )nLocation;
-    *tmpMsg << ( u16 )nEntity;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildAptLiftUseMsg( PClient* nClient, u32 nLocation, u16 nEntity, u8 nEntityType )
-{
-    PMessage* tmpMsg = new PMessage( 43 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x0f; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x38;
-    *tmpMsg << ( u8 )0x04; // Accepted (?)
-    *tmpMsg << ( u8 )nEntityType; // "Sewer Level"
-    *tmpMsg << ( u32 )nLocation;
-    *tmpMsg << ( u16 )nEntity;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildAptLiftFailedMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 14 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x08; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x38;
-    *tmpMsg << ( u8 )0x03; // Refused
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildChangeLocationMsg( PClient* nClient, u32 nLocation, u16 nEntity, u8 nEntityType, u32 nRawItemID )
-{
-    PMessage* tmpMsg = new PMessage( 28 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    if ( nRawItemID )
-    {
-        *tmpMsg << ( u8 )0x06; // Sub message length;
-        *tmpMsg << ( u8 )0x2d; // Item use response;
-        *tmpMsg << ( u32 )nRawItemID;
-        *tmpMsg << ( u8 )0x0a; // Use allowed
-    }
-
-    *tmpMsg << ( u8 )0x0f; // Sub message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x38;
-    *tmpMsg << ( u8 )0x04; // Accepted (?)
-    *tmpMsg << ( u8 )nEntityType;
-    *tmpMsg << ( u32 )nLocation;
-    *tmpMsg << ( u16 )nEntity;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildEntityPositionMsg( PClient* nClient, u16 pX, u16 pY, u16 pZ )
-{
-    PMessage* tmpMsg = new PMessage( 18 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x23;
-    *tmpMsg << ( u16 )0x000a;
-    *tmpMsg << ( u16 )( pY + 768 );
-    *tmpMsg << ( u16 )( pZ + 768 );
-    *tmpMsg << ( u16 )( pX + 768 );
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharAptLocInfoMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 21 );
-    nClient->IncreaseUDP_ID();
-
-    int BaseAppId = nClient->GetChar()->GetBaseApartment();
-    u32 AptLocation = ( u32 )Appartements->GetAptLocation( BaseAppId );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x0f;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x3d;
-    *tmpMsg << ( u32 )0x0000000b;
-    *tmpMsg << ( u32 )AptLocation;
-
-    return tmpMsg;
-}
-
-// OLD FUNCTION, REWRITTEN BELOW
-/*
-PMessage* PMsgBuilder::BuildSubskillIncMsg( PClient* nClient, u8 nSubskill, u16 nSkillPoints )
-{
-  PMessage* tmpMsg = new PMessage( 33 );
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u16 )nClient->GetSessionID();
-
-  nClient->IncreaseUDP_ID();
-  *tmpMsg << ( u8 )0x09; // SubMessage length;
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nClient->GetLocalID();
-  *tmpMsg << ( u8 )0x25;
-  *tmpMsg << ( u8 )0x23;
-  *tmpMsg << ( u8 )0x41; // 0x28 ?? // 0x 18 // 0x2c
-
-  nClient->IncreaseUDP_ID();
-  nClient->IncreaseTransactionID(); // testing ...
-  *tmpMsg << ( u8 )0x11; // SubMessage length;
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nClient->GetLocalID();
-  *tmpMsg << ( u8 )0x25;
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )nClient->GetTransactionID(); // testing / 0x0000 ????
-  *tmpMsg << ( u8 )0x09; // ?
-  *tmpMsg << ( u16 )nSubskill;
-  *tmpMsg << ( u16 )nClient->GetChar()->Skill->GetSubSkill( nSubskill ); // nSubskill ?
-  *tmpMsg << ( u16 )nSkillPoints;
-
-  //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-  return tmpMsg;
-}
- */\r
-// NPC Dialog. Start dialog with NPC\r
-PMessage* PMsgBuilder::BuildNPCStartDialogMsg( PClient* nClient, u32 nNPCWorldID, std::string *nDialogScript  )\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
-    nClient->IncreaseUDP_ID();\r
\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 ) 0x0000; // UDP Placeholder\r
-    *tmpMsg << ( u16 ) 0x0000; // UDP Placeholder\r
-    *tmpMsg << ( u8 )0x00; // Message length\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u8 )0x1f;\r
-    *tmpMsg << ( u16 )nClient->GetLocalID();\r
-    *tmpMsg << ( u8 )0x18;\r
-    *tmpMsg << ( u32 ) nNPCWorldID;\r
\r
-    // Todo: is this correct? random u32 value??\r
-    *tmpMsg << ( u16 ) GetRandom( 65535, 4369 );\r
-    *tmpMsg << ( u16 ) GetRandom( 65535, 4369 );\r
-    *tmpMsg << ( u32 ) 0x0000;\r
-    *tmpMsg << nDialogScript->c_str();\r
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x0a;\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u8 )0x1f;\r
-    *tmpMsg << ( u16 )nClient->GetLocalID();\r
-    *tmpMsg << ( u8 )0x1a;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x00;\r
\r
-    tmpMsg->U16Data( 1 ) = nClient->GetUDP_ID();\r
-    tmpMsg->U16Data( 3 ) = nClient->GetSessionID();\r
\r
-    return tmpMsg;\r
- }\r
-// NPC Dialog. Send next node number in lua script to client\r
-PMessage* PMsgBuilder::BuildNPCDialogReplyMsg( PClient* nClient, u16 nNextNode, std::vector<int>*nResultBuffer)\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();;\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();;\r
-    *tmpMsg << ( u8 )0x00; // SubMessage length;\r
\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();;\r
-    *tmpMsg << ( u8 )0x1f;\r
-    *tmpMsg << ( u16 )nClient->GetLocalID();\r
-    *tmpMsg << ( u8 )0x1a;\r
-    *tmpMsg << ( u16 )nNextNode;\r
-    //*tmpMsg << ( u8 )nNumResults;\r
-    *tmpMsg << ( u8 )nResultBuffer->size();\r
\r
-    std::vector<int>::const_iterator it;\r
\r
-    for(it = nResultBuffer->begin(); it != nResultBuffer->end(); it++)\r
-     {\r
-        *tmpMsg << ( f32 )*(it);\r
-     }\r
\r
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
\r
-    return tmpMsg;\r
- }\r
-
-PMessage* PMsgBuilder::BuildNPCBeginAllBuyerTradeMsg( PClient* nClient, int nWorldID )\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();\r
-    *tmpMsg << ( u8 )0x00; // Message length\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u8 )0x1f;\r
-    *tmpMsg << ( u16 )nClient->GetLocalID();\r
-    *tmpMsg << ( u8 )0x26;\r
-    *tmpMsg << ( u32 ) nWorldID;\r
-    *tmpMsg << ( u8 )0x01; // Traders inventory\r
-    *tmpMsg << ( u16 )0xFFFF; // Traders inventory\r
\r
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
\r
-    return tmpMsg;\r
- }\r
\r
-PMessage* PMsgBuilder::BuildNPCShoppingListMsg( PClient* nClient, PMessage* nContentList, int nWorldID, u8 nItemQuality)\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();\r
-    *tmpMsg << ( u8 )0x00; // Message length\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u8 )0x1f;\r
-    *tmpMsg << ( u16 )nClient->GetLocalID();\r
-    *tmpMsg << ( u8 )0x26;\r
-    *tmpMsg << ( u32 ) nWorldID;\r
-    *tmpMsg << ( u8 )0x01; // Traders inventory\r
-    *tmpMsg << ( u16 )( nContentList->GetSize() / 6 ); // List entries\r
-    *tmpMsg << ( u8 )nItemQuality; // Items quality\r
-    *tmpMsg << *nContentList;\r
\r
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );\r
\r
-    return tmpMsg;\r
- }\r
\r
-// ==========================\r
-PMessage* PMsgBuilder::BuildNPCSingleInfoMsg( PClient* nClient, u32 nWorldID, u16 nTypeID, u16 nClothing,\r
-u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nUnknown,\r
-u16 nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName)\r
-// Initial NPC Packet that defines how the NPC look, etc\r
- {\r
-//    u8 tMsgLen = 29 + nNpcName->size() + nAngleStr->size() + nCustomName->size();\r
\r
-    PMessage* tmpMsg = new PMessage();\r
-    nClient->IncreaseUDP_ID();\r
\r
-    *tmpMsg << ( u8 )0x13; // Begin UDP message\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();\r
-    *tmpMsg << ( u8 )0x00;\r
-     *tmpMsg << ( u8 )0x03;\r
-     *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-     *tmpMsg << ( u8 )0x28;\r
-     *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x01;\r
-    *tmpMsg << ( u32 )nWorldID;\r
-    *tmpMsg << ( u16 )nTypeID;\r
-    *tmpMsg << ( u16 )nClothing;\r
-    *tmpMsg << ( u16 )nNameID;\r
-    *tmpMsg << ( u16 )nPosY;\r
-    *tmpMsg << ( u16 )nPosZ;\r
-    *tmpMsg << ( u16 )nPosX;\r
-     *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u16 )nUnknown;\r
-    *tmpMsg << ( u16 )nTraderID;\r
-    *tmpMsg << nNpcName->c_str();\r
-    *tmpMsg << nAngleStr->c_str();\r
-    if(nCustomName->length() > 1)\r
-        *tmpMsg << nCustomName->c_str();\r
\r
-    (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);\r
-    return tmpMsg;\r
- }\r
\r
-PMessage* PMsgBuilder::BuildNPCMassInfoMsg( u32 nWorldID, u16 nTypeID, u16 nClothing,\r
-u16 nNameID, u16 nPosY, u16 nPosZ, u16 nPosX, u16 nHealth,\r
-u16 nTraderID, std::string *nAngleStr, std::string *nNpcName, std::string *nCustomName)\r
-// Initial NPC Packet that defines how the NPC look, etc\r
- {\r
-//    u8 tMsgLen = 29 + nNpcName->size() + nAngleStr->size() + nCustomName->size();\r
\r
-    PMessage* tmpMsg = new PMessage();\r
\r
-    *tmpMsg << ( u8 )0x13; // Begin UDP message\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x03;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u8 )0x28;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )0x01;\r
-    *tmpMsg << ( u32 )nWorldID;\r
-    *tmpMsg << ( u16 )nTypeID;\r
-    *tmpMsg << ( u16 )nClothing;\r
-    *tmpMsg << ( u16 )nNameID;\r
-    *tmpMsg << ( u16 )nPosY;\r
-    *tmpMsg << ( u16 )nPosZ;\r
-    *tmpMsg << ( u16 )nPosX;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u16 )nHealth;\r
-    *tmpMsg << ( u16 )nTraderID;\r
-    *tmpMsg << nNpcName->c_str();\r
-    *tmpMsg << nAngleStr->c_str();\r
-    if(nCustomName->length() > 1)\r
-        *tmpMsg << nCustomName->c_str();\r
\r
-    (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);\r
-     return tmpMsg;\r
- }\r
\r
-// **************\r
-PMessage* PMsgBuilder::BuildNPCUpdateMsg(u32 nWorldID, u16 nPosY, u16 nPosZ, u16 nPosX, u8 nActionBM, u16 nHealth, u8 nWeaponState, u8 nUnknown, u32 nTargetID)\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
\r
-    *tmpMsg << ( u8 )0x13;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u8 )0x00;      // len\r
-    *tmpMsg << ( u8 )0x1b;      // NPC Update\r
-    *tmpMsg << ( u32 )nWorldID; // NPCs world ID\r
-    *tmpMsg << ( u8 )0x1f;      // Parameters\r
-    *tmpMsg << ( u16 )nPosY;    // Position Y\r
-    *tmpMsg << ( u16 )nPosZ;    // Position Z\r
-    *tmpMsg << ( u16 )nPosX;    // Position X\r
-    *tmpMsg << ( u8 )nActionBM; // NPCs current action-bitmask\r
-    *tmpMsg << ( u16 )nHealth;   // Health value\r
-    if(nTargetID > 0)\r
-        *tmpMsg << ( u32 )nTargetID; // WorldID of NPCs target (if any)\r
-    *tmpMsg << ( u8 )nUnknown;\r
-    *tmpMsg << ( u8 )nWeaponState;\r
\r
-    (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);\r
\r
-    return tmpMsg;\r
- }\r
-// **************\r
\r
-PMessage* PMsgBuilder::BuildNPCSingleAliveMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction )\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
\r
-    *tmpMsg << ( u8 )0x13; // Begin UDP message\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();\r
-    *tmpMsg << ( u8 )0x11;\r
-    *tmpMsg << ( u8 )0x1B;\r
-    *tmpMsg << ( u32 )nWorldID;\r
-    *tmpMsg << ( u8 )0x1F;\r
-    *tmpMsg << ( u16 )nY;\r
-    *tmpMsg << ( u16 )nZ;\r
-    *tmpMsg << ( u16 )nX;\r
-    *tmpMsg << ( u8 )nActionStatus;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )nHealth;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )nAction;\r
\r
-    return tmpMsg;\r
- }\r
\r
-PMessage* PMsgBuilder::BuildNPCMassAliveMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u8 nAction )\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
\r
-    *tmpMsg << ( u8 )0x13; // Begin UDP message\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u8 )0x11;\r
-    *tmpMsg << ( u8 )0x1B;\r
-    *tmpMsg << ( u32 )nWorldID;\r
-    *tmpMsg << ( u8 )0x1F;\r
-    *tmpMsg << ( u16 )nY;\r
-    *tmpMsg << ( u16 )nZ;\r
-    *tmpMsg << ( u16 )nX;\r
-    *tmpMsg << ( u8 )nActionStatus;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )nHealth;\r
-    *tmpMsg << ( u8 )0x00;\r
-    *tmpMsg << ( u8 )nAction;\r
\r
-    return tmpMsg;\r
- }\r
\r
-PMessage* PMsgBuilder::BuildNPCMassUpdateMsg( u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction )\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
\r
-    *tmpMsg << ( u8 )0x13; // Begin UDP message\r
-     *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u16 )0x0000;\r
-    *tmpMsg << ( u8 )0x15; // Message length\r
-    *tmpMsg << ( u8 )0x1b;\r
-    *tmpMsg << ( u32 )nWorldID;\r
-    *tmpMsg << ( u8 )0x1F;\r
-    *tmpMsg << ( u16 )nY;\r
-    *tmpMsg << ( u16 )nZ;\r
-    *tmpMsg << ( u16 )nX;\r
-    *tmpMsg << ( u8 )nActionStatus;\r
-    *tmpMsg << ( u8 )0x77; // ?\r
-    *tmpMsg << ( u8 )nHealth;\r
-    *tmpMsg << ( u16 )nTarget;\r
-    *tmpMsg << ( u8 )0x00; // ?\r
-    *tmpMsg << ( u8 )0x00; // ?\r
-    *tmpMsg << ( u8 )0x00; // ?\r
-    *tmpMsg << ( u8 )nAction;\r
\r
-    return tmpMsg;\r
- }\r
\r
-// ==========================\r
\r
-PMessage* PMsgBuilder::BuildNPCSingleUpdateMsg( PClient* nClient, u32 nWorldID, u16 nX, u16 nY, u16 nZ, u8 nActionStatus, u8 nHealth, u16 nTarget, u8 nAction )\r
- {\r
-    PMessage* tmpMsg = new PMessage();\r
\r
-    *tmpMsg << ( u8 )0x13; // Begin UDP message\r
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();\r
-    *tmpMsg << ( u16 )nClient->GetSessionID();\r
-    *tmpMsg << ( u8 )0x15; // Message length\r
-    *tmpMsg << ( u8 )0x1b;\r
-    *tmpMsg << ( u32 )nWorldID;\r
-    *tmpMsg << ( u8 )0x1F;\r
-    *tmpMsg << ( u16 )nY;\r
-    *tmpMsg << ( u16 )nZ;\r
-    *tmpMsg << ( u16 )nX;\r
-    *tmpMsg << ( u8 )nActionStatus;\r
-    *tmpMsg << ( u8 )0x77; // ?\r
-    *tmpMsg << ( u8 )nHealth;\r
-    *tmpMsg << ( u16 )nTarget;\r
-    *tmpMsg << ( u8 )0x00; // ?\r
-    *tmpMsg << ( u8 )0x00; // ?\r
-    *tmpMsg << ( u8 )0x00; // ?\r
-    *tmpMsg << ( u8 )nAction;\r
\r
-    return tmpMsg;\r
- }\r
-// ==========================\r
-PMessage* PMsgBuilder::BuildSubskillIncMsg( PClient* nClient, u8 nSubskill, u16 nSkillPoints )
-{
-    PMessage* tmpMsg = new PMessage( 33 );
-
-    nClient->IncreaseUDP_ID();
-    u16 tFirstUDPID = nClient->GetUDP_ID();
-
-    nClient->IncreaseUDP_ID();
-    u16 tSecondUDPID = nClient->GetUDP_ID();
-    u16 tSecondSessionID = nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )tSecondUDPID;
-    *tmpMsg << ( u16 )tSecondSessionID;
-
-    *tmpMsg << ( u8 )0x09; // SubMessage length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )tFirstUDPID;
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25;
-    *tmpMsg << ( u8 )0x23;
-    *tmpMsg << ( u8 )0x27;
-
-    nClient->IncreaseTransactionID();
-    *tmpMsg << ( u8 )0x11; // SubMessage length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )tSecondUDPID;
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25;
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetTransactionID(); // testing / 0x0000 ????
-    *tmpMsg << ( u8 )0x09; // ?
-    *tmpMsg << ( u16 )nSubskill;
-    *tmpMsg << ( u16 )nClient->GetChar()->Skill->GetSubSkill( nSubskill ); // nSubskill ?
-    *tmpMsg << ( u16 )nSkillPoints;
-
-    //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildLevelUpMessage( PClient* nClient, u8 nMainSkill, u8 nNewLevel, u16 nFreeSkillPoints)
-{
-    PMessage* tmpMsg = new PMessage(21);
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << (u8)0x13;
-    *tmpMsg << (u16)nClient->GetUDP_ID();
-    *tmpMsg << (u16)nClient->GetSessionID();
-    *tmpMsg << (u8)0x0F;
-    *tmpMsg << (u8)0x03;
-    *tmpMsg << (u16)nClient->GetUDP_ID();
-    *tmpMsg << (u8)0x1F;
-    *tmpMsg << (u16)nClient->GetLocalID();
-    *tmpMsg << (u8)0x25;
-    *tmpMsg << (u8)0x0B;
-    *tmpMsg << (u16)nMainSkill;
-    *tmpMsg << (u8)nNewLevel;
-    *tmpMsg << (u16)nFreeSkillPoints;
-    *tmpMsg << (u8)0x00;
-    *tmpMsg << (u8)0x00;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildChatAddMsg( PClient* nClient, u32 nAddedCharID, u8 nMode )
-{
-    PMessage* tmpMsg = new PMessage( 18 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x32;
-    *tmpMsg << ( u8 )nMode;
-    *tmpMsg << ( u32 )nAddedCharID;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildDoorOpenMsg( u32 nRawItemID, bool nDoubleDoor )
-{
-    //PMessage* tmpMsg = new PMessage(37);
-    PMessage* tmpMsg = new PMessage( 21 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-
-    *tmpMsg << ( u8 )0x0f; // Sub-message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; //++Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u8 )0x1b;
-    *tmpMsg << ( u32 )nRawItemID;
-    *tmpMsg << ( u8 )0x20; //?
-    if ( nDoubleDoor )
-    {
-        *tmpMsg << ( u16 )0x0005; //?
-        *tmpMsg << ( u16 )0x0000; //?
-        *tmpMsg << ( u16 )0x1500; //?
-    }
-    else
-    {
-        *tmpMsg << ( u16 )0x0000; //?
-        *tmpMsg << ( u16 )0x00c8; //? or 0x64 ?
-        *tmpMsg << ( u16 )0x10ff; //?
-    }
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-// Message from text.ini, section [MISC], id = 100+nTxtMsgId
-PMessage* PMsgBuilder::BuildText100Msg( PClient* nClient, u8 nTxtMsgId, u32 nRawObjectID )
-{
-    PMessage* tmpMsg = new PMessage( 17 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x0c; // Message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x31;
-    *tmpMsg << ( u8 )nTxtMsgId;
-    *tmpMsg << ( u32 )nRawObjectID;
-
-    //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-    return tmpMsg;
-}
-
-// Same as BuildText100Msg, but here we can specify *ANY* text from text.ini, not limited to section [MISC]
-// 1: [DIALOG]
-// 2: [STATEMENT]
-// 3: [GUI] + [playertextures]
-// 4: [TERMINAL]
-// 5: [MENU]
-// 6: [MISC]
-// 7: [ITEMDESC]
-// 8: [HELPTEXT]
-PMessage* PMsgBuilder::BuildTextIniMsg( PClient* nClient, u8 nTxtGroupID, u16 nTxtID )
-{
-    PMessage* tmpMsg = new PMessage( 20 );
-
-    nClient->IncreaseUDP_ID();
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x0e; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25; // ??
-    *tmpMsg << ( u8 )0x15; // ??
-    *tmpMsg << nTxtGroupID;
-    *tmpMsg << nTxtID;
-    *tmpMsg << ( u8 )0x00; // ??
-    *tmpMsg << ( u8 )0x00; // ??
-    *tmpMsg << ( u8 )0x00; // ??
-
-    //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharInteractionMenuMsg( PClient* nClient, u32 nRawTargetID )
-{
-    PMessage* tmpMsg = new PMessage( 17 );
-
-    nClient->IncreaseUDP_ID();
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x0b; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x4d;
-    *tmpMsg << ( u32 )nRawTargetID;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildFurnitureActivateMsg( PClient* nClient, u32 nRawObjectID, u8 nActionValue )
-{
-    PMessage* tmpMsg = new PMessage( 12 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x06; // SubMessage length;
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nRawObjectID;
-    *tmpMsg << ( u8 )nActionValue; // known valid are 5 (ring), 9 (remove) and 10 (clic)
-
-    //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseFurnitureMsg( PClient* nClient, u32 nRawObjectID )
-{
-    PMessage* tmpMsg = new PMessage( 24 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x06; // SubMessage length;
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nRawObjectID;
-    *tmpMsg << ( u8 )0x0a;
-
-    *tmpMsg << ( u8 )0x0b; // SubMessage length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x17;
-    *tmpMsg << ( u32 )nRawObjectID;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseVhcTerminalMsg( PClient* nClient, u32 nRawObjectID )
-{
-    PMessage* tmpMsg = new PMessage( 24 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x06; // SubMessage length;
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nRawObjectID;
-    *tmpMsg << ( u8 )0x0a;
-
-    *tmpMsg << ( u8 )0x07; // SubMessage length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x4a;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseGogoMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 17 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x0b; // Message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x3d;
-    *tmpMsg << ( u32 )0x0000000d; // cmd
-
-    //(*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseVentureWarpMsg( PClient* nClient, u32 nRawObjectID )
-{
-    PMessage* tmpMsg = new PMessage( 17 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x0b; // Message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x3d;
-    *tmpMsg << ( u32 )0x00000008; // cmd
-    *tmpMsg << ( u32 )0x00000007; // cmd ?
-    *tmpMsg << ( u32 )0x00000002; // ?
-    *tmpMsg << ( u16 )0x0004; // ?
-    *tmpMsg << nRawObjectID;
-    // *tmpMsg << (u8)0x13; // ? Seems we can do without...
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildVhcAccessRequestMsg( PClient* nClient, u32 nRequestId, u32 nRequesterCharId, u32 nRequesterLocalId, u32 nVhcRawObjectID )
-{
-    PMessage* tmpMsg = new PMessage( 40 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x22; // Message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x3d;
-    *tmpMsg << ( u32 )0x00000008; // cmd
-    *tmpMsg << ( u32 )0x00000005; // cmd ?
-    *tmpMsg << ( u32 )nRequestId;
-    *tmpMsg << ( u16 )0x000c; // ? length ?
-    *tmpMsg << nRequesterCharId; //u32
-    *tmpMsg << nRequesterLocalId; // ? u32
-    *tmpMsg << nVhcRawObjectID;
-    *tmpMsg << ( u8 )0x08; // ?
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-/* S->C
-13:ff:00:72:d6:22:
-03:ff:00:1f:03:00:
-3d:
-08:00:00:00:
-05:00:00:00:
-01:00:00:00:
-0c:00:
-2f:d8:01:00:
-02:00:00:00:
-5d:03:00:00:
-08:
-*/
-
-/* C->S RESP: OK
-13:79:00:ec:d5:17:
-03:79:00:1f:03:00:
-3d:
-09:00:00:00:
-06:00:00:00:
-02:00:00:00:
-01:00:
-01:00
-*/
-/* C->S RESP: NOK
-13:74:00:e7:d5:17:
-03:74:00:1f:03:00:
-3d:
-09:00:00:00:
-06:00:00:00:
-01:00:00:00:
-01:00:
-00:00
-
-*/
-
-PMessage* PMsgBuilder::BuildCharUseGenrepMsg( PClient* nClient, u32 nRawObjectID, u32 nLocation, u16 nEntity )
-{
-    PMessage* tmpMsg = new PMessage( 24 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x06; // SubMessage length;
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nRawObjectID;
-    *tmpMsg << ( u8 )0x0a;
-
-    // this submessage is only needed to set to location/entity of the GR for a potential record in the char's GR list
-    *tmpMsg << ( u8 )0x0d; // SubMessage length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nLocation;
-    *tmpMsg << ( u16 )nEntity;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseLiftMsg( PClient* nClient, u32 nRawObjectID, u16 nAptPlace )
-{
-    PMessage* tmpMsg = new PMessage( 29 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x06; // SubMessage length;
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nRawObjectID;
-    *tmpMsg << ( u8 )0x0a;
-
-    *tmpMsg << ( u8 )0x11; // SubMessage length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x38;
-    *tmpMsg << ( u8 )0x01;
-    *tmpMsg << ( u32 )nRawObjectID;
-    *tmpMsg << ( u16 )nAptPlace;
-    *tmpMsg << ( u16 )0x0000;
-    *tmpMsg << ( u8 )0x00;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharShowGlowCircleMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 14 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // UDP ID placeholder
-    *tmpMsg << ( u16 )0x0000; // SessionID placeholder
-    *tmpMsg << ( u8 )0x08;  // Len (static, always 0x08
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // Sub UDP ID placeholder
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x3c; // Command SHOW GLOWING CIRCLE (kinda ^^)
-    *tmpMsg << ( u8 )0x01; // "on" ?
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharMoneyUpdateMsg( PClient* nClient, u32 nCredits )
-{
-    PMessage* tmpMsg = new PMessage( 21 );
-    nClient->IncreaseUDP_ID();
-    nClient->IncreaseTransactionID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x0f; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25; // cmd
-    *tmpMsg << ( u8 )0x13; // cmd
-    *tmpMsg << ( u16 )nClient->GetTransactionID();
-    *tmpMsg << ( u8 )0x04; // cmd
-    *tmpMsg << nCredits;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildUndefineduseMsg( PClient* nClient, u8 nValue )
-{
-    PMessage* tmpMsg = new PMessage( 15 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x09; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25;
-    *tmpMsg << ( u8 )0x23;
-    *tmpMsg << nValue;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseQBSlotMsg2( PClient* nClient, u16 nV1, u16 nV2, u16 nV3, u16 nV4, u16 nV5, u16 nV6, u16 nV7 )
-{
-    // lol? Whats this?
-    PMessage* tmpMsg = new PMessage( 28 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x16; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25; // cmd
-    *tmpMsg << ( u8 )0x22; // cmd
-    *tmpMsg << nV1;
-    *tmpMsg << nV2;
-    *tmpMsg << nV3;
-    *tmpMsg << nV4;
-    *tmpMsg << nV5;
-    *tmpMsg << nV6;
-    *tmpMsg << nV7;
-    /* *tmpMsg << (u8)0x64; // ??
-     *tmpMsg << (u8)0x00; // ??
-     *tmpMsg << (u8)0x64; // ??
-     *tmpMsg << (u8)0x00; // ??
-     *tmpMsg << (u8)0x64; // ??
-     *tmpMsg << (u8)0x00; // ??
-     *tmpMsg << (u8)0x64; // ??
-     *tmpMsg << (u8)0x00; // ??
-     *tmpMsg << (u8)0x64; // ??
-     *tmpMsg << (u8)0x00; // ??
-     *tmpMsg << (u8)0x64; // ??
-     *tmpMsg << (u8)0x00; // ??
-     *tmpMsg << (u8)0x00; // ??
-     *tmpMsg << (u8)0x00; // ??
-    */
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseQBSlotMsg3( PClient* nClient, u8 nSlot )
-{
-    PMessage* tmpMsg = new PMessage( 19 );
-    nClient->IncreaseUDP_ID();
-    nClient->IncreaseTransactionID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x0d; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25; // cmd
-    *tmpMsg << ( u8 )0x13; // cmd
-    *tmpMsg << ( u16 )nClient->GetTransactionID();
-    *tmpMsg << ( u8 )0x0b; // cmd
-    *tmpMsg << nSlot; // ??
-    *tmpMsg << ( u8 )0x00; // ??
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseQBSlotMsg4( PClient* nClient, u16 nWeaponId )
-{
-    PMessage* tmpMsg = new PMessage( 16 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x0a; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x2f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x02; // ??
-    *tmpMsg << ( u8 )0x02; // ??
-    *tmpMsg << nWeaponId;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildContainerContentList( PContainer* nContainer, u8 nLocType )
-{
-    PMessage* tmpMsg = new PMessage( 256 );
-    std::vector< PContainerEntry* >* Entries = nContainer->GetEntries();
-    PContainerEntry* tEntry;
-    PMessage* entryMsg;
-
-//Console->Print(YELLOW, BLACK, "BuildContainerContentList for loc %d", nLocType);
-    if ( nLocType != INV_LOC_BOX )
-    {
-        if ( nLocType == INV_LOC_BACKPACK )
-            *tmpMsg << ( u16 )Entries->size(); // items nb
-        else
-            *tmpMsg << ( u8 )Entries->size(); // items nb
-    }
-
-    for ( u16 i = 0; i < Entries->size(); ++i )
-    {
-        tEntry = Entries->at( i );
-        entryMsg = BuildContainerContentEntry( tEntry, nLocType );
-//if(tEntry->mItem->mItemID == 390)
-//{
-//Console->Print(YELLOW, BLACK, "BuildContainerContentList entry %d - size %d", i, entryMsg->GetSize());
-//entryMsg->Dump();
-//}
-        *tmpMsg << *entryMsg;
-        delete entryMsg;
-    }
-
-    delete Entries;
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildContainerContentEntry( PContainerEntry* nEntry, u8 nLocType )
-{
-    PMessage* tmpMsg = new PMessage( 16 );
-    PItem* tItem;
-    u8 dataFlags, Qualifier;
-
-    tItem = nEntry->mItem;
-    dataFlags = Qualifier = 0x00 ;
-
-    if (( tItem->mItemID == 390 ) /* testing */ || tItem->mLoadedAmmoNb )
-    {
-        dataFlags |= 0x01;
-    }
-    if (( tItem->GetType() == ITEM_TYPE_WEAPON ) || ( tItem->GetType() == ITEM_TYPE_BLUEPRINT ) || ( tItem->GetType() == ITEM_TYPE_WRECKEDPART )/*|| (tItem->GetType() == ITEM_TYPE_APARTMENTKEY) || (tItem->GetType() == ITEM_TYPE_CLANKEY) || (tItem->GetType() == ITEM_TYPE_VHCKEY) */ ) // testing loaded ammo type & BP attributes
-    {
-        dataFlags |= 0x20;
-    }
-
-    switch ( tItem->GetType() )
-    {
-    case ITEM_TYPE_WEAPON:
-    case ITEM_TYPE_AUTOWEAPON:
-        Qualifier = 6;
-        dataFlags |= 0x02;
-        break;
-    case ITEM_TYPE_IMPLANT:
-    case ITEM_TYPE_ARMOR:
-        Qualifier = 2;
-        dataFlags |= 0x02;
-        break;
-    default:
-        Qualifier = 0;
-        break;
-    }
-
-    if ( tItem->IsStackable() && tItem->mStackSize )
-    {
-        dataFlags |= 0x04;
-    }
-
-    if (( tItem->mModificators ) || ( tItem->mItemID == 390 ) ) // TEST
-        dataFlags |= 0x10;
-
-    if ( tItem->mMaxSlots || ( tItem->mItemID == 390 ) ) // TEST
-        dataFlags |= 0x40;
-
-
-
-    if ( nLocType == INV_LOC_BOX )
-        *tmpMsg << ( u8 )0x00;   // Size of item placeholder
-    else
-        *tmpMsg << ( u16 )0x0000;   // Size of item placeholder
-
-    switch ( nLocType )
-    {
-    case INV_LOC_WORN:
-        *tmpMsg << ( u8 )nEntry->mPosX; // X Location
-        *tmpMsg << ( u8 )0x00; // just nothing
-        break;
-    case INV_LOC_BACKPACK:
-        *tmpMsg << ( u8 )0x00; // just nothing again
-        *tmpMsg << ( u8 )nEntry->mPosX; // X Location
-        *tmpMsg << ( u8 )nEntry->mPosY; // Y Location
-        break;
-    case INV_LOC_GOGO:
-        *tmpMsg << ( u8 )nEntry->mPosX;
-        break;
-    case INV_LOC_BOX:
-    case INV_LOC_BOX2:
-        break;
-    default:
-        break;
-    }
-
-    *tmpMsg << ( u16 )tItem->mItemID; // ItemID
-    *tmpMsg << ( u8 )dataFlags; // (0x01|0x02|0x04|0x10|0x20|0x40|0x80); // Datatypes
-
-    if ( dataFlags & 0x01 )
-    {
-        if ( tItem->GetType() == ITEM_TYPE_WEAPON ) // TESTING
-            *tmpMsg << ( u8 )6; // Remaining ammos
-        else
-            *tmpMsg << ( u8 )tItem->mLoadedAmmoNb; // Remaining ammos
-    }
-
-    if ( dataFlags & 0x02 )
-    {
-        *tmpMsg << ( u8 )Qualifier; // Qual entries
-        if ( Qualifier >= 2 )
-        {
-            *tmpMsg << ( u8 )tItem->mCurDuration; // current qual
-            if ( Qualifier == 6 )
-            {
-                *tmpMsg << ( u8 )tItem->mDamages; // dmg
-                *tmpMsg << ( u8 )tItem->mFrequency; // freq
-                *tmpMsg << ( u8 )tItem->mHandling; // handl
-                *tmpMsg << ( u8 )tItem->mRange; // range
-            }
-            *tmpMsg << ( u8 )tItem->mMaxDuration; // max qual
-        }
-    }
-
-    if ( dataFlags & 0x10 )
-    {
-        if ( tItem->mItemID == 390 ) // test
-            *tmpMsg << ( u8 )4;
-        else
-            *tmpMsg << ( u8 )tItem->mModificators; // addons bitflag: flashlight=1, scope, silencer, laserpointer
-    }
-
-    if ( dataFlags & 0x40 )
-    {
-        if ( tItem->mItemID == 390 ) // test
-        {
-            *tmpMsg << ( u8 )3;
-            *tmpMsg << ( u8 )3;
-            *tmpMsg << ( u16 )0x000b; // enlarged
-            *tmpMsg << ( u16 )0x05de; // phosophore
-            *tmpMsg << ( u16 )( -3 ); // silencer
-        }
-        else
-        {
-
-            *tmpMsg << ( u8 )tItem->mUsedSlots; // used slots
-            *tmpMsg << ( u8 )tItem->mMaxSlots; // max slots
-            for ( u8 j = 0; j < tItem->mMaxSlots; ++j )
-                *tmpMsg << ( u16 )(( j < tItem->mUsedSlots ) ? tItem->mSlot[j] : 0 ); // mod in slot
-        }
-    }
-
-    if ( dataFlags & 0x20 ) // loaded ammo type ????
-    {
-        u16 lengthFieldOffset = tmpMsg->GetNextByteOffset();
-        *tmpMsg << ( u16 )0x0000; // length placeholder
-
-        if ( tItem->GetType() == ITEM_TYPE_WEAPON )
-        {
-            *tmpMsg << ( u8 )0x01; // ammo info
-            *tmpMsg << ( u8 )0x04; // total length ?
-            *tmpMsg << ( u8 )0x00; // + baseammo => current ammoId. 0xff => undefined
-            *tmpMsg << ( u8 )0xff; // supported ammos bitmap (all here)
-        }
-
-        if ( false && ( tItem->GetType() == ITEM_TYPE_APARTMENTKEY ) ) // activated Apartment key
-        {
-            *tmpMsg << ( u8 )0x02; // ammo info
-            *tmpMsg << ( u8 )0x06; // total length
-            *tmpMsg << ( u32 )123456; // apartmentObjectID ?
-        }
-
-        if ( false && ( tItem->GetType() == ITEM_TYPE_CLANKEY ) ) // activated ClanKey
-        {
-            *tmpMsg << ( u8 )0x04; // BP of... info
-            *tmpMsg << ( u8 )0x0a; // total length
-            *tmpMsg << ( u32 )1234; // ClanID ?
-            *tmpMsg << ( u32 )123456; // apartmentObjectID ?
-        }
-
-        if ( tItem->GetType() == ITEM_TYPE_BLUEPRINT ) // BP
-        {
-            *tmpMsg << ( u8 )0x05; // BP of... info
-            *tmpMsg << ( u8 )0x06; // total length
-            *tmpMsg << ( u32 )486; // ItemID ("Tangent Sniper Rifle")
-        }
-
-        if ( false && ( tItem->GetType() == ITEM_TYPE_VHCKEY ) ) // activated VHC Key
-        {
-            *tmpMsg << ( u8 )0x08; // VHC Key
-            *tmpMsg << ( u8 )0x0a; // total length
-            *tmpMsg << ( u32 )654321; // vhcObjectID ?
-            *tmpMsg << ( u32 )123456; // Owner CharID ?
-        }
-
-        if ( false && ( tItem->GetType() == ITEM_TYPE_WRECKEDPART ) ) // Identified rare part
-        {
-            *tmpMsg << ( u8 )0x09; // Rare part
-            *tmpMsg << ( u8 )0x05; // total length
-            *tmpMsg << ( u16 )453; // Rare Item ID ? REDEEMER
-            *tmpMsg << ( u8 )0; // ??
-        }
-
-        if (( tItem->mConstructorId ) || ( tItem->mItemID == 390 ) ) // Named item /itemId 390: test
-        {
-            *tmpMsg << ( u8 )0x0a; // constructor info
-            *tmpMsg << ( u8 )0x06; // total length
-            //*tmpMsg << (u32)tItem->mConstructorId; // charID
-            *tmpMsg << ( u32 )2;
-        }
-
-        tmpMsg->U16Data( lengthFieldOffset ) = tmpMsg->GetNextByteOffset() - lengthFieldOffset - 2;
-    }
-
-    if ( dataFlags & 0x04 )
-    {
-        *tmpMsg << ( u32 )tItem->mStackSize;
-    }
-
-
-    if ( nLocType == INV_LOC_BOX )
-        tmpMsg->U8Data( 0 ) = tmpMsg->GetSize() - 1;
-    else
-        tmpMsg->U16Data( 0 ) = tmpMsg->GetSize() - 2;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharOpenContainerMsg( PClient* nClient, u32 nContainerID, PContainer* nContainer )
-{
-    PMessage* ContentList = BuildContainerContentList( nContainer, INV_LOC_BOX );
-
-    PMessage* tmpMsg = new PMessage();
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x26;
-    *tmpMsg << nContainerID;
-    *tmpMsg << ( u8 )0x00; // Always the same on item containers? // 0x01 for Trader (NeoX gameclient 3608)
-    *tmpMsg << ( u8 )0x64; // Always the same on item containers?
-    *tmpMsg << ( u8 )0x00; // Always the same on item containers?
-    *tmpMsg << ( u8 )0x08; // 0x08 when container is filled, 0x00 when not? At least it works..
-
-    *tmpMsg << ( u16 )( ContentList->GetSize() );
-    *tmpMsg << *ContentList;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    delete ContentList;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildItemMoveMsg( PClient* nClient, u8 nSource, u8 nSrcX, u8 nSrcY, u8 nDestination, u8 nDestX, u8 nDestY, u8 nItemCnt )
-{
-    PMessage* tmpMsg = new PMessage( 26 );
-    nClient->IncreaseUDP_ID();
-    nClient->IncreaseTransactionID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x14; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25;
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetTransactionID();
-    *tmpMsg << ( u8 )0x14; // ItemMove Answer
-    *tmpMsg << nSource;
-    *tmpMsg << nSrcX;
-    *tmpMsg << nSrcY;
-    *tmpMsg << nDestination;
-    *tmpMsg << nDestX;
-    *tmpMsg << nDestY;
-    *tmpMsg << nItemCnt;
-    *tmpMsg << ( u8 )0x00; // ??
-    *tmpMsg << ( u8 )0x00; // ??
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildBoxItemMoveMsg( PClient* nClient, PContainerEntry* nEntry, u8 nSrcX, u8 nSrcY, u8 nDestination, u8 nDestX, u8 nDestY, u8 nItemCnt )
-{
-    PMessage* tmpMsg = new PMessage( 64 );
-    PMessage* entryMsg = BuildContainerContentEntry( nEntry, INV_LOC_BOX2 );
-
-    nClient->IncreaseUDP_ID();
-    nClient->IncreaseTransactionID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x09; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25;
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetTransactionID();
-    *tmpMsg << ( u8 )0x17; // BoxItemMove Answer Src
-    *tmpMsg << ( u8 )INV_LOC_BOX; // Src = Box
-    *tmpMsg << nSrcX;
-    *tmpMsg << nSrcY;
-    *tmpMsg << nItemCnt;
-    *tmpMsg << ( u8 )0x00; // Qty high
-    *tmpMsg << ( u8 )0x18; // BoxItemMove Answer Dst
-    *tmpMsg << nDestination;
-    *tmpMsg << nDestX;
-    *tmpMsg << nDestY;
-    *tmpMsg << *entryMsg;
-    *tmpMsg << ( u8 )0x12; // ? vary ...
-    *tmpMsg << ( u8 )0x00;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    delete entryMsg;
-    return tmpMsg;
-}
-
-/*PMessage* PMsgBuilder::BuildItemAmmoUpdateMsg (PClient* nClient, PContainerEntry* nEntry, u8 nSrcX, u8 nSrcY, u8 nDestination, u8 nDestX, u8 nDestY, u8 nItemCnt)
-{
-  PMessage* tmpMsg = new PMessage(64);
-  PMessage* entryMsg = BuildContainerContentEntry(nEntry, INV_LOC_BOX2);
-
-  nClient->IncreaseUDP_ID();
-  nClient->IncreaseTransactionID();
-
-  *tmpMsg << (u8)0x13;
-  *tmpMsg << (u16)nClient->GetUDP_ID();
-  *tmpMsg << (u16)nClient->GetSessionID();
-
-  *tmpMsg << (u8)0x09; // Message length
-  *tmpMsg << (u8)0x03;
-  *tmpMsg << (u16)nClient->GetUDP_ID();
-  *tmpMsg << (u8)0x1f;
-  *tmpMsg << (u16)nClient->GetLocalID();
-  *tmpMsg << (u8)0x25;
-  *tmpMsg << (u8)0x13;
-  *tmpMsg << (u16)nClient->GetTransactionID();
-  *tmpMsg << (u8)0x17; // BoxItemMove Answer Src
-  *tmpMsg << (u8)INV_LOC_BOX; // Src = Box
-  *tmpMsg << nSrcX;
-  *tmpMsg << nSrcY;
-  *tmpMsg << nItemCnt;
-  *tmpMsg << (u8)0x00; // Qty high
-  *tmpMsg << (u8)0x18; // BoxItemMove Answer Dst
-  *tmpMsg << nDestination;
-  *tmpMsg << nDestX;
-  *tmpMsg << nDestY;
-  *tmpMsg << *entryMsg;
-  *tmpMsg << (u8)0x12; // ? vary ...
-  *tmpMsg << (u8)0x00;
-
-  (*tmpMsg)[5] = (u8)(tmpMsg->GetSize() - 6);
-
-  delete entryMsg;
-  return tmpMsg;
-}*/
-/* Resp:
-03:33:00:1f:01:00:25:13
-c2:01:0a:00:02:00:00:00 ??
-c3:01:05:03:00:00:12 Update ammo left
-c4:01:05:02:00:00:0c Update ammo left
-*/
-
-PMessage* PMsgBuilder::BuildStartHackGameMsg( PClient* nClient, u32 nWorldObjID, u8 nHackDifficult )
-{
-    PMessage* tmpMsg = new PMessage( 22 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x10;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x28;
-    *tmpMsg << nWorldObjID;
-    *tmpMsg << nHackDifficult;
-    *tmpMsg << ( u8 )0x28;
-    *tmpMsg << ( u8 )0x5c;
-    *tmpMsg << ( u8 )0xcf;
-    *tmpMsg << ( u8 )0x3e;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildSubwaySpawnMsg( PClient* nClient, bool IsSecondMessage )
-{
-    PMessage* tmpMsg = new PMessage( 197 );
-    u16 First = IsSecondMessage ? 6 : 0;
-    u16 Last = IsSecondMessage ? 10 : 5;
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    for ( u16 i = First; ( i <= Last ); i++ )
-    {
-        nClient->IncreaseUDP_ID();
-        *tmpMsg << ( u8 )0x11; //msg size
-        *tmpMsg << ( u8 )0x03;
-        *tmpMsg << ( u16 )nClient->GetUDP_ID();
-        *tmpMsg << ( u8 )0x28;
-        *tmpMsg << ( u16 )0x0027;
-        *tmpMsg << ( u32 )( PSubway::mCabsBaseId + i );
-        *tmpMsg << ( u16 )0x0000;
-        *tmpMsg << ( u8 )0x00;
-        *tmpMsg << ( u16 )Subway->mSubways[i].mPosition;
-        *tmpMsg << ( u8 )0x00;
-        *tmpMsg << ( u8 )Subway->mSubways[i].mDoorOpened;;
-
-        nClient->IncreaseUDP_ID(); // vhc health update
-        *tmpMsg << ( u8 )0x0d; //msg size
-        *tmpMsg << ( u8 )0x03;
-        *tmpMsg << ( u16 )nClient->GetUDP_ID();
-        *tmpMsg << ( u8 )0x2d;
-        *tmpMsg << ( u32 )( PSubway::mCabsBaseId + i );
-        *tmpMsg << ( u8 )0x0a;
-        *tmpMsg << ( u32 )PSubway::mCabsBaseHealth;
-    }
-
-    tmpMsg->U16Data( 1 ) = nClient->GetUDP_ID();
-    tmpMsg->U16Data( 3 ) = nClient->GetSessionID();
-
-    return tmpMsg;
-}
-
-/*
-PMessage* PMsgBuilder::BuildSubwayFullUpdateMsg(PClient* nClient)
-{
-    PMessage* tmpMsg = new PMessage(148);
-    *tmpMsg << (u8)0x13;
-    *tmpMsg << (u16)0x0000; // placeholder for UDP_ID;
-    *tmpMsg << (u16)0x0000; // placeholder for SessionID();
-
-    for(u8 i=0; i<PSubway::mCabsNumber; i++)
-    {
-      nClient->IncreaseUDP_ID();
-      *tmpMsg << (u8)0x0c; //msg size
-      *tmpMsg << (u8)0x03;
-      *tmpMsg << (u16)nClient->GetUDP_ID();
-      *tmpMsg << (u8)0x32;
-      *tmpMsg << (u32)(PSubway::mCabsBaseId + i);
-      *tmpMsg << (u8)0x00;
-      *tmpMsg << (u16)Subway->mSubways[i].mPosition;
-      *tmpMsg << (u8)Subway->mSubways[i].mDoorOpened;;
-  }
-
-    tmpMsg->U16Data(1) = nClient->GetUDP_ID();
-    tmpMsg->U16Data(3) = nClient->GetSessionID();
-
-    return tmpMsg;
-}
-*/
-
-PMessage* PMsgBuilder::BuildSubwaySingleUpdateMsg( u32 nVehicleID, u16 nPosition, u8 nDoorOpened )
-{
-    PMessage* tmpMsg = new PMessage( 18 );
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x0c; //msg size
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // ++UDP_ID placeholder
-    *tmpMsg << ( u8 )0x32;
-    *tmpMsg << ( u32 )nVehicleID;
-    *tmpMsg << ( u8 )0x00;
-    *tmpMsg << ( u16 )nPosition;
-    *tmpMsg << ( u8 )nDoorOpened;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildSpawnWorldObjectMsg( u16 nModelID, u16 nFunctionID, u32 nWOID, u16 nPosX, u16 nPosY, u16 nPosZ, u8 nRotX, u8 nRotY, u8 nRotZ )
-{
-    PMessage* tmpMsg = new PMessage( 31 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // UDP placeholder
-    *tmpMsg << ( u16 )0x0000; // Session placeholder
-    *tmpMsg << ( u8 )0x16;  // Message length
-    *tmpMsg << ( u8 )0x03;  // 0x03 commandset
-    *tmpMsg << ( u16 )0x0000; // UDP placeholder
-    *tmpMsg << ( u8 )0x1b;  // Subcommandset
-    *tmpMsg << ( u32 )nWOID;  // WorldobjectID
-
-    *tmpMsg << ( u8 )0x19;  // Positiondata follows
-    *tmpMsg << ( u16 )nPosY;
-    *tmpMsg << ( u16 )nPosZ;
-    *tmpMsg << ( u16 )nPosX;
-    *tmpMsg << ( u8 )nRotY;  // Rotation X
-    *tmpMsg << ( u8 )nRotZ;  // Rotation Y
-    *tmpMsg << ( u8 )nRotX;  // Rotation Z
-    *tmpMsg << ( u16 )nModelID;
-    *tmpMsg << ( u16 )nFunctionID;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildRemoveWorldObjectMsg( u32 nWOID )
-{
-    PMessage* tmpMsg = new PMessage( 14 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // UDP ID placeholder
-    *tmpMsg << ( u16 )0x0000; // SessionID placeholder
-    *tmpMsg << ( u8 )0x08;  // Len (static, always 0x08
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // Sub UDP ID placeholder
-    *tmpMsg << ( u8 )0x26;  // Command FADE AWAY CHAR (kinda ^^)
-    *tmpMsg << ( u32 )nWOID;  // WorldobjectID
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildDBRequestStatusMsg( PClient* nClient, std::string *nCommandName, u8 nStatus, u16 nErrCode )
-{
-    PMessage* tmpMsg = new PMessage( 32 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x14; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x2b;
-    *tmpMsg << ( u8 )0x1a;
-    *tmpMsg << ( u16 )( nCommandName->size() + 1 );
-    *tmpMsg << ( u8 )nStatus;
-    *tmpMsg << ( u16 )nErrCode;
-    *tmpMsg << ( *nCommandName );
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildDBAnswerMsg( PClient* nClient, std::string *nCommandName, std::string *nAnswerData, u16 nRows, u16 nCols )
-{
-    u8 i, j, k;
-    PMessage* tmpMsg = new PMessage( 32 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x14; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x2b;
-    *tmpMsg << ( u8 )0x17;
-    *tmpMsg << ( u16 )( nCommandName->size() + 1 );
-    *tmpMsg << ( u16 )nRows;
-    *tmpMsg << ( u16 )nCols;
-    *tmpMsg << ( *nCommandName );
-
-    for ( i = 0, k = 0; i < nRows; ++i )
-    {
-        for ( j = 0; j < nCols; ++j, ++k )
-        {
-            *tmpMsg << ( u16 )( nAnswerData[k].size() + 1 );
-            *tmpMsg << nAnswerData[k];
-        }
-    }
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseVhcMsg( PClient* nClient, u32 nRawObjectID, u16 nVhcType, u16 nAvailableSeats )
-{
-    PMessage* tmpMsg = new PMessage( 24 );
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x13; // Message length;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x3d;
-    *tmpMsg << ( u32 )0x0000000e; // cmd
-    *tmpMsg << nRawObjectID;
-    *tmpMsg << nVhcType;
-    *tmpMsg << nAvailableSeats; // Bit flags
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildVhcInfoMsg( PClient* nClient, PSpawnedVehicle* nVehicle )
-{
-    PMessage* tmpMsg = new PMessage( 32 );
-    PVhcCoordinates VhcPos = nVehicle->GetPosition();
-    PVehicleInformation VhcInfo = nVehicle->GetInformation();
-
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x28;
-    *tmpMsg << ( u16 )0x0031;
-    *tmpMsg << ( u32 )nVehicle->GetLocalId();
-    *tmpMsg << ( u8 )0x02;
-    *tmpMsg << ( u16 )( VhcPos.GetY() + 768 );
-    *tmpMsg << ( u16 )( VhcPos.GetZ() + 768 );
-    *tmpMsg << ( u16 )( VhcPos.GetX() + 768 );
-    *tmpMsg << ( u8 )VhcPos.GetUD();
-    *tmpMsg << ( u16 )VhcPos.GetLR();
-    *tmpMsg << ( u16 )VhcPos.GetRoll();
-    *tmpMsg << ( u8 )VhcInfo.GetVehicleType();
-    *tmpMsg << ( u8 )0xff;
-    *tmpMsg << ( u32 )0x00000000;
-    *tmpMsg << ( u16 )0x0000;
-    *tmpMsg << ( u8 )0x00;
-    *tmpMsg << ( u8 )0x01; // ? changes
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-/*PMessage* PMsgBuilder::BuildVhcInfoMsg( PClient* nClient, PSpawnedVehicle* nVehicle )
-{
-  PMessage* tmpMsg = new PMessage( 32 );
-  PVhcCoordinates VhcPos = nVehicle->GetPosition();
-  PVehicleInformation VhcInfo = nVehicle->GetInformation();
-
-  nClient->IncreaseUDP_ID();
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u16 )nClient->GetSessionID();
-
-  *tmpMsg << ( u8 )0x00; // Message length placeholder;
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u8 )0x28;
-  *tmpMsg << ( u16 )0x0031;
-  *tmpMsg << ( u32 )nVehicle->GetLocalId();
-  *tmpMsg << ( u8 )0x02;
-  *tmpMsg << ( u16 )( VhcPos.GetY() + 768 );
-  *tmpMsg << ( u16 )( VhcPos.GetZ() + 768 );
-  *tmpMsg << ( u16 )( VhcPos.GetX() + 768 );
-  *tmpMsg << ( u8 )VhcPos.GetUD();
-  *tmpMsg << ( u16 )VhcPos.GetLR();
-  *tmpMsg << ( u16 )VhcPos.GetRoll();
-  *tmpMsg << ( u8 )VhcInfo.GetVehicleType();
-  *tmpMsg << ( u32 )0x00000000;
-  *tmpMsg << ( u32 )0x00000000;
-  *tmpMsg << ( u32 )0x00000000;
-  *tmpMsg << ( u16 )0x0000;
-  u32 tCharId;
-  for(u8 i = 0; i < 8; ++i)
-  {
-    if( (tCharId = nVehicle->GetSeatUser(i)) )
-    {
-      *tmpMsg << tCharId;
-    }
-    else
-    {
-      *tmpMsg << ( u32 )0xffffffff;
-    }
-    *tmpMsg << i;
-    *tmpMsg << ( u16 )0x0000;
-  }
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-  return tmpMsg;
-}*/
-/* ????
-13 f7 00 49 bf
-5d
-03 f7 00
-28 31 00
-c9 03 00 00 = Object ID
-02
-47 ff
-00 cd
-c3 c3
-d7
-d7 ec
-00 00
-29
-2b 65 35 8b 8c 6c 7f 80 96
-5f 26 00 80 00
-ff ff ff ff 00 00 00
-ff ff ff ff 01 00 00
-ff ff ff ff 02 00 00
-ff ff ff ff 03 00 00
-ff ff ff ff 04 00 00
-ff ff ff ff 05 00 00
-ff ff ff ff 06 00 00
-ff ff ff ff 07 00 00
-
-*/
-
-PMessage* PMsgBuilder::BuildVhcHealthUpdateMsg( PSpawnedVehicle* nVehicle )
-{
-    PMessage* tmpMsg = new PMessage( 19 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x0d; //msg size
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // placeholder for ++UDP_ID
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nVehicle->GetLocalId();
-    *tmpMsg << ( u8 )0x0a; // Health update
-    *tmpMsg << ( f32 )( nVehicle->GetInformation().GetHealth() );
-
-    return tmpMsg;
-}
-
-// NB: same as BuildCharSittingMsg. To be merged later when classes are adapted
-PMessage* PMsgBuilder::BuildVhcPosUpdateMsg( PSpawnedVehicle* nVehicle )
-{
-    PMessage* tmpMsg = new PMessage( 33 );
-    PVhcCoordinates VhcPos = nVehicle->GetPosition();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; //Client->GetUDP_ID(); // just placeholder, must be set outside
-    *tmpMsg << ( u16 )0x0000;  // Client->GetSessionID(); // just placeholder, must be set outside
-
-    *tmpMsg << ( u8 )0x00; // Message length placeholder;
-    *tmpMsg << ( u8 )0x32;
-    *tmpMsg << ( u16 )( nVehicle->GetLocalId() & 0xffff );
-    *tmpMsg << ( u8 )0x03; // We suppose we use move type 3, as in client message
-    *tmpMsg << ( u16 )( VhcPos.GetY() + 768 ); // +768 or +0 ??? All Char/Vhc/NPC/Objet offset to clean up...
-    *tmpMsg << ( u16 )( VhcPos.GetZ() + 768 );
-    *tmpMsg << ( u16 )( VhcPos.GetX() + 768 );
-    *tmpMsg << ( u8 )VhcPos.GetUD();
-    *tmpMsg << ( u16 )VhcPos.GetLR();
-    *tmpMsg << ( u16 )VhcPos.GetRoll();
-    *tmpMsg << ( u16 )VhcPos.GetUnknown();
-    *tmpMsg << ( u8 )0x00;
-    *tmpMsg << ( u8 )VhcPos.GetAct();
-    /* What is that for ????
-    *tmpMsg << ( u8 )0x02; // <= these two u8 corresond to mUnknown... = additionnal data ?
-    *tmpMsg << ( u8 )0x00; // maybe weapon related ?
-    *tmpMsg << ( u16 )0x0000;
-    *tmpMsg << ( u16 )0x0001;
-    *tmpMsg << ( u16 )0x8000;
-    *tmpMsg << ( u16 )0x8000;
-    */
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildVhcPosUpdate2Msg( PSpawnedVehicle* nVehicle )
-{
-    PMessage* tmpMsg = new PMessage( 28 );
-    PVhcCoordinates VhcPos = nVehicle->GetPosition();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x00; //msg size
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // ++UDP_ID placeholder
-    *tmpMsg << ( u8 )0x32;
-    *tmpMsg << ( u16 )( nVehicle->GetLocalId() & 0xffff );
-    *tmpMsg << ( u8 )0x03; // 0x07 in nc2.2, and one more field (same a received msg)
-    *tmpMsg << ( u16 )( VhcPos.GetY() + 768 ); // +768 or +0 ??? All Char/Vhc/NPC/Objet offset to clean up...
-    *tmpMsg << ( u16 )( VhcPos.GetZ() + 768 );
-    *tmpMsg << ( u16 )( VhcPos.GetX() + 768 );
-    *tmpMsg << ( u8 )VhcPos.GetUD();
-    *tmpMsg << ( u16 )VhcPos.GetLR();
-    *tmpMsg << ( u16 )VhcPos.GetRoll();
-    *tmpMsg << ( u16 )VhcPos.GetUnknown();
-    *tmpMsg << ( u8 )VhcPos.GetFF();
-    *tmpMsg << ( u8 )VhcPos.GetAct();
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-/*
-ground vhc in NC1
-C->S
-[...] 32:fb:03:03:d4:8c:2f:84:a0:7b:7b:bf:c6:53:28:01:00:ff:05
-S->C
-[...] 32: fb:03: 03: d4:8c: 2f:84: a0:7b: 7b: bf:c6: 53:28: 01:00:ff:05
-
-  *nMsg >> mVhcLocalId;
-  *nMsg >> mMoveType; // 0 for subway, 3 for nc1 vhc, 7 for nc2 vhc // u8
-  *nMsg >> mNewY;
-  *nMsg >> mNewZ;
-  *nMsg >> mNewX;
-  *nMsg >> mNewUD; // u8
-  *nMsg >> mNewLR;
-  *nMsg >> mNewRoll;
-  *nMsg >> mUnk1;
-  *nMsg >> mFF; // u8
-  *nMsg >> mAction; // u8
-
-quad in NC2.2
-C->S
-[...] 32:c9:03:07:28:65:35:8b:8c:6c:7f:09:99:45:26:10:80:01:00:ff:05
-S->C
-[...] 32:c9:03:07:28:65:35:8b:8c:6c:7f:09:99:45:26:10:80:01:00:ff:05
-
-glider in NC2.2
-C->S
-[...] 32:4b:03:07:13:57:a9:88:89:af:86:c1:89:ec:81:64:82:01:00:ff:00
-S->C
-[...] 32:4b:03:07:98:57:c8:88:59:b0:83:5c:88:13:81:64:82:01:00:ff:00:
-[...] 32:4b:03:07:13:57:a9:88:89:af:86:c1:89:ec:81:64:82:01:00:ff:00:
-
-
-*/
-PMessage* PMsgBuilder::BuildTraderItemListMsg( PClient* nClient, u32 nTraderNpcID ) //, PContainer* nContainer)
-{
-//    PMessage* ContentList = BuildContainerContentList(nContainer, INV_LOC_BOX);
-// Tmp manual content list:
-    PMessage* ContentList = new PMessage();
-    f32 PriceCoef = 1 / 1.379942;
-    u8 Quality = 255; // Range 0 - 255
-
-    //Item 1:
-    *ContentList << ( u16 )0x05e6; // Item Id "Clan key for CityAdmin"
-    *ContentList << ( u32 )304567; // Base (?) Item price = item.def price / 1.97
-    // Displayed price is this price * 1.38 . Is this faction/barter factor ?
-    //Item 2:
-    *ContentList << ( u16 )0x05e7; // Item Id "Clan key for Diamond Real Estate"
-    *ContentList << ( u32 )( 420285 * PriceCoef );
-    //Item 3:
-    *ContentList << ( u16 )0x05e8; // Item Id "Clan key for N.E.X.T."
-    *ContentList << ( u32 )( 420285 * PriceCoef );
-    //Item 4:
-    *ContentList << ( u16 )0x060f; // Item Id "PLAZA - 2nd Lev. Apartment"
-    *ContentList << ( u32 )( 245166 * PriceCoef );
-    //Item 5:
-    *ContentList << ( u16 )0x065c; // Item Id "Normal Viarosso Apartment Alamo Living"
-    *ContentList << ( u32 )( 840571 * PriceCoef );
-    //Item 6:
-    *ContentList << ( u16 )0x065d; // Item Id "Luxus Viarosso Apartment Alamo Living"
-    *ContentList << ( u32 )( 1260856 * PriceCoef );
-
-    //Item 7:
-    *ContentList << ( u16 )355; // Item Id "HEW ï¿½Liquid Fire� Rifle"
-    *ContentList << ( u32 )( 1260856 * PriceCoef );
-
-    PMessage* tmpMsg = new PMessage();
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x26;
-    *tmpMsg << nTraderNpcID;
-    *tmpMsg << ( u8 )0x01; // Traders inventory
-    *tmpMsg << ( u16 )( ContentList->GetSize() / 6 ); // List entries
-    *tmpMsg << ( u8 )Quality; // Items quality
-    *tmpMsg << *ContentList;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    delete ContentList;
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildStartWeaponReloadMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 16 );
-    nClient->IncreaseUDP_ID();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u16 )nClient->GetSessionID();
-    *tmpMsg << ( u8 )0x00; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )nClient->GetUDP_ID();
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x25; // cmd
-    *tmpMsg << ( u8 )0x16; // cmd
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildStartWeaponReloadAnimMsg( PClient* nClient )
-{
-    PMessage* tmpMsg = new PMessage( 13 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x00;  // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u8 )0x15; // cmd
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildHeldItemUseMsg( u16 nUserCharLocalId, u16 nWeaponId, u32 nTargetRawItemID, u8 nAiming, u8 nTargetedHeight, u8 nScore )
-{
-    PMessage* tmpMsg = new PMessage( 22 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x00;  // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )nUserCharLocalId;
-    *tmpMsg << ( u8 )0x01; // cmd
-    *tmpMsg << ( u16 )nWeaponId;
-    *tmpMsg << ( u32 )nTargetRawItemID;
-    *tmpMsg << ( u8 )nAiming;
-    *tmpMsg << ( u8 )nTargetedHeight;
-    *tmpMsg << ( u8 )nScore;
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildHeldItemUse2Msg( u16 nUserCharLocalId, u32 nTargetRawItemID )
-{
-  PMessage* tmpMsg = new PMessage( 18 );
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-  *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-  *tmpMsg << ( u8 )0x00;  // Message length placeholder;
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nUserCharLocalId;
-  *tmpMsg << ( u8 )0x2c; // cmd
-  *tmpMsg << ( u8 )0x09; // cmd
-  *tmpMsg << ( u32 )nTargetRawItemID;
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-  return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildHeldItemUse3Msg(  PClient* nClient, u16 nUnknown1, u16 nUnknown2, u16 nUnknown3, u16 nUnknown4 )
-{
-  PMessage* tmpMsg = new PMessage( 22 );
-  nClient->IncreaseUDP_ID();
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u16 )nClient->GetSessionID();
-  *tmpMsg << ( u8 )0x00; // Message length
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nClient->GetLocalID();
-  *tmpMsg << ( u8 )0x25; // cmd
-  *tmpMsg << ( u8 )0x1a; // cmd
-  *tmpMsg << ( u16 )nUnknown1;
-  *tmpMsg << ( u16 )nUnknown2;
-  *tmpMsg << ( u16 )nUnknown3;
-  *tmpMsg << ( u16 )nUnknown4;
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-  return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildHeldItemUse4Msg( u16 nUserCharLocalId, u32 nTargetRawItemID, u16 nUnknown1, u16 nUnknown2, u8 nTargetedHeight )
-{
-  PMessage* tmpMsg = new PMessage( 23 );
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-  *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-  *tmpMsg << ( u8 )0x00;  // Message length placeholder;
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nUserCharLocalId;
-  *tmpMsg << ( u8 )0x2c; // cmd
-  *tmpMsg << ( u8 )0x01; // cmd
-  *tmpMsg << ( u16 )nUnknown1;
-  *tmpMsg << ( u16 )nUnknown2;
-  *tmpMsg << ( u32 )nTargetRawItemID;
-  *tmpMsg << ( u8 )nTargetedHeight;
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-  return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildHeldItemAddonActivationMsg( PClient* nClient, u8 nState )
-{
-    PMessage* tmpMsg = new PMessage( 15 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x00;  // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u8 )0x2f;
-    *tmpMsg << ( u16 )nClient->GetLocalID();
-    *tmpMsg << ( u16 )0x0001; // cmd ?
-    *tmpMsg << ( u8 )( 0x60 | nState );
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildWeatherControlMsg( u16 nWeatherId )
-{
-    PMessage* tmpMsg = new PMessage( 13 );
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x00;  // Message length placeholder;
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u8 )0x2e;
-    *tmpMsg << ( u8 )0x01; // cmd
-    *tmpMsg << ( u16 )nWeatherId; //see at bottom of weather.def
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseTimedDrugMsg( PClient* nClient, const PDefDrug* nDrugDef, u16 nItemId )
-{
-  PMessage* tmpMsg = new PMessage( 60 );
-  nClient->IncreaseUDP_ID();
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u16 )nClient->GetSessionID();
-  *tmpMsg << ( u8 )0x00; // Message length
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nClient->GetLocalID();
-  *tmpMsg << ( u8 )0x25; // cmd
-  *tmpMsg << ( u8 )0x06; // cmd
-  *tmpMsg << ( u8 )nDrugDef->GetChangeNum();
-  *tmpMsg << ( u8 )0x01; // ??? not working if 0, no apparent change if > 1
-  *tmpMsg << ( u16 )nDrugDef->GetDuration();
-  *tmpMsg << ( u16 )nItemId;
-  for( u8 i = 0; i < nDrugDef->GetChangeNum(); ++i )
-  {
-    *tmpMsg << ( u8 )nDrugDef->GetChangeType( i );
-    *tmpMsg << ( u16 )( nDrugDef->GetChangeScale( i ) * 100 );
-    *tmpMsg << ( u16 )nDrugDef->GetChangeTarget( i );
-  }
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-  return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseInstantDrugMsg( PClient* nClient, const PDefDrug* nDrugDef )
-{
-  PMessage* tmpMsg = new PMessage( 60 );
-  nClient->IncreaseUDP_ID();
-
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u16 )nClient->GetSessionID();
-  *tmpMsg << ( u8 )0x00; // Message length
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nClient->GetLocalID();
-  *tmpMsg << ( u8 )0x25; // cmd
-  *tmpMsg << ( u8 )0x07; // cmd
-  *tmpMsg << ( u8 )nDrugDef->GetChangeNum();
-  *tmpMsg << ( u8 )0x02; // ??? other values not tested
-  for( u8 i = 0; i < nDrugDef->GetChangeNum(); ++i )
-  {
-    *tmpMsg << ( u8 )nDrugDef->GetChangeType( i );
-    *tmpMsg << ( f32 )( nDrugDef->GetChangeScale( i ) * 100 ); // f32 in nc2.2 - u16 in nc1 ???
-    *tmpMsg << ( u16 )nDrugDef->GetChangeTarget( i );
-  }
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-  Console->Print( "%s PMsgBuilder::BuildCharUseInstantDrugMsg : data format not tested", Console->ColorText( YELLOW, BLACK, "[WARNING]" ) );
-
-  return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildCharUseRecreationUnitMsg( PClient* nClient, u32 nObjectId )
-{
-  PMessage* tmpMsg = new PMessage( 16 );
-  nClient->IncreaseUDP_ID();
-/*
-  *tmpMsg << ( u8 )0x13;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u16 )nClient->GetSessionID();
-  *tmpMsg << ( u8 )0x00; // Message length
-  *tmpMsg << ( u8 )0x03;
-  *tmpMsg << ( u16 )nClient->GetUDP_ID();
-  *tmpMsg << ( u8 )0x1f;
-  *tmpMsg << ( u16 )nClient->GetLocalID();
-  *tmpMsg << ( u8 )0x25; // cmd
-  *tmpMsg << ( u8 )0x16; // cmd
-
-  ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-*/
-  Console->Print( "%s PMsgBuilder::BuildCharUseRecreationUnitMsg : not implemented (target: 0x%08x)", Console->ColorText( YELLOW, BLACK,"[WARNING]" ), nObjectId );
-  return tmpMsg;
-}
-
-// For testing - packet to be broadcasted to zone
-PMessage* PMsgBuilder::BuildNpcDeathMsg( PClient* nClient, u32 nNpcId, u8 unknown1, u8 unknown2 )
-{
-    PMessage* tmpMsg = new PMessage( 19 );
-    PChar *nChar = nClient->GetChar();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000; // placeholder for UDP_ID;
-    *tmpMsg << ( u16 )0x0000; // placeholder for SessionID();
-
-    *tmpMsg << ( u8 )0x00;  // Message length placeholder;
-    *tmpMsg << ( u8 )0x1b;
-    *tmpMsg << ( u32 )nNpcId;
-    *tmpMsg << ( u8 )0x1f;
-    *tmpMsg << ( u16 )( nChar->Coords.mY + 768 + 30 ); //move Npc near to char :p
-    *tmpMsg << ( u16 )( nChar->Coords.mZ + 768 + 0 );
-    *tmpMsg << ( u16 )( nChar->Coords.mX + 768 + 30 );
-    *tmpMsg << ( u8 )2; // ??? 0x01=look at target, 0x02=?, 0x10 = kneel, 0x80 = die
-    *tmpMsg << ( u8 )1; //0=> dead on health 0 / else alive on health 0. Changes in caps
-    *tmpMsg << ( u8 )96; // health => 0 alive if prec >0 1-127 alive, <0 dead (ie u8 128-255 = neg signed values)
-    *tmpMsg << ( u16 )259; // targetId (N)PC - Here: left copbot at NC entrance (zone 2008)
-    *tmpMsg << ( u8 )0x00; // ? doesn't seem to change in caps
-    *tmpMsg << ( u8 )0x00; // ? doesn't seem to change in caps
-    *tmpMsg << ( u8 )0; // ? changes in caps
-    *tmpMsg << ( u8 )0; // ? changes in caps // moving speed somewhere ?
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    unknown2 = unknown1; // so that gcc doesn't complain if these vars are not used
-    return tmpMsg;
-}
-
-PMessage* PMsgBuilder::BuildNpcCleanupMsg( u32 nNpcId, u8 nCmd )
-{
-    PMessage* tmpMsg = new PMessage();
-
-    *tmpMsg << ( u8 )0x13;
-    *tmpMsg << ( u16 )0x0000;
-    *tmpMsg << ( u16 )0x0000;
-    *tmpMsg << ( u8 )0x00; // Message length
-    *tmpMsg << ( u8 )0x03;
-    *tmpMsg << ( u16 )0x0000;
-    *tmpMsg << ( u8 )0x2d;
-    *tmpMsg << ( u32 )nNpcId;
-    *tmpMsg << ( u8 )nCmd; // 6: npc/vhc "cleanup", 1: kill npc + msg "no reward, too small"
-
-    ( *tmpMsg )[5] = ( u8 )( tmpMsg->GetSize() - 6 );
-
-    return tmpMsg;
- }\r
\r
-
-/*
-void Cmd_GiveItem (int ItemId, int Amount, int ClientNum)
-{
- unsigned char SendBuffer[256];
-
-// Inventory_AddNewItem (&Client_Sockets[ClientNum].CharInfo, ItemId, Amount);
- SendBuffer[0] = 0x13;
- SendBuffer[5] = 0x1b;
- SendBuffer[6] = 0x03;
- Network_IncrementUDP (ClientNum);
- *(unsigned short*)&SendBuffer[7] = Client_Sockets[ClientNum].UDP_ID;
- SendBuffer[9] = 0x1f;
- *(unsigned short*)&SendBuffer[10] = Client_Sockets[ClientNum].CharInfo.MapID;
- SendBuffer[12] = 0x25;
- SendBuffer[13] = 0x13;
- Client_Sockets[ClientNum].TransactionID++;
- *(unsigned short*)&SendBuffer[14] = Client_Sockets[ClientNum].TransactionID;//Transaction ID
- SendBuffer[16] = 0x18;
- SendBuffer[17] = 0x03; //Location
- SendBuffer[18] = 0xff; // \/
- SendBuffer[19] = 0xff; //Anywhere
- SendBuffer[20] = 0x08;
- SendBuffer[21] = 0x00;
- *(unsigned short*)&SendBuffer[22] = ItemId; //Item Id
- SendBuffer[24] = 0x05;
- SendBuffer[25] = 0x01;
- *(unsigned short*)&SendBuffer[26] = Amount; //Quantity
- SendBuffer[28] = 0x00;
- SendBuffer[29] = 0x00;
- *(unsigned short*)&SendBuffer[30] = Client_Sockets[ClientNum].CharInfo.ItemTransactionID; //Id of Purchased Item (Client sends another packet for placement of new item)
-
- *(unsigned short*)&SendBuffer[1] = Client_Sockets[ClientNum].UDP_ID;
- *(unsigned short*)&SendBuffer[3] = Client_Sockets[ClientNum].UDP_ID_HIGH;
-
- Network_SendUDP (SendBuffer, 32, ClientNum);
-}
-*/
-
-/* Unkown use packets (from nc2.2)
-13:81:00:81:e2: 0c: 03:81:00:23: 12:00: 07:00:00:00:00:00 // weather related ?
-
-13:56:00:56:e2: 40: 03:56:00:1f:01:00:25:13: f1:18:13:01:77:05:48:c7: f2:18:13:02:16:74:61:c7: f3:18:13:03:17:74:61:c7: f4:18:13:04:18:74:61:c7: f5:18:13:05:1f:2a:60:c7: f6:18:13:06:1f:2a:60:c7: f7:18:13:0b:3e:8f:6d:c7
-
-13:5c:00:5c:e2: 0c: 03:5c:00:1f:01:00:25:13: f8:18:0e:02
-
-13:xx:xx:xx:xx: 09: 03:68:00:2d: 6d:03:00:00: 06 // Action update ? other NPC update ? some vanish ?
-*/
diff --git a/server/src/game/npctemplate.cpp b/server/src/game/npctemplate.cpp
deleted file mode 100644 (file)
index 1971819..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-   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.
-*/
-
-
-/*
-npctemplate.cpp - NPC template class
-
-MODIFIED: 21 Jun 2009 Namikon
-REASON: - creation
-
-*/
-
-
-#include "main.h"
-#include "include/npctemplate.h"
-
-PNPCTemplate::PNPCTemplate()
-{
-    mUnknown1 = 0;
-    mPosY = 0.0f;
-    mPosZ = 0.0f;
-    mPosX = 0.0f;
-    mNPCTypeID = 0;
-    mActorStringSize = 0;
-    mAngleStringSize = 0;
-    mNpcID = 0;
-    mHasAdditionalCoords = 0;
-    mUnknown2a = 0;
-    mUnknown2b = 0;
-    mUnknown2c = 0;
-    /*mUnknown3*/mTradeID = 0;
-    mUnknown4 = 0;
-    mActorName = "";
-    mAngle = "";
-}
-
-PNPCTemplate::~PNPCTemplate()
-{
-    // Cleanup waypoints
-    for ( PWaypointMap::iterator i = mWayPoints.begin(); i != mWayPoints.end(); i++ )
-        delete i->second;
-}
-
-void PNPCTemplate::AddWayPoint(f32 nX, f32 nY, f32 nZ, u8 nID)
-{
-    struct s_f32coords *tWayPoint = new s_f32coords;
-    tWayPoint->mX = nX;
-    tWayPoint->mY = nY;
-    tWayPoint->mZ = nZ;
-
-    if ( mWayPoints.insert( std::make_pair( nID, tWayPoint)).second )
-        if ( gDevDebug ) Console->Print( "%s Waypoint %d (X %0.1f Y %0.1f Z %0.1f) added to NPC", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), nID, nX, nY, nZ );
-}
diff --git a/server/src/game/rconsole.cpp.inhib b/server/src/game/rconsole.cpp.inhib
deleted file mode 100644 (file)
index 285c78e..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-        rconsole.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-\r
-#include "main.h"\r
-\r
-static const int RCON_INPUTLEN = 512;\r
-\r
-struct PRConClient\r
-{\r
-       enum\r
-       {\r
-               RCCS_AUTH,\r
-               RCCS_AUTH_USER,\r
-               RCCS_AUTH_PASS,\r
-               RCCS_VALID,\r
-               RCCS_DISCONNECT\r
-       } mState;\r
-\r
-       PSocket *mSocket;\r
-       PAccount *mAccount;\r
-       char mInput[RCON_INPUTLEN];\r
-       int mInputLen;\r
-       bool mEcho;\r
-       std::clock_t mSleep, mSleepStart;\r
-       int mNumFailures;\r
-\r
-       inline PRConClient(NLsocket &Sock)\r
-       {\r
-               mSocket = new PSocket(Sock);\r
-               mAccount = 0;\r
-               mInputLen = 0;\r
-               mEcho = true;\r
-               mSleep = 0;\r
-               mSleepStart = 0;\r
-               mNumFailures = 0;\r
-       }\r
-\r
-       inline ~PRConClient()\r
-       {\r
-               delete mSocket;\r
-       }\r
-\r
-       inline void Print(const char *Fmt, ...)\r
-       {\r
-               static char Str[256];\r
-               va_list args;\r
-               va_start(args, Fmt);\r
-               vsnprintf(Str, 255, Fmt, args);\r
-               va_end(args);\r
-               mSocket->Write(Str);\r
-       }\r
-\r
-};\r
-\r
-PRConsole::PRConsole()\r
-{\r
-       mListener = NL_INVALID;\r
-}\r
-\r
-PRConsole::~PRConsole()\r
-{\r
-       if(mListener != NL_INVALID)\r
-               nlClose(mListener);\r
-\r
-       for(ClientList::iterator i=mClients.begin(); i!=mClients.end(); i++)\r
-               delete *i;\r
-}\r
-\r
-void PRConsole::Start()\r
-{\r
-  // CHECK FOR rconsole enabled!!!\r
-       Console->LPrint("Starting remote console...");\r
-       u16 Port = Config->GetOptionInt("rconsole_port");\r
-       mListener = nlOpen(Port, NL_TCP);\r
-       if(mListener == NL_INVALID)\r
-       {\r
-               Console->LPrint(RED, BLACK, "[ERROR]");\r
-               Console->LPrint(" Remote console failed");\r
-               Console->LClose();\r
-               return;\r
-       }\r
-\r
-       Console->LPrint(GREEN, BLACK, "Success");\r
-       Console->LClose();\r
-       nlListen(mListener);\r
-}\r
-\r
-void PRConsole::Update()\r
-{\r
-       if(mListener==NL_INVALID)\r
-               return;\r
-\r
-       NLsocket temp = nlAcceptConnection(mListener);\r
-       if(temp != NL_INVALID)\r
-       {\r
-               // TODO: print client ip addr\r
-               Console->Print("RConsole: client connected");\r
-               PRConClient *cl = new PRConClient(temp);\r
-               cl->mState = PRConClient::RCCS_AUTH;\r
-               mClients.push_back(cl);\r
-               cl->Print("TinNS shell [%s]\r\n", TINNS_VERSION);\r
-       }\r
-\r
-       for(ClientList::iterator i=mClients.begin(); i!=mClients.end();)\r
-       {\r
-               ClientList::iterator j=i;\r
-               PRConClient *cl = *i;\r
-               ++i;\r
-               if(!cl->mSocket->Update() || cl->mSocket->TimeOut())\r
-               {\r
-                       Console->Print("RConsole: client disconnected");\r
-                       mClients.erase(j);\r
-                       delete cl;\r
-                       continue;\r
-               }\r
-\r
-               if(cl->mSleep > 0)\r
-               {\r
-                       std::clock_t t = std::clock();\r
-                       cl->mSleep -= (t-cl->mSleepStart);\r
-                       cl->mSleepStart = t;\r
-\r
-                       if(cl->mSleep < 0)\r
-                               cl->mSleep = 0;\r
-\r
-                       // flush socket while sleeping\r
-                       int Size=0;\r
-                       cl->mSocket->Read(&Size);\r
-\r
-                       continue;\r
-               }\r
-\r
-               if(cl->mState==PRConClient::RCCS_AUTH)\r
-               {\r
-                       cl->Print("\r\nlogin: ");\r
-                       cl->mState = PRConClient::RCCS_AUTH_USER;\r
-               }\r
-\r
-               const u8 *Buf = 0;\r
-               int Size=0;\r
-               if((bool)(Buf = cl->mSocket->Read(&Size)))\r
-               {\r
-                       for(int i=0; i<Size; i++)\r
-                               if(cl->mInputLen < RCON_INPUTLEN)\r
-                               {\r
-                                       switch(Buf[i])\r
-                                       {\r
-                                               case 0x08 :\r
-                                               {\r
-                                                       if(cl->mInputLen > 0)\r
-                                                       {\r
-                                                               if(cl->mEcho)\r
-                                                                       cl->mSocket->Write(Buf[i]);\r
-                                                               cl->mInput[cl->mInputLen]=0;\r
-                                                               --cl->mInputLen;\r
-                                                       }\r
-                                                       break;\r
-                                               }\r
-\r
-                                               case '\n' :\r
-                                               {\r
-                                                       if(cl->mEcho)\r
-                                                               cl->mSocket->Write(Buf[i]);\r
-                                                       cl->mInput[cl->mInputLen]=0;\r
-                                                       ProcessClient(cl);\r
-                                                       cl->mInputLen = 0;\r
-                                                       break;\r
-                                               }\r
-\r
-                                               default :\r
-                                               {\r
-                                                       cl->mInput[cl->mInputLen++]=Buf[i];\r
-                                                       if(cl->mEcho)\r
-                                                               cl->mSocket->Write(Buf[i]);\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-                               }\r
-               }\r
-       }\r
-}\r
-\r
-void PRConsole::ProcessClient(PRConClient* Client)\r
-{\r
-       Console->Print(">%s", Client->mInput);\r
-       if(Client->mInputLen > 1)\r
-       {\r
-               if(Client->mInput[Client->mInputLen-1] == '\r')\r
-                       Client->mInput[Client->mInputLen-1]=0;\r
-\r
-               if(Client->mState == PRConClient::RCCS_AUTH_USER)\r
-               {\r
-                       Client->mAccount = Database->GetAccount(Client->mInput);\r
-                       Client->mState = PRConClient::RCCS_AUTH_PASS;\r
-                       Client->Print("password: ");\r
-                       Client->mEcho = false;\r
-               } else\r
-               if(Client->mState == PRConClient::RCCS_AUTH_PASS)\r
-               {\r
-                       Client->mEcho = true;\r
-                       if((!Client->mAccount) || (Client->mAccount->GetPassword() != Client->mInput) || (!Client->mAccount->IsConsoleAllowed()))\r
-                       {\r
-                               Client->Print("Invalid user or password\r\n");\r
-                               Client->mSleepStart = std::clock();\r
-                               ++Client->mNumFailures;\r
-                               if(Client->mNumFailures >= 3)\r
-                               {\r
-                                       // sleep 1 minute\r
-                                       Client->mSleep = 60*CLOCKS_PER_SEC;\r
-                                       Client->mNumFailures = 0;\r
-                               } else\r
-                                       Client->mSleep = 5*CLOCKS_PER_SEC;\r
-\r
-                               Client->mState = PRConClient::RCCS_AUTH;\r
-                       } else\r
-                       {\r
-                               Client->Print("\r\n\nUser %s logged in\r\n", Client->mAccount->GetName().c_str());\r
-                               Client->mState = PRConClient::RCCS_VALID;\r
-                               // disconnect after 30 minutes lacking socket activity\r
-                               Client->mSocket->SetTimeOutValue(1800);\r
-                               Prompt(Client);\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-void PRConsole::Prompt(PRConClient *Client)\r
-{\r
-       Client->Print("$ ", Client->mAccount->GetName().c_str(), Config->GetOption("server_name").c_str());\r
-}\r
diff --git a/server/src/game/server.cpp b/server/src/game/server.cpp
deleted file mode 100644 (file)
index df19173..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-        server.cpp\r
-\r
-        Authors:\r
-        - Akiko\r
-        - Namikon\r
-        - someone else?\r
-\r
-        MODIFIED: Unknown date / Unknown author\r
-        REASON: - initial release by unknown\r
-\r
-        MODIFIED: 25 Dec 2005 Namikon\r
-        REASON: - Added GPL\r
-*/\r
-#include "main.h"\r
-\r
-PServer::PServer()\r
-{\r
-       mNumClients = 0;\r
-       mMaxClients = Config->GetOptionInt("maxclients");\r
-       mGMSlots = Config->GetOptionInt("gm_slots");\r
-       if(mMaxClients==0)\r
-               mMaxClients=1;\r
-       if(mGMSlots==0)\r
-               mGMSlots=1;\r
-       Console->Print("Max clients: %i / GM slots: %i", mMaxClients, mGMSlots);\r
-       mClients.reserve(mMaxClients + mGMSlots);\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-               mClients[i]=0;\r
-}\r
-\r
-PServer::~PServer()\r
-{\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-               delete mClients[i];\r
-}\r
-\r
-int PServer::NewClient()\r
-{\r
-       if(mNumClients==mMaxClients+mGMSlots)\r
-               return -1;\r
-\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-       {\r
-               if(!mClients[i])\r
-               {\r
-                       mClients[i]=new PClient(i);\r
-                       ++mNumClients;\r
-                       return i;\r
-               }\r
-       }\r
-       return -1;\r
-}\r
-\r
-PClient *PServer::GetClient(int Client) const\r
-{\r
-       if(Client < 0 || Client >= mMaxClients+mGMSlots)\r
-               return 0;\r
-\r
-       return mClients[Client];\r
-}\r
-\r
-void PServer::Update()\r
-{\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-       {\r
-               if(mClients[i])\r
-               {\r
-                       mClients[i]->Update();\r
-                       if(mClients[i]->GetConnection()==PCC_NONE && mClients[i]->getTCPConn() == 0)\r
-                       {\r
-                               Console->Print("Removing client %i...", i);\r
-                               delete mClients[i];\r
-                               mClients[i]=0;\r
-                               --mNumClients;\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-void PServer::Shutdown()\r
-{\r
-    Console->Print("======================");\r
-       Console->Print("Shutting down Gameserver...");\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-       {\r
-               if(mClients[i])\r
-               {\r
-                       delete mClients[i];\r
-                       mClients[i]=0;\r
-               }\r
-       }\r
-}\r
-\r
-//SELECT `s_name` , NOW( ) , `s_lastupdate` , NOW( ) - `s_lastupdate` FROM `server_list` \r
diff --git a/server/src/game/zoning.cpp b/server/src/game/zoning.cpp
deleted file mode 100644 (file)
index 00c6f13..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       Zoning - makes changing of maps possible ingame\r
-\r
-       Authors:\r
-       - initial release by unknown person\r
-       - Sting\r
-       - Akiko <akiko@gmx.org>\r
-       - Namikon\r
-\r
-       MODIFIED: 23 August 2005 by Sting\r
-        REASON: - TO match up with defs/pak_worldinfo.def from patch 200\r
-\r
-       MODIFIED: 27 Aug 2005 by Akiko\r
-       REASON: - reformated for better reading\r
-               - thinking about a way to optimize the case statements\r
-       MODIFIED: 28 Aug 2005 by Akiko\r
-       REASON: - continued reformating\r
-       MODIFIED: 26 Oct 2005 Akiko\r
-       REASON: - fixed a bug -> loc is a int, and the location is a 16 bit value\r
-               - added GPL\r
-       MODIFIED: 27 Nov 2005 Akiko\r
-       REASON: - fixed a very stupid bug (loc)\r
-       MODIFIED: 04 Dec 2005 Akiko\r
-       REASON: - copying int to char array (loc) correctly now\r
-       MODIFIED: 07 Jan 2006 Namikon\r
-       REASON: - Fixed zoning to / from wastelands to / from city sectors (packet1 was wrong, thanks Maxx!!)\r
-       MODIFIED: 08 Jan 2006 Namikon\r
-       REASON: - Added appartment handling\r
-               - Fixed minimap\r
-       MODIFIED: 17 Jan 2006 Namikon\r
-       REASON: - File rewritten. Now, only 1 packet is send, like the real servers (that one fixed subway)\r
-               - Fixed several worldnames\r
-       MODIFIED: 26 Jul 2006 Hammag\r
-       REASON: - Fixed world 1086 (area mc5) worldname (from NeoX source)\r
-\r
-       MODIFIED: 28 Sep 2006 Hammag\r
-       REASON: - Zone filename in now taken from appartments.def (for app zoning) or from worlds.ini (general case)\r
-                   rather than hardcoded.\r
-\r
-       MODIFIED: 09 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-\r
-       TODO: Put get the fallback world from config\r
-             Check for file existence before sending info to client to avoid client crash and bad location in char info\r
-             \r
-*/\r
-\r
-\r
-#include "main.h"\r
-\r
-#include "include/worlds.h"\r
-#include "include/appartements.h"\r
-#include "include/msgbuilder.h"\r
-\r
-\r
-void SendZone(PClient *Client, u32 loc)\r
-{\r
-       //TODO : FIX case for worldroute and 5 missing id 505\r
-  std::string worldName;\r
-       ConnectionTCP *Socket = Client->getTCPConn();\r
-       //PChar *Char = Chars->GetChar(Client->GetCharID());\r
-\r
-       Socket->SetTimeOutValue(0xffff);\r
-  \r
-  PWorld* CurrentWorld = Worlds->GetWorld(loc);\r
-  if (CurrentWorld)\r
-  {\r
-    worldName = CurrentWorld->GetBspName();\r
-    if (worldName.empty())\r
-    {\r
-      worldName = "plaza/plaza_p1"; // Should be a config entry\r
-      Console->Print("Client %d: Empty name for world %d. Redirecting to %s", Console->ColorText(RED, BLACK, "Warning"), Client->GetID(), loc, worldName.c_str());\r
-      loc = 1;\r
-    }\r
-  }\r
-  else\r
-  {\r
-    worldName = "plaza/plaza_p1"; // Should be a config entry\r
-    Console->Print("Client %d: Invalid or not loaded world %d. Redirecting to %s", Console->ColorText(YELLOW, BLACK, "Warning"), Client->GetID(), loc, worldName.c_str());\r
-    loc = 1;\r
-  }\r
-  \r
-  PMessage* cMsg = MsgBuilder->BuildSendZoneTCPMsg(loc, &worldName);\r
-       Client->SendTCPMessage(cMsg);\r
-}\r
diff --git a/server/src/include/external.h b/server/src/include/external.h
deleted file mode 100644 (file)
index 8d78051..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       external.h - include file for all common external standard libs\r
-\r
-       MODIFIED: 31 Aug 2005 Akiko\r
-       REASON: - updating def file definitions to match the changes in gamedefs.cpp\r
-               - added define for charfiles path\r
-               - added define for database path\r
-       MODIFIED: 26 Sep 2005 Akiko\r
-       REASON: - reformated code\r
-               - added GPL\r
-               - added infoserver default port as define\r
-               - added my threading model (mutex.h, semaphore.h, thread.h)\r
-               - added basic includes pthread.h, semaphore.h and errno.h\r
-       MODIFIED: 28 Sep 2005 Akiko\r
-       REASON: - added define for game server port\r
-       MODIFIED: 30 Nov 2005 Akiko\r
-       REASON: - added chat.h for the chat part from Namikon\r
-       MODIFIED: 02 Dec 2005 Akiko\r
-       REASON: - commented out mutex.h, thread.h, semaphore.h\r
-       MODIFIED: 22 Dec 2005 Namikon/bakkdoor\r
-       REASON: - Added commands.h, skill.h, clientmanager.h\r
-    MODIFIED: 23 Dec 2005 bakkdoor\r
-       REASON: - Added <csignal> for main.cpp -> catch strg-c and shutdown nicely\r
-    MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added mysql.h, sql.h for MySQL support\r
-    MODIFIED: 01 Jan 2006 Namikon\r
-       REASON: - Moved skill.h before chars.h (char.h needs skill.h now)\r
-    MODIFIED: 30 May 2006 Namikon\r
-       REASON: - Removed all useless includes to complete the server splitup; Also renamed tinns.h to main.h\r
-    MODIFIED: 6 Jul 2006 Hammag\r
-         REASON: - moved include "types.h" before include "../netcode/main.h" to permit compile\r
-    MODIFIED: 10 Jul 2006 Hammag\r
-         REASON: - added inventory.h\r
-         REASON: - added item.h\r
-\r
-    MODIFIED: 26 Aug 2006 Hammag\r
-         REASON: - splitted from main.h, keeping external includes in this single file\r
-                   for all source tree\r
-\r
-*/\r
-\r
-#ifndef EXTERNAL_H\r
-#define EXTERNAL_H\r
-\r
-#include <cstdio>\r
-#include <ctime>\r
-#include <cstring>\r
-#include <cctype>\r
-#include <fstream>\r
-#include <vector>\r
-#include <string>\r
-#include <sstream>\r
-#include <map>\r
-#include <list>\r
-#include <queue>\r
-#include <unistd.h>\r
-#include <iostream>\r
-#include <stdarg.h>\r
-#include <string.h>\r
-#include <zlib.h>\r
-#include <pthread.h>\r
-#include <semaphore.h>\r
-#include <errno.h>\r
-#include <stdlib.h>\r
-#include <csignal>\r
-#include <netdb.h>\r
-#include <fcntl.h>\r
-#include <sys/types.h>\r
-#include <algorithm>\r
-\r
-#endif\r
diff --git a/server/src/include/svnrevision.h b/server/src/include/svnrevision.h
deleted file mode 100644 (file)
index 6111157..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       Copyright (C) 2005 Linux Addicted Community
-       maintainer Akiko <akiko@gmx.org>
-
-       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 "AKIKO_CMAKE_R2"
-
-#endif
-
diff --git a/server/src/include/tinns_mutex.h b/server/src/include/tinns_mutex.h
deleted file mode 100644 (file)
index 4c8bc8b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       mutex.h - part of a C++ thread model using the POSIX way\r
-\r
-       MODIFIED: 26 Sep 2005 Akiko\r
-       REASON: - started the implementaion of a thread model\r
-*/\r
-\r
-\r
-#ifndef MUTEX_H\r
-#define MUTEX_H\r
-\r
-//this class needs pthread.h, but it should come from tinns.h\r
-\r
-class Mutex {\r
-       private:\r
-               mutable pthread_mutex_t mut;\r
-               void operator = (Mutex &mut) {\r
-               }\r
-               Mutex(const Mutex &mut) {\r
-               }\r
-\r
-       public:\r
-               Mutex() {\r
-                       pthread_mutexattr_t attr;\r
-                       pthread_mutexattr_init(&attr);\r
-                       pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);\r
-                       pthread_mutex_init(&mut, &attr);\r
-                       pthread_mutexattr_destroy(&attr);\r
-               }\r
-\r
-               virtual ~Mutex() {\r
-                       pthread_mutex_unlock(&mut);\r
-                       pthread_mutex_destroy(&mut);\r
-               }\r
-\r
-               int Lock() const {\r
-                       return(pthread_mutex_lock(&mut));\r
-               }\r
-\r
-               int TryLock() const {\r
-                       return(pthread_mutex_trylock(&mut));\r
-               }\r
-\r
-               int Unlock() const {\r
-                       return(pthread_mutex_unlock(&mut));\r
-               }\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/include/tinns_semaphore.h b/server/src/include/tinns_semaphore.h
deleted file mode 100644 (file)
index 735b81d..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       semaphore.h - part of the C++ threading model (an very efficently way\r
-                     of dealing with threads) - also a POSIX way\r
-\r
-       MODIFIED: 26 Sep 2005 Akiko\r
-       REASON: - started threading model\r
-*/\r
-\r
-#ifndef SEMAPHORE_H\r
-#define SEMAPHORE_H\r
-\r
-//this class uses semaphore.h, but it should come from tinns.h\r
-\r
-class Semaphore {\r
-       private:\r
-               sem_t sem;\r
-       \r
-       public:\r
-               Semaphore(int init = 0) {\r
-                       sem_init(&sem, 0, init);\r
-               }\r
-\r
-               virtual ~Semaphore() {\r
-                       sem_destroy(&sem);\r
-               }\r
-\r
-               void Wait() const {\r
-                       sem_wait((sem_t *)&sem);\r
-               }\r
-\r
-               int TryWait() const {\r
-                       return(sem_trywait((sem_t *)&sem) ? errno : 0);\r
-               }\r
-\r
-               int Post() const {\r
-                       return(sem_post((sem_t *)&sem) ? errno : 0);\r
-               }\r
-\r
-               int GetValue() const {\r
-                       int val = -1;\r
-\r
-                       sem_getvalue((sem_t *)&sem, &val);\r
-\r
-                       return(val);\r
-               }\r
-\r
-               void Reset(int init = 0) {\r
-                       sem_destroy(&sem);\r
-                       sem_init(&sem, 0, init);\r
-               }\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/include/types.h b/server/src/include/types.h
deleted file mode 100644 (file)
index 1c26202..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       types.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-*/\r
-\r
-#ifndef TYPES_H\r
-#define TYPES_H\r
-\r
-// basic type definitions\r
-\r
-#ifdef WIN32\r
-       typedef signed char s8;\r
-       typedef unsigned char u8;\r
-       typedef signed short s16;\r
-       typedef unsigned short u16;\r
-       typedef signed int s32;\r
-       typedef unsigned int u32;\r
-//     #ifdef _MSC_VER\r
-//             typedef signed __int64 s64;\r
-//             typedef unsigned __int64 u64;\r
-//     #endif  // _MSC_VER\r
-       typedef float f32;\r
-       typedef double f64;\r
-#else  // no WIN32\r
-       typedef signed char s8;\r
-       typedef unsigned char u8;\r
-       typedef signed short s16;\r
-       typedef unsigned short u16;\r
-       typedef signed int s32;\r
-       typedef unsigned int u32;\r
-       //typedef signed int64 s64;\r
-       //typedef unsigned int64 u64;\r
-       typedef float f32;\r
-       typedef double f64;\r
-#endif // LINUX\r
-\r
-#endif\r
diff --git a/server/src/include/version.h b/server/src/include/version.h
deleted file mode 100644 (file)
index 79d0654..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*\r
-    TinNS (TinNS is not a Neocron Server)\r
-    Copyright (C) 2005 Linux Addicted Community\r
-    maintainer Akiko <akiko@gmx.org>\r
-\r
-    This program is free software; you can redistribute it and/or\r
-    modify it under the terms of the GNU General Public License\r
-    as published by the Free Software Foundation; either version 2\r
-    of the License, or (at your option) any later version.\r
-\r
-    This program is distributed in the hope that it will be useful,\r
-    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-    GNU General Public License for more details.\r
-\r
-    You should have received a copy of the GNU General Public License\r
-    along with this program; if not, write to the Free Software\r
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-    02110-1301, USA.\r
-*/\r
-\r
-#ifndef VERSION_H\r
-#define VERSION_H\r
-\r
-#include "svnrevision.h"\r
-\r
-#define TINNS_PATCH_VERSION "0.0.2 Dev"\r
-#define TINNS_INFO_VERSION "0.0.2 Dev"\r
-#define TINNS_GAME_VERSION "0.1.38 Dev"\r
-\r
-#endif\r
-\r
diff --git a/server/src/info/CMakeLists.txt b/server/src/info/CMakeLists.txt
deleted file mode 100644 (file)
index 8962ecf..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-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/accounts.h b/server/src/info/accounts.h
deleted file mode 100644 (file)
index b779a74..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       accounts.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-       MODIFIED: 26 Dec 2005 Namikon\r
-       REASON: - Added load/save functions for SQL DB\r
-       MODIFIED: 01 Jan 2005 Namikon\r
-       REASON: - Added bool var for ingame debug outputs for administrators\r
-       MODIFIED: 06 Jan 2005 Namikon\r
-       REASON: - Added SetBannedStatus(<unix timestamp>) to ban/unban an account (use SetBannedStatus(0) to unban a player)\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#ifndef ACCOUNTS_H\r
-#define ACCOUNTS_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-#include "common/regex++.h"\r
-\r
-/*\r
-0 = unregistered user\r
-1 = Registered user\r
-30 = volunteer\r
-50 = GM\r
-100 = Admin\r
-*/\r
-\r
-// New way of AccountLevel handling:\r
-// Every level is possible, the following values are only edge values. We need a bit control about that\r
-#define PAL_BANNED -1\r
-#define PAL_UNREGPLAYER 0\r
-#define PAL_REGPLAYER 1\r
-#define PAL_VOLUNTEER 30\r
-#define PAL_GM 50\r
-#define PAL_ADMIN 100\r
-\r
-// Max number of char slots per account\r
-#define MAX_CHARS_PER_ACCOUNT  4\r
-\r
-/*\r
-0 = Offline\r
-1 = Online\r
-2 = Banned\r
-*/\r
-\r
-enum PAccountStatus\r
-{\r
-    PAS_OFFLINE = 0,\r
-    PAS_ONLINE = 1,\r
-    PAS_BANNED = 2\r
-};\r
-  \r
-class PAccount\r
-{\r
-       private :\r
-    // SQL Layout\r
-    enum {\r
-        a_id,\r
-        a_username,\r
-        a_password,\r
-        a_priv,\r
-        a_status,\r
-        a_bandate,\r
-        a_emailaddress,\r
-        a_creationdate,\r
-        a_lastused\r
-    };\r
-    \r
-    // static members\r
-         static RegEx* mUsernameRegexFilter;\r
-         static RegEx* mPasswordRegexFilter;\r
-         \r
-         // instance members\r
-         u32 mID;\r
-         std::string mName;\r
-         std::string mPassword;\r
-    int mLevel;\r
-    PAccountStatus mStatus;\r
-    std::time_t mBannedUntil;\r
-\r
-    bool LoadFromQuery(char* query);\r
-    bool DecodePassword(const u8* PasswordData, int PassLen, const u8 *Key, char* ClearPassword);\r
-    \r
-       public :\r
-         PAccount();\r
-         PAccount(const u32 AccountId);\r
-         PAccount(const char *Username);\r
-         \r
-         static bool SetUsernameRegexFilter(const char* RegexStr);\r
-               static bool SetPasswordRegexFilter(const char* RegexStr);\r
-               static bool IsUsernameWellFormed(const char *Username);\r
-               static bool IsPasswordWellFormed(const char *Password);\r
-               \r
-               inline u32 GetID() const { return mID; }\r
-               bool SetName(const std::string &Pass);\r
-               inline const std::string &GetName() const { return mName; }\r
-               bool SetPassword(const std::string &Pass);\r
-               bool SetPasswordEncoded(const u8* PasswordData, int PassLen, const u8* Key);\r
-               inline const std::string &GetPassword() const { return mPassword; }\r
-    bool SetLevel(int newLevel);\r
-               inline int GetLevel() const { return mLevel; }\r
-               std::string GetLevelString() const;\r
-    bool SetStatus(PAccountStatus Status);\r
-               inline PAccountStatus GetStatus() const { return mStatus; }\r
-               bool SetBannedUntilTime(std::time_t BannedUntil);\r
-    inline bool IsBanned() const { return (mBannedUntil > std::time(NULL)); }\r
-    std::string GetBannedTime() const;\r
-\r
-               bool Authenticate(const u8* PasswordData, int PassLen, const u8 *Key);\r
-               bool Authenticate(const char *Password) const;\r
-                   \r
-               bool Create();\r
-    bool Save(bool CreateMode = false);\r
-\r
-    //u32 GetCharIdBySlot(const u32 SlotId);\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/info/client.cpp b/server/src/info/client.cpp
deleted file mode 100644 (file)
index 8e801cc..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PClient::PClient(int Index)\r
-{\r
-       mIndex = Index;\r
-       mConnection = PCC_NONE;\r
-       mAccountID = 0;\r
-}\r
-\r
-PClient::~PClient()\r
-{\r
-    if(m_TCPConnection)\r
-    {\r
-        delete m_TCPConnection;\r
-    }\r
-}\r
-\r
-void PClient::InfoDisconnect()\r
-{\r
-    if(m_TCPConnection)\r
-    {\r
-        delete m_TCPConnection;\r
-    }\r
-    m_TCPConnection = 0;\r
-\r
-       //mConnection &= ~PCC_INFO;\r
-       mConnection = PCC_NONE;\r
-       mAccountID = 0;\r
-}\r
-\r
-void PClient::Update()\r
-{\r
-    if(m_TCPConnection)\r
-    {\r
-        if(m_TCPConnection->timeOut())\r
-        {\r
-                Console->Print("InfoSocket: Client %i: timeout", mIndex);\r
-                InfoServer->ClientDisconnected(this);\r
-        }\r
-        else\r
-        {\r
-            if(!m_TCPConnection->update())\r
-            {\r
-                InfoServer->ClientDisconnected(this);\r
-            }\r
-        }\r
-    }\r
-}\r
diff --git a/server/src/info/client.h b/server/src/info/client.h
deleted file mode 100644 (file)
index 25bc05a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef CLIENT_H\r
-#define CLIENT_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-enum PClientConnection\r
-{\r
-       PCC_NONE = 0,\r
-       PCC_INFO = 1\r
-};\r
-\r
-class PClient\r
-{\r
-       private :\r
-    ConnectionTCP* m_TCPConnection;\r
-               int mIndex;\r
-               int mConnection;\r
-               u32 mAccountID;\r
-\r
-       protected :\r
-       public :\r
-               PClient(int Index);\r
-               ~PClient();\r
-\r
-               inline int GetIndex() const { return mIndex; }\r
-\r
-               void setTCPConnection(ConnectionTCP* conn) { m_TCPConnection = conn; mConnection = PCC_INFO; }\r
-               inline ConnectionTCP* getTCPConn() const { return m_TCPConnection; }\r
-\r
-               inline int GetConnection() const { return mConnection; }\r
-               inline const char *GetAddress() const { return m_TCPConnection->getRemoteAddress(); }\r
-\r
-    inline void setAccountID(u32 nAccountID) { mAccountID = nAccountID; }\r
-    inline u32 getAccountID() { return mAccountID; }\r
-    \r
-               void InfoDisconnect();\r
-\r
-               void Update();\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/info/globals.h b/server/src/info/globals.h
deleted file mode 100644 (file)
index 649489b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-       globals.h\r
-\r
-       MODIFIED: 12 September 2005 Akiko\r
-       REASON: - exchanged Pretender Strings by TinNS\r
-                - removed some Windows specific code\r
-       MODIFIED: 16 Dec 2005 bakkdoor\r
-       REASON: - Added global ClientManager and Chat Interface\r
-       MODIFIED: 22 Dec 2005 Namikon\r
-       REASON: - Added GPL\r
-  MODIFIED: 27 Aug 2006 Hammag\r
-  REASON: - Added AdditionnalConfigChecks() local function\r
-\r
-*/\r
-\r
-#ifndef GLOBALS_H\r
-#define GLOBALS_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-extern class ServerSocket* ServerSock;\r
-extern class PConsole *Console;\r
-extern class PServer *Server;\r
-extern class PConfig *Config;\r
-extern class PInfoServer *InfoServer;\r
-\r
-extern class PMySQL* MySQL;\r
-//extern class PAccounts* Accounts;  // To be removed\r
-\r
-extern const char ServerVersion[];\r
-extern const char SVNRevision[];\r
-\r
-bool Init();\r
-void Shutdown();\r
-bool AdditionnalConfigChecks();\r
-\r
-#endif\r
-\r
diff --git a/server/src/info/infoserver.cpp b/server/src/info/infoserver.cpp
deleted file mode 100644 (file)
index 561e9b1..0000000
+++ /dev/null
@@ -1,608 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-  MODIFIED: 01 Jul 2006 hammag\r
-       REASON: - added set timeout to 10 msec (for ReadSetTCP select) in Start()\r
-                 to avoid useless 100% CPU use\r
-  MODIFIED: 27 Aug 2006 hammag\r
-       REASON: - Removed INFO_PORT use as value is available from config\r
-  MODIFIED: 27 Aug 2006 hammag\r
-       REASON: - Modified GSLiveCheck() to be independant of gameserver time (no time sync needed between servers)\r
-  MODIFIED: 27 Aug 2006 hammag\r
-       REASON: - Display the client id in Client connection message rather than the always increasing mNumClients\r
-               - Removed use of mNumClients in PInfoServer. the count is done in PServer.\r
-\r
-    ToDo:\r
-    - Take main loop timeout setting from config file\r
-*/\r
-\r
-#include "main.h"\r
-\r
-struct PInfoState\r
-{\r
-       enum State\r
-       {\r
-               IS_UNKNOWN,\r
-               IS_CONNECTED,\r
-               IS_HANDSHAKE0,\r
-               IS_AUTHENTICATE,\r
-               IS_SERVERLIST\r
-       } mState;\r
-\r
-       bool mWaitSend; // wait-for-completition flag\r
-       PInfoState()\r
-       {\r
-               mState = IS_UNKNOWN;\r
-               mWaitSend = false;\r
-       };\r
-};\r
-\r
-PInfoServer::PInfoServer()\r
-{\r
-       //mNumClients = 1;\r
-       mLivecheckInterval = Config->GetOptionInt("gameserver_livecheck");\r
-}\r
-\r
-PInfoServer::~PInfoServer()\r
-{\r
-    Console->Print("Closing Infoserver...");\r
-\r
-    ServerSock->closeServer();\r
-\r
-       for(InfoStateMap::iterator i=ClientStates.begin(); i!=ClientStates.end(); i++)\r
-               delete i->second;\r
-}\r
-\r
-void PInfoServer::Start()\r
-{\r
-       u16 Port = Config->GetOptionInt("infoserver_port");\r
-       Console->LPrint("Starting Infoserver on port %i...", Port);\r
-\r
-       if(ServerSock->open(Port))\r
-       {\r
-           Console->LPrint(GREEN, BLACK, "Success");\r
-           Console->LClose();\r
-       }\r
-       else\r
-       {\r
-               Console->LPrint(RED, BLACK, "Failed");\r
-               Console->LClose();\r
-       }\r
-       ServerSock->settimeout(0, 10000);\r
-       GSLiveCheck();\r
-}\r
-\r
-void PInfoServer::Update()\r
-{\r
-       if(ServerSock->newConnection())\r
-       {\r
-               int clid = Server->NewClient();\r
-               if(clid!=-1)\r
-               {\r
-                       Console->Print(GREEN, BLACK, "Infoserver: client [%i] connected", clid);\r
-                       PClient *Client = Server->GetClient(clid);\r
-\r
-                       ConnectionTCP* tcpConn = ServerSock->getTCPConnection();\r
-                       Client->setTCPConnection(tcpConn);\r
-\r
-                       Console->Print("Client address: %s", Client->GetAddress());\r
-                       //++mNumClients;\r
-\r
-                       PInfoState *state = new PInfoState();\r
-                       ClientStates.insert(std::make_pair(Client, state));\r
-                       state->mState = PInfoState::IS_CONNECTED;\r
-               } else\r
-               {\r
-                       Console->Print("Infoserver: Client connection refused (server full?)");\r
-               }\r
-       }\r
-\r
-       for(InfoStateMap::iterator i=ClientStates.begin(); i!=ClientStates.end();)\r
-       {\r
-               PClient *Client = i->first;\r
-               PInfoState *State = i->second;\r
-               // node gets erased in FinalizeClient, increment iterator now\r
-               ++i;\r
-               if(!ProcessClient(Client, State))\r
-                       FinalizeClient(Client, State);\r
-       }\r
-}\r
-\r
-void PInfoServer::GSLiveCheck()\r
-{\r
-    MYSQL_ROW row;\r
-    MYSQL_RES *result;\r
-    char query[256];\r
-    snprintf (query, 256, "SELECT *, (NOW()< (`s_lastupdate` + INTERVAL %d SECOND)) FROM `server_list`", mLivecheckInterval);\r
-\r
-    result = MySQL->ResQuery(query);\r
-    if(result == NULL)\r
-    {\r
-        Console->Print("Livecheck: %s unable to read server list!", Console->ColorText(RED, BLACK, "[Warning]"));\r
-        MySQL->ShowSQLError();\r
-        return;\r
-    }\r
-    if(mysql_num_rows(result) == 0)\r
-    {\r
-        Console->Print("Livecheck: %s no gameserver found!", Console->ColorText(RED, BLACK, "[Warning]"));\r
-        MySQL->FreeSQLResult(result);\r
-        return;\r
-    }\r
-\r
-    ServerMap::iterator it;\r
-    while((row = mysql_fetch_row(result)))\r
-    {\r
-        it = Serverlist.find(atoi(row[s_id]));\r
-        if(it != Serverlist.end())\r
-        {\r
-            strncpy(it->second.mName, row[s_name], MAX_SERVER_NAME_LENGTH);\r
-                       it->second.mLanIp = IPStringToDWord(row[s_lanaddr]);\r
-                       it->second.mWanIp = IPStringToDWord(row[s_wanaddr]);\r
-            it->second.mPort = atoi(row[s_port]);\r
-            it->second.mPlayers = atoi(row[s_players]);\r
-            /* Prepared for future addon Servers by Accesslevel */\r
-            // it->second.mMinLv = atoi(row[s_minlv]);\r
-            /* ------------------------------------------------ */\r
-\r
-            // ToDo: If statement correct? Maybe GSLiveCheck() has\r
-            // to be called every mLinvecheckInterval seconds.... We'll\r
-            // see when Gameserver has been rewritten\r
-\r
-            if(row[s_timecheck] && (atoi(row[s_timecheck]) == 1))\r
-            {\r
-                it->second.mLasttimestamp = atol(row[s_lastupdate]);\r
-                it->second.mOnline = true;\r
-            }\r
-            else\r
-            {\r
-                it->second.mOnline = false;\r
-            }\r
-\r
-            it->second.mUpdated = true;\r
-        }\r
-        else\r
-        {\r
-            GameServers tmpServer;\r
-\r
-            strncpy(tmpServer.mName, row[s_name], MAX_SERVER_NAME_LENGTH);\r
-            tmpServer.mLanIp = IPStringToDWord(row[s_lanaddr]);\r
-            tmpServer.mWanIp = IPStringToDWord(row[s_wanaddr]);\r
-            tmpServer.mLasttimestamp = atol(row[s_lastupdate]);\r
-            tmpServer.mPlayers = atoi(row[s_players]);\r
-            tmpServer.mPort = atoi(row[s_port]);\r
-            tmpServer.mOnline = true;\r
-            tmpServer.mUpdated = true;\r
-            Console->Print("Added GameServer %s", tmpServer.mName);\r
-            /* Prepared for future addon Servers by Accesslevel */\r
-            //    tmpServer.mMinLv = atoi(row[s_minlv]);\r
-            /* ------------------------------------------------ */\r
-\r
-            Serverlist.insert(std::make_pair(atoi(row[s_id]), tmpServer));\r
-        }\r
-    }\r
-    MySQL->FreeSQLResult(result);\r
-\r
-       for(ServerMap::iterator it = Serverlist.begin(); it != Serverlist.end(); it++)\r
-    {\r
-        if(it->second.mUpdated == false)\r
-            Serverlist.erase(it);\r
-        else\r
-            it->second.mUpdated = false;\r
-    }\r
-\r
-}\r
-\r
-void PInfoServer::ClientDisconnected(PClient *Client)\r
-{\r
-       InfoStateMap::iterator node = ClientStates.find(Client);\r
-       if(node == ClientStates.end())\r
-               return;\r
-\r
-       PInfoState *State = node->second;\r
-       FinalizeClient(Client, State);\r
-}\r
-\r
-bool PInfoServer::HandleHandshake(PInfoState *State, const u8 *Packet, int PacketSize)\r
-{\r
-       //static const u8 HANDSHAKE1A[6]={0xfe, 0x03, 0x00, 0x80, 0x03, 0x68};\r
-\r
-       switch(State->mState)\r
-       {\r
-               case PInfoState::IS_HANDSHAKE0 :\r
-               {\r
-                       if(PacketSize==6 && *(u16*)&Packet[3]==0x0080 && Packet[5]==0x78)\r
-                       {\r
-                               //FIXME: this packet seems to be unnecessary, although it appears in traffic dumps\r
-                               // (causes clientside "Wrong protocol" errors)\r
-                               //Socket->Write(HANDSHAKE1A, 6);\r
-                               State->mState = PInfoState::IS_AUTHENTICATE;\r
-                       }\r
-                       else\r
-                       {\r
-                               Console->Print(RED, BLACK, "Infoserver protocol error (IS_HANDSHAKE0): invalid packet [%04x]", *(u16*)&Packet[3]);\r
-                               return false;\r
-                       }\r
-                       break;\r
-               }\r
-               default:\r
-                       break;\r
-       }\r
-\r
-       return true;\r
-}\r
-\r
-bool PInfoServer::HandleAuthenticate(PClient *Client, PInfoState *State, const u8 *Packet, int PacketSize)\r
-{\r
-  int returnval = 0;\r
-    // ReturnValue values:\r
-    // 0: No error\r
-    // -1: Wrong/Unknown username\r
-    // -2: Wrong Password\r
-    // -3: Malformed Auth Data. Please relog\r
-    // -4: Database error, contact admin\r
-    // -5: No such account, Account created. Please relog\r
-    // -6: Could not create autoaccount, PW too short\r
-    // -7: Could not create autoaccount, Name too short\r
-    // -8: Could not create autoaccount, PW and Name too short\r
-    // -9: Duplicate entry for Username! Contact Admin\r
-    // -10: User is banned\r
-    // -11: Insufficient access rights\r
-    // -12: Account is not yet activated (accesslevel = 0)\r
-    // -99: General fault. Contact admin\r
-       ConnectionTCP *Socket = Client->getTCPConn();\r
-       PAccount* currentAccount = NULL;\r
-       \r
-       if(PacketSize > 20 && *(u16*)&Packet[3]==0x8084)\r
-       {\r
-               const u8 *Key = &Packet[5];                     // password key\r
-               u16 ULen = *(u16*)&Packet[16];          // username length\r
-               u16 PLen = *(u16*)&Packet[18];          // password length\r
-               char *UserName = (char*)&Packet[20];    // account name\r
-               const u8 *PW = &Packet[20+ULen];        // encoded password\r
-\r
-    if(UserName[ULen-1]) // Check that string is well terminated\r
-    {\r
-      Console->Print("Infoserver: Client [%d]: Username was not NULL-terminated !", Client->GetIndex());\r
-      returnval = -1;\r
-    }\r
-    else\r
-    {\r
-      currentAccount = new PAccount(UserName);\r
-      if(!currentAccount->GetID())\r
-      {\r
-        if(Config->GetOptionInt("auto_accounts")) // Autoaccount\r
-        {\r
-          delete currentAccount;\r
-          currentAccount = new PAccount();\r
-          \r
-          if(!currentAccount->SetName(UserName)) // !!! len\r
-          {\r
-              returnval = -7;\r
-          }\r
-          if(!currentAccount->SetPasswordEncoded(PW, PLen, Key))\r
-          {\r
-              returnval = returnval ? -8 : -6;\r
-          }\r
-              \r
-          if(!returnval)\r
-          {\r
-            if(currentAccount->Create())\r
-            {\r
-              returnval = -5;\r
-            }\r
-            else\r
-            {\r
-              returnval = -4;\r
-            }\r
-          }\r
-        }\r
-        else\r
-        {\r
-          returnval = -1;\r
-        }\r
-      }\r
-      else\r
-      {\r
-        if(currentAccount->Authenticate(PW, PLen, Key))\r
-        { // Username & Password correct\r
-          if(currentAccount->IsBanned())\r
-          {\r
-              returnval = -10;\r
-          }\r
-          else if(currentAccount->GetLevel() < Config->GetOptionInt("minlevel")) // insufficient access rights\r
-          {\r
-              returnval = -11;\r
-          }\r
-          else if(Config->GetOptionInt("require_validation") == 1 && currentAccount->GetLevel() == PAL_UNREGPLAYER)\r
-          {\r
-              returnval = -12;\r
-          }\r
-          else\r
-          {\r
-              Client->setAccountID(currentAccount->GetID());\r
-              returnval = 0;\r
-          }\r
-  \r
-        }\r
-        else\r
-        {\r
-          returnval = -2;\r
-        }\r
-      }\r
-    }\r
-    \r
-               bool Failed = false;\r
-               if(returnval == 0)\r
-               {\r
-                       u8 AUTHOK[28]={0xfe, 0x19, 0x00, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\r
-                                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
-                                                       0x00, 0x00, 0x00, 0x00, 0x00 };\r
-                       *(u32*)&AUTHOK[5] = currentAccount->GetID();\r
-                       Socket->write(AUTHOK, 28);\r
-                       State->mState = PInfoState::IS_SERVERLIST;\r
-               }\r
-               else\r
-               {\r
-                       Console->Print("Infoserver: User '%s': authentication failed. Errorcode %d", UserName, returnval);\r
-                       Failed = true;  // auth failed\r
-               }\r
-               if(Failed == true)\r
-               {\r
-                       std::string errorReason;\r
-                       switch(returnval)\r
-                       {\r
-                           // It seems that the client cuts the line off after 40 chars...\r
-//                                 |1       |10       |20       |30       |40       |50       |60       |70       |80\r
-                           case -99:\r
-                           {\r
-                    //errorReason = "General fault in processing your login request";\r
-                    errorReason = "General fault while login request";\r
-                    break;\r
-                           }\r
-                           case -12:\r
-                           {\r
-                    //errorReason = "Account not activated. Please check your EMails";\r
-                    errorReason = "Error: Your account is not activated";\r
-                    break;\r
-                           }\r
-                           case -11:\r
-                           {\r
-                               //errorReason = "Login rejected. You have to be " + GetAccessString(Config->GetOptionInt("minlevel")) + " or higher";\r
-                               errorReason = "Level " + GetAccessString(Config->GetOptionInt("minlevel")) + " or higher required";\r
-                               break;\r
-                           }\r
-                           case -10:\r
-                           {\r
-                               errorReason = "You are banned for " + currentAccount->GetBannedTime();\r
-                               break;\r
-                           }\r
-                           case -9:\r
-                           {\r
-                               //errorReason = "Duplicate entry for this login. Contact Admin";\r
-                               errorReason = "Duplicate entry found. Contact Admin";\r
-                               break;\r
-                           }\r
-                           case -8:\r
-                           {\r
-                               //errorReason = "Autoaccount failed, name and password too short";\r
-                               errorReason = "AutoAcc failed, name and pwd too short";\r
-                               break;\r
-                           }\r
-                           case -7:\r
-                           {\r
-                               errorReason = "Autoaccount failed, name is too short";\r
-                               break;\r
-                           }\r
-                           case -6:\r
-                           {\r
-                               //errorReason = "Autoaccount failed, password is too short";\r
-                               errorReason = "Autoaccount failed, pwd is too short";\r
-                               break;\r
-                           }\r
-                           case -5:\r
-                           {\r
-                               errorReason = "New Account created, please login again";\r
-                               break;\r
-                           }\r
-                           case -4:\r
-                           {\r
-                               errorReason = "Database error, contact Administrator";\r
-                               break;\r
-                           }\r
-                           case -3:\r
-                           {\r
-                               errorReason = "Malformed AuthData. Please login again";\r
-                               break;\r
-                           }\r
-                           case -2:\r
-                           {\r
-                               errorReason = "Wrong password";\r
-                               break;\r
-                           }\r
-                           case -1:\r
-                           {\r
-                               errorReason = "Unknown username";\r
-                               break;\r
-                           }\r
-                       }\r
-                       u8 AUTHFAILED_HEADER[] = {0xfe, 0x0c, 0x00, 0x83, 0x86, 0x05, 0x00, 0x06, 0x00};\r
-                       u8 AUTHFAILED_FOOTER[] = {0x00, 0x40};\r
-                       *(u16*)&AUTHFAILED_HEADER[1] = errorReason.size() + 8;\r
-                       *(u16*)&AUTHFAILED_HEADER[7] = errorReason.size() + 1;\r
-                       //*(u8*)&AUTHFAILED_FOOTER[1] = {0x40};\r
-\r
-                       Socket->write(AUTHFAILED_HEADER, sizeof(AUTHFAILED_HEADER));\r
-                       Socket->write(errorReason.c_str(), errorReason.size());\r
-                       Socket->write(AUTHFAILED_FOOTER, sizeof(AUTHFAILED_FOOTER));\r
-                       FinalizeClientDelayed(Client, State);\r
-                       State->mState=PInfoState::IS_UNKNOWN;\r
-               }\r
-       }\r
-       else\r
-       {\r
-               Console->Print(RED, BLACK, "Infoserver protocol error (IS_AUTHENTICATE): invalid packet [%04x]", *(u16*)&Packet[3]);\r
-               return false;\r
-       }\r
-\r
-       return true;\r
-}\r
-\r
-bool PInfoServer::HandleServerList(PClient *Client, const u8 *Packet, int PacketSize)\r
-{\r
-    u8 SERVERLIST_HEAD[] = {0xfe, 0x00, 0x00, 0x83, 0x83, 0x01, 0x00, 0x0d, 0x00};\r
-    u8 SERVERLIST[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\r
-    u8 SERVERLIST_FOOTER[] = {0x00};\r
-\r
-       ConnectionTCP *Socket = Client->getTCPConn();\r
-\r
-       u32 tID = *(u32*)&Packet[5];\r
-       PAccount* currentAccount = new PAccount(Client->getAccountID());\r
-       u32 aID = currentAccount->GetID();\r
-\r
-       if(!aID || (aID != tID))\r
-       {\r
-           Console->Print("%s invalid userID %d (auth with id %d)", Console->ColorText(YELLOW, BLACK, "Warning:"), tID, aID);\r
-           delete currentAccount;\r
-           return false;\r
-       }\r
-\r
-       if(currentAccount->GetLevel() < Config->GetOptionInt("minlevel"))\r
-       {\r
-           Console->Print("%s someone tried to bypass the login process! UserID %d", Console->ColorText(RED, BLACK, "Warning:"), aID);\r
-           delete currentAccount;\r
-           return false;\r
-       }\r
-\r
-  if(PacketSize == 31 && *(u16*)&Packet[3]==0x8284)\r
-       {\r
-    GSLiveCheck(); // Perform livecheck to have up-to-date data\r
-\r
-    int len = 0;\r
-    int num = 0;\r
-    for(ServerMap::iterator it = Serverlist.begin(); it != Serverlist.end(); it++)\r
-    {\r
-        num++;\r
-        len += 14 + strlen(it->second.mName);\r
-    }\r
-\r
-    *(u16*)&SERVERLIST_HEAD[1] = len;\r
-    *(u8*)&SERVERLIST_HEAD[5] = num;\r
-    Socket->write(SERVERLIST_HEAD, sizeof(SERVERLIST_HEAD));\r
-\r
-    for(ServerMap::iterator it = Serverlist.begin(); it != Serverlist.end(); it++)\r
-    {\r
-            /* Prepared for future addon Servers by Accesslevel */\r
-//            if(accesslevel >= it->second.mMinLv)\r
-//            {\r
-            /* ------------------------------------------------ */\r
-            // Todo: Set correct lan/wan IP here!\r
-      *(u32*)&SERVERLIST[0] = it->second.mLanIp;\r
-      *(u16*)&SERVERLIST[4] = it->second.mPort;\r
-      *(u8*)&SERVERLIST[8] = strlen(it->second.mName) + 1;\r
-      *(u16*)&SERVERLIST[9] = it->second.mPlayers;\r
-      if(it->second.mOnline == true)\r
-      {\r
-          Console->Print("Sending server name: %s ip: %s player: %d port: %d online: yes", it->second.mName, IPlongToString(it->second.mLanIp), it->second.mPlayers, it->second.mPort);\r
-          *(u16*)&SERVERLIST[11] = 1;\r
-      }\r
-      else if(it->second.mOnline == false)\r
-      {\r
-                 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);\r
-          *(u16*)&SERVERLIST[11] = 0;\r
-      }\r
-      Socket->write(SERVERLIST, sizeof(SERVERLIST));\r
-      Socket->write(it->second.mName, strlen(it->second.mName));\r
-      Socket->write(SERVERLIST_FOOTER, sizeof(SERVERLIST_FOOTER));\r
-            /* Prepared for future addon Servers by Accesslevel */\r
-//            }\r
-            /* ------------------------------------------------ */\r
-    }\r
-       }\r
-       else\r
-       {\r
-               Console->Print(RED, BLACK, "Infoserver protocol error (IS_SERVERLIST): invalid packet [%04x]", *(u16*)&Packet[3]);\r
-               delete currentAccount;\r
-               return false;\r
-       }\r
-       delete currentAccount;\r
-       return true;\r
-}\r
-\r
-bool PInfoServer::ProcessClient(PClient *Client, PInfoState *State)\r
-{\r
-       static const u8 HANDSHAKE0A[6]={0xfe, 0x03, 0x00, 0x80, 0x01, 0x66};\r
-\r
-       if(!State)\r
-       {\r
-               InfoStateMap::iterator node = ClientStates.find(Client);\r
-               if(node == ClientStates.end())\r
-                       return false;\r
-\r
-               State = node->second;\r
-       }\r
-\r
-       ConnectionTCP *Socket = Client->getTCPConn();\r
-\r
-       if(State->mWaitSend && Socket->getSendBufferSize()==0)\r
-               return false;\r
-\r
-       if(State->mState==PInfoState::IS_CONNECTED)\r
-       {\r
-               Socket->write(HANDSHAKE0A, 6);\r
-               State->mState = PInfoState::IS_HANDSHAKE0;\r
-       }\r
-\r
-       int PacketSize=0;\r
-       const u8 *Packet = Socket->read(&PacketSize);\r
-       if(PacketSize > 0)\r
-       {\r
-               switch(State->mState)\r
-               {\r
-                       case PInfoState::IS_HANDSHAKE0:\r
-                               return HandleHandshake(State, Packet, PacketSize);\r
-\r
-                       case PInfoState::IS_AUTHENTICATE:\r
-                               return HandleAuthenticate(Client, State, Packet, PacketSize);\r
-\r
-                       case PInfoState::IS_SERVERLIST:\r
-                               return HandleServerList(Client, Packet, PacketSize);\r
-                       default:\r
-                               break;\r
-               }\r
-       }\r
-       return true;\r
-}\r
-\r
-void PInfoServer::FinalizeClient(PClient *Client, PInfoState *State)\r
-{\r
-       Console->Print(RED, BLACK, "Infoserver: client %s disconnected", Client->GetAddress());\r
-       Client->InfoDisconnect();\r
-       ClientStates.erase(Client);\r
-       delete State;\r
-}\r
-\r
-void PInfoServer::FinalizeClientDelayed(PClient *Client, PInfoState *State)\r
-{\r
-       Console->Print("Infoserver: client %i is about to be disconnected", Client->GetIndex());\r
-       State->mWaitSend = true;\r
-}\r
diff --git a/server/src/info/infoserver.h b/server/src/info/infoserver.h
deleted file mode 100644 (file)
index 8cab98c..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef INFOSERVER_H\r
-#define INFOSERVER_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-#define MAX_SERVER_NAME_LENGTH 45\r
-struct GameServers\r
-{\r
-  char            mName[MAX_SERVER_NAME_LENGTH];\r
-   unsigned int    mLanIp;\r
-   unsigned int    mWanIp;\r
-       short           mPort;\r
-       int             mPlayers;\r
-       bool            mOnline;\r
-       bool            mUpdated;\r
-       long            mLasttimestamp;\r
-/* Prepared for future addon Servers by Accesslevel */\r
-//    int             mMinLv;\r
-/* ------------------------------------------------ */\r
-};\r
-\r
-class PInfoServer\r
-{\r
-       private :\r
-        // SQL layout\r
-        enum {\r
-            s_id,\r
-            s_name,\r
-            s_wanaddr,\r
-            s_port,\r
-            s_players,\r
-            s_lastupdate,\r
-                       s_lanaddr,\r
-            s_timecheck // computed field, not in table !\r
-        };\r
-               //int mNumClients;\r
-               typedef std::map<PClient*, struct PInfoState*> InfoStateMap;\r
-               InfoStateMap ClientStates;\r
-\r
-               typedef std::map<int, GameServers> ServerMap;\r
-               ServerMap Serverlist;\r
-\r
-               //time_t mLastLivecheck;\r
-               int mLivecheckInterval;\r
-               void GSLiveCheck();\r
-\r
-       protected :\r
-               bool ProcessClient(PClient *Client, PInfoState *State=NULL);\r
-               void FinalizeClient(PClient *Client, PInfoState *State);\r
-               void FinalizeClientDelayed(PClient *Client, PInfoState *State);\r
-\r
-               bool HandleHandshake(PInfoState *State, const u8 *Packet, int PacketSize);\r
-               bool HandleAuthenticate(PClient *Client, PInfoState *State, const u8 *Packet, int PacketSize);\r
-               bool HandleServerList(PClient *Client, const u8 *Packet, int PacketSize);\r
-       public :\r
-               PInfoServer();\r
-               ~PInfoServer();\r
-\r
-               void Start();\r
-               void Update();\r
-               void ClientDisconnected(PClient *Client);\r
-};\r
-\r
-#endif\r
diff --git a/server/src/info/main.cpp b/server/src/info/main.cpp
deleted file mode 100644 (file)
index 8ad0528..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*     \r
-        MODIFIED: 01 Jul 2006 hammag\r
-             REASON: - commented out sched_yield() in main loop, as it is\r
-                     not needed anymore with a right timeout for ReadSetTCP select\r
-                     \r
-*/\r
-\r
-#include "main.h"\r
-\r
-void signal_handler(int signal)\r
-{\r
-    if (signal == SIGINT)\r
-    {\r
-        Shutdown();\r
-    }\r
-}\r
-\r
-int main()\r
-{\r
-    signal(SIGINT, signal_handler);\r
-\r
-       if(!Init())\r
-       {\r
-         if(Console)\r
-           Console->Print("%s Aborting startup.", Console->ColorText(RED, BLACK, "[Fatal]"));\r
-               Shutdown(); // exits with 0 ...\r
-  }\r
-\r
-       InfoServer->Start();\r
-       Console->Print("Infoserver is now %s. Waiting for clients...", Console->ColorText(GREEN, BLACK, "Online"));\r
-\r
-       while(1)\r
-       {\r
-         ServerSock->update();\r
-         Server->Update();\r
-               InfoServer->Update();\r
-               MySQL->Update(); // MySQL keepalive\r
-               Console->Update();\r
-       }\r
-\r
-       return 0;\r
-}\r
diff --git a/server/src/info/main.h b/server/src/info/main.h
deleted file mode 100644 (file)
index ebceffa..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       MODIFIED: 06 Jul 2006 Hammag\r
-       REASON: - moved include "types.h" before include "../netcode/main.h" to enable compile\r
-       MODIFIED: 27 Aug 2006 Hammag\r
-       REASON: - replaced MAX_INFO_CLIENTS define by config setting\r
-               - removed INFO_PORT define not used anymore\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-\r
-#ifndef MAIN_H\r
-#define MAIN_H\r
-\r
-//#include "version.h"\r
-\r
-//basic includes\r
-#include "include/external.h"\r
-\r
-//tinns includes\r
-#include "include/types.h"\r
-#include "common/netcode.h"\r
-\r
-// MySQL Support\r
-#ifdef MYSQL_INC_DIR\r
-#include <mysql/mysql.h>\r
-#else\r
-#include <mysql.h>\r
-#endif\r
-\r
-#include "sql.h"\r
-#include "common/console.h"\r
-#include "common/config.h"\r
-#include "accounts.h"\r
-#include "client.h"\r
-#include "server.h"\r
-#include "infoserver.h"\r
-#include "common/misc.h"\r
-#include "globals.h"\r
-\r
-#endif\r
diff --git a/server/src/info/server.cpp b/server/src/info/server.cpp
deleted file mode 100644 (file)
index fba8060..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-\r
-       MODIFIED: 27 Aug 2005 Hammag\r
-       REASON: - Use mMaxClient member instead of MAX_INFO_CLIENTS define\r
-\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PServer::PServer()\r
-{\r
-  mMaxClients = Config->GetOptionInt("maxclients");\r
-  \r
-       mClients.reserve(mMaxClients);\r
-       mNumClients = 0;\r
-       for(int i=0; i<mMaxClients; i++)\r
-               mClients[i]=0;\r
-}\r
-\r
-PServer::~PServer()\r
-{\r
-       for(int i=0; i<mMaxClients; i++)\r
-               delete mClients[i];\r
-}\r
-\r
-int PServer::NewClient()\r
-{\r
-       if(mNumClients==mMaxClients)\r
-               return -1;\r
-\r
-       for(int i=0; i<mMaxClients; i++)\r
-       {\r
-               if(!mClients[i])\r
-               {\r
-                       mClients[i]=new PClient(i);\r
-                       ++mNumClients;\r
-                       return i;\r
-               }\r
-       }\r
-       return -1;\r
-}\r
-\r
-PClient *PServer::GetClient(int Client) const\r
-{\r
-       if(Client < 0 || Client >= mMaxClients)\r
-               return 0;\r
-\r
-       return mClients[Client];\r
-}\r
-\r
-void PServer::Update()\r
-{\r
-       for(int i=0; i<mMaxClients; i++)\r
-       {\r
-               if(mClients[i])\r
-               {\r
-                       mClients[i]->Update();\r
-                       if(mClients[i]->GetConnection()==PCC_NONE && mClients[i]->getTCPConn() == 0)\r
-                       {\r
-                               Console->Print("Removing client ...");\r
-                               delete mClients[i];\r
-                               mClients[i]=0;\r
-                               --mNumClients;\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-void PServer::Shutdown()\r
-{\r
-    Console->Print("======================");\r
-       Console->Print("Shutting down Infoserver...");\r
-       for(int i=0; i<mMaxClients; i++)\r
-       {\r
-               if(mClients[i])\r
-               {\r
-                       delete mClients[i];\r
-                       mClients[i]=0;\r
-               }\r
-       }\r
-}\r
diff --git a/server/src/info/server.h b/server/src/info/server.h
deleted file mode 100644 (file)
index 3942fdd..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       server.h\r
-\r
-       MODIFIED: 25 Dec 2005 Namikon\r
-       REASON: - Added GPL     \r
-       MODIFIED: 27 Aug 2005 Hammag\r
-       REASON: - Added mMaxClient member       \r
-*/\r
-\r
-#ifndef SERVER_H\r
-#define SERVER_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-class PServer\r
-{\r
-       private :\r
-         int mMaxClients;\r
-               int mNumClients;\r
-               std::vector<PClient*> mClients;\r
-       protected :\r
-       public :\r
-               PServer();\r
-               ~PServer();\r
-\r
-               inline int GetNumClients() const { return mNumClients; }\r
-               int NewClient();\r
-               PClient *GetClient(int Client) const;\r
-               void Update();\r
-               void Shutdown();\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/info/sql.h b/server/src/info/sql.h
deleted file mode 100644 (file)
index 319f3f2..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef SQL_H\r
-#define SQL_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-class PMySQL\r
-{\r
-    private:\r
-        int port;\r
-        char host[100];\r
-         char userName[100];\r
-        char password[100];\r
-        char database[100];\r
-        MYSQL *dbHandle;\r
-        std::time_t mKeepaliveDelay;\r
-        std::time_t mLastKeepaliveSent;\r
-\r
-    public:\r
-        PMySQL();\r
-        ~PMySQL();\r
-\r
-        void Update();\r
-        inline MYSQL *GetHandle() { return dbHandle; };\r
-\r
-        bool Connect();\r
-        int Query(const char *query);\r
-        MYSQL_RES *ResQuery(const char *query);\r
-        void ShowSQLError();\r
-        void FreeSQLResult(MYSQL_RES *res);\r
-        inline u32 GetLastInsertId() { return mysql_insert_id(dbHandle); };\r
-        \r
-        u32 EscapeString(const char* nText, char* dText, u32 dMaxLength);\r
-};\r
-#endif\r
diff --git a/server/src/patch/CMakeLists.txt b/server/src/patch/CMakeLists.txt
deleted file mode 100644 (file)
index 3154f2b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-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/client.cpp b/server/src/patch/client.cpp
deleted file mode 100644 (file)
index cf4691b..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PClient::PClient(int Index)\r
-{\r
-       mIndex = Index;\r
-       mConnection = PCC_NONE;\r
-}\r
-\r
-PClient::~PClient()\r
-{\r
-    if(m_TCPConnection)\r
-    {\r
-        delete m_TCPConnection;\r
-    }\r
-}\r
-\r
-void PClient::Update()\r
-{\r
-    if(m_TCPConnection)\r
-    {\r
-        if(m_TCPConnection->timeOut())\r
-        {\r
-            Console->Print("Patchsocket: Client %i: timeout", mIndex);\r
-            PatchServer->ClientDisconnected(this);\r
-        }\r
-        else\r
-        {\r
-            if(!m_TCPConnection->update())\r
-            {\r
-                PatchServer->ClientDisconnected(this);\r
-            }\r
-        }\r
-       }\r
-}\r
-\r
-void PClient::PatchDisconnect()\r
-{\r
-    if(m_TCPConnection)\r
-    {\r
-        delete m_TCPConnection;\r
-    }\r
-    mConnection = PCC_NONE;\r
-    m_TCPConnection = 0;\r
-}\r
diff --git a/server/src/patch/client.h b/server/src/patch/client.h
deleted file mode 100644 (file)
index 0eeb1c6..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef CLIENT_H\r
-#define CLIENT_H\r
-\r
-enum PClientConnection\r
-{\r
-       PCC_NONE = 0,\r
-       PCC_PATCH = 1\r
-};\r
-class PClient\r
-{\r
-       private :\r
-        ConnectionTCP* m_TCPConnection;\r
-               int mIndex;\r
-               int mConnection;\r
-\r
-\r
-       protected :\r
-       public :\r
-               PClient(int Index);\r
-               ~PClient();\r
-\r
-               inline int GetIndex() const { return mIndex; }\r
-\r
-               inline int GetConnection() const { return mConnection; }\r
-               inline const char *GetAddress() const { return m_TCPConnection->getRemoteAddress(); }\r
-\r
-               void setTCPConnection(ConnectionTCP* conn) { m_TCPConnection = conn; mConnection = PCC_PATCH; }\r
-\r
-               inline ConnectionTCP* getTCPConn() { return m_TCPConnection; }\r
-\r
-               void Update();\r
-\r
-               void PatchDisconnect();\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/patch/configtemplate.h b/server/src/patch/configtemplate.h
deleted file mode 100644 (file)
index daeac00..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-/*\r
-    Configuration template for patchserver\r
-    Used to set available/optional/required options when loading config\r
-      with a PConfig object.\r
-*/\r
-\r
-const char* PatchConfigTemplate[][2] = {\r
-  // {option_name, default_value} if default_value is empty string, it means option is mandatory\r
-  // List ends with empty string for option_name\r
-  {"server_version", "200"},\r
-  {"patchserver_port", "8040"},\r
-  {"patches_path", "./patches"},\r
-  {"file_path", "./files"},\r
-  {"max_file_xfers", "5"},\r
-  {"patch_packet_size", "512"},\r
-  {"maxclients", "5"},\r
-  {"gm_slots", "2"},\r
-  \r
-  {"", ""} // do not change this line (end mark)\r
-};\r
diff --git a/server/src/patch/globals.cpp b/server/src/patch/globals.cpp
deleted file mode 100644 (file)
index 94b5ade..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       MODIFIED: 27 Aug 2006 Hammag\r
-       REASON: - Implemented shared Config class use and config template to load conf.\r
-               - Added gameserver configtemplate.h include,\r
-               - Added new required parameters to Config->LoadOptions()\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-\r
-       TODO:   - Get logfile name from config file    \r
-*/\r
-\r
-      \r
-#include "main.h"\r
-\r
-#include "configtemplate.h"\r
-\r
-#include "include/version.h"\r
-\r
-\r
-const char ServerVersion[] = TINNS_PATCH_VERSION;\r
-const char SVNRevision[] = TINNS_SVN_REVISION;\r
-\r
-ServerSocket* ServerSock = 0;\r
-PConsole *Console = 0;\r
-PServer *Server = 0;\r
-PConfig *Config = 0;\r
-PFileSystem *Filesystem = 0;\r
-PPatchServer *PatchServer = 0;\r
-\r
-bool InitTinNS()\r
-{\r
-       Console = new PConsole("log/patchserver.log");  // Make that from config file !!!\r
-       Console->Print("Starting TinNS Patchserver...");\r
-       Console->Print(WHITE, BLUE, "/-------------------------------------------------------------------\\");\r
-       Console->Print(WHITE, BLUE, "|               TinNS (TinNS is not a Neocron Server)               |");\r
-  Console->Print(WHITE, BLUE, "|            Copyright (C) 2005 Linux Addicted Community            |");\r
-       Console->Print(WHITE, BLUE, "|                  maintainer Akiko <akiko@gmx.org>                 |");\r
-       Console->Print(WHITE, BLUE, "|             ==========================================            |");\r
-       Console->Print(WHITE, BLUE, "|      Head coders:                   The packet analyzing team:    |");\r
-       Console->Print(WHITE, BLUE, "|      - Akiko                         - MaxxJag                    |");\r
-       Console->Print(WHITE, BLUE, "|      - bakkdoor                      - Sting                      |");\r
-       Console->Print(WHITE, BLUE, "|      - Namikon                       - Balm                       |");\r
-       Console->Print(WHITE, BLUE, "|      - Hammag                                                     |");\r
-       Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
-       Console->Print(WHITE, BLUE, "|  This project would'nt be at its current stage without the help   |");\r
-  Console->Print(WHITE, BLUE, "|        from the NeoPolis team, special thanks to you guys!        |");\r
-       Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");\r
-       Console->Print(WHITE, BLUE, "|  This project is under GPL, see any source file for more details  |");\r
-       Console->Print(WHITE, BLUE, "\\-------------------------------------------------------------------/");\r
-\r
-       //char svnrev[10];\r
-       //GetSVNRev(svnrev);\r
-       Console->LPrint("You are running TinNS Patchserver version");\r
-       Console->LPrint(GREEN, BLACK, " %s", ServerVersion);\r
-       Console->LPrint(WHITE, BLACK, " - SVN Rev");\r
-       Console->LPrint(GREEN, BLACK, " %s", SVNRevision);\r
-       Console->LClose();\r
-       \r
-       Config = new PConfig();\r
-       if(!Config->LoadOptions(PatchConfigTemplate ,"./conf/patchserver.conf"))\r
-    Shutdown();\r
-\r
-       ServerSock = new ServerSocket();\r
-       Server = new PServer();\r
-       PatchServer = new PPatchServer();\r
-\r
-       return true;\r
-}\r
-\r
-void Shutdown()\r
-{\r
-       if(PatchServer) delete PatchServer;\r
-       if(Config) delete Config;\r
-       if(Console) delete Console;\r
-    if(ServerSock) delete ServerSock;\r
-    exit(0);\r
-}\r
-\r
diff --git a/server/src/patch/globals.h b/server/src/patch/globals.h
deleted file mode 100644 (file)
index bb5eb16..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef GLOBALS_H\r
-#define GLOBALS_H\r
-\r
-extern class ServerSocket* ServerSock;\r
-extern class PConsole *Console;\r
-extern class PConfig *Config;\r
-extern class PFileSystem *Filesystem;\r
-extern class PServer *Server;\r
-extern class PPatchServer *PatchServer;\r
-\r
-extern const char ServerVersion[];\r
-extern const char SVNRevision[];\r
-\r
-bool InitTinNS();\r
-void Shutdown();\r
-\r
-#endif\r
-\r
diff --git a/server/src/patch/main.cpp b/server/src/patch/main.cpp
deleted file mode 100644 (file)
index b2c7e80..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-\r
-\r
-        MODIFIED: 01 Jul 2006 hammag\r
-             REASON: - commented out sched_yield() in main loop, as it is\r
-                     not needed anymore with a right timeout for ReadSetTCP select\r
-\r
-*/                     \r
-#include "main.h"\r
-\r
-// for handling strg-c signal to shutdown in correct way\r
-void signal_handler(int signal)\r
-{\r
-    if (signal == SIGINT)\r
-    {\r
-        Shutdown();\r
-    }\r
-    else\r
-    {\r
-        psignal(signal, "Unkown signal: ");\r
-    }\r
-}\r
-\r
-int main()\r
-{\r
-    // Connect signal with handlerfunction\r
-    signal(SIGINT, signal_handler);\r
-\r
-\r
-       if(!InitTinNS())\r
-               while(1)\r
-                       sleep(1);\r
-\r
-       PatchServer->Start();\r
-       Console->Print("Patchserver is now %s. Waiting for clients...", Console->ColorText(GREEN, BLACK, "Online"));\r
-\r
-       while(1)\r
-       {\r
-         ServerSock->update();\r
-         Server->Update();\r
-               PatchServer->Update();\r
-               // sched_yield();\r
-       }\r
-\r
-\r
-       return 0;\r
-}\r
-\r
diff --git a/server/src/patch/main.h b/server/src/patch/main.h
deleted file mode 100644 (file)
index 2628a17..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-/*\r
-       MODIFIED: 06 Jul 2006 Hammag\r
-       REASON: - moved include "types.h" before include "../netcode/main.h" to permit compile\r
-       MODIFIED: 10 Jun 2009 Akiko\r
-       REASON: - adjusted includes for new buildsystem\r
-*/\r
-\r
-#ifndef MAIN_H\r
-#define MAIN_H\r
-\r
-//#include "version.h"\r
-\r
-#define PATCH_PORT 7000\r
-#define MAX_PATCH_CLIENTS 50\r
-\r
-//basic includes\r
-#include "include/external.h"\r
-\r
-//tinns includes\r
-#include "include/types.h"\r
-#include "common/netcode.h"\r
-\r
-#include "common/console.h"\r
-#include "common/config.h"\r
-#include "common/filesystem.h"\r
-#include "client.h"\r
-#include "server.h"\r
-#include "patchserver.h"\r
-#include "common/misc.h"\r
-#include "globals.h"\r
-\r
-#endif\r
-\r
diff --git a/server/src/patch/patchserver.h b/server/src/patch/patchserver.h
deleted file mode 100644 (file)
index 790da48..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef PATCHSERVER_H\r
-#define PATCHSERVER_H\r
-\r
-#ifdef _MSC_VER\r
-       #pragma once\r
-#endif\r
-\r
-class PPatchServer\r
-{\r
-       private :\r
-               int mNumClients;\r
-               int mNumFileTransfers;\r
-               typedef std::map<PClient*, struct PPatchState*> PatchStateMap;\r
-               PatchStateMap ClientStates;\r
-       protected :\r
-               bool ProcessClient(PClient *Client, PPatchState *State=0);\r
-//             u32 StartPatch(PClient *Client, PPatchState *State);\r
-               u32 StartPatch(PPatchState *State);\r
-               bool SendPatchData(PClient *Client, PPatchState *State) const;\r
-//             u32 StartFile(PClient *Client, PPatchState *State);\r
-               u32 StartFile(PPatchState *State);\r
-               bool SendFileData(PClient *Client, PPatchState *State) const;\r
-               void FinalizeClient(PClient *Client, PPatchState *State);\r
-               void FinalizeClientDelayed(PClient *Client, PPatchState *State);\r
-\r
-               bool HandleHandshake(PClient *Client, PPatchState *State, const u8 *Packet, int PacketSize);\r
-               bool HandleVersionRequest(PClient *Client, PPatchState *State, const u8 *Packet, int PacketSize);\r
-               bool HandleFileRequests(PClient *Client, PPatchState *State, const u8 *Packet, int PacketSize);\r
-       public :\r
-               PPatchServer();\r
-               ~PPatchServer();\r
-\r
-               void Start();\r
-               void Update();\r
-               void ClientDisconnected(PClient *Client);\r
-};\r
-\r
-#endif\r
-\r
diff --git a/server/src/patch/server.cpp b/server/src/patch/server.cpp
deleted file mode 100644 (file)
index 8337b01..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#include "main.h"\r
-\r
-PServer::PServer()\r
-{\r
-       mNumClients = 0;\r
-       mMaxClients = Config->GetOptionInt("maxclients");\r
-       mGMSlots = Config->GetOptionInt("gm_slots");\r
-\r
-       if(mMaxClients==0)\r
-               mMaxClients=1;\r
-       if(mGMSlots==0)\r
-               mGMSlots=1;\r
-       mClients.reserve(mMaxClients + mGMSlots);\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-               mClients[i]=0;\r
-}\r
-\r
-PServer::~PServer()\r
-{\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-               delete mClients[i];\r
-}\r
-\r
-int PServer::NewClient()\r
-{\r
-//Console->Print("%d %d", mMaxClients, mGMSlots);\r
-       if(mNumClients==mMaxClients+mGMSlots)\r
-               return -1;\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-       {\r
-               if(!mClients[i])\r
-               {\r
-                       mClients[i]=new PClient(i);\r
-                       ++mNumClients;\r
-                       return i;\r
-               }\r
-       }\r
-       return -1;\r
-}\r
-\r
-PClient *PServer::GetClient(int Client) const\r
-{\r
-       if(Client < 0 || Client >= mMaxClients+mGMSlots)\r
-               return 0;\r
-\r
-       return mClients[Client];\r
-}\r
-\r
-void PServer::Update()\r
-{\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-       {\r
-               if(mClients[i])\r
-               {\r
-                       mClients[i]->Update();\r
-                       if(mClients[i]->GetConnection()==PCC_NONE && mClients[i]->getTCPConn() == 0)\r
-                       {\r
-                               Console->Print("Removing client ...");\r
-                               delete mClients[i];\r
-                               mClients[i]=0;\r
-                               --mNumClients;\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-void PServer::Shutdown()\r
-{\r
-    Console->Print("======================");\r
-       Console->Print("Shutting down Patchserver...");\r
-       for(int i=0; i<mMaxClients+mGMSlots; i++)\r
-       {\r
-               if(mClients[i])\r
-               {\r
-                       delete mClients[i];\r
-                       mClients[i]=0;\r
-               }\r
-       }\r
-}\r
diff --git a/server/src/patch/server.h b/server/src/patch/server.h
deleted file mode 100644 (file)
index 1a4b6d2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       Copyright (C) 2005 Linux Addicted Community\r
-       maintainer Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-#ifndef SERVER_H\r
-#define SERVER_H\r
-\r
-class PServer\r
-{\r
-       private :\r
-               int mMaxClients;\r
-               int mGMSlots;\r
-               int mNumClients;\r
-               std::vector<PClient*> mClients;\r
-       protected :\r
-       public :\r
-               PServer();\r
-               ~PServer();\r
-\r
-               inline int GetMaxClients() const { return mMaxClients; }\r
-               inline int GetGMSlots() const { return mGMSlots; }\r
-               inline int GetNumClients() const { return mNumClients; }\r
-               int NewClient();\r
-               PClient *GetClient(int Client) const;\r
-               void Update();\r
-               void Shutdown();\r
-};\r
-\r
-#endif\r
-\r
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
deleted file mode 100644 (file)
index 8a99738..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ADD_SUBDIRECTORY        (pak_decompress)
-ADD_SUBDIRECTORY        (vfs_viewer)
diff --git a/tools/pak_decompress/CMakeLists.txt b/tools/pak_decompress/CMakeLists.txt
deleted file mode 100644 (file)
index b3f2c76..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ADD_EXECUTABLE          (pak_decompress pak_decompress.cpp)
-TARGET_LINK_LIBRARIES   (pak_decompress ${ZLIB_LIBRARY})
diff --git a/tools/pak_decompress/pak_decompress.cpp b/tools/pak_decompress/pak_decompress.cpp
deleted file mode 100644 (file)
index d5e7738..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*\r
-       TinNS (TinNS is not a Neocron Server)\r
-       pak_decompress - pak file decompression tool\r
-       Copyright (C) 2005 Akiko <akiko@gmx.org>\r
-\r
-       This program is free software; you can redistribute it and/or\r
-       modify it under the terms of the GNU General Public License\r
-       as published by the Free Software Foundation; either version 2\r
-       of the License, or (at your option) any later version.\r
-\r
-       This program is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
-\r
-       You should have received a copy of the GNU General Public License\r
-       along with this program; if not, write to the Free Software\r
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
-       02110-1301, USA.\r
-*/\r
-\r
-\r
-\r
-/*\r
-       pak_decompress - a decompression tool for single pak files\r
-\r
-       MODIFIED: 23 Sep 2005 Akiko\r
-       REASON: - started this tool\r
-       MODIFIED: 26 Sep 2005 Akiko\r
-       REASON: - added printing of some information\r
-       MODIFIED: 26 Oct 2005 Akiko\r
-       REASON: - fixed an issue belonging to portability\r
-       MODIFIED: 06 Dec 2005 Akiko\r
-       REASON: - compression ration fixed\r
-       MODIFIED: 09 Dec 2005 Akiko\r
-       REASON: - fixed typo\r
-               - compression ratio\r
-       MODIFIED: 21 Dec 2006 Namikon\r
-       REASON: - Added errorcheck for in/output file\r
-               - Added check for NC and normal zLib files\r
-       MODIFIED: 15 Jun 2009 Akiko\r
-       REASON: - fixed warning\r
-\r
-       TODO:   - time needed for decompression\r
-               - ideas for a compression tool\r
-*/\r
-\r
-#include <iostream>\r
-#include <fstream>\r
-#include <cstdio>\r
-#include <cstring>\r
-#include <cassert>\r
-#include <zlib.h>\r
-\r
-#define CHUNK 262144\r
-\r
-int inf(FILE *source, FILE *dest, bool details)\r
-{\r
-       int ret;\r
-       char check;\r
-       unsigned have;\r
-       z_stream strm;\r
-       unsigned char in[CHUNK];\r
-       unsigned char out[CHUNK];\r
-\r
-       strm.zalloc = Z_NULL;\r
-       strm.zfree = Z_NULL;\r
-       strm.opaque = Z_NULL;\r
-       strm.avail_in = 0;\r
-       strm.next_in = Z_NULL;\r
-       ret = inflateInit(&strm);\r
-\r
-       if (ret != Z_OK)\r
-               return(ret);\r
-\r
-       check = fgetc(source);\r
-       if(check == 'x')\r
-       {\r
-               if(details == true) std::cout << "Found zLibfile" << std::endl;\r
-               fseek(source, 0, SEEK_SET);\r
-       }\r
-       else\r
-       {\r
-               fseek(source, 16, SEEK_SET);\r
-               check = fgetc(source);\r
-               if(check == 'x')\r
-               {\r
-                       if(details == true) std::cout << "Found Neocron file" << std::endl;\r
-                       fseek(source, 16, SEEK_SET);\r
-               }\r
-               else\r
-               {\r
-                       if(details == true) std::cout << "Error: No compatible file!" << std::endl;\r
-                       return -3;\r
-               }\r
-       }\r
-\r
-       do {\r
-               strm.avail_in = fread(in, 1, CHUNK, source);\r
-\r
-               if (ferror(source)) {\r
-                       (void)inflateEnd(&strm);\r
-\r
-                       return(Z_ERRNO);\r
-               }\r
-\r
-               if (strm.avail_in == 0)\r
-                       break;\r
-               strm.next_in = in;\r
-\r
-               do {\r
-                       strm.avail_out = CHUNK;\r
-                       strm.next_out = out;\r
-                       ret = inflate(&strm, Z_NO_FLUSH);\r
-                       assert(ret != Z_STREAM_ERROR);\r
-\r
-                       switch(ret) {\r
-                               case Z_NEED_DICT:\r
-                                       ret = Z_DATA_ERROR;\r
-                               case Z_DATA_ERROR:\r
-                               case Z_MEM_ERROR:\r
-                                       (void)inflateEnd(&strm);\r
-                                       return(ret);\r
-                               }\r
-\r
-                               have = CHUNK - strm.avail_out;\r
-\r
-                               if (fwrite(out, 1, have, dest) != have || ferror(dest)) {\r
-                                       (void)inflateEnd(&strm);\r
-\r
-                               return(Z_ERRNO);\r
-                       }\r
-               } while (strm.avail_out == 0);\r
-\r
-               assert(strm.avail_in == 0);\r
-       } while (ret != Z_STREAM_END);\r
-\r
-       (void)inflateEnd(&strm);\r
-       \r
-       return(ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR);\r
-}\r
-\r
-void zerr(int ret)\r
-{\r
-       fputs("zpipe: ", stderr);\r
-\r
-       switch(ret) {\r
-               case Z_ERRNO:\r
-                       if (ferror(stdin))\r
-                               fputs("error reading stdin\n", stderr);\r
-                       if (ferror(stdout))\r
-                               fputs("error writing stdout\n", stderr);\r
-                       break;\r
-               case Z_STREAM_ERROR:\r
-                       fputs("invalid compression level\n", stderr);\r
-                       break;\r
-               case Z_DATA_ERROR:\r
-                       fputs("invalid or incomplete deflate data\n", stderr);\r
-                       break;\r
-               case Z_MEM_ERROR:\r
-                       fputs("out of memory\n", stderr);\r
-                       break;\r
-               case Z_VERSION_ERROR:\r
-                       fputs("zlib version mismatch!\n", stderr);\r
-       }\r
-}\r
-\r
-int main(int argc, char **argv) {\r
-       int ret;\r
-       long inSize;\r
-       long outSize;\r
-       bool details = false;\r
-       FILE *inFile;\r
-       FILE *outFile;\r
-       std::string src;\r
-       std::string dst;\r
-\r
-       if(argc == 2) {\r
-               src = argv[1];\r
-               dst = strcat(argv[1], ".decompressed");\r
-       }\r
-       else if(argc > 2 && strcmp(argv[1], argv[2])) {\r
-               src = argv[1];\r
-               dst = argv[2];\r
-       }\r
-       else {\r
-               std::cout << "Usage: pak_decompress source <dest != source> <detailedoutput 1/0>" << std::endl;\r
-               return(0);\r
-       }\r
-       if(argc == 4)\r
-       {\r
-               if(argv[3][0] == '1') details = true;\r
-               else if(argv[3][0] == '0') details = false;\r
-       }\r
-\r
-       inFile = fopen(src.c_str(), "rb");\r
-       outFile = fopen(dst.c_str(), "wb");\r
-\r
-       if(inFile == NULL)\r
-       {\r
-               std::cout << "Cannot open InFile" << std::endl;\r
-               return(-1);\r
-       }\r
-       if(outFile == NULL)\r
-       {\r
-               std::cout << "Cannot open OutFile" << std::endl;\r
-               return(-2);\r
-       }\r
-       ret = inf(inFile, outFile, details);\r
-\r
-       /* just to be sure - we got to the end */\r
-       fseek(inFile, 0, SEEK_END);\r
-       fseek(outFile, 0, SEEK_END);\r
-       inSize = ftell(inFile);\r
-       outSize = ftell(outFile);\r
-       \r
-       fclose(outFile);\r
-       fclose(inFile);\r
-       \r
-       if(ret == Z_OK && details == true)\r
-       {\r
-               std::cout << "bytes read:        " << inSize << std::endl;\r
-               std::cout << "bytes written:     " << outSize << std::endl;\r
-               std::cout << "compression ratio: " << (100-((float)inSize/(float)outSize*100)) << "%" << std::endl;\r
-       }\r
-       else if(ret == Z_OK && details == false)\r
-       {\r
-               std::cout << "[OK]    " << src.c_str() << std::endl;\r
-       }\r
-       else if(ret != Z_OK && details == false)\r
-       {\r
-               std::cout << "[ERROR] " << src.c_str() << std::endl;\r
-       }\r
-\r
-       return(ret);\r
-}\r
-\r
-\r
diff --git a/tools/pak_decompress/pak_decompress.jar b/tools/pak_decompress/pak_decompress.jar
deleted file mode 100644 (file)
index 7758c1e..0000000
Binary files a/tools/pak_decompress/pak_decompress.jar and /dev/null differ
diff --git a/tools/vfs_viewer/CMakeLists.txt b/tools/vfs_viewer/CMakeLists.txt
deleted file mode 100644 (file)
index bba6633..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ADD_EXECUTABLE          (vfs_viewer vfs_viewer.c)
-TARGET_LINK_LIBRARIES   (vfs_viewer ${ZLIB_LIBRARY})
diff --git a/tools/vfs_viewer/vfs_viewer.c b/tools/vfs_viewer/vfs_viewer.c
deleted file mode 100644 (file)
index dfb9b04..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-       TinNS (TinNS is not a Neocron Server)
-       vfs_viewer.c - NC virutal file system decompression/browsing tool
-       Copyright (C) 2005 Akiko <akiko@gmx.org>
-
-       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.
-*/
-
-
-
-/*
-       vfs_viewer.c
-
-       Authors:
-       - Akiko <akiko@gmx.org>
-
-       ToDo:
-       - remove memory leaks, a lot of memory gets reserved but not freed
-       - adding decompressing
-       - adding file selection for decompressing
-       - adding a nice gui (kde/ncurses)
-
-       MODIFIED: 09 Dec 2005 Akiko
-       REASON: - initial release
-               - just a output fix
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-typedef unsigned int u32;
-typedef unsigned char u8;
-
-int main(int argc, char *argv[]) {
-       // structure of the file informtion inside the virtual FS
-       struct t_file_header {
-               u32 id;
-               u32 offset;
-               u32 csize;
-               u32 dsize;
-               u32 len_name;
-               u8 *name;
-       };
-       // structure of the virtual FS
-       struct t_vfs_header {
-               u32 id;
-               u32 file_count;
-               struct t_file_header *files;
-               u8 *data;
-       };
-
-       if (argc == 2) {
-               FILE *fd;
-               struct t_vfs_header vfs_file;
-
-               fd = fopen(argv[1], "rb");
-
-               // reading the vfs header including the amount of files in the virtual FS
-               fread(&vfs_file.id, sizeof(u32), 1, fd);
-               fread(&vfs_file.file_count, sizeof(u32), 1, fd);
-
-               struct t_file_header files[vfs_file.file_count];
-
-               // reading all information from the vfs into an array and print some of them
-               u32 i;
-               for (i = 0; i < vfs_file.file_count; i++) {
-                       fread(&files[i].id, sizeof(u32), 1, fd);
-                       fread(&files[i].offset, sizeof(u32), 1, fd);
-                       fread(&files[i].csize, sizeof(u32), 1, fd);
-                       fread(&files[i].dsize, sizeof(u32), 1 ,fd);
-                       fread(&files[i].len_name, sizeof(u32), 1, fd);
-
-                       files[i].name = (u8 *)malloc(sizeof(u8)*files[i].len_name);
-                       fread(files[i].name, sizeof(u8), files[i].len_name, fd);
-                       //fseek(fd, files[i].len_name, SEEK_CUR);
-
-                       printf("Filenumber %4i: %50s (%7i/%7i) ID-%2i\n", i, files[i].name, files[i].csize, files[i].dsize, files[i].id);
-               }
-               
-               fclose(fd);
-       } else {
-               printf("Usage: vfs_viewer <nc1 vfs file>\n");
-               exit(1);
-       }
-
-       exit(0);
-}
-