From ffcff4aea15466d6adacd99844d58de5186c883a Mon Sep 17 00:00:00 2001 From: j883376 Date: Mon, 6 May 2013 13:07:41 -0400 Subject: [PATCH 1/4] Remove trailing whitespace --- CMakeLists.txt | 10 +- cmake/FindMySQL.cmake | 5 +- common/BasePacket.cpp | 6 +- common/BasePacket.h | 6 +- common/CRC16.cpp | 2 +- common/Condition.cpp | 20 +- common/Condition.h | 4 +- common/EQDB.cpp | 8 +- common/EQDB.h | 8 +- common/EQDBRes.cpp | 8 +- common/EQDBRes.h | 6 +- common/EQEMuError.cpp | 6 +- common/EQEMuError.h | 6 +- common/EQEmuConfig.cpp | 16 +- common/EQEmuConfig.h | 28 +- common/EQNetwork.cpp | 30 +- common/EQPacket.cpp | 22 +- common/EQPacket.h | 44 +- common/EQStream.cpp | 110 +- common/EQStream.h | 42 +- common/EQStreamFactory.cpp | 44 +- common/EQStreamFactory.h | 2 +- common/EQStreamIdent.cpp | 26 +- common/EQStreamIdent.h | 10 +- common/EQStreamIntf.h | 2 +- common/EQStreamLocator.h | 26 +- common/EQStreamProxy.cpp | 4 +- common/EQStreamProxy.h | 6 +- common/EmuTCPConnection.cpp | 68 +- common/EmuTCPConnection.h | 34 +- common/Item.cpp | 292 +- common/Item.h | 84 +- common/MaxSkill.cpp | 3110 ++++++++--------- common/MiscFunctions.cpp | 10 +- common/MiscFunctions.h | 4 +- common/Mutex.cpp | 2 +- common/ProcLauncher.cpp | 100 +- common/ProcLauncher.h | 18 +- common/StructStrategy.cpp | 14 +- common/StructStrategy.h | 12 +- common/TCPConnection.cpp | 38 +- common/TCPConnection.h | 26 +- common/TCPServer.cpp | 16 +- common/TCPServer.h | 26 +- common/XMLParser.cpp | 22 +- common/XMLParser.h | 12 +- common/bodytypes.h | 2 +- common/breakdowns.h | 4 +- common/classes.cpp | 424 +-- common/classes.h | 30 +- common/common_profile.h | 24 +- common/crash.cpp | 12 +- common/crc32.cpp | 6 +- common/crc32.h | 4 +- common/database.cpp | 128 +- common/database.h | 24 +- common/dbasync.cpp | 20 +- common/dbasync.h | 8 +- common/dbcore.cpp | 2 +- common/dbcore.h | 2 +- common/dbmemshare.cpp | 2 +- common/debug.cpp | 10 +- common/debug.h | 8 +- common/deity.h | 4 +- common/emu_opcodes.cpp | 4 +- common/emu_oplist.h | 2 +- common/eq_constants.h | 80 +- common/eq_packet_structs.h | 56 +- common/eqemu_exception.cpp | 18 +- common/eqemu_exception.h | 30 +- common/eqtime.cpp | 8 +- common/eqtime.h | 6 +- common/errmsg.h | 6 +- common/extprofile.cpp | 6 +- common/extprofile.h | 8 +- common/faction.h | 12 +- common/features.h | 8 +- common/fixed_memory_hash_set.h | 16 +- common/fixed_memory_variable_hash_set.h | 22 +- common/guild_base.cpp | 424 +-- common/guild_base.h | 30 +- common/guilds.cpp | 46 +- common/ipc_mutex.h | 16 +- common/languages.h | 28 +- common/linked_list.h | 22 +- common/logsys.cpp | 18 +- common/logsys.h | 24 +- common/logsys_eqemu.cpp | 6 +- common/logtypes.h | 4 +- common/md5.cpp | 4 +- common/md5.h | 4 +- common/memory_mapped_file.cpp | 60 +- common/memory_mapped_file.h | 20 +- common/opcode_dispatch.h | 50 +- common/opcodemgr.cpp | 52 +- common/opcodemgr.h | 42 +- common/packet_dump.cpp | 4 +- common/packet_dump_file.cpp | 2 +- common/packet_functions.cpp | 76 +- common/packetfile.cpp | 124 +- common/packetfile.h | 46 +- common/patches/Client62.cpp | 102 +- common/patches/Client62.h | 20 +- common/patches/Client62_structs.h | 112 +- common/patches/RoF.cpp | 230 +- common/patches/RoF.h | 20 +- common/patches/RoF_structs.h | 136 +- common/patches/SSDefine.h | 16 +- common/patches/SoD.cpp | 200 +- common/patches/SoD.h | 20 +- common/patches/SoD_structs.h | 50 +- common/patches/SoF.cpp | 186 +- common/patches/SoF.h | 20 +- common/patches/SoF_opcode_list.h | 2 +- common/patches/SoF_structs.h | 38 +- common/patches/Titanium.cpp | 126 +- common/patches/Titanium.h | 20 +- common/patches/Titanium_structs.h | 166 +- common/patches/Underfoot.cpp | 198 +- common/patches/Underfoot.h | 20 +- common/patches/Underfoot_structs.h | 58 +- common/patches/template.cpp | 26 +- common/patches/template.h | 20 +- common/perl_EQDB.cpp | 4 +- common/perl_EQDBRes.cpp | 6 +- common/profiler.h | 10 +- common/ptimer.h | 34 +- common/queues.h | 6 +- common/rdtsc.cpp | 24 +- common/rdtsc.h | 26 +- common/rulesys.h | 20 +- common/ruletypes.h | 8 +- common/seperator.h | 4 +- common/serverinfo.cpp | 16 +- common/servertalk.h | 14 +- common/shareddb.cpp | 246 +- common/shareddb.h | 12 +- common/spdat.cpp | 50 +- common/spdat.h | 60 +- common/timeoutmgr.cpp | 2 +- common/timeoutmgr.h | 10 +- common/timer.cpp | 18 +- common/types.h | 2 +- common/useperl.h | 4 +- common/worldconn.cpp | 12 +- common/worldconn.h | 12 +- eqlaunch/CMakeLists.txt | 2 +- eqlaunch/ZoneLaunch.cpp | 26 +- eqlaunch/ZoneLaunch.h | 30 +- eqlaunch/eqlaunch.cpp | 40 +- eqlaunch/worldserver.cpp | 22 +- eqlaunch/worldserver.h | 6 +- loginserver/CMakeLists.txt | 2 +- loginserver/Client.cpp | 14 +- loginserver/Client.h | 2 +- loginserver/ClientManager.cpp | 4 +- loginserver/Config.cpp | 2 +- loginserver/Config.h | 4 +- loginserver/Database.h | 2 +- loginserver/DatabaseMySQL.cpp | 10 +- loginserver/DatabaseMySQL.h | 2 +- loginserver/DatabasePostgreSQL.cpp | 12 +- loginserver/DatabasePostgreSQL.h | 2 +- loginserver/Encryption.cpp | 10 +- loginserver/ErrorLog.cpp | 68 +- loginserver/LoginServer.h | 2 +- loginserver/LoginStructures.h | 2 +- loginserver/Main.cpp | 18 +- loginserver/Options.h | 16 +- loginserver/ServerManager.cpp | 8 +- loginserver/WorldServer.cpp | 24 +- loginserver/WorldServer.h | 4 +- queryserv/CMakeLists.txt | 2 +- queryserv/database.h | 4 +- queryserv/lfguild.cpp | 14 +- queryserv/queryservconfig.h | 2 +- queryserv/worldserver.cpp | 12 +- queryserv/worldserver.h | 2 +- shared_memory/items.cpp | 12 +- shared_memory/items.h | 4 +- shared_memory/loot.cpp | 10 +- shared_memory/loot.h | 4 +- shared_memory/main.cpp | 12 +- shared_memory/npc_faction.cpp | 12 +- shared_memory/npc_faction.h | 4 +- shared_memory/skill_caps.cpp | 10 +- shared_memory/skill_caps.h | 4 +- shared_memory/spells.cpp | 4 +- shared_memory/spells.h | 4 +- tests/cppunit/collectoroutput.cpp | 18 +- tests/cppunit/compileroutput.cpp | 28 +- tests/cppunit/cpptest-assert.h | 6 +- tests/cppunit/cpptest-collectoroutput.h | 28 +- tests/cppunit/cpptest-compileroutput.h | 20 +- tests/cppunit/cpptest-htmloutput.h | 12 +- tests/cppunit/cpptest-output.h | 20 +- tests/cppunit/cpptest-source.h | 10 +- tests/cppunit/cpptest-suite.h | 34 +- tests/cppunit/cpptest-textoutput.h | 14 +- tests/cppunit/cpptest-time.h | 12 +- tests/cppunit/htmloutput.cpp | 80 +- tests/cppunit/missing.cpp | 12 +- tests/cppunit/missing.h | 12 +- tests/cppunit/source.cpp | 12 +- tests/cppunit/suite.cpp | 48 +- tests/cppunit/textoutput.cpp | 26 +- tests/cppunit/time.cpp | 30 +- tests/cppunit/utils.cpp | 4 +- tests/cppunit/utils.h | 2 +- tests/cppunit/winconfig.h | 2 +- tests/fixed_memory_test.h | 24 +- tests/fixed_memory_variable_test.h | 22 +- tests/ipc_mutex_test.h | 10 +- tests/main.cpp | 4 +- tests/memory_mapped_file_test.h | 20 +- ucs/CMakeLists.txt | 2 +- ucs/chatchannel.cpp | 10 +- ucs/clientlist.cpp | 72 +- ucs/clientlist.h | 4 +- ucs/database.cpp | 28 +- ucs/database.h | 4 +- ucs/ucs.cpp | 2 +- ucs/ucsconfig.h | 2 +- ucs/worldserver.cpp | 14 +- ucs/worldserver.h | 2 +- utils/EQExtractor2/EQExtractor2/ChangeLog.txt | 4 +- .../EQExtractor2/EQApplicationLayer.cs | 94 +- .../EQExtractor2/EQExtractor2.csproj | 2 +- .../EQExtractor2Form1.Designer.cs | 92 +- .../EQExtractor2/EQExtractor2Form1.cs | 58 +- .../EQExtractor2/EQExtractor2Form1.resx | 54 +- utils/EQExtractor2/EQExtractor2/EQPacket.cs | 70 +- .../EQExtractor2/GenerateSQLForm.Designer.cs | 172 +- .../EQExtractor2/GenerateSQLForm.cs | 4 +- .../EQExtractor2/GenerateSQLForm.resx | 54 +- .../EQExtractor2/InternalTypes.cs | 34 +- .../EQExtractor2/LogForm.Designer.cs | 8 +- utils/EQExtractor2/EQExtractor2/LogForm.cs | 2 +- utils/EQExtractor2/EQExtractor2/LogForm.resx | 54 +- .../EQExtractor2/OpcodeManager.cs | 8 +- .../EQExtractor2/PacketDotNet.dll | Bin 90624 -> 90623 bytes .../EQExtractor2/PatchApril15-2013.cs | 6 +- .../EQExtractor2/PatchAug04-2011.cs | 2 +- .../EQExtractor2/PatchAugust15-2012.cs | 8 +- .../EQExtractor2/PatchDec7-2010.cs | 6 +- .../EQExtractor2/PatchDecember10-2012.cs | 138 +- .../EQExtractor2/PatchFeb8-2011.cs | 2 +- .../EQExtractor2/PatchFebruary11-2013.cs | 6 +- .../EQExtractor2/EQExtractor2/PatchGeneric.cs | 12 +- .../EQExtractor2/PatchJanuary16-2013.cs | 6 +- .../EQExtractor2/PatchJuly13-2010.cs | 6 +- .../EQExtractor2/PatchJuly13-2012.cs | 4 +- .../EQExtractor2/PatchJune25-2012.cs | 4 +- .../EQExtractor2/PatchMar15-2012.cs | 8 +- .../EQExtractor2/PatchMarch13-2013.cs | 6 +- .../EQExtractor2/PatchMarch15-2011.cs | 4 +- .../EQExtractor2/PatchMay12-2010.cs | 78 +- .../EQExtractor2/PatchMay12-2011.cs | 16 +- .../EQExtractor2/PatchMay24-2011.cs | 6 +- .../EQExtractor2/PatchNov17-2011.cs | 6 +- utils/EQExtractor2/EQExtractor2/PatchSoD.cs | 8 +- .../EQExtractor2/PatchTestSep1-2010.cs | 38 +- .../EQExtractor2/PatchTestSep22-2010.cs | 8 +- .../PatchTestServerFebruary5-2013.cs | 4 +- .../PatchTestServerJanuary16-2013.cs | 4 +- .../EQExtractor2/Properties/AssemblyInfo.cs | 10 +- .../Properties/Resources.Designer.cs | 14 +- .../EQExtractor2/Properties/Resources.resx | 54 +- .../Properties/Settings.Designer.cs | 14 +- utils/EQExtractor2/EQExtractor2/SharpPcap.dll | Bin 38400 -> 38399 bytes .../EQExtractor2/UserOptions.Designer.cs | 36 +- .../EQExtractor2/UserOptions.resx | 54 +- utils/EQExtractor2/EQExtractor2/Utils.cs | 22 +- utils/EQExtractor2/EQExtractor2/log4net.dll | Bin 243712 -> 243704 bytes .../EQExtractor2/patch_April15-2013.conf | 2 +- .../EQExtractor2/patch_Aug04-2011.conf | 232 +- .../EQExtractor2/patch_August15-2012.conf | 1072 +++--- .../EQExtractor2/patch_Dec10-2012.conf | 2 +- .../EQExtractor2/patch_Dec7-2010.conf | 232 +- .../EQExtractor2/patch_Feb11-2013.conf | 2 +- .../EQExtractor2/patch_Feb8-2011.conf | 232 +- .../EQExtractor2/patch_July13-2012.conf | 1072 +++--- .../EQExtractor2/patch_June25-2012.conf | 1072 +++--- .../EQExtractor2/patch_Mar13-2013.conf | 2 +- .../EQExtractor2/patch_Mar15-2012.conf | 1072 +++--- .../EQExtractor2/patch_March15-2011.conf | 232 +- .../EQExtractor2/patch_May12-2010.conf | 234 +- .../EQExtractor2/patch_May12-2011.conf | 232 +- .../EQExtractor2/patch_Nov17-2011.conf | 232 +- .../EQExtractor2/patch_Sep01-2010.conf | 234 +- .../EQExtractor2/patch_Sep22-2010.conf | 232 +- .../EQExtractor2/EQExtractor2/patch_SoD.conf | 236 +- utils/EQExtractor2/EQExtractor2/zlib.net.dll | Bin 69632 -> 69605 bytes utils/TaskMaster/ErrorLog.cpp | 14 +- utils/TaskMaster/ErrorLog.h | 4 +- utils/TaskMaster/activities.cpp | 6 +- utils/TaskMaster/base.cpp | 16 +- utils/TaskMaster/base.h | 4 +- utils/TaskMaster/base_utility.cpp | 16 +- utils/TaskMaster/goals.cpp | 4 +- utils/TaskMaster/proximity.cpp | 12 +- utils/TaskMaster/tasks.cpp | 6 +- utils/azone2/CMakeLists.txt | 6 +- utils/azone2/GLModelViewer.cpp | 224 +- utils/azone2/awater.cpp | 48 +- utils/azone2/azone.h | 48 +- utils/azone2/dat.cpp | 78 +- utils/azone2/listobj.cpp | 26 +- utils/azone2/pfs.cpp | 10 +- utils/azone2/ter.cpp | 20 +- utils/azone2/wld.cpp | 32 +- utils/azone2/wld.hpp | 2 +- utils/azone2/zon.cpp | 18 +- utils/azone2/zon.hpp | 2 +- utils/azone2/zonv4.cpp | 2 +- utils/azone2/zonv4.hpp | 2 +- utils/defaults/eqemu_config.xml.full | 2 +- utils/defaults/mime.types | 30 +- utils/defaults/plugins/check_handin.pl | 4 +- utils/defaults/templates/TreeMenu.css | 14 +- utils/defaults/templates/TreeMenu.js | 104 +- utils/defaults/templates/account.html | 18 +- utils/defaults/templates/accounts.html | 6 +- utils/defaults/templates/bugs.html | 2 +- utils/defaults/templates/commands.html | 2 +- utils/defaults/templates/guild.html | 12 +- utils/defaults/templates/guilds.html | 2 +- utils/defaults/templates/launcher.html | 10 +- utils/defaults/templates/launchers.html | 4 +- utils/defaults/templates/main.css | 18 +- utils/defaults/templates/rule.html | 4 +- utils/defaults/templates/rules.html | 8 +- utils/defaults/templates/top.html | 2 +- utils/defaults/templates/variables.html | 2 +- .../updated_templates/actions/bug_action.html | 2 +- .../actions/console_action.html | 2 +- .../actions/launcher_action.html | 16 +- .../actions/world_action.html | 2 +- .../actions/zone_action.html | 2 +- utils/defaults/updated_templates/bugs.html | 26 +- utils/defaults/updated_templates/bugview.html | 22 +- utils/defaults/updated_templates/console.html | 42 +- .../updated_templates/data/bug_data.html | 6 +- .../updated_templates/data/console_data.html | 4 +- .../updated_templates/data/launcher_data.html | 10 +- .../updated_templates/data/player_data.html | 8 +- .../updated_templates/data/world_status.html | 2 +- .../updated_templates/data/zone_data.html | 4 +- .../updated_templates/images/loading.gif | Bin 673 -> 665 bytes utils/defaults/updated_templates/index.html | 50 +- .../defaults/updated_templates/launcher.html | 82 +- .../defaults/updated_templates/launchers.html | 46 +- .../defaults/updated_templates/petitions.html | 2 +- utils/defaults/updated_templates/players.html | 26 +- .../updated_templates/playerview.html | 22 +- .../updated_templates/style/style.css | 22 +- utils/defaults/updated_templates/zones.html | 18 +- .../defaults/updated_templates/zoneview.html | 14 +- utils/patches/opcodes.conf | 34 +- utils/patches/patch_6.2.conf | 20 +- utils/patches/patch_RoF.conf | 2 +- utils/patches/patch_SoD.conf | 236 +- utils/patches/patch_SoF.conf | 40 +- utils/patches/patch_Titanium.conf | 30 +- utils/patches/patch_Underfoot.conf | 234 +- .../player_profile_set/MiscFunctions.cpp | 6 +- .../player_profile_set/database.cpp | 8 +- .../player_profile_set/eq_player_structs.h | 10 +- .../player_profile_set/ini.cpp | 8 +- .../player_profile_set/ini.h | 2 +- .../player_profile_set/main.cpp | 4 +- .../player_profile_set/types.h | 2 +- utils/scripts/Examples/ListIteration.pl | 18 +- utils/scripts/Examples/SpawnManipulation.pl | 2 +- utils/scripts/factionmod.pl | 26 +- utils/scripts/import_showeq | 2 +- utils/scripts/import_spells.pl | 4 +- utils/scripts/ppreader.pl | 34 +- world/Adventure.cpp | 10 +- world/AdventureManager.cpp | 60 +- world/CMakeLists.txt | 2 +- world/EQLConfig.h | 26 +- world/EQW.cpp | 48 +- world/EQW.h | 24 +- world/EQWHTTPHandler.cpp | 58 +- world/EQWHTTPHandler.h | 42 +- world/EQWParser.cpp | 48 +- world/EQWParser.h | 10 +- world/HTTPRequest.cpp | 4 +- world/HTTPRequest.h | 14 +- world/LauncherLink.cpp | 52 +- world/LauncherLink.h | 22 +- world/LauncherList.cpp | 20 +- world/LauncherList.h | 14 +- world/LoginServer.cpp | 8 +- world/LoginServerList.h | 8 +- world/SoFCharCreateData.h | 2 +- world/WorldConfig.cpp | 4 +- world/WorldConfig.h | 8 +- world/client.cpp | 52 +- world/client.h | 6 +- world/cliententry.cpp | 6 +- world/clientlist.cpp | 92 +- world/clientlist.h | 18 +- world/console.cpp | 8 +- world/console.h | 2 +- world/lfplist.cpp | 14 +- world/lfplist.h | 6 +- world/net.cpp | 46 +- world/perl_EQLConfig.cpp | 8 +- world/perl_EQW.cpp | 4 +- world/perl_HTTPRequest.cpp | 8 +- world/queryserv.cpp | 6 +- world/ucs.cpp | 6 +- world/wguild_mgr.cpp | 30 +- world/wguild_mgr.h | 8 +- world/world_logsys.cpp | 4 +- world/worlddb.cpp | 100 +- world/worlddb.h | 12 +- world/zonelist.cpp | 18 +- world/zonelist.h | 10 +- world/zoneserver.cpp | 44 +- world/zoneserver.h | 2 +- zone/AA.cpp | 26 +- zone/AA.h | 110 +- zone/Map.cpp | 156 +- zone/MobAI.cpp | 360 +- zone/Object.cpp | 126 +- zone/PlayerCorpse.cpp | 204 +- zone/QGlobals.h | 4 +- zone/Quest.cpp | 2 +- zone/Quest.h | 2 +- zone/QuestParserCollection.cpp | 12 +- zone/StringIDs.h | 6 +- zone/ZoneConfig.cpp | 4 +- zone/ZoneConfig.h | 6 +- zone/aggro.cpp | 154 +- zone/attack.cpp | 536 +-- zone/basic_functions.h | 2 +- zone/beacon.cpp | 6 +- zone/beacon.h | 2 +- zone/bonuses.cpp | 388 +- zone/bot.cpp | 6 +- zone/botspellsai.cpp | 242 +- zone/client.cpp | 368 +- zone/client.h | 26 +- zone/client_logs.cpp | 12 +- zone/client_logs.h | 14 +- zone/client_mods.cpp | 238 +- zone/client_packet.cpp | 6 +- zone/client_packet.h | 4 +- zone/client_process.cpp | 208 +- zone/command.cpp | 644 ++-- zone/command.h | 6 +- zone/common.h | 14 +- zone/doors.cpp | 54 +- zone/doors.h | 12 +- zone/effects.cpp | 184 +- zone/embparser.cpp | 48 +- zone/embparser.h | 14 +- zone/embperl.h | 30 +- zone/embxs.cpp | 106 +- zone/embxs.h | 12 +- zone/entity.cpp | 692 ++-- zone/entity.h | 24 +- zone/errmsg.h | 6 +- zone/exp.cpp | 136 +- zone/fearpath.cpp | 164 +- zone/forage.cpp | 108 +- zone/groups.cpp | 160 +- zone/groups.h | 6 +- zone/guild.cpp | 58 +- zone/guild_mgr.cpp | 136 +- zone/guild_mgr.h | 10 +- zone/hate_list.cpp | 46 +- zone/horse.cpp | 46 +- zone/horse.h | 6 +- zone/inventory.cpp | 262 +- zone/loottables.cpp | 54 +- zone/map.h | 30 +- zone/masterentity.h | 2 +- zone/maxskill.h | 70 +- zone/merc.cpp | 20 +- zone/mob.cpp | 494 +-- zone/mob.h | 102 +- zone/net.cpp | 64 +- zone/net.h | 2 +- zone/npc.cpp | 230 +- zone/npc.h | 62 +- zone/object.h | 22 +- zone/oldcode.cpp | 172 +- zone/parser.cpp | 92 +- zone/parser.h | 8 +- zone/pathing.cpp | 130 +- zone/pathing.h | 2 +- zone/perl_PlayerCorpse.cpp | 4 +- zone/perl_client.cpp | 28 +- zone/perl_doors.cpp | 6 +- zone/perl_entity.cpp | 4 +- zone/perl_groups.cpp | 8 +- zone/perl_hateentry.cpp | 2 +- zone/perl_mob.cpp | 14 +- zone/perl_npc.cpp | 4 +- zone/perl_object.cpp | 4 +- zone/perl_perlpacket.cpp | 4 +- zone/perl_questitem.cpp | 8 +- zone/perl_raids.cpp | 10 +- zone/perlpacket.cpp | 10 +- zone/perlpacket.h | 12 +- zone/perlparser.cpp | 22 +- zone/petitions.cpp | 72 +- zone/petitions.h | 2 +- zone/pets.cpp | 84 +- zone/pets.h | 20 +- zone/questmgr.cpp | 26 +- zone/queues.h | 6 +- zone/raids.cpp | 56 +- zone/raids.h | 4 +- zone/spawn2.cpp | 272 +- zone/spawn2.h | 28 +- zone/spawngroup.cpp | 30 +- zone/special_attacks.cpp | 330 +- zone/spell_effects.cpp | 536 +-- zone/spells.cpp | 426 +-- zone/tasks.cpp | 296 +- zone/tasks.h | 12 +- zone/tradeskills.cpp | 250 +- zone/trading.cpp | 138 +- zone/trap.cpp | 20 +- zone/trap.h | 8 +- zone/tribute.cpp | 182 +- zone/updatemgr.cpp | 12 +- zone/updatemgr.h | 14 +- zone/watermap.cpp | 26 +- zone/watermap.h | 2 +- zone/waypoints.cpp | 150 +- zone/worldserver.cpp | 162 +- zone/worldserver.h | 14 +- zone/zone.cpp | 190 +- zone/zone.h | 30 +- zone/zone_logsys.cpp | 14 +- zone/zone_profile.cpp | 64 +- zone/zone_profile.h | 32 +- zone/zonedb.cpp | 300 +- zone/zonedb.h | 62 +- zone/zonedbasync.cpp | 2 +- zone/zonedump.h | 12 +- zone/zoning.cpp | 108 +- 548 files changed, 16397 insertions(+), 16398 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 312095f08..9b2bfd03b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,25 +37,25 @@ IF(MSVC) SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86") SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86") ENDIF(CMAKE_CL_64) - + #disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON) IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS) ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) ENDIF(EQEMU_DISABLE_CRT_SECURE_WARNINGS) - + #fast FP if you'd like it OPTION(EQEMU_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON) IF(EQEMU_FAST_FLOATINGPOINT) ADD_DEFINITIONS(/fp:fast) ENDIF(EQEMU_FAST_FLOATINGPOINT) - + #crash logging currently only works on windows x86/x64 OPTION(EQEMU_ENABLE_CRASH_LOGGING "Enable crash logging" ON) IF(EQEMU_ENABLE_CRASH_LOGGING) ADD_DEFINITIONS(-DCRASH_LOGGING) ENDIF(EQEMU_ENABLE_CRASH_LOGGING) - + #Disable safe SEH or not? OPTION(EQEMU_DISABLE_SAFESEH "Disable Safe SEH (Needed for Strawberry Perl)" OFF) IF(EQEMU_DISABLE_SAFESEH) @@ -72,7 +72,7 @@ IF(MSVC) SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO") SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") ENDIF(EQEMU_DISABLE_SAFESEH) - + #We want to compile /MT not /MD so we change that FOREACH(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) IF(${flag_var} MATCHES "/MD") diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index b4b65900c..8027ef9a0 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -37,7 +37,7 @@ IF(MYSQL_ROOT) PATHS ${MYSQL_ROOT}/lib/debug /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 PATH_SUFFIXES mysql ) - + FIND_LIBRARY(MySQL_LIBRARY_RELEASE NAMES ${MySQL_NAMES} PATHS ${MYSQL_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 @@ -49,7 +49,7 @@ ELSE(MYSQL_ROOT) PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 PATH_SUFFIXES mysql ) - + FIND_LIBRARY(MySQL_LIBRARY_RELEASE NAMES ${MySQL_NAMES} PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 @@ -82,4 +82,3 @@ MARK_AS_ADVANCED( MySQL_LIBRARY_RELEASE MySQL_INCLUDE_DIR ) - \ No newline at end of file diff --git a/common/BasePacket.cpp b/common/BasePacket.cpp index 28d88659a..838e6454b 100644 --- a/common/BasePacket.cpp +++ b/common/BasePacket.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -108,7 +108,7 @@ void BasePacket::ReadString(char *str, uint32 Offset, uint32 MaxLength) const while((j < size) && (i < MaxLength) && (str[i - 1] != 0)); str[i - 1] = '\0'; -} +} void DumpPacketHex(const BasePacket* app) { diff --git a/common/BasePacket.h b/common/BasePacket.h index 56a36c2ef..2d4e88ec6 100644 --- a/common/BasePacket.h +++ b/common/BasePacket.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -71,7 +71,7 @@ public: uint32 ReadUInt32(uint32 Offset) const { uint32 value = *(uint32 *)(pBuffer + Offset); return value; } void ReadString(char *str) { uint32 len = static_cast(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; } void ReadString(char *str, uint32 Offset, uint32 MaxLength) const; - + uint32 GetWritePosition() { return _wpos; } uint32 GetReadPosition() { return _rpos; } void SetWritePosition(uint32 Newwpos) { _wpos = Newwpos; } diff --git a/common/CRC16.cpp b/common/CRC16.cpp index d5a8942d5..401ff4ad1 100644 --- a/common/CRC16.cpp +++ b/common/CRC16.cpp @@ -1,6 +1,6 @@ #include "crc32.h" -uint16 CRC16(const unsigned char *buf, int size, int key) +uint16 CRC16(const unsigned char *buf, int size, int key) { // This is computed as the lowest 16 bits of an Ethernet CRC32 checksum // where the key is prepended to the data in little endian order. diff --git a/common/Condition.cpp b/common/Condition.cpp index 27a2015fa..29a3425e0 100644 --- a/common/Condition.cpp +++ b/common/Condition.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -29,7 +29,7 @@ #ifdef _WINDOWS -Condition::Condition() +Condition::Condition() { m_events[SignalEvent] = CreateEvent (nullptr, // security FALSE, // is auto-reset event? @@ -69,28 +69,28 @@ void Condition::SignalAll() void Condition::Wait() { EnterCriticalSection(&CSMutex); - + m_waiters++; - - + + LeaveCriticalSection(&CSMutex); int result = WaitForMultipleObjects (_eventCount, m_events, FALSE, INFINITE); EnterCriticalSection(&CSMutex); - + m_waiters--; - + //see if we are the last person waiting on the condition, and there was a broadcast //if so, we need to reset the broadcast event. if(m_waiters == 0 && result == (WAIT_OBJECT_0+BroadcastEvent)) ResetEvent(m_events[BroadcastEvent]); - + LeaveCriticalSection(&CSMutex); } #else //!WIN32 -Condition::Condition() +Condition::Condition() { pthread_cond_init(&cond,nullptr); pthread_mutex_init(&mutex,nullptr); diff --git a/common/Condition.h b/common/Condition.h index 139f41530..e66b28551 100644 --- a/common/Condition.h +++ b/common/Condition.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/common/EQDB.cpp b/common/EQDB.cpp index b1f0166cd..d729eaee7 100644 --- a/common/EQDB.cpp +++ b/common/EQDB.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -64,9 +64,9 @@ EQDBRes * EQDB::query(Const_char *q) { Const_char *EQDB::escape_string(Const_char *from) { int len = strlen(from); char *res = new char[len*2+1]; - + mysql_real_escape_string(mysql_ref,res,from,len); - + res[len*2] = '\0'; m_escapeBuffer = res; delete[] res; diff --git a/common/EQDB.h b/common/EQDB.h index 5bac35073..700ca5584 100644 --- a/common/EQDB.h +++ b/common/EQDB.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -32,10 +32,10 @@ public: static EQDB *Singleton() { return(&s_EQDB); } static void SetMySQL(MYSQL *m) { s_EQDB.mysql_ref=m; } - + //BEGIN PERL EXPORT //NOTE: you must have a space after the * of a return value - + unsigned int field_count(); unsigned long affected_rows(); unsigned long insert_id(); diff --git a/common/EQDBRes.cpp b/common/EQDBRes.cpp index d33b46bf2..ed6bb6ba2 100644 --- a/common/EQDBRes.cpp +++ b/common/EQDBRes.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -23,7 +23,7 @@ vector EQDBRes::fetch_row_array() { vector array; if(res == nullptr) return(array); - + int count=mysql_num_fields(res); MYSQL_ROW row=mysql_fetch_row(res); for (int i=0;i EQDBRes::fetch_row_hash() { map rowhash; if(res == nullptr) return(rowhash); - + MYSQL_FIELD *fields; MYSQL_ROW row; unsigned long num_fields,i; diff --git a/common/EQDBRes.h b/common/EQDBRes.h index dd1a3a1ca..19f9ee685 100644 --- a/common/EQDBRes.h +++ b/common/EQDBRes.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -30,7 +30,7 @@ class EQDBRes { public: EQDBRes(MYSQL_RES *r) { res=r; } ~EQDBRes() { finish(); } - + //BEGIN PERL EXPORT unsigned long num_rows() { return (res) ? mysql_num_rows(res) : 0; } unsigned long num_fields() { return (res) ? mysql_num_fields(res) : 0; } diff --git a/common/EQEMuError.cpp b/common/EQEMuError.cpp index 353c5a342..04836c4dc 100644 --- a/common/EQEMuError.cpp +++ b/common/EQEMuError.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -71,7 +71,7 @@ void AddEQEMuError(eEQEMuError iError, bool iExitNow) { } iterator.Advance(); } - + char* tmp = new char[6]; tmp[0] = 1; tmp[5] = 0; diff --git a/common/EQEMuError.h b/common/EQEMuError.h index 8ecb53aa6..edd0fdaf5 100644 --- a/common/EQEMuError.h +++ b/common/EQEMuError.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -20,7 +20,7 @@ #include "../common/types.h" -enum eEQEMuError { EQEMuError_NoError, +enum eEQEMuError { EQEMuError_NoError, EQEMuError_Mysql_1405, EQEMuError_Mysql_2003, EQEMuError_Mysql_2005, diff --git a/common/EQEmuConfig.cpp b/common/EQEmuConfig.cpp index 30d31606c..dded129cc 100644 --- a/common/EQEmuConfig.cpp +++ b/common/EQEmuConfig.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -63,7 +63,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) { text=ParseTextBlock(sub_ele,"port",true); if (text) LoginPort=atoi(text); - + text=ParseTextBlock(sub_ele,"account",true); if (text) LoginAccount=text; @@ -97,7 +97,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) { } } while(sub_ele); } - + // Check for locked sub_ele = ele->FirstChildElement("locked"); if (sub_ele != nullptr) @@ -140,7 +140,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) { text = sub_ele->Attribute("enabled"); if (text && !strcasecmp(text,"true")) WorldHTTPEnabled=true; - + } } @@ -155,7 +155,7 @@ void EQEmuConfig::do_chatserver(TiXmlElement *ele) { if (text) ChatPort=atoi(text); } - + void EQEmuConfig::do_mailserver(TiXmlElement *ele) { const char *text; @@ -167,7 +167,7 @@ void EQEmuConfig::do_mailserver(TiXmlElement *ele) { if (text) MailPort=atoi(text); } - + void EQEmuConfig::do_database(TiXmlElement *ele) { const char *text; @@ -192,7 +192,7 @@ void EQEmuConfig::do_database(TiXmlElement *ele) { DatabaseDB=text; } - + void EQEmuConfig::do_qsdatabase(TiXmlElement *ele) { const char *text; diff --git a/common/EQEmuConfig.h b/common/EQEmuConfig.h index 36b0056df..08ea3bfec 100644 --- a/common/EQEmuConfig.h +++ b/common/EQEmuConfig.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -52,11 +52,11 @@ public: uint16 WorldHTTPPort; string WorldHTTPMimeFile; string SharedKey; - + // From string ChatHost; uint16 ChatPort; - + // From string MailHost; uint16 MailPort; @@ -85,7 +85,7 @@ public: string MapDir; string QuestDir; string PluginDir; - + // From string LogPrefix; string LogSuffix; @@ -103,7 +103,7 @@ public: // uint16 DynamicCount; // map StaticZones; - + protected: static EQEmuConfig *_config; @@ -168,7 +168,7 @@ protected: MapDir="Maps"; QuestDir="quests"; PluginDir="plugins"; - + // Launcher LogPrefix = "logs/zone-"; LogSuffix = ".log"; @@ -181,22 +181,22 @@ protected: #else ZoneExe = "./zone"; #endif - + // Zones ZonePortLow=7000; ZonePortHigh=7999; DefaultStatus=0; - + // For where zones need to connect to. WorldIP="127.0.0.1"; - + // Dynamics to start //DynamicCount=5; - + MaxClients=-1; - + LoginCount=0; - + } virtual ~EQEmuConfig() {} @@ -204,7 +204,7 @@ public: // Produce a const singleton static const EQEmuConfig *get() { - if (_config == nullptr) + if (_config == nullptr) LoadConfig(); return(_config); } diff --git a/common/EQNetwork.cpp b/common/EQNetwork.cpp index 1dfa9ddb2..0aa3db4c2 100644 --- a/common/EQNetwork.cpp +++ b/common/EQNetwork.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* +/* * EQStream classes, by Quagmire */ @@ -61,17 +61,17 @@ using namespace std; //#define PRIORITYTEST template // LO_BYTE -type LO_BYTE (type a) {return (a&=0xff);} -template // HI_BYTE -type HI_BYTE (type a) {return (a&=0xff00);} +type LO_BYTE (type a) {return (a&=0xff);} +template // HI_BYTE +type HI_BYTE (type a) {return (a&=0xff00);} template // LO_WORD -type LO_WORD (type a) {return (a&=0xffff);} -template // HI_WORD -type HI_WORD (type a) {return (a&=0xffff0000);} +type LO_WORD (type a) {return (a&=0xffff);} +template // HI_WORD +type HI_WORD (type a) {return (a&=0xffff0000);} template // HI_LOSWAPshort -type HI_LOSWAPshort (type a) {return (LO_BYTE(a)<<8) | (HI_BYTE(a)>>8);} +type HI_LOSWAPshort (type a) {return (LO_BYTE(a)<<8) | (HI_BYTE(a)>>8);} template // HI_LOSWAPlong -type HI_LOSWAPlong (type x) {return (LO_WORD(a)<<16) | (HIWORD(a)>>16);} +type HI_LOSWAPlong (type x) {return (LO_WORD(a)<<16) | (HIWORD(a)>>16);} EQStreamServer::EQStreamServer(uint16 iPort) { RunLoop = false; @@ -125,7 +125,7 @@ bool EQStreamServer::Open(uint16 iPort) { unsigned long nonblocking = 1; #endif - /* Setup internet address information. + /* Setup internet address information. This is used with the bind() call */ memset((char *) &address, 0, sizeof(address)); address.sin_family = AF_INET; @@ -207,7 +207,7 @@ void EQStreamServer::Process() { } uchar buffer[1518]; - + int status; struct sockaddr_in from; unsigned int fromlen; @@ -240,13 +240,13 @@ void EQStreamServer::Process() { connection_list.erase(tmp); continue; } - EQStream* eqs_data = connection->second; - if (eqs_data->IsFree() && (!eqs_data->CheckNetActive())) { + EQStream* eqs_data = connection->second; + if (eqs_data->IsFree() && (!eqs_data->CheckNetActive())) { map ::iterator tmp=connection; connection++; safe_delete(eqs_data); connection_list.erase(tmp); - } + } else if(!eqs_data->RunLoop) { eqs_data->Process(sock); connection++; @@ -291,7 +291,7 @@ void EQStreamServer::RecvData(uchar* data, uint32 size, uint32 irIP, uint16 irPo return; } - if (data[1]==0x01) { + if (data[1]==0x01) { cout << "New EQStream Connection." << endl; EQStream* tmp = new EQStream(irIP, irPort); tmp->RecvData(data, size); diff --git a/common/EQPacket.cpp b/common/EQPacket.cpp index 9df2912fd..452aefe94 100644 --- a/common/EQPacket.cpp +++ b/common/EQPacket.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2005 Michael S. Finger This program is free software; you can redistribute it and/or modify @@ -43,7 +43,7 @@ EQPacket::EQPacket(EmuOpcode op, const unsigned char *buf, uint32 len) void EQPacket::build_raw_header_dump(char *buffer, uint16 seq) const { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + buffer += sprintf(buffer, "[EmuOpCode 0x%04x Size=%u]\n", emu_opcode, size); } @@ -68,7 +68,7 @@ void EQPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + fprintf(to, "[EmuOpCode 0x%04x Size=%lu]\n",emu_opcode,(unsigned long)size); } @@ -76,7 +76,7 @@ void EQProtocolPacket::build_raw_header_dump(char *buffer, uint16 seq) const { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + buffer += sprintf(buffer, "[ProtoOpCode 0x%04x Size=%u]\n",opcode,size); } @@ -102,7 +102,7 @@ void EQProtocolPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + fprintf(to, "[ProtoOpCode 0x%04x Size=%lu]\n",opcode,(unsigned long)size); } @@ -110,7 +110,7 @@ void EQApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + #ifdef STATIC_OPCODE buffer += sprintf(buffer, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size); #else @@ -144,7 +144,7 @@ void EQApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + #ifdef STATIC_OPCODE fprintf(to, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size); #else @@ -156,7 +156,7 @@ void EQRawApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) con { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + #ifdef STATIC_OPCODE buffer += sprintf(buffer, "[OpCode 0x%04x (0x%04x) Size=%u]\n", emu_opcode, opcode,size); #else @@ -190,7 +190,7 @@ void EQRawApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + #ifdef STATIC_OPCODE fprintf(to, "[OpCode 0x%04x (0x%04x) Size=%u]\n", emu_opcode, opcode,size); #else @@ -421,7 +421,7 @@ void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey { test[i]=buffer[i]^KC; } - memcpy(buffer,test,size); + memcpy(buffer,test,size); free(test); } } @@ -445,7 +445,7 @@ void EQProtocolPacket::ChatEncode(unsigned char *buffer, int size, int EncodeKey { test[i]=buffer[i]^KC; } - memcpy(buffer,test,size); + memcpy(buffer,test,size); free(test); } } diff --git a/common/EQPacket.h b/common/EQPacket.h index f8d4f11fb..74fe871af 100644 --- a/common/EQPacket.h +++ b/common/EQPacket.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2005 Michael S. Finger This program is free software; you can redistribute it and/or modify @@ -39,9 +39,9 @@ class EQPacket : public BasePacket { friend class EQStream; public: virtual ~EQPacket() {} - + uint32 Size() const { return size+2; } - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; @@ -50,7 +50,7 @@ public: void SetOpcode(EmuOpcode op) { emu_opcode = op; } const EmuOpcode GetOpcode() const { return(emu_opcode); } // const char *GetOpcodeName() const; - + protected: //this is just a cache so we dont look it up several times on Get() //and it is mutable so we can store the cached copy even on a const object @@ -68,32 +68,32 @@ class EQProtocolPacket : public BasePacket { friend class EQStream; friend class EQStreamPair; public: - EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len) : BasePacket(buf,len), opcode(op) { acked = false; } + EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len) : BasePacket(buf,len), opcode(op) { acked = false; } // EQProtocolPacket(const unsigned char *buf, uint32 len); bool combine(const EQProtocolPacket *rhs); uint32 serialize (unsigned char *dest) const; EQProtocolPacket *Copy() { return new EQProtocolPacket(opcode,pBuffer,size); } EQRawApplicationPacket *MakeAppPacket() const; - + bool acked; - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const; - + protected: - + static bool ValidateCRC(const unsigned char *buffer, int length, uint32 Key); static uint32 Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize); static uint32 Compress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize); static void ChatDecode(unsigned char *buffer, int size, int DecodeKey); static void ChatEncode(unsigned char *buffer, int size, int EncodeKey); - + uint16 GetRawOpcode() const { return(opcode); } - + uint32 Size() const { return size+2; } - + //the actual raw EQ opcode uint16 opcode; }; @@ -102,25 +102,25 @@ class EQApplicationPacket : public EQPacket { // friend class EQProtocolPacket; friend class EQStream; public: - EQApplicationPacket() : EQPacket(OP_Unknown,nullptr,0) + EQApplicationPacket() : EQPacket(OP_Unknown,nullptr,0) { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } - EQApplicationPacket(const EmuOpcode op) : EQPacket(op,nullptr,0) + EQApplicationPacket(const EmuOpcode op) : EQPacket(op,nullptr,0) { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } - EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op,nullptr,len) + EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op,nullptr,len) { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } - EQApplicationPacket(const EmuOpcode op, const unsigned char *buf, const uint32 len) : EQPacket(op,buf,len) + EQApplicationPacket(const EmuOpcode op, const unsigned char *buf, const uint32 len) : EQPacket(op,buf,len) { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } bool combine(const EQApplicationPacket *rhs); uint32 serialize (uint16 opcode, unsigned char *dest) const; uint32 Size() const { return size+app_opcode_size; } - + virtual EQApplicationPacket *Copy() const; - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const; - + protected: uint8 app_opcode_size; @@ -135,17 +135,17 @@ class EQRawApplicationPacket : public EQApplicationPacket { public: EQRawApplicationPacket(uint16 opcode, const unsigned char *buf, const uint32 len); uint16 GetRawOpcode() const { return(opcode); } - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const; protected: - + //the actual raw EQ opcode uint16 opcode; - + EQRawApplicationPacket(const unsigned char *buf, const uint32 len); }; diff --git a/common/EQStream.cpp b/common/EQStream.cpp index c9397f43e..1593d3ec5 100644 --- a/common/EQStream.cpp +++ b/common/EQStream.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2005 Michael S. Finger This program is free software; you can redistribute it and/or modify @@ -106,11 +106,11 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf EQProtocolPacket *EQStream::MakeProtocolPacket(const unsigned char *buf, uint32 len) { uint16 proto_opcode = ntohs(*(const uint16 *)buf); - + //advance over opcode. buf += 2; len -= 2; - + return(new EQProtocolPacket(proto_opcode, buf, len)); } @@ -149,7 +149,7 @@ uint32 processed=0,subpacket_length=0; } } break; - + case OP_AppCombined: { processed=0; while(processedsize) { @@ -171,7 +171,7 @@ uint32 processed=0,subpacket_length=0; } } break; - + case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { @@ -221,7 +221,7 @@ uint32 processed=0,subpacket_length=0; } } break; - + case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { @@ -317,10 +317,10 @@ uint32 processed=0,subpacket_length=0; #ifndef COLLECTOR if (GetState()==ESTABLISHED) { _log(NET__ERROR, _L "Received OP_SessionRequest in ESTABLISHED state (%d)" __L, GetState()); - + /*RemoveData(); - init(); - State=UNESTABLISHED;*/ + init(); + State=UNESTABLISHED;*/ _SendDisconnect(); SetState(CLOSED); break; @@ -360,7 +360,7 @@ uint32 processed=0,subpacket_length=0; encoded=(Response->Format&FLAG_ENCODED); _log(NET__NET_TRACE, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); - + // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { if (compressed) { @@ -406,7 +406,7 @@ uint32 processed=0,subpacket_length=0; #ifndef COLLECTOR uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); MOutboundQueue.lock(); - + if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { _log(NET__ERROR, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } @@ -457,9 +457,9 @@ if(NextSequencedSend > SequencedQueue.size()) { } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - _log(NET__NET_TRACE, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, - (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), - (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), + _log(NET__NET_TRACE, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), + (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); uint64 x=Stats->packets_received; Stats->packets_received=Stats->packets_sent; @@ -502,7 +502,7 @@ void EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req) { if(p == nullptr) return; - + EQApplicationPacket *newp = p->Copy(); if (newp != nullptr) @@ -513,18 +513,18 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) { EQApplicationPacket *pack=*p; *p = nullptr; //clear caller's pointer.. effectively takes ownership - + if(pack == nullptr) return; - + if(OpMgr == nullptr || *OpMgr == nullptr) { _log(NET__DEBUG, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } - + uint16 opcode = (*OpMgr)->EmuToEQ(pack->emu_opcode); - + //make sure this packet is compatible with this stream /* if(StreamType == UnknownStream || StreamType == ChatOrMailStream) { _log(NET__DEBUG, _L "Stream type undetermined (%s), packet ignored" __L, StreamTypeString(StreamType)); @@ -534,9 +534,9 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) _log(NET__ERROR, _L "Trying to queue a packet of type %s into a stream of type %s, dropping it." __L, StreamTypeString(pack->GetPacketType()), StreamTypeString(StreamType)); return; }*/ - + _log(NET__APP_TRACE, "Queueing %sacked packet with opcode 0x%x (%s) and length %d", ack_req?"":"non-", opcode, OpcodeManager::EmuToName(pack->emu_opcode), pack->size); - + if (!ack_req) { NonSequencedPush(new EQProtocolPacket(opcode, pack->pBuffer, pack->size)); delete pack; @@ -556,15 +556,15 @@ uint32 length; unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); - + EQProtocolPacket *out=new EQProtocolPacket(OP_Fragment,nullptr,MaxLen-4); *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); _log(NET__FRAGMENT, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); - - + + while (used::iterator sitr; sitr = SequencedQueue.begin(); if (sitr!=SequencedQueue.end()) sitr += NextSequencedSend; - + // Loop until both are empty or MaxSends is reached while(!SeqEmpty || !NonSeqEmpty) { @@ -703,7 +703,7 @@ deque::iterator sitr; ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; - + if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair _log(NET__RATES, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); @@ -721,7 +721,7 @@ deque::iterator sitr; } if (sitr!=SequencedQueue.end()) { -//_log(NET__NET_COMBINE, _L "Send Seq with %d seq packets starting at seq %d, next send %d, and %d non-seq packets." __L, +//_log(NET__NET_COMBINE, _L "Send Seq with %d seq packets starting at seq %d, next send %d, and %d non-seq packets." __L, // SequencedQueue.size(), SequencedBase, NextSequencedSend, NonSequencedQueue.size()); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { _log(NET__ERROR, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); @@ -802,7 +802,7 @@ if(NextSequencedSend > SequencedQueue.size()) { delete p; ReadyToSend.pop(); } - + //see if we need to send our disconnect and finish our close if(SeqEmpty && NonSeqEmpty) { //no more data to send @@ -825,7 +825,7 @@ sockaddr_in address; address.sin_port=remote_port; #ifdef NOWAY uint32 ip=address.sin_addr.s_addr; - cout << "Sending to: " + cout << "Sending to: " << (int)*(unsigned char *)&ip << "." << (int)*((unsigned char *)&ip+1) << "." << (int)*((unsigned char *)&ip+2) @@ -886,7 +886,7 @@ char temp[15]; ntohs(from->sin_port)); //cout << timestamp() << "Data from: " << temp << " OpCode 0x" << hex << setw(2) << setfill('0') << (int)p->opcode << dec << endl; //dump_message(p->pBuffer,p->size,timestamp()); - + } return p; }*/ @@ -904,12 +904,12 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses if (encoded) Response->Format|=FLAG_ENCODED; Response->Key=htonl(Key); - + out->size=sizeof(SessionResponse); - + _log(NET__NET_TRACE, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); - + NonSequencedPush(out); } @@ -920,9 +920,9 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess memset(Request,0,sizeof(SessionRequest)); Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - + _log(NET__NET_TRACE, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); - + NonSequencedPush(out); } @@ -930,11 +930,11 @@ void EQStream::_SendDisconnect() { if(GetState() == CLOSED) return; - + EQProtocolPacket *out=new EQProtocolPacket(OP_SessionDisconnect,nullptr,sizeof(uint32)); *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - + _log(NET__NET_TRACE, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } @@ -956,7 +956,7 @@ EQRawApplicationPacket *p=nullptr; InboundQueue.erase(itr); } MInboundQueue.unlock(); - + //resolve the opcode if we can. if(p) { if(OpMgr != nullptr && *OpMgr != nullptr) { @@ -969,7 +969,7 @@ EQRawApplicationPacket *p=nullptr; p->SetOpcode(emu_op); } } - + return p; } @@ -984,7 +984,7 @@ EQRawApplicationPacket *p=nullptr; InboundQueue.erase(itr); } MInboundQueue.unlock(); - + //resolve the opcode if we can. if(p) { if(OpMgr != nullptr && *OpMgr != nullptr) { @@ -1018,9 +1018,9 @@ EQRawApplicationPacket *p=nullptr; void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - + _log(NET__APP_TRACE, _L "Clearing inbound queue" __L); - + MInboundQueue.lock(); if (!InboundQueue.empty()) { vector::iterator itr; @@ -1036,11 +1036,11 @@ EQApplicationPacket *p=nullptr; bool EQStream::HasOutgoingData() { bool flag; - + //once closed, we have nothing more to say if(CheckClosed()) return(false); - + MOutboundQueue.lock(); flag=(!NonSequencedQueue.empty()); if (!flag) { @@ -1063,7 +1063,7 @@ void EQStream::OutboundQueueClear() EQProtocolPacket *p=nullptr; _log(NET__APP_TRACE, _L "Clearing outbound queue" __L); - + MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { delete NonSequencedQueue.front(); @@ -1078,7 +1078,7 @@ EQProtocolPacket *p=nullptr; SequencedQueue.clear(); } MOutboundQueue.unlock(); - + /*if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { _log(NET__ERROR, _L "Out-bound Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } @@ -1093,7 +1093,7 @@ void EQStream::PacketQueueClear() EQProtocolPacket *p=nullptr; _log(NET__APP_TRACE, _L "Clearing future packet queue" __L); - + if(!PacketQueue.empty()) { map::iterator itr; for(itr=PacketQueue.begin();itr!=PacketQueue.end();itr++) { @@ -1150,7 +1150,7 @@ long EQStream::GetLastAckSent() void EQStream::AckPackets(uint16 seq) { deque::iterator itr, tmp; - + MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { @@ -1159,7 +1159,7 @@ if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if(NextSequencedSend > SequencedQueue.size()) { _log(NET__ERROR, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - + SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... @@ -1197,7 +1197,7 @@ if(NextSequencedSend > SequencedQueue.size()) { _log(NET__ERROR, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } - + MOutboundQueue.unlock(); } @@ -1222,7 +1222,7 @@ void EQStream::ProcessQueue() if(PacketQueue.empty()) { return; } - + EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { _log(NET__DEBUG, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); @@ -1326,9 +1326,9 @@ void EQStream::SetState(EQStreamState state) { void EQStream::CheckTimeout(uint32 now, uint32 timeout) { - + bool outgoing_data = HasOutgoingData(); //up here to avoid recursive locking - + EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { _log(NET__NET_TRACE, _L "Out of data in closing state, disconnecting." __L); @@ -1410,7 +1410,7 @@ void EQStream::Close() { EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { EQRawApplicationPacket *p = nullptr; MatchState res = MatchNotReady; - + MInboundQueue.lock(); if (!InboundQueue.empty()) { //this is already getting hackish... @@ -1444,7 +1444,7 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } } MInboundQueue.unlock(); - + return(res); } diff --git a/common/EQStream.h b/common/EQStream.h index 2c6bf6c7b..73d0c4265 100644 --- a/common/EQStream.h +++ b/common/EQStream.h @@ -55,10 +55,10 @@ struct SessionStats { /*030*/ uint64 packets_received; /*038*/ }; - + #pragma pack() -class OpcodeManager; +class OpcodeManager; //extern OpcodeManager *EQNetworkOpcodeManager; //class EQStreamFactory; @@ -73,7 +73,7 @@ class EQStream : public EQStreamInterface { SeqInOrder, SeqFuture } SeqOrder; - + uint32 remote_ip; uint16 remote_port; uint8 buffer[8192]; @@ -119,10 +119,10 @@ class EQStream : public EQStreamInterface { uint16 SequencedBase; //the sequence number of SequencedQueue[0] long NextSequencedSend; //index into SequencedQueue Mutex MOutboundQueue; - + //a buffer we use for compression/decompression unsigned char _tempBuffer[2048]; - + // Packets waiting to be processed vector InboundQueue; map PacketQueue; //not mutex protected, only accessed by caller of Process() @@ -136,18 +136,18 @@ class EQStream : public EQStreamInterface { int32 RateThreshold; int32 DecayRate; - + OpcodeManager **OpMgr; - + // EQStreamFactory *const Factory; EQRawApplicationPacket *MakeApplicationPacket(EQProtocolPacket *p); EQRawApplicationPacket *MakeApplicationPacket(const unsigned char *buf, uint32 len); EQProtocolPacket *MakeProtocolPacket(const unsigned char *buf, uint32 len); void SendPacket(uint16 opcode, EQApplicationPacket *p); - + void SetState(EQStreamState state); - + void SendSessionResponse(); void SendSessionRequest(); void SendAck(uint16 seq); @@ -157,7 +157,7 @@ class EQStream : public EQStreamInterface { void NonSequencedPush(EQProtocolPacket *p); void SequencedPush(EQProtocolPacket *p); void WritePacket(int fd,EQProtocolPacket *p); - + uint32 GetKey() { return Key; } void SetKey(uint32 k) { Key=k; } @@ -172,16 +172,16 @@ class EQStream : public EQStreamInterface { void InboundQueuePush(EQRawApplicationPacket *p); EQRawApplicationPacket *PeekPacket(); //for collector. EQRawApplicationPacket *PopRawPacket(); //for collector. - + void InboundQueueClear(); void OutboundQueueClear(); void PacketQueueClear(); - + void ProcessQueue(); EQProtocolPacket *RemoveQueue(uint16 seq); - + void _SendDisconnect(); - + void init(); public: EQStream() { init(); remote_ip = 0; remote_port = 0; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); } @@ -201,21 +201,21 @@ class EQStream : public EQStreamInterface { virtual void RemoveData() { InboundQueueClear(); OutboundQueueClear(); PacketQueueClear(); /*if (CombinedAppPacket) delete CombinedAppPacket;*/ } virtual bool CheckState(EQStreamState state) { return GetState() == state; } virtual std::string Describe() const { return("Direct EQStream"); } - + void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; } - + void CheckTimeout(uint32 now, uint32 timeout=30); bool HasOutgoingData(); void Process(const unsigned char *data, const uint32 length); void SetLastPacketTime(uint32 t) {LastPacket=t;} void Write(int eq_fd); - + // inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; } inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); } - + inline EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; } - + // static EQProtocolPacket *Read(int eq_fd, sockaddr_in *from); static SeqOrder CompareSequence(uint16 expected_seq , uint16 seq); @@ -259,7 +259,7 @@ class EQStream : public EQStreamInterface { return 0; return bytes_recv / (Timer::GetTimeSeconds() - create_time); } - + //used for dynamic stream identification class Signature { public: @@ -274,7 +274,7 @@ class EQStream : public EQStreamInterface { MatchFailed } MatchState; MatchState CheckSignature(const Signature *sig); - + }; diff --git a/common/EQStreamFactory.cpp b/common/EQStreamFactory.cpp index 56b1f9da7..c91d5da77 100644 --- a/common/EQStreamFactory.cpp +++ b/common/EQStreamFactory.cpp @@ -24,28 +24,28 @@ using namespace std; ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) { EQStreamFactory *fs=(EQStreamFactory *)eqfs; - + #ifndef WIN32 _log(COMMON__THREADS, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif - + fs->ReaderLoop(); #ifndef WIN32 _log(COMMON__THREADS, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif - + THREAD_RETURN(nullptr); } ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) { EQStreamFactory *fs=(EQStreamFactory *)eqfs; - + #ifndef WIN32 _log(COMMON__THREADS, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif - + fs->WriterLoop(); #ifndef WIN32 @@ -55,7 +55,7 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) THREAD_RETURN(nullptr); } -EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout) +EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout) : Timeoutable(5000), stream_timeout(timeout) { StreamType=type; @@ -81,7 +81,7 @@ struct sockaddr_in address; #ifndef WIN32 pthread_t t1,t2; #endif - /* Setup internet address information. + /* Setup internet address information. This is used with the bind() call */ memset((char *) &address, 0, sizeof(address)); address.sin_family = AF_INET; @@ -172,10 +172,10 @@ timeval sleep_time; continue; } else if (num==0) continue; - + if(sock == -1) break; //somebody closed us while we were sleeping. - + if (FD_ISSET(sock,&readset)) { #ifdef _WINDOWS if ((length=recvfrom(sock,(char*)buffer,sizeof(buffer),0,(struct sockaddr*)&from,(int *)&socklen)) < 2) @@ -208,7 +208,7 @@ timeval sleep_time; else curstream->PutInUse(); MStreams.unlock(); //the in use flag prevents the stream from being deleted while we are using it. - + if(curstream) { curstream->AddBytesRecv(length); curstream->Process(buffer,length); @@ -225,17 +225,17 @@ void EQStreamFactory::CheckTimeout() { //lock streams the entire time were checking timeouts, it should be fast. MStreams.lock(); - + unsigned long now=Timer::GetCurrentTime(); map::iterator stream_itr; - + for(stream_itr=Streams.begin();stream_itr!=Streams.end();) { EQStream *s = stream_itr->second; - + s->CheckTimeout(now, stream_timeout); - + EQStreamState state = s->GetState(); - + //not part of the else so we check it right away on state change if (state==CLOSED) { if (s->IsInUse()) { @@ -267,7 +267,7 @@ bool decay=false; uint32 stream_count; Timer DecayTimer(20); - + WriterRunning=true; DecayTimer.Enable(); while(sock!=-1) { @@ -278,12 +278,12 @@ Timer DecayTimer(20); if (!WriterRunning) break; MWriterRunning.unlock(); - + havework = false; wants_write.clear(); decay=DecayTimer.Check(); - + //copy streams into a seperate list so we dont have to keep //MStreams locked while we are writting MStreams.lock(); @@ -291,13 +291,13 @@ Timer DecayTimer(20); // If it's time to decay the bytes sent, then let's do it before we try to write if (decay) stream_itr->second->Decay(); - + //bullshit checking, to see if this is really happening, GDB seems to think so... if(stream_itr->second == nullptr) { fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %s", stream_itr->first.c_str()); continue; } - + if (stream_itr->second->HasOutgoingData()) { havework=true; stream_itr->second->PutInUse(); @@ -305,7 +305,7 @@ Timer DecayTimer(20); } } MStreams.unlock(); - + //do the actual writes cur = wants_write.begin(); end = wants_write.end(); @@ -313,7 +313,7 @@ Timer DecayTimer(20); (*cur)->Write(sock); (*cur)->ReleaseFromUse(); } - + Sleep(10); diff --git a/common/EQStreamFactory.h b/common/EQStreamFactory.h index 316a175b0..82cdaa7b9 100644 --- a/common/EQStreamFactory.h +++ b/common/EQStreamFactory.h @@ -23,7 +23,7 @@ class EQStreamFactory : private Timeoutable { Condition WriterWork; EQStreamType StreamType; - + queue NewStreams; Mutex MNewStreams; diff --git a/common/EQStreamIdent.cpp b/common/EQStreamIdent.cpp index 2cc5385e9..a04a0bfb9 100644 --- a/common/EQStreamIdent.cpp +++ b/common/EQStreamIdent.cpp @@ -39,12 +39,12 @@ void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const cha void EQStreamIdentifier::Process() { vector::iterator cur; vector::iterator curp, endp; - + //foreach pending stream. cur = m_streams.begin(); while(cur != m_streams.end()) { Record *r = *cur; - + //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. @@ -54,7 +54,7 @@ void EQStreamIdentifier::Process() { cur = m_streams.erase(cur); continue; } - + //then make sure the stream is still active //if stream hasn't finished initializing then continue; if(r->stream->GetState() == UNESTABLISHED) @@ -87,18 +87,18 @@ void EQStreamIdentifier::Process() { cur = m_streams.erase(cur); continue; } - + //not expired, check against all patch signatures - + bool found_one = false; //"we found a matching patch for this stream" bool all_ready = true; //"all signatures were ready to check the stream" - + //foreach possbile patch... curp = m_patches.begin(); endp = m_patches.end(); for(; !found_one && curp != endp; curp++) { Patch *p = *curp; - + //ask the stream to see if it matches the supplied signature EQStream::MatchState res = r->stream->CheckSignature(&p->signature); switch(res) { @@ -109,13 +109,13 @@ void EQStreamIdentifier::Process() { break; case EQStream::MatchSuccessful: { //yay, a match. - + _log(NET__IDENTIFY, "Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); - + //might want to do something less-specific here... some day.. EQStreamInterface *s = new EQStreamProxy(r->stream, p->structs, p->opcodes); m_identified.push(s); - + found_one = true; break; } @@ -125,14 +125,14 @@ void EQStreamIdentifier::Process() { break; } } - + //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. _log(NET__IDENTIFY, "Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); } - + //if we found a match, or were not able to identify it if(found_one || all_ready) { //cannot print ip/port here. r->stream is invalid. @@ -156,7 +156,7 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() { m_identified.pop(); return(res); } - + EQStreamIdentifier::Record::Record(EQStream *s) : stream(s), expire(STREAM_IDENT_WAIT_MS) diff --git a/common/EQStreamIdent.h b/common/EQStreamIdent.h index 361c6237f..6ab734fb5 100644 --- a/common/EQStreamIdent.h +++ b/common/EQStreamIdent.h @@ -15,17 +15,17 @@ class StructStrategy; class EQStreamIdentifier { public: ~EQStreamIdentifier(); - + //registration interface. void RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs); - + //main processing interface void Process(); void AddStream(EQStream *& eqs); EQStreamInterface *PopIdentified(); - + protected: - + //registered patches.. class Patch { public: @@ -35,7 +35,7 @@ protected: const StructStrategy *structs; }; std::vector m_patches; //we own these objects. - + //pending streams.. class Record { public: diff --git a/common/EQStreamIntf.h b/common/EQStreamIntf.h index e3e3ac092..9373f2262 100644 --- a/common/EQStreamIntf.h +++ b/common/EQStreamIntf.h @@ -19,7 +19,7 @@ class EQApplicationPacket; class EQStreamInterface { public: virtual ~EQStreamInterface() {} - + virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true) = 0; virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true) = 0; virtual EQApplicationPacket *PopPacket() = 0; diff --git a/common/EQStreamLocator.h b/common/EQStreamLocator.h index 27d17aeb3..1724e77c6 100644 --- a/common/EQStreamLocator.h +++ b/common/EQStreamLocator.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2005 EQEmulator Team This program is free software; you can redistribute it and/or modify @@ -66,7 +66,7 @@ if(res) else printf(": False\n");*/ - + if(l.src_ip != r.src_ip) return(l.src_ip < r.src_ip); if(l.dst_ip != r.dst_ip) @@ -74,7 +74,7 @@ else if(l.src_port != r.src_port) return(l.src_port < r.src_port); return(l.dst_port < r.dst_port); - + /* //so, this turned out uglier than I had hoped if(l.src_ip < r.src_ip) return(true); @@ -105,35 +105,35 @@ class EQStreamLocator { protected: typedef typename map::iterator iterator; public: - + void Clear() { streams.clear(); } - + void AddStream(const EQStreamInfo &i, T *o) { //do we care to check if it exists? - + //add this stream, and its inverse streams[i] = o; EQStreamInfo inv; i.invert(inv); streams[inv] = o; } - + //deletes this stream, and its inverse void RemoveStream(const EQStreamInfo &i) { iterator res; res = streams.find(i); if(res != streams.end()) streams.erase(res); - + EQStreamInfo inv; i.invert(inv); res = streams.find(inv); if(res != streams.end()) streams.erase(res); } - + //removes every occurance of this stream from the list void RemoveStream(T *it) { iterator cur, end; @@ -142,14 +142,14 @@ public: for(; cur != end; cur++) { if(cur->second == it) { streams.erase(cur); - //lazy recursive delete for now, since we have to redo + //lazy recursive delete for now, since we have to redo //our iterators anyways RemoveStream(it); return; } } } - + T *GetStream(const EQStreamInfo &i) { iterator res; res = streams.find(i); @@ -160,12 +160,12 @@ public: return(nullptr); return(res->second); } - + //allow people to iterate over the const struct // typedef map::const_iterator iterator; // inline iterator begin() const { return(streams.begin()); } // inline iterator end() const { return(streams.end()); } - + protected: map streams; }; diff --git a/common/EQStreamProxy.cpp b/common/EQStreamProxy.cpp index 1268b378d..2791ad4e3 100644 --- a/common/EQStreamProxy.cpp +++ b/common/EQStreamProxy.cpp @@ -30,7 +30,7 @@ const EQClientVersion EQStreamProxy::ClientVersion() const void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) { if(p == nullptr) return; - + EQApplicationPacket *newp = p->Copy(); FastQueuePacket(&newp, ack_req); } @@ -45,7 +45,7 @@ EQApplicationPacket *EQStreamProxy::PopPacket() { EQApplicationPacket *pack = m_stream->PopPacket(); if(pack == nullptr) return(nullptr); - + //pass this packet through the struct strategy. m_structs->Decode(pack); return(pack); diff --git a/common/EQStreamProxy.h b/common/EQStreamProxy.h index d2266ab9c..68681899d 100644 --- a/common/EQStreamProxy.h +++ b/common/EQStreamProxy.h @@ -15,7 +15,7 @@ public: //takes ownership of the stream. EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes); virtual ~EQStreamProxy(); - + //EQStreamInterface: virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true); virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true); @@ -28,7 +28,7 @@ public: virtual bool CheckState(EQStreamState state); virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + virtual const uint32 GetBytesSent() const; virtual const uint32 GetBytesRecieved() const; virtual const uint32 GetBytesSentPerSecond() const; @@ -39,7 +39,7 @@ protected: const StructStrategy *const m_structs; //we do not own this object. //this is a pointer to a pointer to make it less likely that a packet will //reference an invalid opcode manager when they are being reloaded. - OpcodeManager **const m_opcodes; //we do not own this object. + OpcodeManager **const m_opcodes; //we do not own this object. }; diff --git a/common/EmuTCPConnection.cpp b/common/EmuTCPConnection.cpp index a4108b0bb..e696efee2 100644 --- a/common/EmuTCPConnection.cpp +++ b/common/EmuTCPConnection.cpp @@ -17,30 +17,30 @@ */ /* - * - * - * - * + * + * + * + * * There are really two or three different objects shoe-hored into this * connection object. Sombody really needs to factor out the relay link - * crap into its own subclass of this object, it will clean things up + * crap into its own subclass of this object, it will clean things up * tremendously. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * */ #include "../common/debug.h" @@ -92,7 +92,7 @@ EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_s RelayServer = false; RelayCount = 0; RemoteID = 0; - + } //client outgoing connection case (and client side relay) @@ -246,7 +246,7 @@ bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) { return false; if (GetMode() != modePacket) return false; - + LockMutex lock(&MState); eTCPMode tmp = GetMode(); if (tmp == modeTransition) { @@ -391,13 +391,13 @@ bool EmuTCPConnection::LineOutQueuePush(char* line) { } } - + return(TCPConnection::LineOutQueuePush(line)); } void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) { TCPConnection::Disconnect(); - + if (RelayLink) { RelayLink->RemoveRelay(this, iSendRelayDisconnect); RelayLink = 0; @@ -407,7 +407,7 @@ void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) { bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) { if(!TCPConnection::ConnectIP(irIP, irPort, errbuf)) return(false); - + MSendQueue.lock(); #ifdef MINILOGIN TCPMode = modePacket; @@ -453,22 +453,22 @@ bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) { } #endif MSendQueue.unlock(); - + return(true); } void EmuTCPConnection::ClearBuffers() { TCPConnection::ClearBuffers(); - + LockMutex lock2(&MOutQueueLock); ServerPacket* pack = 0; while ((pack = OutQueue.pop())) safe_delete(pack); - + EmuTCPNetPacket_Struct* tnps = 0; while ((tnps = InModeQueue.pop())) safe_delete(tnps); - + keepalive_timer.Start(); timeout_timer.Start(); } @@ -810,7 +810,7 @@ bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) { sent_something = false; if(!TCPConnection::SendData(sent_something, errbuf)) return(false); - + if(sent_something) keepalive_timer.Start(); else if (TCPMode == modePacket && keepalive_timer.Check()) { @@ -821,7 +821,7 @@ bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) { cout << "Sending TCP keepalive packet. (timeout=" << timeout_timer.GetRemainingTime() << " remaining)" << endl; #endif } - + return(true); } @@ -832,13 +832,13 @@ bool EmuTCPConnection::RecvData(char* errbuf) { else return(false); } - + if ((TCPMode == modePacket || TCPMode == modeTransition) && timeout_timer.Check()) { if (errbuf) snprintf(errbuf, TCPConnection_ErrorBufferSize, "TCPConnection::RecvData(): Connection timeout"); return false; } - + return(true); } diff --git a/common/EmuTCPConnection.h b/common/EmuTCPConnection.h index 8d567154d..1c64c2196 100644 --- a/common/EmuTCPConnection.h +++ b/common/EmuTCPConnection.h @@ -31,67 +31,67 @@ class EmuTCPConnection : public TCPConnection { public: enum eTCPMode { modeConsole, modeTransition, modePacket }; enum ePacketMode { packetModeZone, packetModeLauncher, packetModeLogin, packetModeUCS, packetModeQueryServ }; - + EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET iSock, uint32 irIP, uint16 irPort, bool iOldFormat = false); EmuTCPConnection(bool iOldFormat = false, EmuTCPServer* iRelayServer = 0, eTCPMode iMode = modePacket); // for outgoing connections EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConnection* iRelayLink, uint32 iRemoteID, uint32 irIP, uint16 irPort); // for relay connections virtual ~EmuTCPConnection(); - + virtual bool ConnectIP(uint32 irIP, uint16 irPort, char* errbuf = 0); virtual void Disconnect(bool iSendRelayDisconnect = true); - + static EmuTCPNetPacket_Struct* MakePacket(ServerPacket* pack, uint32 iDestination = 0); static SPackSendQueue* MakeOldPacket(ServerPacket* pack); - + virtual bool SendPacket(ServerPacket* pack, uint32 iDestination = 0); virtual bool SendPacket(EmuTCPNetPacket_Struct* tnps); ServerPacket* PopPacket(); // OutQueuePop() void SetPacketMode(ePacketMode mode) { PacketMode = mode; } - + eTCPMode GetMode() const { return TCPMode; } ePacketMode GetPacketMode() const { return(PacketMode); } - + //relay crap: inline bool IsRelayServer() const { return RelayServer; } inline TCPConnection* GetRelayLink() const { return RelayLink; } inline uint32 GetRemoteID() const { return RemoteID; } - + protected: void OutQueuePush(ServerPacket* pack); void RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect); - + void SendNetErrorPacket(const char* reason = 0); - + virtual bool SendData(bool &sent_something, char* errbuf = 0); virtual bool RecvData(char* errbuf = 0); - + virtual bool ProcessReceivedData(char* errbuf = 0); bool ProcessReceivedDataAsPackets(char* errbuf = 0); bool ProcessReceivedDataAsOldPackets(char* errbuf = 0); void ProcessNetworkLayerPacket(ServerPacket* pack); - + virtual bool LineOutQueuePush(char* line); virtual void ClearBuffers(); - + EmuTCPServer* Server; - + eTCPMode TCPMode; ePacketMode PacketMode; bool pOldFormat; - + Timer keepalive_timer; Timer timeout_timer; - + //relay crap: EmuTCPConnection* RelayLink; int32 RelayCount; bool RelayServer; uint32 RemoteID; - + //input queue... void InModeQueuePush(EmuTCPNetPacket_Struct* tnps); MyQueue InModeQueue; - + //output queue... MyQueue OutQueue; Mutex MOutQueueLock; diff --git a/common/Item.cpp b/common/Item.cpp index 023f341e9..74fa9579a 100644 --- a/common/Item.cpp +++ b/common/Item.cpp @@ -42,7 +42,7 @@ int32 NextItemInstSerialNumber = 1; static inline int32 GetNextItemInstSerialNumber() { - // The Bazaar relies on each item a client has up for Trade having a unique + // The Bazaar relies on each item a client has up for Trade having a unique // identifier. This 'SerialNumber' is sent in Serialized item packets and // is used in Bazaar packets to identify the item a player is buying or inspecting. // @@ -103,8 +103,8 @@ ItemInstQueue::~ItemInstQueue() { Inventory::~Inventory() { map::iterator cur,end; - - + + cur = m_worn.begin(); end = m_worn.end(); for(; cur != end; cur++) { @@ -112,7 +112,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_worn.clear(); - + cur = m_inv.begin(); end = m_inv.end(); for(; cur != end; cur++) { @@ -120,7 +120,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_inv.clear(); - + cur = m_bank.begin(); end = m_bank.end(); for(; cur != end; cur++) { @@ -128,7 +128,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_bank.clear(); - + cur = m_shbank.begin(); end = m_shbank.end(); for(; cur != end; cur++) { @@ -136,7 +136,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_shbank.clear(); - + cur = m_trade.begin(); end = m_trade.end(); for(; cur != end; cur++) { @@ -163,11 +163,11 @@ ItemInst::ItemInst(const ItemInst& copy) for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); it++) { ItemInst* inst_old = it->second; ItemInst* inst_new = nullptr; - + if (inst_old) { inst_new = inst_old->Clone(); } - + if (inst_new != nullptr) { m_contents[it->first] = inst_new; } @@ -200,11 +200,11 @@ bool ItemInst::IsType(ItemClass item_class) const { // Check usage type if ((m_use_type == ItemUseWorldContainer) && (item_class == ItemClassContainer)) - + return true; if (!m_item) return false; - + return (m_item->ItemClass == item_class); } @@ -229,14 +229,14 @@ bool ItemInst::IsEquipable(int16 slot_id) const { if (!m_item) return false; - + if(slot_id == 9999) { slot_id = 22; uint32 slot_mask = (1 << slot_id); if (slot_mask & m_item->Slots) return true; } - + if (slot_id < 22) { uint32 slot_mask = (1 << slot_id); if (slot_mask & m_item->Slots) @@ -321,7 +321,7 @@ bool ItemInst::IsAmmo() const { return true; return false; - + } // Retrieve augment inside item @@ -329,7 +329,7 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const { if (m_item->ItemClass == ItemClassCommon) return GetItem(slot); - + return nullptr; } @@ -376,7 +376,7 @@ ItemInst* ItemInst::GetItem(uint8 index) const ItemInst* inst = it->second; return inst; } - + return nullptr; } @@ -384,8 +384,8 @@ void ItemInst::PutItem(uint8 index, const ItemInst& inst) { // Clean up item already in slot (if exists) DeleteItem(index); - - + + // Delegate to internal method _PutItem(index, inst.Clone()); } @@ -423,7 +423,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) const Item_Struct* item = inst->GetItem(); del = cur; cur++; - + switch(is_nodrop) { case byFlagSet: if (item->NoDrop == 0) { @@ -440,7 +440,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) default: break; } - + switch(is_norent) { case byFlagSet: if (item->NoRent == 0) { @@ -470,7 +470,7 @@ ItemInst* ItemInst::PopItem(uint8 index) m_contents.erase(index); return inst; } - + // Return pointer that needs to be deleted (or otherwise managed) return nullptr; } @@ -492,7 +492,7 @@ ItemInst* ItemInstQueue::pop() { if (m_list.size() == 0) return nullptr; - + ItemInst* inst = m_list.front(); m_list.pop_front(); return inst; @@ -509,13 +509,13 @@ ItemInst* Inventory::GetItem(int16 slot_id) const { _CP(Inventory_GetItem); ItemInst* result = nullptr; - + // Cursor if (slot_id == SLOT_CURSOR) { // Cursor slot result = m_cursor.peek_front(); } - + // Non bag slots else if (slot_id>=3000 && slot_id<=3007) { // Trade slots @@ -537,7 +537,7 @@ ItemInst* Inventory::GetItem(int16 slot_id) const // Equippable slots (on body) result = _GetItem(m_worn, slot_id); } - + // Inner bag slots else if (slot_id>=3031 && slot_id<=3110) { // Trade bag slots @@ -574,7 +574,7 @@ ItemInst* Inventory::GetItem(int16 slot_id) const result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } - + return result; } @@ -656,13 +656,13 @@ int16 Inventory::PutItem(int16 slot_id, const ItemInst& inst) { // Clean up item already in slot (if exists) DeleteItem(slot_id); - + if (!inst) { // User is effectively deleting the item // in the slot, why hold a null ptr in map<>? return slot_id; } - + // Delegate to internal method return _PutItem(slot_id, inst.Clone()); } @@ -693,48 +693,48 @@ int16 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) { _CP(Inventory_HasItem); int16 slot_id = SLOT_INVALID; - + //Altered by Father Nitwit to support a specification of //where to search, with a default value to maintain compatibility - + // Check each inventory bucket if(where & invWhereWorn) { slot_id = _HasItem(m_worn, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWherePersonal) { slot_id = _HasItem(m_inv, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereBank) { slot_id = _HasItem(m_bank, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereSharedBank) { slot_id = _HasItem(m_shbank, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereTrading) { slot_id = _HasItem(m_trade, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereCursor) { // Check cursor queue slot_id = _HasItem(m_cursor, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + return slot_id; } @@ -743,90 +743,90 @@ int16 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) int16 Inventory::HasItemByUse(uint8 use, uint8 quantity, uint8 where) { int16 slot_id = SLOT_INVALID; - + // Check each inventory bucket if(where & invWhereWorn) { slot_id = _HasItemByUse(m_worn, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWherePersonal) { slot_id = _HasItemByUse(m_inv, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereBank) { slot_id = _HasItemByUse(m_bank, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereSharedBank) { slot_id = _HasItemByUse(m_shbank, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereTrading) { slot_id = _HasItemByUse(m_trade, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereCursor) { // Check cursor queue slot_id = _HasItemByUse(m_cursor, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + return slot_id; } -int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) +int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) { int16 slot_id = SLOT_INVALID; - + // Check each inventory bucket if(where & invWhereWorn) { slot_id = _HasItemByLoreGroup(m_worn, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWherePersonal) { slot_id = _HasItemByLoreGroup(m_inv, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereBank) { slot_id = _HasItemByLoreGroup(m_bank, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereSharedBank) { slot_id = _HasItemByLoreGroup(m_shbank, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereTrading) { slot_id = _HasItemByLoreGroup(m_trade, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereCursor) { // Check cursor queue slot_id = _HasItemByLoreGroup(m_cursor, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + return slot_id; } @@ -835,13 +835,13 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { if(ItemToTry->Stackable) { for(int16 i = 22; i <= 29; i++) { - + ItemInst* InvItem = GetItem(i); if(InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - + if(Quantity <= ChargeSlotsLeft) return true; @@ -860,7 +860,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - + if(Quantity <= ChargeSlotsLeft) return true; @@ -930,7 +930,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) { // Pop item out of inventory map (or queue) ItemInst* item_to_delete = PopItem(slot_id); - + // Determine if object should be fully deleted, or // just a quantity of charges of the item can be deleted if (item_to_delete && (quantity > 0)) { @@ -942,7 +942,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) // If the item is stackable (e.g arrows), or // the item is not stackable, and is not a charged item, or is expendable, delete it if(item_to_delete->IsStackable() || - (!item_to_delete->IsStackable() && + (!item_to_delete->IsStackable() && ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))) { // Item can now be destroyed safe_delete(item_to_delete); @@ -954,11 +954,11 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) _PutItem(slot_id, item_to_delete); return false; } - + safe_delete(item_to_delete); return true; - + } // Checks All items in a bag for No Drop @@ -980,7 +980,7 @@ bool Inventory::CheckNoDrop(int16 slot_id) { ItemInst* Inventory::PopItem(int16 slot_id) { ItemInst* p = nullptr; - + if (slot_id==SLOT_CURSOR) { // Cursor p = m_cursor.pop(); } @@ -1011,7 +1011,7 @@ ItemInst* Inventory::PopItem(int16 slot_id) p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); } } - + // Return pointer that needs to be deleted (or otherwise managed) return p; } @@ -1026,12 +1026,12 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo // Found available slot in personal inventory return i; } - + if (!for_bag) { for (int16 i=22; i<=29; i++) { const ItemInst* inst = GetItem(i); - if (inst && inst->IsType(ItemClassContainer) - && inst->GetItem()->BagSize >= min_size) + if (inst && inst->IsType(ItemClassContainer) + && inst->GetItem()->BagSize >= min_size) { if(inst->GetItem()->BagType == bagTypeQuiver && inst->GetItem()->ItemType != ItemTypeArrow) { @@ -1050,12 +1050,12 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo } } } - + if (try_cursor) // Always room on cursor (it's a queue) // (we may wish to cap this in the future) return SLOT_CURSOR; - + // No available slots return SLOT_INVALID; } @@ -1064,7 +1064,7 @@ void Inventory::dumpInventory() { iter_inst it; iter_contents itb; ItemInst* inst = nullptr; - + // Check item: After failed checks, check bag contents (if bag) printf("Worn items:\n"); for (it=m_worn.begin(); it!=m_worn.end(); it++) { @@ -1072,9 +1072,9 @@ void Inventory::dumpInventory() { it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { for (itb=inst->_begin(); itb!=inst->_end(); itb++) { @@ -1086,16 +1086,16 @@ void Inventory::dumpInventory() { } } } - + printf("Inventory items:\n"); for (it=m_inv.begin(); it!=m_inv.end(); it++) { inst = it->second; it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { for (itb=inst->_begin(); itb!=inst->_end(); itb++) { @@ -1104,57 +1104,57 @@ void Inventory::dumpInventory() { continue; printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges()); - + } } } - + printf("Bank items:\n"); for (it=m_bank.begin(); it!=m_bank.end(); it++) { inst = it->second; it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if(!baginst || !baginst->GetItem()) continue; printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges()); - + } } } - + printf("Shared Bank items:\n"); for (it=m_shbank.begin(); it!=m_shbank.end(); it++) { inst = it->second; it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if(!baginst || !baginst->GetItem()) continue; printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges()); - + } } } - + printf("\n"); fflush(stdout); } @@ -1166,7 +1166,7 @@ ItemInst* Inventory::_GetItem(const map& bucket, int16 slot_id if (it != bucket.end()) { return it->second; } - + // Not found! return nullptr; } @@ -1181,9 +1181,9 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) PopItem(slot_id); return slot_id; } - + int16 result = SLOT_INVALID; - + if (slot_id==SLOT_CURSOR) { // Cursor // Replace current item on cursor, if exists m_cursor.pop(); // no memory delete, clients of this function know what they are doing @@ -1218,12 +1218,12 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) result = slot_id; } } - + if (result == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i)", slot_id); safe_delete(inst); // Slot not found, clean up } - + return result; } @@ -1234,7 +1234,7 @@ int16 Inventory::_HasItem(map& bucket, uint32 item_id, uint8 q iter_contents itb; ItemInst* inst = nullptr; uint8 quantity_found = 0; - + // Check item: After failed checks, check bag contents (if bag) for (it=bucket.begin(); it!=bucket.end(); it++) { inst = it->second; @@ -1244,15 +1244,15 @@ int16 Inventory::_HasItem(map& bucket, uint32 item_id, uint8 q if (quantity_found >= quantity) return it->first; } - + for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst->GetID() == item_id) { @@ -1261,13 +1261,13 @@ int16 Inventory::_HasItem(map& bucket, uint32 item_id, uint8 q return Inventory::CalcSlotId(it->first, itb->first); } for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } } } - + // Not found return SLOT_INVALID; } @@ -1278,7 +1278,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) iter_queue it; iter_contents itb; uint8 quantity_found = 0; - + // Read-only iteration of queue for (it=iqueue.begin(); it!=iqueue.end(); it++) { ItemInst* inst = *it; @@ -1290,13 +1290,13 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) return SLOT_CURSOR; } for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst->GetID() == item_id) { @@ -1305,14 +1305,14 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) return Inventory::CalcSlotId(SLOT_CURSOR, itb->first); } for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } } } - + // Not found return SLOT_INVALID; } @@ -1324,7 +1324,7 @@ int16 Inventory::_HasItemByUse(map& bucket, uint8 use, uint8 q iter_contents itb; ItemInst* inst = nullptr; uint8 quantity_found = 0; - + // Check item: After failed checks, check bag contents (if bag) for (it=bucket.begin(); it!=bucket.end(); it++) { inst = it->second; @@ -1333,10 +1333,10 @@ int16 Inventory::_HasItemByUse(map& bucket, uint8 use, uint8 q if (quantity_found >= quantity) return it->first; } - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) { @@ -1347,7 +1347,7 @@ int16 Inventory::_HasItemByUse(map& bucket, uint8 use, uint8 q } } } - + // Not found return SLOT_INVALID; } @@ -1358,7 +1358,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) iter_queue it; iter_contents itb; uint8 quantity_found = 0; - + // Read-only iteration of queue for (it=iqueue.begin(); it!=iqueue.end(); it++) { ItemInst* inst = *it; @@ -1367,10 +1367,10 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) if (quantity_found >= quantity) return SLOT_CURSOR; } - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) { @@ -1381,24 +1381,24 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) } } } - + // Not found return SLOT_INVALID; } -int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loregroup) +int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loregroup) { iter_inst it; iter_contents itb; ItemInst* inst = nullptr; - + // Check item: After failed checks, check bag contents (if bag) for (it=bucket.begin(); it!=bucket.end(); it++) { inst = it->second; if (inst) { - if (inst->GetItem()->LoreGroup == loregroup) + if (inst->GetItem()->LoreGroup == loregroup) return it->first; - + ItemInst* Aug; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug = inst->GetAugment(i); @@ -1408,12 +1408,12 @@ int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loreg } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) + if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(it->first, itb->first); - + ItemInst* Aug2; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug2 = baginst->GetAugment(i); @@ -1423,7 +1423,7 @@ int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loreg } } } - + // Not found return SLOT_INVALID; } @@ -1433,15 +1433,15 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) { iter_queue it; iter_contents itb; - + // Read-only iteration of queue for (it=iqueue.begin(); it!=iqueue.end(); it++) { ItemInst* inst = *it; if (inst) { - if (inst->GetItem()->LoreGroup == loregroup) + if (inst->GetItem()->LoreGroup == loregroup) return SLOT_CURSOR; - + ItemInst* Aug; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug = inst->GetAugment(i); @@ -1451,13 +1451,13 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) + if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(SLOT_CURSOR, itb->first); - - + + ItemInst* Aug2; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug2 = baginst->GetAugment(i); @@ -1468,7 +1468,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) } } } - + // Not found return SLOT_INVALID; } @@ -1513,7 +1513,7 @@ bool ItemInst::IsNoneEmptyContainer() for(int i = 0; i < m_item->BagSlots; ++i) if(GetItem(i)) return true; - + return false; } @@ -1522,7 +1522,7 @@ bool ItemInst::IsAugmented() for(int i = 0; i < MAX_AUGMENT_SLOTS; ++i) if (GetAugmentItemID(i)) return true; - + return false; } @@ -1532,9 +1532,9 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) if (!Inventory::SupportsContainers(bagslot_id)) { return SLOT_INVALID; } - + int16 slot_id = SLOT_INVALID; - + if (bagslot_id==SLOT_CURSOR || bagslot_id==8000) // Cursor slot_id = IDX_CURSOR_BAG + bagidx; else if (bagslot_id>=22 && bagslot_id<=29) // Inventory slots @@ -1545,7 +1545,7 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) slot_id = IDX_SHBANK_BAG + (bagslot_id-2500)*MAX_ITEMS_PER_BAG + bagidx; else if (bagslot_id>=3000 && bagslot_id<=3007) // Trade window slots slot_id = IDX_TRADE_BAG + (bagslot_id-3000)*MAX_ITEMS_PER_BAG + bagidx; - + return slot_id; } @@ -1553,7 +1553,7 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) int16 Inventory::CalcSlotId(int16 slot_id) { int16 parent_slot_id = SLOT_INVALID; - + if (slot_id>=251 && slot_id<=330) parent_slot_id = IDX_INV + (slot_id-251) / MAX_ITEMS_PER_BAG; else if (slot_id>=331 && slot_id<=340) @@ -1566,14 +1566,14 @@ int16 Inventory::CalcSlotId(int16 slot_id) parent_slot_id = IDX_SHBANK + (slot_id-2531) / MAX_ITEMS_PER_BAG; else if (slot_id>=3100 && slot_id<=3179) parent_slot_id = IDX_TRADE + (slot_id-3100) / MAX_ITEMS_PER_BAG; - + return parent_slot_id; } uint8 Inventory::CalcBagIdx(int16 slot_id) { uint8 index = 0; - + if (slot_id>=251 && slot_id<=330) index = (slot_id-251) % MAX_ITEMS_PER_BAG; else if (slot_id>=331 && slot_id<=340) @@ -1588,7 +1588,7 @@ uint8 Inventory::CalcBagIdx(int16 slot_id) index = (slot_id-3100) % MAX_ITEMS_PER_BAG; else if (slot_id>=4000 && slot_id<=4009) index = (slot_id-4000) % MAX_ITEMS_PER_BAG; - + return index; } @@ -1691,11 +1691,11 @@ EvoItemInst::EvoItemInst(const EvoItemInst ©) { for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); it++) { ItemInst* inst_old = it->second; ItemInst* inst_new = nullptr; - + if (inst_old) { inst_new = inst_old->Clone(); } - + if (inst_new != nullptr) { m_contents[it->first] = inst_new; } @@ -1717,7 +1717,7 @@ EvoItemInst::EvoItemInst(const EvoItemInst ©) { EvoItemInst::EvoItemInst(const ItemInst &basecopy) { EvoItemInst* copy = (EvoItemInst*)&basecopy; - + m_use_type=copy->m_use_type; m_item=copy->m_item; m_charges=copy->m_charges; @@ -1732,11 +1732,11 @@ EvoItemInst::EvoItemInst(const ItemInst &basecopy) { for (it=copy->m_contents.begin(); it!=copy->m_contents.end(); it++) { ItemInst* inst_old = it->second; ItemInst* inst_new = nullptr; - + if (inst_old) { inst_new = inst_old->Clone(); } - + if (inst_new != nullptr) { m_contents[it->first] = inst_new; } @@ -1775,7 +1775,7 @@ EvoItemInst::EvoItemInst(const Item_Struct* item, int16 charges) { } EvoItemInst::~EvoItemInst() { - safe_delete(m_scaledItem); + safe_delete(m_scaledItem); } EvoItemInst* EvoItemInst::Clone() const { @@ -1812,7 +1812,7 @@ void EvoItemInst::Initialize(SharedDatabase *db) { void EvoItemInst::ScaleItem() { // free memory from any previously scaled item data safe_delete(m_scaledItem); - + m_scaledItem = new Item_Struct(*m_item); float Mult = (float)(GetExp())/10000; // scaling is determined by exp, with 10,000 being full stats @@ -1829,7 +1829,7 @@ void EvoItemInst::ScaleItem() { m_scaledItem->DR = (int8)((float)m_item->DR*Mult); m_scaledItem->CR = (int8)((float)m_item->CR*Mult); m_scaledItem->FR = (int8)((float)m_item->FR*Mult); - + m_scaledItem->HP = (int32)((float)m_item->HP*Mult); m_scaledItem->Mana = (int32)((float)m_item->Mana*Mult); m_scaledItem->AC = (int32)((float)m_item->AC*Mult); @@ -1862,8 +1862,8 @@ void EvoItemInst::ScaleItem() { m_scaledItem->EnduranceRegen = (uint32)((float)m_item->EnduranceRegen*Mult); m_scaledItem->Haste = (uint32)((float)m_item->Haste*Mult); m_scaledItem->DamageShield = (uint32)((float)m_item->DamageShield*Mult); - - + + m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself. } @@ -1874,14 +1874,14 @@ bool EvoItemInst::EvolveOnAllKills() const { int8 EvoItemInst::GetMaxEvolveLvl() const { if(m_evolveInfo) return m_evolveInfo->MaxLvl; - else + else return 0; } uint32 EvoItemInst::GetKillsNeeded(uint8 currentlevel) { uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero. - if (m_evolveInfo) - if (currentlevel != m_evolveInfo->MaxLvl) + if (m_evolveInfo) + if (currentlevel != m_evolveInfo->MaxLvl) kills = m_evolveInfo->LvlKills[currentlevel-1]; if (kills == 0) @@ -1913,7 +1913,7 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const { bool IsRace = false; bool IsClass = false; - + uint32 Classes_ = Classes; uint32 Races_ = Races; diff --git a/common/Item.h b/common/Item.h index 4b765221d..7a677edf6 100644 --- a/common/Item.h +++ b/common/Item.h @@ -105,23 +105,23 @@ public: ///////////////////////// // Public Methods ///////////////////////// - + inline iter_queue begin() { return m_list.begin(); } inline iter_queue end() { return m_list.end(); } - + void push(ItemInst* inst); void push_front(ItemInst* inst); ItemInst* pop(); ItemInst* peek_front() const; inline int size() { return static_cast(m_list.size()); } - + protected: ///////////////////////// // Protected Members ///////////////////////// - + list m_list; - + }; // ######################################## @@ -134,9 +134,9 @@ public: /////////////////////////////// // Public Methods /////////////////////////////// - + virtual ~Inventory(); - + // Retrieve a writeable item at specified slot ItemInst* GetItem(int16 slot_id) const; ItemInst* GetItem(int16 slot_id, uint8 bagidx) const; @@ -144,16 +144,16 @@ public: inline iter_queue cursor_begin() { return m_cursor.begin(); } inline iter_queue cursor_end() { return m_cursor.end(); } inline bool CursorEmpty() { return (m_cursor.size() == 0); } - + // Retrieve a read-only item from inventory inline const ItemInst* operator[](int16 slot_id) const { return GetItem(slot_id); } - + // Add item to inventory int16 PutItem(int16 slot_id, const ItemInst& inst); // Add item to cursor queue int16 PushCursor(const ItemInst& inst); - + // Swap items in inventory bool SwapItem(int16 slot_a, int16 slot_b); @@ -162,17 +162,17 @@ public: // Checks All items in a bag for No Drop bool CheckNoDrop(int16 slot_id); - + // Remove item from inventory (and take control of memory) ItemInst* PopItem(int16 slot_id); - + // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look int16 HasItem(uint32 item_id, uint8 quantity=0, uint8 where=0xFF); // Check whether there is space for the specified number of the specified item. bool HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity); - + // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look int16 HasItemByUse(uint8 use, uint8 quantity=0, uint8 where=0xFF); @@ -180,10 +180,10 @@ public: // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look int16 HasItemByLoreGroup(uint32 loregroup, uint8 where=0xFF); - + // Locate an available inventory slot int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); - + // Calculate slot_id for an item within a bag static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag @@ -195,7 +195,7 @@ public: // Test whether a given slot can support a container item static bool SupportsContainers(int16 slot_id); - + void dumpInventory(); void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value); @@ -207,13 +207,13 @@ protected: /////////////////////////////// // Protected Methods /////////////////////////////// - + // Retrieves item within an inventory bucket ItemInst* _GetItem(const map& bucket, int16 slot_id) const; - + // Private "put" item into bucket, without regard for what is currently in bucket int16 _PutItem(int16 slot_id, ItemInst* inst); - + // Checks an inventory bucket for a particular item int16 _HasItem(map& bucket, uint32 item_id, uint8 quantity); int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity); @@ -221,8 +221,8 @@ protected: int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity); int16 _HasItemByLoreGroup(map& bucket, uint32 loregroup); int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup); - - + + // Player inventory map m_worn; // Items worn by character map m_inv; // Items in character personal inventory @@ -245,12 +245,12 @@ public: ///////////////////////// // Methods ///////////////////////// - + // Constructors/Destructor ItemInst(const Item_Struct* item = nullptr, int16 charges = 0); - + ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0); - + ItemInst(ItemUseType use_type) { m_use_type = use_type; m_item = nullptr; @@ -262,19 +262,19 @@ public: } ItemInst(const ItemInst& copy); - + virtual ~ItemInst(); - + // Query item type virtual bool IsType(ItemClass item_class) const; - + // Can item be stacked? virtual bool IsStackable() const; // Can item be equipped by/at? virtual bool IsEquipable(uint16 race, uint16 class_) const; virtual bool IsEquipable(int16 slot_id) const; - + // // Augements // @@ -322,13 +322,13 @@ public: const uint32 GetItemScriptID() const { return m_item->ScriptFileID; } virtual const Item_Struct* GetItem() const { return m_item; } void SetItem(const Item_Struct* item) { m_item = item; } - + int16 GetCharges() const { return m_charges; } void SetCharges(int16 charges) { m_charges = charges; } - + uint32 GetPrice() const { return m_price; } void SetPrice(uint32 price) { m_price = price; } - + void SetColor(uint32 color) { m_color = color; } uint32 GetColor() const { return m_color; } @@ -358,14 +358,14 @@ public: // Allows treatment of this object as though it were a pointer to m_item operator bool() const { return (m_item != nullptr); } - + // Compare inner Item_Struct of two ItemInst objects bool operator==(const ItemInst& right) const { return (this->m_item == right.m_item); } bool operator!=(const ItemInst& right) const { return (this->m_item != right.m_item); } - + // Clone current item virtual ItemInst* Clone() const; - + bool IsSlotAllowed(int16 slot_id) const; virtual bool IsScaling() const { return false; } @@ -383,10 +383,10 @@ protected: iter_contents _end() { return m_contents.end(); } friend class Inventory; - - + + void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; } - + ItemUseType m_use_type; // Usage type for item const Item_Struct* m_item; // Ptr to item data int16 m_charges; // # of charges for chargeable items @@ -410,7 +410,7 @@ public: EvoItemInst(const ItemInst& copy); EvoItemInst(const Item_Struct* item = nullptr, int16 charges = 0); ~EvoItemInst(); - + // accessors... a lot of these are for evolving items (not complete yet) bool IsScaling() const { return (m_evolveLvl == -1); } bool IsEvolving() const { return (m_evolveLvl >= 1); } @@ -420,16 +420,16 @@ public: bool IsActivated() { return m_activated; } void SetActivated(bool activated) { m_activated = activated; } int8 GetEvolveLvl() const { return m_evolveLvl; } - + EvoItemInst* Clone() const; const Item_Struct* GetItem() const; const Item_Struct* GetUnscaledItem() const; void Initialize(SharedDatabase *db = nullptr); void ScaleItem(); - bool EvolveOnAllKills() const; + bool EvolveOnAllKills() const; int8 GetMaxEvolveLvl() const; uint32 GetKillsNeeded(uint8 currentlevel); - + private: uint32 m_exp; @@ -447,7 +447,7 @@ public: uint32 FirstItem; uint8 MaxLvl; bool AllKills; - + EvolveInfo(); EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 L3, uint32 L4, uint32 L5, uint32 L6, uint32 L7, uint32 L8, uint32 L9, uint32 L10); ~EvolveInfo(); diff --git a/common/MaxSkill.cpp b/common/MaxSkill.cpp index 5558827c2..3b914b611 100644 --- a/common/MaxSkill.cpp +++ b/common/MaxSkill.cpp @@ -3,7 +3,7 @@ #include "../zone/skills.h" uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level); -/* TODO: +/* TODO: Load MaxSkillTable function into ram as a really big matrix: MaxSkillTable[skillid][race][eqclass][level] @@ -31,43 +31,43 @@ uint8 MaxSkill(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { "must put one point in at GM", etc */ -uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { - uint16 r_value = 0; - - switch (skillid) { - /////////////// - // Melee Weapon/ Hand to Hand - /////////////// - case _1H_BLUNT: - case _2H_BLUNT: - case PIERCING: - case HAND_TO_HAND: - case _1H_SLASHING: - case _2H_SLASHING:{ - switch (eqclass) { - // Pure melee classes - case WARRIOR: case WARRIORGM: { - r_value = 5 + (level*5); - if ( level < 51 && r_value > 200) - r_value = 200; - if ( level > 51 && r_value > 250 ) - r_value = 250; +uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { + uint16 r_value = 0; + + switch (skillid) { + /////////////// + // Melee Weapon/ Hand to Hand + /////////////// + case _1H_BLUNT: + case _2H_BLUNT: + case PIERCING: + case HAND_TO_HAND: + case _1H_SLASHING: + case _2H_SLASHING:{ + switch (eqclass) { + // Pure melee classes + case WARRIOR: case WARRIORGM: { + r_value = 5 + (level*5); + if ( level < 51 && r_value > 200) + r_value = 200; + if ( level > 51 && r_value > 250 ) + r_value = 250; switch (skillid) { case PIERCING: { - if ( r_value > 240 ) - r_value = 240; - break; - } + if ( r_value > 240 ) + r_value = 240; + break; + } case HAND_TO_HAND: { - if ( r_value > 100 ) - r_value = 100; - break; - } + if ( r_value > 100 ) + r_value = 100; + break; + } default: - break; + break; } - break; - } + break; + } case MONK: case MONKGM: { r_value = 5 + (level*5); if ( level < 51 && r_value > 240) @@ -80,24 +80,24 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { if ( r_value > 225 && level < 51 ) r_value = 225; break; - } - case PIERCING: - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + } + case PIERCING: + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; } - break; - } + break; + } case ROGUE: case ROGUEGM: { r_value = 5 + (level*5); if ( level > 50 ) { - if ( r_value > 250 ) - r_value = 250; - } + if ( r_value > 250 ) + r_value = 250; + } else if ( level < 51 ) { if ( r_value > 200 && skillid != PIERCING ) r_value = 200; @@ -108,226 +108,226 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { break; } default: - break; - } - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } + break; + } + } + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; + break; + } default: break; - } - break; - } + } + break; + } ////////////////////////////////////////////////////////////// - // Melee Weapon/ Hand to Hand - // Priest classes + // Melee Weapon/ Hand to Hand + // Priest classes ////////////////////////////////////////////////////////////// - case CLERIC: case CLERICGM:{ - r_value = 4 + (level*4); - if ( r_value > 175 ){ - r_value = 175; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - break; - } + case CLERIC: case CLERICGM:{ + r_value = 4 + (level*4); + if ( r_value > 175 ){ + r_value = 175; + } + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 75 ) + r_value = 75; + break; + } case PIERCING: case _1H_SLASHING: case _2H_SLASHING: { - r_value = 0; - break; - } + r_value = 0; + break; + } default: break; - } - break; - } - case DRUID: case DRUIDGM:{ - r_value = 4 + (level*4); - if ( r_value > 175 ){ - r_value = 175; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - } - case PIERCING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + } + break; + } + case DRUID: case DRUIDGM:{ + r_value = 4 + (level*4); + if ( r_value > 175 ){ + r_value = 175; + } + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 75 ) + r_value = 75; + } + case PIERCING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; - } - break; - } - case SHAMAN: case SHAMANGM:{ - r_value = 4 + (level*4); - if ( r_value > 200 ){ - r_value = 200; - } + } + break; + } + case SHAMAN: case SHAMANGM:{ + r_value = 4 + (level*4); + if ( r_value > 200 ){ + r_value = 200; + } switch (skillid) { case HAND_TO_HAND: { - if ( r_value > 75 ) - r_value = 75; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + if ( r_value > 75 ) + r_value = 75; + } + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; - } - break; + } + break; } - /////////////////////////////////////////////////////////// - // Melee Weapon/ Hand to Hand - // Hybrids + /////////////////////////////////////////////////////////// + // Melee Weapon/ Hand to Hand + // Hybrids ////////////////////////////////////////////////////////// - case RANGER: case RANGERGM:{ - r_value = 5 + (level*5); + case RANGER: case RANGERGM:{ + r_value = 5 + (level*5); if ( level > 50 ) { - if ( r_value > 250 ) - r_value = 250; - - switch (skillid) { + if ( r_value > 250 ) + r_value = 250; + + switch (skillid) { case PIERCING: { - if ( r_value > 240 ) - r_value = 240; - break; + if ( r_value > 240 ) + r_value = 240; + break; } default: break; - } - } + } + } else if ( level < 51 ) { - if ( r_value > 200 ) - r_value = 200; - } + if ( r_value > 200 ) + r_value = 200; + } switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - default: + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; break; - } - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - r_value = 5 + (level*5); - if ( level > 50 ){ - if ( r_value > 225 ) - r_value = 225; - } - if ( level < 51 ){ - if ( r_value > 200 ) - r_value = 200; - } - - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; } default: - break; + break; } - break; - } + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + r_value = 5 + (level*5); + if ( level > 50 ){ + if ( r_value > 225 ) + r_value = 225; + } + if ( level < 51 ){ + if ( r_value > 200 ) + r_value = 200; + } + + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; + break; + } + default: + break; + } + break; + } case BARD: case BARDGM: { r_value = 5 + (level*5); if ( level > 51 && r_value > 225 ) r_value = 225; if ( level < 51 && r_value > 200 ) - r_value = 200; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - case _2H_BLUNT: - case _2H_SLASHING:{ - r_value = 0; + r_value = 200; + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; + break; + } + case _2H_BLUNT: + case _2H_SLASHING:{ + r_value = 0; - } + } default: break; } - break; + break; } - - case BEASTLORD: case BEASTLORDGM:{ - r_value = 4 + (level*4); - if ( level > 51 ){ - if ( r_value > 225 && skillid != HAND_TO_HAND ) - r_value = 225; - } - if ( r_value > 250 ) - r_value = 250; - if ( level < 51 && r_value > 200 ) - r_value = 200; - - switch (skillid) { - case HAND_TO_HAND:{ - r_value = 5 + (level*5); - if ( level < 51 ) - r_value = 200; - if ( r_value > 250 ) - r_value = 250; - break; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } - default: - break; - } - break; - } + case BEASTLORD: case BEASTLORDGM:{ + r_value = 4 + (level*4); + if ( level > 51 ){ + if ( r_value > 225 && skillid != HAND_TO_HAND ) + r_value = 225; + } + if ( r_value > 250 ) + r_value = 250; + if ( level < 51 && r_value > 200 ) + r_value = 200; - // Melee Weapon/ Hand to Hand - // Pure casters - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - r_value = 3 + (level*3); - if ( r_value > 110 ) - r_value = 110; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; + switch (skillid) { + case HAND_TO_HAND:{ + r_value = 5 + (level*5); + if ( level < 51 ) + r_value = 200; + + if ( r_value > 250 ) + r_value = 250; break; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + } + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; } - } + break; + } + + // Melee Weapon/ Hand to Hand + // Pure casters + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + r_value = 3 + (level*3); + if ( r_value > 110 ) + r_value = 110; + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 75 ) + r_value = 75; + break; + } + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } + default: + break; + } + } default: { r_value = 0; break; @@ -337,95 +337,95 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { } // end case weapon skills -///////////////////////////////////////////////////////////// -// Combat non weapon -///////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////// +// Combat non weapon +///////////////////////////////////////////////////////////// -// Attack +// Attack case OFFENSE: { switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM: - case ROGUE: case ROGUEGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case MONK: case MONKGM:{ - // 230 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 230) - r_value = 230; - } - if (r_value > 252) - r_value = 252; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 200 200 4*level+4 - r_value = ((level*4) + 4); - if (r_value > 200) - r_value = 200; - break; + // Melee + case WARRIOR: case WARRIORGM: + case ROGUE: case ROGUEGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - // 200 225 5*level+5 + case MONK: case MONKGM:{ + // 230 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 230) + r_value = 230; + } + if (r_value > 252) + r_value = 252; + break; + } + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM:{ + // 200 200 4*level+4 + r_value = ((level*4) + 4); + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM:{ + // 200 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 252) + r_value = 252; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM:{ + // 200 225 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 225) - r_value = 225; - break; - } - case RANGER: case RANGERGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 140 140 level*4 - r_value = (level*4); - if (r_value > 140) - r_value = 140; - break; - } + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 225) + r_value = 225; + break; + } + case RANGER: case RANGERGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; + } + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + // 140 140 level*4 + r_value = (level*4); + if (r_value > 140) + r_value = 140; + break; + } default: { r_value = 0; break; @@ -433,221 +433,221 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { } // end switch (eqclass) break; } // end case OFFENSE - case THROWING: { - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM:{ - // 220 250 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 220) - r_value = 220; - } - if (r_value > 250) - r_value = 250; - break; - } - case WARRIOR: case WARRIORGM: - case MONK: case MONKGM:{ - // 113 200 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 113) - r_value = 113; - } - if (r_value > 200) - r_value = 200; - break; + case THROWING: { + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM:{ + // 220 250 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 220) + r_value = 220; + } + if (r_value > 250) + r_value = 250; + break; } - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: - case RANGER: case RANGERGM:{ - // 113 - r_value = ((level*5) + 5); - if ( r_value > 113 ) - r_value = 113; - break; - } - // Pure + case WARRIOR: case WARRIORGM: + case MONK: case MONKGM:{ + // 113 200 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 113) + r_value = 113; + } + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: + case RANGER: case RANGERGM:{ + // 113 + r_value = ((level*5) + 5); + if ( r_value > 113 ) + r_value = 113; + break; + } + // Pure case NECROMANCER: case NECROMANCERGM: case WIZARD: case WIZARDGM: case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 75 - r_value = ((level*3) + 3); - if ( r_value > 75 ) - r_value = 75; - break; + case ENCHANTER: case ENCHANTERGM:{ + // 75 + r_value = ((level*3) + 3); + if ( r_value > 75 ) + r_value = 75; + break; } - // No skill classes - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: + // No skill classes + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: default: { - r_value = 0; + r_value = 0; break; } } // end switch (eqclass) - break; + break; } // end case THROWING: case ARCHERY: { - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM: - case WARRIOR: case WARRIORGM:{ - // 200 240 - r_value = ((level*5) + 5); - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 240) - r_value = 240; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 75 75 - r_value = ((level*5) + 5); - if ( r_value > 75 ) - r_value = 75; - break; - } - case RANGER: case RANGERGM:{ - // 240 240 - r_value = ((level*5) + 5); - if ( r_value > 240 ) - r_value = 240; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM: + case WARRIOR: case WARRIORGM:{ + // 200 240 + r_value = ((level*5) + 5); + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 240) + r_value = 240; + break; + } + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 75 75 + r_value = ((level*5) + 5); + if ( r_value > 75 ) + r_value = 75; + break; + } + case RANGER: case RANGERGM:{ + // 240 240 + r_value = ((level*5) + 5); + if ( r_value > 240 ) + r_value = 240; + break; + } + // Pure + // No skill classes + // Melee + case MONK: case MONKGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: default: { - r_value = 0; + r_value = 0; break; } } // end switch (eqclass) break; } // end case ARCHERY: - case DOUBLE_ATTACK: { - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM:{ - // 16 200 240 - r_value = ((level*5) + 5); - if ( level < 16 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 240) - r_value = 240; - break; - } - case WARRIOR: case WARRIORGM:{ - // 15 205 245 - r_value = ((level*5) + 5); - if ( level < 15 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 245) - r_value = 245; - break; - } - case MONK: case MONKGM:{ - // 15 210 250 - r_value = ((level*5) + 5); - if ( level < 15 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 250) - r_value = 250; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 20 200 235 - r_value = ((level*5) + 5); - if ( level < 20 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 235) - r_value = 235; - break; - } - case RANGER: case RANGERGM:{ - // 20 200 245 - r_value = ((level*5) + 5); - if ( level < 20 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 245) - r_value = 245; - break; - } - // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: + case DOUBLE_ATTACK: { + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM:{ + // 16 200 240 + r_value = ((level*5) + 5); + if ( level < 16 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 240) + r_value = 240; + break; + } + case WARRIOR: case WARRIORGM:{ + // 15 205 245 + r_value = ((level*5) + 5); + if ( level < 15 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 245) + r_value = 245; + break; + } + case MONK: case MONKGM:{ + // 15 210 250 + r_value = ((level*5) + 5); + if ( level < 15 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 250) + r_value = 250; + break; + } + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 20 200 235 + r_value = ((level*5) + 5); + if ( level < 20 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 235) + r_value = 235; + break; + } + case RANGER: case RANGERGM:{ + // 20 200 245 + r_value = ((level*5) + 5); + if ( level < 20 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 245) + r_value = 245; + break; + } + // Pure + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: default: { r_value = 0; break; } } // end switch (eqclass) - break; + break; } // end case DOUBLE_ATTACK: case DUEL_WIELD: { - switch (eqclass) { - // Melee + switch (eqclass) { + // Melee case MONK: case MONKGM:{ // 1 252 252 r_value = level*7; // This can't be right can it? break ; } - case WARRIOR: case WARRIORGM: + case WARRIOR: case WARRIORGM: case ROGUE: case ROGUEGM: { // 15 210 245 r_value = ((level*5) + 5); @@ -661,7 +661,7 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { r_value = 245; break; } - // Hybrid + // Hybrid case BEASTLORD: case BEASTLORDGM: // 17 210 245 case RANGER: case RANGERGM:{ @@ -686,25 +686,25 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { r_value = 210; break; } - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: default: { - r_value = 0; - break; + r_value = 0; + break; } - }// end Class switch + }// end Class switch break; } // end case DUEL_WIELD: case KICK: { @@ -721,519 +721,519 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { r_value = 210; break; } - case MONK: case MONKGM:{ - // 1 200 250 + case MONK: case MONKGM:{ + // 1 200 250 r_value = ((level*5) + 5); if ( level < 51 ) { if (r_value > 200) r_value = 200; } - if (r_value > 250) + if (r_value > 250) r_value = 250; break; - } - // Hybrid - case RANGER: case RANGERGM:{ - // 5 149 205 - r_value = ((level*5) + 5); - if ( level < 5 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 149) - r_value = 149; - } - if (r_value > 205) - r_value = 205; - break; - } - case BEASTLORD: case BEASTLORDGM:{ - // 5 180 230 - r_value = ((level*5) + 5); - if ( level < 5 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 180) - r_value = 180; - } - if (r_value > 230) - r_value = 230; - break; - } - // Pure - // No skill classes - case ROGUE: case ROGUEGM: - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM: + } + // Hybrid + case RANGER: case RANGERGM:{ + // 5 149 205 + r_value = ((level*5) + 5); + if ( level < 5 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 149) + r_value = 149; + } + if (r_value > 205) + r_value = 205; + break; + } + case BEASTLORD: case BEASTLORDGM:{ + // 5 180 230 + r_value = ((level*5) + 5); + if ( level < 5 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 180) + r_value = 180; + } + if (r_value > 230) + r_value = 230; + break; + } + // Pure + // No skill classes + case ROGUE: case ROGUEGM: + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM: default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch(eqclass) break; } // end case KICK: - /////////// - // FIXME Where is slam? + /////////// + // FIXME Where is slam? // Quagmire: Slam = bash w/ race check - case BASH:{ - r_value = ((level*5)+5); - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 6 220 240 - if (level < 6) - r_value = 0; - if (level < 51 && r_value > 220) - r_value = 220; - if (r_value > 240) - r_value = 240; - break; - } - // Priest - case CLERIC: case CLERICGM:{ - // 25 180 200 - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 180) - r_value = 180; - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 6 175 200 - if (level < 6) - r_value = 0; - if (level < 51 && r_value > 175) - r_value = 175; - if (r_value > 200) - r_value = 200; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - case ROGUE: case ROGUEGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case RANGER: case RANGERGM: - case BARD: case BARDGM:{ - switch (race) { - case BARBARIAN: - case TROLL: - case OGRE:{ - r_value = 50; - break; - } + case BASH:{ + r_value = ((level*5)+5); + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 6 220 240 + if (level < 6) + r_value = 0; + if (level < 51 && r_value > 220) + r_value = 220; + if (r_value > 240) + r_value = 240; + break; + } + // Priest + case CLERIC: case CLERICGM:{ + // 25 180 200 + if (level < 25) + r_value = 0; + if (level < 51 && r_value > 180) + r_value = 180; + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 6 175 200 + if (level < 6) + r_value = 0; + if (level < 51 && r_value > 175) + r_value = 175; + if (r_value > 200) + r_value = 200; + break; + } + // Pure + // No skill classes + // Melee + case MONK: case MONKGM: + case ROGUE: case ROGUEGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case RANGER: case RANGERGM: + case BARD: case BARDGM:{ + switch (race) { + case BARBARIAN: + case TROLL: + case OGRE:{ + r_value = 50; + break; + } default: { break; } } // end switch (race) r_value = 0; - break; + break; } - } + } break; } // end case BASH: - ///////////////////////////////////// - ///////////////////////////////////// - // Defensive skills - case DEFENSE:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case ROGUE: case ROGUEGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case MONK: case MONKGM:{ - // 230 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 230) - r_value = 230; - } - if (r_value > 252) - r_value = 252; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 200 200 4*level+4 - r_value = ((level*4) + 4); - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case BARD: case BARDGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case RANGER: case RANGERGM:{ - // 200 200 5*level+5 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 145 145 level*4 - r_value = (level*4); - if (r_value > 140) - r_value = 140; + ///////////////////////////////////// + ///////////////////////////////////// + // Defensive skills + case DEFENSE:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; break; - } + } + case ROGUE: case ROGUEGM:{ + // 200 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 252) + r_value = 252; + break; + } + case MONK: case MONKGM:{ + // 230 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 230) + r_value = 230; + } + if (r_value > 252) + r_value = 252; + break; + } + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM:{ + // 200 200 4*level+4 + r_value = ((level*4) + 4); + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; + } + case BARD: case BARDGM:{ + // 200 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 252) + r_value = 252; + break; + } + case RANGER: case RANGERGM:{ + // 200 200 5*level+5 + r_value = ((level*5) + 5); + if (r_value > 200) + r_value = 200; + break; + } + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + // 145 145 level*4 + r_value = (level*4); + if (r_value > 140) + r_value = 140; + break; + } default: { break; } } // end switch(eqclass) - break; + break; } // end case DEFENSE: - case PARRY:{ - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM:{ - // 12 200 230 - r_value = ((level*5) + 5); - if ( level < 12 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - case WARRIOR: case WARRIORGM:{ - // 10 200 230 - r_value = ((level*5) + 5); - if ( level < 10 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - // Hybrid - case BARD: case BARDGM:{ - // 53 0 75 - r_value = ((level*5) + 5); - if ( level < 53 ) - r_value = 0; - if (r_value > 75) - r_value = 75; + case PARRY:{ + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM:{ + // 12 200 230 + r_value = ((level*5) + 5); + if ( level < 12 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 230) + r_value = 230; break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 17 175 205 - r_value = ((level*5) + 5); - if ( level < 17 ) - r_value = 0; - if (r_value > 175 && level < 51 ) - r_value = 175; - if (r_value > 205) - r_value = 205; - break; - } - case RANGER: case RANGERGM:{ - // 18 185 220 - r_value = ((level*5) + 5); - if ( level < 18 ) - r_value = 0; - if (r_value > 185 && level < 51 ) - r_value = 185; - if (r_value > 220) - r_value = 220; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: + } + case WARRIOR: case WARRIORGM:{ + // 10 200 230 + r_value = ((level*5) + 5); + if ( level < 10 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 230) + r_value = 230; + break; + } + // Hybrid + case BARD: case BARDGM:{ + // 53 0 75 + r_value = ((level*5) + 5); + if ( level < 53 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 17 175 205 + r_value = ((level*5) + 5); + if ( level < 17 ) + r_value = 0; + if (r_value > 175 && level < 51 ) + r_value = 175; + if (r_value > 205) + r_value = 205; + break; + } + case RANGER: case RANGERGM:{ + // 18 185 220 + r_value = ((level*5) + 5); + if ( level < 18 ) + r_value = 0; + if (r_value > 185 && level < 51 ) + r_value = 185; + if (r_value > 220) + r_value = 220; + break; + } + // Pure + // No skill classes + // Melee + case MONK: case MONKGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (eqclass) - break; + break; } // end case PARRY: - case RIPOSTE:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 25 200 225 - r_value = ((level*5) + 5); - if ( level < 25 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case ROGUE: case ROGUEGM:{ - // 30 200 225 - r_value = ((level*5) + 5); - if ( level < 30 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case MONK: case MONKGM:{ - // 35 200 225 - r_value = ((level*5) + 5); - if ( level < 35 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 40 150 185 - r_value = ((level*5) + 5); - if ( level < 40 ) - r_value = 0; - if (r_value > 150 && level < 51 ) - r_value = 150; - if (r_value > 185) - r_value = 185; - break; - } - case BARD: case BARDGM:{ - // 58 75 75 - r_value = ((level*5) + 5); - if ( level < 58 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 30 175 200 - r_value = ((level*5) + 5); - if ( level < 30 ) - r_value = 0; - if (r_value > 175 && level < 51 ) - r_value = 175; - if (r_value > 200) - r_value = 200; - break; - } - case RANGER: case RANGERGM:{ - // 35 150 150 - r_value = ((level*5) + 5); - if ( level < 35 ) - r_value = 0; - if (r_value > 150) - r_value = 150; - break; - } - // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid + case RIPOSTE:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 25 200 225 + r_value = ((level*5) + 5); + if ( level < 25 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case ROGUE: case ROGUEGM:{ + // 30 200 225 + r_value = ((level*5) + 5); + if ( level < 30 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case MONK: case MONKGM:{ + // 35 200 225 + r_value = ((level*5) + 5); + if ( level < 35 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM:{ + // 40 150 185 + r_value = ((level*5) + 5); + if ( level < 40 ) + r_value = 0; + if (r_value > 150 && level < 51 ) + r_value = 150; + if (r_value > 185) + r_value = 185; + break; + } + case BARD: case BARDGM:{ + // 58 75 75 + r_value = ((level*5) + 5); + if ( level < 58 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 30 175 200 + r_value = ((level*5) + 5); + if ( level < 30 ) + r_value = 0; + if (r_value > 175 && level < 51 ) + r_value = 175; + if (r_value > 200) + r_value = 200; + break; + } + case RANGER: case RANGERGM:{ + // 35 150 150 + r_value = ((level*5) + 5); + if ( level < 35 ) + r_value = 0; + if (r_value > 150) + r_value = 150; + break; + } + // Pure + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (eqclass) - break; + break; } // end case RIPOSTE: - case DODGE:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 6 140 175 - r_value = ((level*5) + 5); - if ( level < 6 ) - r_value = 0; - if (r_value > 140 && level < 51 ) - r_value = 140; - if (r_value > 175) - r_value = 175; - break; - } - case ROGUE: case ROGUEGM:{ - // 4 150 210 - r_value = ((level*5) + 5); - if ( level < 4 ) - r_value = 0; - if (r_value > 150 && level < 51 ) - r_value = 150; - if (r_value > 210) - r_value = 210; - break; - } - case MONK: case MONKGM:{ - // 1 200 230 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 15 75 75 4*level+4 - r_value = ((level*4) + 4); - if ( level < 15 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - // 10 125 155 5*level+5 - r_value = ((level*5) + 5); - if ( level < 10 ) - r_value = 0; - if (r_value > 125 && level < 51 ) - r_value = 125; - if (r_value > 155) - r_value = 155; - break; - } - - case RANGER: case RANGERGM:{ - // 8 137 170 5*level+5 - r_value = ((level*5) + 5); - if ( level < 8 ) - r_value = 0; - if (r_value > 137 && level < 51 ) - r_value = 137; - if (r_value > 170) - r_value = 170; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 22 75 75 3*level+3 - r_value = ((level*3) + 3); - if ( level < 22 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; + case DODGE:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 6 140 175 + r_value = ((level*5) + 5); + if ( level < 6 ) + r_value = 0; + if (r_value > 140 && level < 51 ) + r_value = 140; + if (r_value > 175) + r_value = 175; + break; } - // No skill classes - // Melee - // Priest - // Pure - // Hybrid + case ROGUE: case ROGUEGM:{ + // 4 150 210 + r_value = ((level*5) + 5); + if ( level < 4 ) + r_value = 0; + if (r_value > 150 && level < 51 ) + r_value = 150; + if (r_value > 210) + r_value = 210; + break; + } + case MONK: case MONKGM:{ + // 1 200 230 + r_value = ((level*5) + 5); + if (r_value > 200) + r_value = 200; + if (r_value > 230) + r_value = 230; + break; + } + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM:{ + // 15 75 75 4*level+4 + r_value = ((level*4) + 4); + if ( level < 15 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM:{ + // 10 125 155 5*level+5 + r_value = ((level*5) + 5); + if ( level < 10 ) + r_value = 0; + if (r_value > 125 && level < 51 ) + r_value = 125; + if (r_value > 155) + r_value = 155; + break; + } + + case RANGER: case RANGERGM:{ + // 8 137 170 5*level+5 + r_value = ((level*5) + 5); + if ( level < 8 ) + r_value = 0; + if (r_value > 137 && level < 51 ) + r_value = 137; + if (r_value > 170) + r_value = 170; + break; + } + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + // 22 75 75 3*level+3 + r_value = ((level*3) + 3); + if ( level < 22 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + // No skill classes + // Melee + // Priest + // Pure + // Hybrid default: { r_value = 0; break; @@ -1241,661 +1241,661 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { } // end switch (eqclass) break; } // end case DODGE: - // Other - case TAUNT:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 1 200 200 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - break; - } - // Priest - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 1 180 180 - r_value = ((level*5) + 5); - if (r_value > 180) - r_value = 180; - break; - } - case RANGER: case RANGERGM:{ - // 1 150 150 - r_value = ((level*5) + 5); - if (r_value > 150) - r_value = 150; - break; - } - // Pure - // No skill classes - // Melee - case ROGUE: case ROGUEGM: - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: + // Other + case TAUNT:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 1 200 200 + r_value = ((level*5) + 5); + if (r_value > 200) + r_value = 200; + break; + } + // Priest + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 1 180 180 + r_value = ((level*5) + 5); + if (r_value > 180) + r_value = 180; + break; + } + case RANGER: case RANGERGM:{ + // 1 150 150 + r_value = ((level*5) + 5); + if (r_value > 150) + r_value = 150; + break; + } + // Pure + // No skill classes + // Melee + case ROGUE: case ROGUEGM: + case MONK: case MONKGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: default: { r_value = 0; - break; + break; } } // end swtich (eqclass) break; } // end case TAUNT: - case DISARM:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 35 200 200 - r_value = ((level*5) + 5); - if (level < 35) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case ROGUE: case ROGUEGM: - case MONK: case MONKGM:{ - // 27 200 200 - r_value = ((level*5) + 5); - if (level < 27) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - // Priest - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 40 70 70 - r_value = ((level*5) + 5); - if (level < 40) - r_value = 0; - if (r_value > 70) - r_value = 70; - break; - } - case RANGER: case RANGERGM:{ - // 35 55 55 - r_value = ((level*5) + 5); - if (level < 35) - r_value = 0; - if (r_value > 55) - r_value = 55; - break; - } + case DISARM:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 35 200 200 + r_value = ((level*5) + 5); + if (level < 35) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + case ROGUE: case ROGUEGM: + case MONK: case MONKGM:{ + // 27 200 200 + r_value = ((level*5) + 5); + if (level < 27) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + // Priest + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 40 70 70 + r_value = ((level*5) + 5); + if (level < 40) + r_value = 0; + if (r_value > 70) + r_value = 70; + break; + } + case RANGER: case RANGERGM:{ + // 35 55 55 + r_value = ((level*5) + 5); + if (level < 35) + r_value = 0; + if (r_value > 55) + r_value = 55; + break; + } // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BARD: case BARDGM: - case BEASTLORD: case BEASTLORDGM: + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BARD: case BARDGM: + case BEASTLORD: case BEASTLORDGM: default: { r_value = 0; - break; - } + break; + } } // end switch (eqclass) break; } // end case DISARM: - /////////////////////////////////////////// - /////////////////////////////////////////// - // Spell Skills - case MEDITATE: - case ABJURE: + /////////////////////////////////////////// + /////////////////////////////////////////// + // Spell Skills + case MEDITATE: + case ABJURE: - case ALTERATION: - case CHANNELING: - case CONJURATION: - case DIVINATION: + case ALTERATION: + case CHANNELING: + case CONJURATION: + case DIVINATION: - case EVOCATION:{ - r_value = ((level*5) + 5); - switch(eqclass){ - // Hybrid - case RANGER: case RANGERGM:{ - // 9 235 235 - // Channel 9 200 215 - // Med 12 185 235 - if (level < 9) - r_value = 0; - if (level < 12 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 215) - r_value = 215; + case EVOCATION:{ + r_value = ((level*5) + 5); + switch(eqclass){ + // Hybrid + case RANGER: case RANGERGM:{ + // 9 235 235 + // Channel 9 200 215 + // Med 12 185 235 + if (level < 9) + r_value = 0; + if (level < 12 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 215) + r_value = 215; } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 235) - r_value = 235; - } - break; - } - case BEASTLORD: case BEASTLORDGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 9 235 235 - // Channel 9 200 220 - // Med 12 185 235 - if (level < 9) - r_value = 0; - if (level < 12 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 235) - r_value = 235; - } - break; - } - // Priest - case CLERIC: case CLERICGM: - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM:{ - // 1 235 235 - // Channel 4 200 220 - // Med 8 235 252 - if (level < 4 && skillid == CHANNELING) - r_value = 0; - if (level < 8 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 235) - r_value = 235; - if (r_value > 252) - r_value = 252; - } - break; - } - // Int caster - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - // 1 235 235 - // Channel 1 200 220 - // Med 4 235 252 - if (level < 4 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 235) - r_value = 235; - if (r_value > 252) - r_value = 252; - } - break; + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 185) + r_value = 185; + if (r_value > 235) + r_value = 235; + } + break; + } + case BEASTLORD: case BEASTLORDGM: + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 9 235 235 + // Channel 9 200 220 + // Med 12 185 235 + if (level < 9) + r_value = 0; + if (level < 12 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 185) + r_value = 185; + if (r_value > 220) + r_value = 220; + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 185) + r_value = 185; + if (r_value > 235) + r_value = 235; + } + break; + } + // Priest + case CLERIC: case CLERICGM: + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM:{ + // 1 235 235 + // Channel 4 200 220 + // Med 8 235 252 + if (level < 4 && skillid == CHANNELING) + r_value = 0; + if (level < 8 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 220) + r_value = 220; + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 235) + r_value = 235; + if (r_value > 252) + r_value = 252; + } + break; + } + // Int caster + case ENCHANTER: case ENCHANTERGM: + case MAGICIAN: case MAGICIANGM: + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM:{ + // 1 235 235 + // Channel 1 200 220 + // Med 4 235 252 + if (level < 4 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 220) + r_value = 220; + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 235) + r_value = 235; + if (r_value > 252) + r_value = 252; + } + break; + } + case BARD: case BARDGM:{ + r_value = 0; + if (level > 9 && skillid == MEDITATE) + r_value = 1; + break; } - case BARD: case BARDGM:{ - r_value = 0; - if (level > 9 && skillid == MEDITATE) - r_value = 1; - break; - } default: { - // Unknown class - r_value = 0; - break; + // Unknown class + r_value = 0; + break; } - }// Class Switch + }// Class Switch break; } // end spell skills - case SPECIALIZE_ABJURE: - case SPECIALIZE_ALTERATION: - case SPECIALIZE_CONJURATION: - case SPECIALIZE_DIVINATION: - case SPECIALIZE_EVOCATION: - case RESEARCH:{ - r_value = ((level*5) + 5); - switch(eqclass){ - // Int caster - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - // Res 16 200 200 - if (level < 16 && skillid == RESEARCH) - r_value = 0; - if (r_value > 0 && skillid == RESEARCH) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 235) - r_value = 235; - // FIXME Only let one SPEC go above what ever limit theres supposed to be - break; - } - default:{ - r_value = 0; - break; - } - }// Class Switch + case SPECIALIZE_ABJURE: + case SPECIALIZE_ALTERATION: + case SPECIALIZE_CONJURATION: + case SPECIALIZE_DIVINATION: + case SPECIALIZE_EVOCATION: + case RESEARCH:{ + r_value = ((level*5) + 5); + switch(eqclass){ + // Int caster + case ENCHANTER: case ENCHANTERGM: + case MAGICIAN: case MAGICIANGM: + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM:{ + // Res 16 200 200 + if (level < 16 && skillid == RESEARCH) + r_value = 0; + if (r_value > 0 && skillid == RESEARCH) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 235) + r_value = 235; + // FIXME Only let one SPEC go above what ever limit theres supposed to be + break; + } + default:{ + r_value = 0; + break; + } + }// Class Switch break; } // end specilize & research skills - case BRASS_INSTRUMENTS: - case SINGING: - case STRINGED_INSTRUMENTS: - case WIND_INSTRUMENTS: - case PERCUSSION_INSTRUMENTS:{ - switch(eqclass){ - case BARD: case BARDGM:{ - r_value = ((level*5) + 5); - if (level < 5 && skillid == PERCUSSION_INSTRUMENTS){ - r_value = 0; - } - if (level < 8 && skillid == STRINGED_INSTRUMENTS){ - r_value = 0; - } - if (level < 11 && skillid == BRASS_INSTRUMENTS){ - r_value = 0; - } - if (level < 14 && skillid == WIND_INSTRUMENTS){ - r_value = 0; - } - if (r_value > 235) - r_value = 235; - break; - } - default: { - r_value = 0; + case BRASS_INSTRUMENTS: + case SINGING: + case STRINGED_INSTRUMENTS: + case WIND_INSTRUMENTS: + case PERCUSSION_INSTRUMENTS:{ + switch(eqclass){ + case BARD: case BARDGM:{ + r_value = ((level*5) + 5); + if (level < 5 && skillid == PERCUSSION_INSTRUMENTS){ + r_value = 0; + } + if (level < 8 && skillid == STRINGED_INSTRUMENTS){ + r_value = 0; + } + if (level < 11 && skillid == BRASS_INSTRUMENTS){ + r_value = 0; + } + if (level < 14 && skillid == WIND_INSTRUMENTS){ + r_value = 0; + } + if (r_value > 235) + r_value = 235; + break; } - break; - }// Class Switch + default: { + r_value = 0; + } + break; + }// Class Switch break; } // bard song skills - /////////////////////////////////////////// - /////////////////////////////////////////// - // Class skills - // Rogue - case APPLY_POISON: - case MAKE_POISON: - case PICK_POCKETS: - case BACKSTAB:{ - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM: { - r_value = ((level*5) + 5); - switch (skillid){ - case APPLY_POISON:{ - // 18 200 200 - if (level < 18) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case MAKE_POISON:{ - // 20 200 250 - if (level < 20) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 250) - r_value = 250; - break; - } - case PICK_POCKETS:{ - // 7 200 210 - if (level < 7) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 210) - r_value = 210; - break; - } - case BACKSTAB:{ - // 10 200 225 - if (level < 10) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } + /////////////////////////////////////////// + /////////////////////////////////////////// + // Class skills + // Rogue + case APPLY_POISON: + case MAKE_POISON: + case PICK_POCKETS: + case BACKSTAB:{ + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM: { + r_value = ((level*5) + 5); + switch (skillid){ + case APPLY_POISON:{ + // 18 200 200 + if (level < 18) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + case MAKE_POISON:{ + // 20 200 250 + if (level < 20) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 250) + r_value = 250; + break; + } + case PICK_POCKETS:{ + // 7 200 210 + if (level < 7) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 210) + r_value = 210; + break; + } + case BACKSTAB:{ + // 10 200 225 + if (level < 10) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (skillid) - break; + break; } // end case ROGUE: case ROGUEGM: default: { - r_value = 0; - break; + r_value = 0; + break; } - }// Class Switch + }// Class Switch break; } // end rogue skills - // Monk - case FEIGN_DEATH: - case MEND: - case DRAGON_PUNCH: - case EAGLE_STRIKE: - case FLYING_KICK: - case ROUND_KICK: - case TIGER_CLAW: - case BLOCKSKILL:{ - switch(eqclass){ - case MONK: case MONKGM:{ - r_value = ((level*5) + 5); - switch (skillid){ - case MEND:{ - // 1 200 200 - if (r_value > 200) - r_value = 200; - break; - } - case ROUND_KICK:{ - // 5 200 225 - if (level < 5) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case TIGER_CLAW:{ - // 10 200 225 - if (level < 10) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case BLOCKSKILL:{ - // 12 200 230 - if (level < 12) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - case FEIGN_DEATH:{ - // 17 200 200 - if (level < 17) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case EAGLE_STRIKE:{ - // 20 200 225 - if (level < 20) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case DRAGON_PUNCH:{ - // 25 200 225 - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case FLYING_KICK:{ - // 30 200 225 - if (level < 30) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } + // Monk + case FEIGN_DEATH: + case MEND: + case DRAGON_PUNCH: + case EAGLE_STRIKE: + case FLYING_KICK: + case ROUND_KICK: + case TIGER_CLAW: + case BLOCKSKILL:{ + switch(eqclass){ + case MONK: case MONKGM:{ + r_value = ((level*5) + 5); + switch (skillid){ + case MEND:{ + // 1 200 200 + if (r_value > 200) + r_value = 200; + break; + } + case ROUND_KICK:{ + // 5 200 225 + if (level < 5) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case TIGER_CLAW:{ + // 10 200 225 + if (level < 10) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case BLOCKSKILL:{ + // 12 200 230 + if (level < 12) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 230) + r_value = 230; + break; + } + case FEIGN_DEATH:{ + // 17 200 200 + if (level < 17) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + case EAGLE_STRIKE:{ + // 20 200 225 + if (level < 20) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case DRAGON_PUNCH:{ + // 25 200 225 + if (level < 25) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case FLYING_KICK:{ + // 30 200 225 + if (level < 30) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (skillid) - break; + break; } // end case MONK: case MONKGM: default: { - r_value = 0; - break; + r_value = 0; + break; } }// Class Switch break; } // end monk skills - // Shaman - case ALCHEMY:{ - switch(eqclass){ - case SHAMAN: case SHAMANGM:{ - // 25 130 180 - r_value = ((level*5) + 5); - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 130) - r_value = 130; - if (r_value > 180) - r_value = 180; - break; - } - default: { - r_value = 0; + // Shaman + case ALCHEMY:{ + switch(eqclass){ + case SHAMAN: case SHAMANGM:{ + // 25 130 180 + r_value = ((level*5) + 5); + if (level < 25) + r_value = 0; + if (level < 51 && r_value > 130) + r_value = 130; + if (r_value > 180) + r_value = 180; break; } - }// Class Switch + default: { + r_value = 0; + break; + } + }// Class Switch break; } // end case ALCHEMY: - /////////////////////////////////////////// - ////////////////////////////////////////// - // Shared skill - // Shared Rogue - case HIDE: - case SNEAK:{ - switch(eqclass){ - // True class - case ROGUE: case ROGUEGM:{ - break; - } - // Hybrids - case MONK: case MONKGM: - case RANGER: case RANGERGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - break; - } - default: { - r_value = 0; - break; + /////////////////////////////////////////// + ////////////////////////////////////////// + // Shared skill + // Shared Rogue + case HIDE: + case SNEAK:{ + switch(eqclass){ + // True class + case ROGUE: case ROGUEGM:{ + break; } - }// Class Switch + // Hybrids + case MONK: case MONKGM: + case RANGER: case RANGERGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM:{ + break; + } + default: { + r_value = 0; + break; + } + }// Class Switch } // end sneak/hide - case SENSE_TRAPS: - case PICK_LOCK: - case DISARM_TRAPS:{ - switch(eqclass){ - // True class - case ROGUE: case ROGUEGM:{ - break; - } - // Hybrids - case BARD: case BARDGM:{ - break; - } - default: { - r_value = 0; - break; + case SENSE_TRAPS: + case PICK_LOCK: + case DISARM_TRAPS:{ + switch(eqclass){ + // True class + case ROGUE: case ROGUEGM:{ + break; } - }// Class Switch + // Hybrids + case BARD: case BARDGM:{ + break; + } + default: { + r_value = 0; + break; + } + }// Class Switch break; } // end case SENSE_TRAPS/PICK_LOCK/DISARM_TRAPS - case SAFE_FALL: - case INTIMIDATION:{ - switch(eqclass){ - // Melee - case MONK: case MONKGM: - case ROGUE: case ROGUEGM:{ - break; - } - default: { - r_value = 0; - break; + case SAFE_FALL: + case INTIMIDATION:{ + switch(eqclass){ + // Melee + case MONK: case MONKGM: + case ROGUE: case ROGUEGM:{ + break; } - }// Class Switch + default: { + r_value = 0; + break; + } + }// Class Switch break; } // end SAFE_FALL/INTIMIDATION - // Druid/Ranger/Bard - case FORAGE:{ - switch(eqclass) { - case DRUID: case DRUIDGM: - case RANGER: case RANGERGM:{ - if (r_value > 200) - r_value = 200; - break; - } + // Druid/Ranger/Bard + case FORAGE:{ + switch(eqclass) { + case DRUID: case DRUIDGM: + case RANGER: case RANGERGM:{ + if (r_value > 200) + r_value = 200; + break; + } case BARD: case BARDGM: { - r_value = 55; - break; + r_value = 55; + break; } default: { - r_value = 00; - break; + r_value = 00; + break; } } // end switch (eqclass) - break; + break; } // end case FORAGE: - case TRACKING:{ - switch(eqclass){ - case RANGER: case RANGERGM: - case BARD: case BARDGM: + case TRACKING:{ + switch(eqclass){ + case RANGER: case RANGERGM: + case BARD: case BARDGM: case DRUID: case DRUIDGM: { } default: { - r_value = 0; + r_value = 0; break; } - }// Class Switch + }// Class Switch } // end case TRACKING - /////////////////////////////////////////// - /////////////////////////////////////////// - // Tradeskills - case BAKING: - case TAILORING: - case BLACKSMITHING: - case FLETCHING: - case BREWING: - case JEWELRY_MAKING: - case POTTERY: - case FISHING:{ - // Check for Any Trade above 200, check for X (aa skill) Trades above 200 - r_value = 200; - break; - } + /////////////////////////////////////////// + /////////////////////////////////////////// + // Tradeskills + case BAKING: + case TAILORING: + case BLACKSMITHING: + case FLETCHING: + case BREWING: + case JEWELRY_MAKING: + case POTTERY: + case FISHING:{ + // Check for Any Trade above 200, check for X (aa skill) Trades above 200 + r_value = 200; + break; + } /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// - // Gnome + // Gnome /////////////////////////////////////////////////////////////////// - case TINKERING:{ - if ( race == GNOME && level > 24 ) { - r_value = ((level*5)+5); - break; - } - r_value = 0; - break; + case TINKERING:{ + if ( race == GNOME && level > 24 ) { + r_value = ((level*5)+5); + break; + } + r_value = 0; + break; } // end case TINKERING: - ///////////////////////////////////////// - // Common - ///////////////////////////////////////// - case BIND_WOUND:{ - r_value = 5 + (level*5); - if (level > 50){ - // Check for aa and class - } - if (r_value > 200) - r_value = 200; - switch (eqclass) { - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - if ( r_value > 100 ) - r_value = 100; - } + ///////////////////////////////////////// + // Common + ///////////////////////////////////////// + case BIND_WOUND:{ + r_value = 5 + (level*5); + if (level > 50){ + // Check for aa and class + } + if (r_value > 200) + r_value = 200; + switch (eqclass) { + case ENCHANTER: case ENCHANTERGM: + case MAGICIAN: case MAGICIANGM: + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM:{ + if ( r_value > 100 ) + r_value = 100; + } default: { - break; + break; } } // end switch (eqclass) - break; + break; } // end case BIND_WOUND: - case SENSE_HEADING: - case SWIMMING: - case ALCOHOL_TOLERANCE: - case BEGGING:{ - r_value = 5 + (level*5); - if (r_value > 200) - r_value = 200; - break; - } - //case BERSERKING: - default: { - // Unknown skill we should like print something to a log/debug here - r_value = 0; - break; - } + case SENSE_HEADING: + case SWIMMING: + case ALCOHOL_TOLERANCE: + case BEGGING:{ + r_value = 5 + (level*5); + if (r_value > 200) + r_value = 200; + break; + } + //case BERSERKING: + default: { + // Unknown skill we should like print something to a log/debug here + r_value = 0; + break; + } } // end switch (skillid) // NO skill may go over 252 if (r_value > 252) r_value = 252; - return r_value; -} + return r_value; +} diff --git a/common/MiscFunctions.cpp b/common/MiscFunctions.cpp index f6cd00e63..a08fd1f3d 100644 --- a/common/MiscFunctions.cpp +++ b/common/MiscFunctions.cpp @@ -83,7 +83,7 @@ void CoutTimestamp(bool ms) { time(&rawtime); gmt_t = gmtime(&rawtime); - struct timeval read_time; + struct timeval read_time; gettimeofday(&read_time,0); cout << (gmt_t->tm_year + 1900) << "/" << setw(2) << setfill('0') << (gmt_t->tm_mon + 1) << "/" << setw(2) << setfill('0') << gmt_t->tm_mday << " " << setw(2) << setfill('0') << gmt_t->tm_hour << ":" << setw(2) << setfill('0') << gmt_t->tm_min << ":" << setw(2) << setfill('0') << gmt_t->tm_sec; @@ -383,7 +383,7 @@ const char * itoa(int num, char* a,int b) { } #endif -/* +/* * generate a random integer in the range low-high this * should be used instead of the rand()%limit method */ @@ -425,9 +425,9 @@ uint32 rnd_hash( time_t t, clock_t c ) // Get a uint32 from t and c // Better than uint32(x) in case x is floating point in [0,1] // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk) - + static uint32 differ = 0; // guarantee time-based seeds will change - + uint32 h1 = 0; unsigned char *p = (unsigned char *) &t; for( size_t i = 0; i < sizeof(t); ++i ) @@ -553,7 +553,7 @@ static unsigned int case_6 (void){ char *CleanMobName(const char *in, char *out) { unsigned i, j; - + for(i = j = 0; i < strlen(in); i++) { // convert _ to space.. any other conversions like this? I *think* this diff --git a/common/MiscFunctions.h b/common/MiscFunctions.h index 2ed8a8954..037ffbefc 100644 --- a/common/MiscFunctions.h +++ b/common/MiscFunctions.h @@ -32,8 +32,8 @@ // These are helper macros for dealing with packets of variable length, typically those that contain // variable length strings where it is not convenient to use a fixed length struct. // -#define VARSTRUCT_DECODE_TYPE(Type, Buffer) *(Type *)Buffer; Buffer += sizeof(Type); -#define VARSTRUCT_DECODE_STRING(String, Buffer) strcpy(String, Buffer); Buffer += strlen(String)+1; +#define VARSTRUCT_DECODE_TYPE(Type, Buffer) *(Type *)Buffer; Buffer += sizeof(Type); +#define VARSTRUCT_DECODE_STRING(String, Buffer) strcpy(String, Buffer); Buffer += strlen(String)+1; #define VARSTRUCT_ENCODE_STRING(Buffer, String) { sprintf(Buffer, String); Buffer += strlen(String) + 1; } #define VARSTRUCT_ENCODE_INTSTRING(Buffer, Number) { sprintf(Buffer, "%i", Number); Buffer += strlen(Buffer) + 1; } #define VARSTRUCT_ENCODE_TYPE(Type, Buffer, Value) { *(Type *)Buffer = Value; Buffer += sizeof(Type); } diff --git a/common/Mutex.cpp b/common/Mutex.cpp index a866c5530..df481a68b 100644 --- a/common/Mutex.cpp +++ b/common/Mutex.cpp @@ -23,7 +23,7 @@ using namespace std; #define DEBUG_MUTEX_CLASS 0 #if DEBUG_MUTEX_CLASS >= 1 - + #endif #ifdef _WINDOWS diff --git a/common/ProcLauncher.cpp b/common/ProcLauncher.cpp index de317886f..584dece69 100644 --- a/common/ProcLauncher.cpp +++ b/common/ProcLauncher.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -71,7 +71,7 @@ void ProcLauncher::Process() { //GetLastError(); TerminateProcess(cur->second->proc_info.hProcess, 1); } - + //if we get here, the current process died. tmp = cur; tmp++; @@ -85,7 +85,7 @@ void ProcLauncher::Process() { ProcRef died = waitpid(-1, &status, WNOHANG); if(died == -1) { //error waiting... shouldent really happen... - + } else if(died == 0) { //nothing pending... break; @@ -102,14 +102,14 @@ void ProcLauncher::Process() { } } #endif //!WIN32 - + } void ProcLauncher::ProcessTerminated(std::map::iterator &it) { - + if(it->second->handler != nullptr) it->second->handler->OnTerminate(it->first, it->second); - + #ifdef _WINDOWS CloseHandle(it->second->proc_info.hProcess); #else //!WIN32 @@ -125,18 +125,18 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { #ifdef _WINDOWS STARTUPINFO siStartInfo; - BOOL bFuncRetn = FALSE; - - // Set up members of the PROCESS_INFORMATION structure. - + BOOL bFuncRetn = FALSE; + + // Set up members of the PROCESS_INFORMATION structure. + ZeroMemory( &it->proc_info, sizeof(PROCESS_INFORMATION) ); - - // Set up members of the STARTUPINFO structure. - + + // Set up members of the STARTUPINFO structure. + ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) ); - siStartInfo.cb = sizeof(STARTUPINFO); + siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.dwFlags = 0; - + //handle output redirection. HANDLE logOut = nullptr; BOOL inherit_handles = FALSE; @@ -144,9 +144,9 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { inherit_handles = TRUE; // Set up our log file to redirect output into. SECURITY_ATTRIBUTES saAttr; - saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; //we want this handle to be inherited by the child. - saAttr.lpSecurityDescriptor = nullptr; + saAttr.lpSecurityDescriptor = nullptr; logOut = CreateFile( it->logFile.c_str(), //lpFileName FILE_WRITE_DATA, //dwDesiredAccess @@ -155,7 +155,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { CREATE_ALWAYS, //dwCreationDisposition FILE_FLAG_NO_BUFFERING, //dwFlagsAndAttributes nullptr ); //hTemplateFile - + //configure the startup info to redirect output appropriately. siStartInfo.hStdError = logOut; siStartInfo.hStdOutput = logOut; @@ -164,9 +164,9 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { } siStartInfo.dwFlags |= CREATE_NEW_CONSOLE; - - // Create the child process. - + + // Create the child process. + //glue together all the nice command line arguments string args(it->program); vector::iterator cur, end; @@ -176,39 +176,39 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { args += " "; args += *cur; } - - bFuncRetn = CreateProcess(it->program.c_str(), - const_cast(args.c_str()), // command line - nullptr, // process security attributes - nullptr, // primary thread security attributes - inherit_handles, // handles are not inherited + + bFuncRetn = CreateProcess(it->program.c_str(), + const_cast(args.c_str()), // command line + nullptr, // process security attributes + nullptr, // primary thread security attributes + inherit_handles, // handles are not inherited 0, // creation flags (CREATE_NEW_PROCESS_GROUP maybe) - nullptr, // use parent's environment - nullptr, // use parent's current directory - &siStartInfo, // STARTUPINFO pointer - &it->proc_info); // receives PROCESS_INFORMATION - + nullptr, // use parent's environment + nullptr, // use parent's current directory + &siStartInfo, // STARTUPINFO pointer + &it->proc_info); // receives PROCESS_INFORMATION + if (bFuncRetn == 0) { safe_delete(it); //GetLastError() return(ProcError); } - - + + //keep process handle open to get exit code CloseHandle(it->proc_info.hThread); //we dont need their thread handle if(logOut != nullptr) CloseHandle(logOut); //we dont want their output handle either. - + ProcRef res = it->proc_info.dwProcessId; - + //record this entry.. m_running[res] = it; - + return(res); - + #else //!WIN32 - + //build argv char **argv = new char *[it->args.size()+2]; unsigned int r; @@ -217,7 +217,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { argv[r] = const_cast(it->args[r-1].c_str()); } argv[r] = nullptr; - + ProcRef res = fork(); //cant use vfork since we are opening the log file. if(res == -1) { //error forking... errno @@ -225,10 +225,10 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { safe_delete_array(argv); return(ProcError); } - + if(res == 0) { //child... exec this bitch - + //handle output redirection if requested. if(it->logFile.length() > 0) { //we will put their output directly into a file. @@ -252,20 +252,20 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { write(outfd, err, strlen(err)); } close(STDIN_FILENO); - + close(outfd); //dont need this one, we have two more copies... } } - + //call it... execv(argv[0], argv); _exit(1); } safe_delete_array(argv); - + //record this entry.. m_running[res] = it; - + return(res); #endif //!WIN32 } @@ -277,10 +277,10 @@ bool ProcLauncher::Terminate(const ProcRef &proc, bool graceful) { std::map::iterator res = m_running.find(proc); if(res == m_running.end()) return(false); - + //we do not remove it from the list until we have been notified //that they have been terminated. - + #ifdef _WINDOWS if(!TerminateProcess(res->second->proc_info.hProcess, 0)) { return(false); @@ -311,7 +311,7 @@ void ProcLauncher::TerminateAll(bool final) { //kill each process and remove it from the list std::map running(m_running); m_running.clear(); - + std::map::iterator cur, end; cur = running.begin(); end = running.end(); diff --git a/common/ProcLauncher.h b/common/ProcLauncher.h index 1c851de4f..dcdc25191 100644 --- a/common/ProcLauncher.h +++ b/common/ProcLauncher.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -32,7 +32,7 @@ public: //Singleton method static ProcLauncher *get() { return(&s_launcher); } static void ProcessInThisThread(); - + #ifdef WIN32 typedef DWORD ProcRef; static const ProcRef ProcError; @@ -47,7 +47,7 @@ public: Spec(); Spec(const Spec &other); Spec &operator=(const Spec &other); - + std::string program; std::vector args; //std::map environment; @@ -64,18 +64,18 @@ public: virtual ~EventHandler() {} virtual void OnTerminate(const ProcRef &ref, const Spec *spec) = 0; }; - + /* * The main launch method, call to start a new background process. */ ProcRef Launch(Spec *&to_launch); //takes ownership of the pointer - + /* * The terminate method */ bool Terminate(const ProcRef &proc, bool graceful = true); void TerminateAll(bool final = true); - + /* * The main processing method. Call regularly to check for terminated * background processes. @@ -85,9 +85,9 @@ public: protected: // std::vector m_specs; std::map m_running; //we own the pointers in this map - + void ProcessTerminated(std::map::iterator &it); - + private: static ProcLauncher s_launcher; #ifndef WIN32 diff --git a/common/StructStrategy.cpp b/common/StructStrategy.cpp index 7b71180e3..61b060259 100644 --- a/common/StructStrategy.cpp +++ b/common/StructStrategy.cpp @@ -28,13 +28,13 @@ void StructStrategy::Decode(EQApplicationPacket *p) const { proc(p); } - + void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bool ack_req) { EQApplicationPacket *p = *in_p; *in_p = nullptr; - + _log(NET__STRUCTS, "Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); - + delete p; } @@ -56,13 +56,13 @@ void StructStrategy::PassDecoder(EQApplicationPacket *p) { //effectively a singleton, but I decided to do it this way for no apparent reason. namespace StructStrategyFactory { - + static map strategies; - + void RegisterPatch(EmuOpcode first_opcode, const StructStrategy *structs) { strategies[first_opcode] = structs; } - + const StructStrategy *FindPatch(EmuOpcode first_opcode) { map::const_iterator res; res = strategies.find(first_opcode); @@ -70,7 +70,7 @@ namespace StructStrategyFactory { return(nullptr); return(res->second); } - + }; diff --git a/common/StructStrategy.h b/common/StructStrategy.h index b504db6a5..224c1e31d 100644 --- a/common/StructStrategy.h +++ b/common/StructStrategy.h @@ -14,18 +14,18 @@ public: typedef void (*Encoder)(EQApplicationPacket **p, EQStream *dest, bool ack_req); //the decoder may only edit the supplied packet, producing a single packet for eqemu to consume. typedef void (*Decoder)(EQApplicationPacket *p); - + StructStrategy(); virtual ~StructStrategy() {} - + //this method takes an eqemu struct, and enqueues the produced structs into the stream. void Encode(EQApplicationPacket **p, EQStream *dest, bool ack_req) const; //this method takes an EQ wire struct, and converts it into an eqemu struct void Decode(EQApplicationPacket *p) const; - + virtual std::string Describe() const = 0; virtual const EQClientVersion ClientVersion() const = 0; - + protected: //some common coders: //Print an error saying unknown struct/opcode and drop it @@ -34,7 +34,7 @@ protected: //pass the packet through without modification (emu == EQ) (default) static void PassEncoder(EQApplicationPacket **p, EQStream *dest, bool ack_req); static void PassDecoder(EQApplicationPacket *p); - + Encoder encoders[_maxEmuOpcode]; Decoder decoders[_maxEmuOpcode]; }; @@ -42,7 +42,7 @@ protected: //effectively a singleton, but I decided to do it this way for no apparent reason. namespace StructStrategyFactory { void RegisterPatch(EmuOpcode first_opcode, const StructStrategy *structs); - + //does NOT return ownership of the strategy. const StructStrategy *FindPatch(EmuOpcode first_opcode); }; diff --git a/common/TCPConnection.cpp b/common/TCPConnection.cpp index c4a4f79b3..a1a96ac09 100644 --- a/common/TCPConnection.cpp +++ b/common/TCPConnection.cpp @@ -490,7 +490,7 @@ bool TCPConnection::ConnectIP(uint32 in_ip, uint16 in_port, char* errbuf) { SetEcho(false); ClearBuffers(); - + rIP = in_ip; rPort = in_port; SetState(TCPS_Connected); @@ -504,7 +504,7 @@ void TCPConnection::ClearBuffers() { LockMutex lock4(&MState); safe_delete_array(recvbuf); safe_delete_array(sendbuf); - + char* line = 0; while ((line = LineOutQueue.pop())) safe_delete_array(line); @@ -520,7 +520,7 @@ bool TCPConnection::CheckNetActive() { return false; } -/* This is always called from an IO thread. Either the server socket's thread, or a +/* This is always called from an IO thread. Either the server socket's thread, or a * special thread we create when we make an outbound connection. */ bool TCPConnection::Process() { char errbuf[TCPConnection_ErrorBufferSize]; @@ -535,7 +535,7 @@ bool TCPConnection::Process() { } } return(true); - + case TCPS_Connected: // only receive data in the connected state, no others... if (!RecvData(errbuf)) { @@ -546,7 +546,7 @@ bool TCPConnection::Process() { } /* we break to do the send */ break; - + case TCPS_Disconnecting: { //waiting for any sending data to go out... MSendQueue.lock(); @@ -562,7 +562,7 @@ bool TCPConnection::Process() { MSendQueue.unlock(); } /* Fallthrough */ - + case TCPS_Disconnected: FinishDisconnect(); MRunLoop.lock(); @@ -570,19 +570,19 @@ bool TCPConnection::Process() { MRunLoop.unlock(); // SetState(TCPS_Ready); //reset the state in case they want to use it again... return(false); - + case TCPS_Closing: //I dont understand this state... - + case TCPS_Error: MRunLoop.lock(); pRunLoop = false; MRunLoop.unlock(); return(false); } - + /* we get here in connected or disconnecting with more data to send */ - + bool sent_something = false; if (!SendData(sent_something, errbuf)) { struct in_addr in; @@ -590,7 +590,7 @@ bool TCPConnection::Process() { cout << inet_ntoa(in) << ":" << GetrPort() << ": " << errbuf << endl; return false; } - + return true; } @@ -770,15 +770,15 @@ bool TCPConnection::ProcessReceivedData(char* errbuf) { i = -1; m_previousLineEnd = true; } - - + + if(line != nullptr) { bool finish_proc = false; finish_proc = LineOutQueuePush(line); if(finish_proc) return(true); //break early as requested by LineOutQueuePush } - + break; } case 8: // backspace @@ -877,13 +877,13 @@ bool TCPConnection::SendData(bool &sent_something, char* errbuf) { snprintf(errbuf, TCPConnection_ErrorBufferSize, "TCPConnection::SendData(): send(): Errorcode: %s", strerror(errno)); #endif } - + //if we get an error while disconnecting, just jump to disconnected MState.lock(); if(pState == TCPS_Disconnecting) pState = TCPS_Disconnected; MState.unlock(); - + return false; } } @@ -908,7 +908,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { if (!tcpc->ConnectReady()) { _CP(TCPConnectionLoop); if (!tcpc->Process()) { - //the processing loop has detecting an error.. + //the processing loop has detecting an error.. //we want to drop the link immediately, so we clear buffers too. tcpc->ClearBuffers(); tcpc->Disconnect(); @@ -927,11 +927,11 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { Sleep(10); //nothing to do. } tcpc->MLoopRunning.unlock(); - + #ifndef WIN32 _log(COMMON__THREADS, "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif - + THREAD_RETURN(nullptr); } diff --git a/common/TCPConnection.h b/common/TCPConnection.h index d2f942c5e..1078d58db 100644 --- a/common/TCPConnection.h +++ b/common/TCPConnection.h @@ -75,15 +75,15 @@ protected: TCPS_Closing = 250, TCPS_Error = 255 } State_t; - + public: //socket created by a server (incoming) TCPConnection(uint32 ID, SOCKET iSock, uint32 irIP, uint16 irPort); //socket created to connect to a server (outgoing) TCPConnection(); // for outgoing connections - + virtual ~TCPConnection(); - + // Functions for outgoing connections bool Connect(const char* irAddress, uint16 irPort, char* errbuf = 0); virtual bool ConnectIP(uint32 irIP, uint16 irPort, char* errbuf = 0); @@ -92,7 +92,7 @@ public: virtual void Disconnect(); bool Send(const uchar* data, int32 size); - + char* PopLine(); //returns ownership of allocated byte array inline uint32 GetrIP() const { return rIP; } inline uint16 GetrPort() const { return rPort; } @@ -106,7 +106,7 @@ public: bool GetEcho(); void SetEcho(bool iValue); bool GetSockName(char *host, uint16 *port); - + //should only be used by TCPServer: bool CheckNetActive(); inline bool IsFree() const { return pFree; } @@ -129,10 +129,10 @@ protected: virtual bool ProcessReceivedData(char* errbuf = 0); virtual bool SendData(bool &sent_something, char* errbuf = 0); virtual bool RecvData(char* errbuf = 0); - + virtual void ClearBuffers(); - + bool m_previousLineEnd; eConnectionType ConnectionType; @@ -144,22 +144,22 @@ protected: uint32 rIP; uint16 rPort; // host byte order bool pFree; - + mutable Mutex MState; State_t pState; - + //text based line out queue. Mutex MLineOutQueue; virtual bool LineOutQueuePush(char* line); //this is really kinda a hack for the transition to packet mode. Returns true to stop processing the output. MyQueue LineOutQueue; - + uchar* recvbuf; int32 recvbuf_size; int32 recvbuf_used; - + int32 recvbuf_echo; volatile bool pEcho; - + Mutex MSendQueue; uchar* sendbuf; int32 sendbuf_size; @@ -169,7 +169,7 @@ protected: void ServerSendQueuePushEnd(const uchar* data, int32 size); void ServerSendQueuePushEnd(uchar** data, int32 size); void ServerSendQueuePushFront(uchar* data, int32 size); - + private: void FinishDisconnect(); }; diff --git a/common/TCPServer.cpp b/common/TCPServer.cpp index 175dc0b3b..5abb591b7 100644 --- a/common/TCPServer.cpp +++ b/common/TCPServer.cpp @@ -70,11 +70,11 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { THREAD_RETURN(nullptr); } BaseTCPServer* tcps = (BaseTCPServer*) tmp; - + #ifndef WIN32 _log(COMMON__THREADS, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif - + tcps->MLoopRunning.lock(); while (tcps->RunLoop()) { _CP(BaseTCPServerLoop); @@ -82,11 +82,11 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->Process(); } tcps->MLoopRunning.unlock(); - + #ifndef WIN32 _log(COMMON__THREADS, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif - + THREAD_RETURN(nullptr); } @@ -100,7 +100,7 @@ void BaseTCPServer::ListenNewConnections() { struct in_addr in; unsigned int fromlen; unsigned short port; - + from.sin_family = AF_INET; fromlen = sizeof(from); LockMutex lock(&MSock); @@ -124,7 +124,7 @@ void BaseTCPServer::ListenNewConnections() { setsockopt(tmpsock, SOL_SOCKET, SO_RCVBUF, (char*) &bufsize, sizeof(bufsize)); port = from.sin_port; in.s_addr = from.sin_addr.s_addr; - + // New TCP connection, this must consume the socket. CreateNewConnection(GetNextID(), tmpsock, in.s_addr, ntohs(from.sin_port)); } @@ -151,7 +151,7 @@ bool BaseTCPServer::Open(uint16 in_port, char* errbuf) { #endif int reuse_addr = 1; -// Setup internet address information. +// Setup internet address information. // This is used with the bind() call memset((char *) &address, 0, sizeof(address)); address.sin_family = AF_INET; @@ -211,7 +211,7 @@ bool BaseTCPServer::Open(uint16 in_port, char* errbuf) { void BaseTCPServer::Close() { StopLoopAndWait(); - + LockMutex lock(&MSock); if (sock) { #ifdef _WINDOWS diff --git a/common/TCPServer.h b/common/TCPServer.h index 2a5b95ad3..2ed2e24de 100644 --- a/common/TCPServer.h +++ b/common/TCPServer.h @@ -22,17 +22,17 @@ public: protected: static ThreadReturnType TCPServerLoop(void* tmp); - + //factory method: virtual void CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort) = 0; - - + + virtual void Process(); bool RunLoop(); Mutex MLoopRunning; - + void StopLoopAndWait(); - + void ListenNewConnections(); uint32 NextID; @@ -55,10 +55,10 @@ public: TCPServer(uint16 iPort = 0) : BaseTCPServer(iPort) { } - + virtual ~TCPServer() { StopLoopAndWait(); - + //im not sure what the right thing to do here is... //we are freeing a connection which somebody likely has a pointer to.. //but, we really shouldent ever get called anyhow.. @@ -69,7 +69,7 @@ public: delete *cur; } } - + T * NewQueuePop() { T * ret = nullptr; MNewQueue.lock(); @@ -80,11 +80,11 @@ public: MNewQueue.unlock(); return ret; } - + protected: virtual void Process() { BaseTCPServer::Process(); - + vitr cur; cur = m_list.begin(); while(cur != m_list.end()) { @@ -102,18 +102,18 @@ protected: } } } - + void AddConnection(T *con) { m_list.push_back(con); MNewQueue.lock(); m_NewQueue.push(con); MNewQueue.unlock(); } - + //queue of new connections, for the app to pull from Mutex MNewQueue; std::queue m_NewQueue; - + vstore m_list; }; diff --git a/common/XMLParser.cpp b/common/XMLParser.cpp index 481dbf81f..0b56b6b47 100644 --- a/common/XMLParser.cpp +++ b/common/XMLParser.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -29,7 +29,7 @@ bool XMLParser::ParseFile(const char *file, const char *root_ele) { printf("Unable to load '%s': %s\n", file, doc.ErrorDesc()); return(false); } - + TiXmlElement *root = doc.FirstChildElement( root_ele ); if(root == nullptr) { printf("Unable to find root '%s' in %s\n",root_ele, file); @@ -37,7 +37,7 @@ bool XMLParser::ParseFile(const char *file, const char *root_ele) { } ParseOkay=true; - + TiXmlNode *main_element = nullptr; while( (main_element = root->IterateChildren( main_element )) ) { if(main_element->Type() != TiXmlNode::ELEMENT) @@ -47,25 +47,25 @@ bool XMLParser::ParseFile(const char *file, const char *root_ele) { handler=Handlers.find(ele->Value()); if (handler!=Handlers.end() && handler->second) { ElementHandler h=handler->second; - + /* - * + * * This is kinda a sketchy operation here, since all of these * element handler methods will be functions in child classes. * This essentially causes us to do an un-checkable (and hence * un-handle-properly-able) cast down to the child class. This * WILL BREAK if any children classes do multiple inheritance. - * - * + * + * */ - + (this->*h)(ele); } else { //unhandled element.... do nothing for now } - + } - + return(ParseOkay); } diff --git a/common/XMLParser.h b/common/XMLParser.h index 37e1bb915..54f7d09ee 100644 --- a/common/XMLParser.h +++ b/common/XMLParser.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -34,13 +34,13 @@ using namespace std; class XMLParser { public: typedef void (XMLParser::*ElementHandler)(TiXmlElement *ele); - + XMLParser(); virtual ~XMLParser() {} - + bool ParseFile(const char *file, const char *root_ele); bool ParseStatus() const { return ParseOkay; } - + protected: const char *ParseTextBlock(TiXmlNode *within, const char *name, bool optional = false); const char *GetText(TiXmlNode *within, bool optional = false); @@ -48,7 +48,7 @@ protected: map Handlers; bool ParseOkay; - + }; diff --git a/common/bodytypes.h b/common/bodytypes.h index f3e49a0b4..5975ed54d 100644 --- a/common/bodytypes.h +++ b/common/bodytypes.h @@ -25,7 +25,7 @@ typedef enum { BT_Giant = 4, BT_Construct = 5, BT_Extraplanar = 6, - BT_Magical = 7, //this name might be a bit off, + BT_Magical = 7, //this name might be a bit off, BT_SummonedUndead = 8, BT_RaidGiant = 9, // ... diff --git a/common/breakdowns.h b/common/breakdowns.h index dccf6e2f6..5e56b1e9b 100644 --- a/common/breakdowns.h +++ b/common/breakdowns.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/common/classes.cpp b/common/classes.cpp index a632c8889..98ad290c3 100644 --- a/common/classes.cpp +++ b/common/classes.cpp @@ -20,226 +20,226 @@ const char* GetEQClassName(uint8 class_, uint8 level) { switch(class_) { - case WARRIOR: - if (level >= 70) - return "Vanquisher"; - else if (level >= 65) + case WARRIOR: + if (level >= 70) + return "Vanquisher"; + else if (level >= 65) return "Overlord"; //Baron-Sprite: LEAVE MY CLASSES ALONE. - else if (level >= 60) - return "Warlord"; - else if (level >= 55) - return "Myrmidon"; - else if (level >= 51) - return "Champion"; - else - return "Warrior"; + else if (level >= 60) + return "Warlord"; + else if (level >= 55) + return "Myrmidon"; + else if (level >= 51) + return "Champion"; + else + return "Warrior"; case CLERIC: - if (level >= 70) - return "Prelate"; - else if (level >= 65) - return "Archon"; - else if (level >= 60) - return "High Priest"; - else if (level >= 55) - return "Templar"; - else if (level >= 51) - return "Vicar"; - else - return "Cleric"; - case PALADIN: - if (level >= 70) - return "Lord"; - else if (level >= 65) - return "Lord Protector"; - else if (level >= 60) - return "Crusader"; - else if (level >= 55) - return "Knight"; - else if (level >= 51) - return "Cavalier"; - else - return "Paladin"; + if (level >= 70) + return "Prelate"; + else if (level >= 65) + return "Archon"; + else if (level >= 60) + return "High Priest"; + else if (level >= 55) + return "Templar"; + else if (level >= 51) + return "Vicar"; + else + return "Cleric"; + case PALADIN: + if (level >= 70) + return "Lord"; + else if (level >= 65) + return "Lord Protector"; + else if (level >= 60) + return "Crusader"; + else if (level >= 55) + return "Knight"; + else if (level >= 51) + return "Cavalier"; + else + return "Paladin"; case RANGER: - if (level >= 70) - return "Plainswalker"; - else if (level >= 65) - return "Forest Stalker"; - else if (level >= 60) - return "Warder"; - else if (level >= 55) - return "Outrider"; - else if (level >= 51) - return "Pathfinder"; - else - return "Ranger"; + if (level >= 70) + return "Plainswalker"; + else if (level >= 65) + return "Forest Stalker"; + else if (level >= 60) + return "Warder"; + else if (level >= 55) + return "Outrider"; + else if (level >= 51) + return "Pathfinder"; + else + return "Ranger"; case SHADOWKNIGHT: - if (level >= 70) - return "Scourge Knight"; - else if (level >= 65) - return "Dread Lord"; - else if (level >= 60) - return "Grave Lord"; - else if (level >= 55) - return "Revenant"; - else if (level >= 51) - return "Reaver"; - else - return "Shadowknight"; + if (level >= 70) + return "Scourge Knight"; + else if (level >= 65) + return "Dread Lord"; + else if (level >= 60) + return "Grave Lord"; + else if (level >= 55) + return "Revenant"; + else if (level >= 51) + return "Reaver"; + else + return "Shadowknight"; case DRUID: - if (level >= 70) - return "Natureguard"; - else if (level >= 65) - return "Storm Warden"; - else if (level >= 60) - return "Hierophant"; - else if (level >= 55) - return "Preserver"; - else if (level >= 51) - return "Wanderer"; - else - return "Druid"; + if (level >= 70) + return "Natureguard"; + else if (level >= 65) + return "Storm Warden"; + else if (level >= 60) + return "Hierophant"; + else if (level >= 55) + return "Preserver"; + else if (level >= 51) + return "Wanderer"; + else + return "Druid"; case MONK: - if (level >= 70) - return "Stone Fist"; - else if (level >= 65) - return "Transcendent"; - else if (level >= 60) - return "Grandmaster"; - else if (level >= 55) - return "Master"; - else if (level >= 51) - return "Disciple"; - else - return "Monk"; - case BARD: - if (level >= 70) + if (level >= 70) + return "Stone Fist"; + else if (level >= 65) + return "Transcendent"; + else if (level >= 60) + return "Grandmaster"; + else if (level >= 55) + return "Master"; + else if (level >= 51) + return "Disciple"; + else + return "Monk"; + case BARD: + if (level >= 70) return "Performer"; - else if (level >= 65) - return "Maestro"; - else if (level >= 60) - return "Virtuoso"; - else if (level >= 55) - return "Troubadour"; - else if (level >= 51) - return "Minstrel"; - else - return "Bard"; - case ROGUE: - if (level >= 70) - return "Nemesis"; - else if (level >= 65) - return "Deceiver"; - else if (level >= 60) - return "Assassin"; - else if (level >= 55) - return "Blackguard"; - else if (level >= 51) - return "Rake"; - else - return "Rogue"; - case SHAMAN: - if (level >= 70) + else if (level >= 65) + return "Maestro"; + else if (level >= 60) + return "Virtuoso"; + else if (level >= 55) + return "Troubadour"; + else if (level >= 51) + return "Minstrel"; + else + return "Bard"; + case ROGUE: + if (level >= 70) + return "Nemesis"; + else if (level >= 65) + return "Deceiver"; + else if (level >= 60) + return "Assassin"; + else if (level >= 55) + return "Blackguard"; + else if (level >= 51) + return "Rake"; + else + return "Rogue"; + case SHAMAN: + if (level >= 70) return "Soothsayer"; - else if (level >= 65) - return "Prophet"; - else if (level >= 60) - return "Oracle"; - else if (level >= 55) - return "Luminary"; - else if (level >= 51) - return "Mystic"; - else - return "Shaman"; - case NECROMANCER: - if (level >= 70) - return "Wraith"; - else if (level >= 65) - return "Arch Lich"; - else if (level >= 60) - return "Warlock"; - else if (level >= 55) - return "Defiler"; - else if (level >= 51) - return "Heretic"; - else - return "Necromancer"; - case WIZARD: - if (level >= 70) - return "Grand Arcanist"; - else if (level >= 65) - return "Arcanist"; - else if (level >= 60) - return "Sorcerer"; - else if (level >= 55) - return "Evoker"; - else if (level >= 51) - return "Channeler"; - else - return "Wizard"; - case MAGICIAN: - if (level >= 70) - return "Arch Magus"; - else if (level >= 65) - return "Arch Convoker"; - else if (level >= 60) - return "Arch Mage"; - else if (level >= 55) - return "Conjurer"; - if (level >= 51) - return "Elementalist"; - else - return "Magician"; - case ENCHANTER: - if (level >= 70) - return "Bedazzler"; - else if (level >= 65) - return "Coercer"; - else if (level >= 60) - return "Phantasmist"; - else if (level >= 55) - return "Beguiler"; - else if (level >= 51) - return "Illusionist"; - else - return "Enchanter"; - case BEASTLORD: - if (level >= 70) - return "Wildblood"; - else if (level >= 65) - return "Feral Lord"; - else if (level >= 60) - return "Savage Lord"; - else if (level >= 55) - return "Animist"; - else if (level >= 51) - return "Primalist"; - else - return "Beastlord"; - case BERSERKER: - if (level >= 70) - return "Ravager"; - else if (level >= 65) - return "Fury"; - else if (level >= 60) - return "Rager"; - else if (level >= 55) - return "Vehement"; - else if (level >= 51) - return "Brawler"; - else - return "Berserker"; - case BANKER: - if (level >= 70) - return "Master Banker"; - else if (level >= 65) - return "Elder Banker"; - else if (level >= 60) - return "Oldest Banker"; - else if (level >= 55) - return "Older Banker"; - else if (level >= 51) - return "Old Banker"; - else + else if (level >= 65) + return "Prophet"; + else if (level >= 60) + return "Oracle"; + else if (level >= 55) + return "Luminary"; + else if (level >= 51) + return "Mystic"; + else + return "Shaman"; + case NECROMANCER: + if (level >= 70) + return "Wraith"; + else if (level >= 65) + return "Arch Lich"; + else if (level >= 60) + return "Warlock"; + else if (level >= 55) + return "Defiler"; + else if (level >= 51) + return "Heretic"; + else + return "Necromancer"; + case WIZARD: + if (level >= 70) + return "Grand Arcanist"; + else if (level >= 65) + return "Arcanist"; + else if (level >= 60) + return "Sorcerer"; + else if (level >= 55) + return "Evoker"; + else if (level >= 51) + return "Channeler"; + else + return "Wizard"; + case MAGICIAN: + if (level >= 70) + return "Arch Magus"; + else if (level >= 65) + return "Arch Convoker"; + else if (level >= 60) + return "Arch Mage"; + else if (level >= 55) + return "Conjurer"; + if (level >= 51) + return "Elementalist"; + else + return "Magician"; + case ENCHANTER: + if (level >= 70) + return "Bedazzler"; + else if (level >= 65) + return "Coercer"; + else if (level >= 60) + return "Phantasmist"; + else if (level >= 55) + return "Beguiler"; + else if (level >= 51) + return "Illusionist"; + else + return "Enchanter"; + case BEASTLORD: + if (level >= 70) + return "Wildblood"; + else if (level >= 65) + return "Feral Lord"; + else if (level >= 60) + return "Savage Lord"; + else if (level >= 55) + return "Animist"; + else if (level >= 51) + return "Primalist"; + else + return "Beastlord"; + case BERSERKER: + if (level >= 70) + return "Ravager"; + else if (level >= 65) + return "Fury"; + else if (level >= 60) + return "Rager"; + else if (level >= 55) + return "Vehement"; + else if (level >= 51) + return "Brawler"; + else + return "Berserker"; + case BANKER: + if (level >= 70) + return "Master Banker"; + else if (level >= 65) + return "Elder Banker"; + else if (level >= 60) + return "Oldest Banker"; + else if (level >= 55) + return "Older Banker"; + else if (level >= 51) + return "Old Banker"; + else return "Banker"; case WARRIORGM: return "Warrior Guildmaster"; diff --git a/common/classes.h b/common/classes.h index a6072e1ba..6b9803b6d 100644 --- a/common/classes.h +++ b/common/classes.h @@ -37,23 +37,23 @@ #define BEASTLORD 15 #define BERSERKER 16 #define PLAYER_CLASS_COUNT 16 // used for array defines, must be the count of playable classes -#define WARRIORGM 20 -#define CLERICGM 21 -#define PALADINGM 22 -#define RANGERGM 23 -#define SHADOWKNIGHTGM 24 -#define DRUIDGM 25 -#define MONKGM 26 -#define BARDGM 27 -#define ROGUEGM 28 -#define SHAMANGM 29 -#define NECROMANCERGM 30 -#define WIZARDGM 31 -#define MAGICIANGM 32 -#define ENCHANTERGM 33 +#define WARRIORGM 20 +#define CLERICGM 21 +#define PALADINGM 22 +#define RANGERGM 23 +#define SHADOWKNIGHTGM 24 +#define DRUIDGM 25 +#define MONKGM 26 +#define BARDGM 27 +#define ROGUEGM 28 +#define SHAMANGM 29 +#define NECROMANCERGM 30 +#define WIZARDGM 31 +#define MAGICIANGM 32 +#define ENCHANTERGM 33 #define BEASTLORDGM 34 #define BERSERKERGM 35 -#define BANKER 40 +#define BANKER 40 #define MERCHANT 41 #define DISCORD_MERCHANT 59 #define ADVENTURERECRUITER 60 diff --git a/common/common_profile.h b/common/common_profile.h index 034a59d63..2ecc37020 100644 --- a/common/common_profile.h +++ b/common/common_profile.h @@ -45,41 +45,41 @@ public: Database_DBLoadItems, Database_GetWaypoints, Database_DBLoadNPCFactionLists, - + DBcore_RunQuery, - + DBAsync_ProcessWork, DBAsync_DispatchWork, DBAsyncLoop_loop, - + EQStreamServer_Process, - + EQStream_Process, - + EQStreamServerLoop, EQStreamInLoop, EQStreamOutLoop, TCPServerLoop, TCPConnectionLoop, - + Inventory_GetItem, Inventory_HasItem, - + BaseTCPServerLoop, MakeRandomInt, MakeRandomFloat, - + Mutex_lock, Timer_Check, - + WorldConnection_Process, - + MaxCommonProfilerId }; - + inline CommonProfiler() : GeneralProfiler(MaxCommonProfilerId) { } - + }; extern CommonProfiler _cp; diff --git a/common/crash.cpp b/common/crash.cpp index 44c05f50f..6d8e92a8b 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -9,7 +9,7 @@ class EQEmuStackWalker : public StackWalker public: EQEmuStackWalker() : StackWalker() { } EQEmuStackWalker(DWORD dwProcessId, HANDLE hProcess) : StackWalker(dwProcessId, hProcess) { } - virtual void OnOutput(LPCSTR szText) { + virtual void OnOutput(LPCSTR szText) { char buffer[4096]; for(int i = 0; i < 4096; ++i) { if(szText[i] == 0) { @@ -24,8 +24,8 @@ public: } } - LogFile->write(EQEMuLog::Crash, buffer); - StackWalker::OnOutput(szText); + LogFile->write(EQEMuLog::Crash, buffer); + StackWalker::OnOutput(szText); } }; @@ -97,12 +97,12 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) LogFile->write(EQEMuLog::Crash, "Unknown Exception"); break; } - + if(EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode) { EQEmuStackWalker sw; sw.ShowCallstack(GetCurrentThread(), ExceptionInfo->ContextRecord); - } - + } + return EXCEPTION_EXECUTE_HANDLER; } diff --git a/common/crc32.cpp b/common/crc32.cpp index d5dd48e78..b28d2cd83 100644 --- a/common/crc32.cpp +++ b/common/crc32.cpp @@ -85,9 +85,9 @@ void CRC32::SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at) { unsigned long data; unsigned long check = 0xffffffff; - + assert(in_length >= start_at && in_data); - + for(uint32 i=start_at; i 0) + if (mysql_num_rows(result) > 0) { row = mysql_fetch_row(result); peqzone = atoi(row[0]); @@ -1425,7 +1425,7 @@ uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){ return peqzone; } -bool Database::CheckNameFilter(const char* name, bool surname) +bool Database::CheckNameFilter(const char* name, bool surname) { std::string str_name = name; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -2257,7 +2257,7 @@ uint32 Database::GetRaidID(const char* name){ MYSQL_RES *result; MYSQL_ROW row; uint32 raidid=0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT raidid from raid_members where name='%s'", name), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT raidid from raid_members where name='%s'", name), errbuf, &result)) { if((row = mysql_fetch_row(result))) { @@ -2282,8 +2282,8 @@ const char *Database::GetRaidLeaderName(uint32 rid) char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - - if (RunQuery(query, MakeAnyLenString(&query, "SELECT name FROM raid_members WHERE raidid=%u AND israidleader=1", + + if (RunQuery(query, MakeAnyLenString(&query, "SELECT name FROM raid_members WHERE raidid=%u AND israidleader=1", rid), errbuf, &result)) { if((row = mysql_fetch_row(result)) != nullptr) { @@ -2326,11 +2326,11 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id) char *query = 0; MYSQL_RES *result; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_lockout where id=%u AND zone=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_lockout where id=%u AND zone=%u", instance_id, zone_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { mysql_free_result(result); return true; @@ -2341,7 +2341,7 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id) return false; } } - else + else { safe_delete_array(query); return false; @@ -2356,17 +2356,17 @@ bool Database::CharacterInInstanceGroup(uint16 instance_id, uint32 char_id) MYSQL_RES *result; bool lockout_instance_player = false; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM instance_lockout_player where id=%u AND charid=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM instance_lockout_player where id=%u AND charid=%u", instance_id, char_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) == 1) + if (mysql_num_rows(result) == 1) { lockout_instance_player = true; } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -2402,11 +2402,11 @@ bool Database::CheckInstanceExpired(uint16 instance_id) int32 start_time = 0; int32 duration = 0; uint32 never_expires = 0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); start_time = atoi(row[0]); @@ -2420,7 +2420,7 @@ bool Database::CheckInstanceExpired(uint16 instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); return true; @@ -2448,16 +2448,16 @@ uint32 Database::ZoneIDFromInstanceID(uint16 instance_id) MYSQL_ROW row; uint32 ret; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT zone FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT zone FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2465,7 +2465,7 @@ uint32 Database::ZoneIDFromInstanceID(uint16 instance_id) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2481,16 +2481,16 @@ uint32 Database::VersionFromInstanceID(uint16 instance_id) MYSQL_ROW row; uint32 ret; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2498,7 +2498,7 @@ uint32 Database::VersionFromInstanceID(uint16 instance_id) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2516,11 +2516,11 @@ uint32 Database::GetTimeRemainingInstance(uint16 instance_id, bool &is_perma) uint32 duration = 0; uint32 never_expires = 0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); start_time = atoi(row[0]); @@ -2535,7 +2535,7 @@ uint32 Database::GetTimeRemainingInstance(uint16 instance_id, bool &is_perma) } mysql_free_result(result); } - else + else { safe_delete_array(query); is_perma = false; @@ -2567,7 +2567,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) if (RunQuery(query, MakeAnyLenString(&query, "SELECT COUNT(*) FROM instance_lockout"), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); int count = atoi(row[0]); @@ -2584,7 +2584,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); instance_id = 0; @@ -2597,7 +2597,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_lockout where id >= %i ORDER BY id", count), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { while((row = mysql_fetch_row(result))) { @@ -2624,7 +2624,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) mysql_free_result(result); } } - else + else { safe_delete_array(query); } @@ -2638,13 +2638,13 @@ bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if(RunQuery(query, MakeAnyLenString(&query, "INSERT INTO instance_lockout (id, zone, version, start_time, duration)" + if(RunQuery(query, MakeAnyLenString(&query, "INSERT INTO instance_lockout (id, zone, version, start_time, duration)" " values(%lu, %lu, %lu, UNIX_TIMESTAMP(), %lu)", (unsigned long)instance_id, (unsigned long)zone_id, (unsigned long)version, (unsigned long)duration), errbuf)) { safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2663,7 +2663,7 @@ void Database::PurgeExpiredInstances() "(start_time+duration) <= UNIX_TIMESTAMP() and never_expires = 0"), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) > 0) + if (mysql_num_rows(result) > 0) { row = mysql_fetch_row(result); while(row != nullptr) @@ -2675,7 +2675,7 @@ void Database::PurgeExpiredInstances() } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -2692,7 +2692,7 @@ bool Database::AddClientToInstance(uint16 instance_id, uint32 char_id) safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2704,13 +2704,13 @@ bool Database::RemoveClientFromInstance(uint16 instance_id, uint32 char_id) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu AND charid=%lu", + if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu AND charid=%lu", (unsigned long)instance_id, (unsigned long)char_id), errbuf)) { safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2722,13 +2722,13 @@ bool Database::RemoveClientsFromInstance(uint16 instance_id) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu", + if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu", (unsigned long)instance_id), errbuf)) { safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2741,11 +2741,11 @@ bool Database::CheckInstanceExists(uint16 instance_id) char *query = 0; MYSQL_RES *result; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { mysql_free_result(result); return true; @@ -2753,7 +2753,7 @@ bool Database::CheckInstanceExists(uint16 instance_id) mysql_free_result(result); return false; } - else + else { safe_delete_array(query); return false; @@ -2767,7 +2767,7 @@ void Database::BuryCorpsesInInstance(uint16 instance_id) char *query = 0; MYSQL_RES *result; - if(RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried=1, instanceid=0 WHERE instanceid=%u", + if(RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried=1, instanceid=0 WHERE instanceid=%u", instance_id), errbuf, &result)) { mysql_free_result(result); @@ -2786,16 +2786,16 @@ uint16 Database::GetInstanceVersion(uint16 instance_id) MYSQL_ROW row; uint32 ret; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2803,7 +2803,7 @@ uint16 Database::GetInstanceVersion(uint16 instance_id) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2824,12 +2824,12 @@ uint16 Database::GetInstanceID(const char* zone, uint32 charid, int16 version) "instance_lockout_player.charid=%u LIMIT 1;", GetZoneID(zone), version, charid, charid), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2837,7 +2837,7 @@ uint16 Database::GetInstanceID(const char* zone, uint32 charid, int16 version) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2861,12 +2861,12 @@ uint16 Database::GetInstanceID(uint32 zone, uint32 charid, int16 version) "instance_lockout_player.charid=%u LIMIT 1;", zone, version, charid), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2874,7 +2874,7 @@ uint16 Database::GetInstanceID(uint32 zone, uint32 charid, int16 version) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2891,7 +2891,7 @@ void Database::AssignGroupToInstance(uint32 gid, uint32 instance_id) uint32 zone_id = ZoneIDFromInstanceID(instance_id); uint16 version = VersionFromInstanceID(instance_id); - if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM group_id WHERE groupid=%u", gid), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM group_id WHERE groupid=%u", gid), errbuf, &result)) { safe_delete_array(query); @@ -2905,7 +2905,7 @@ void Database::AssignGroupToInstance(uint32 gid, uint32 instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -2920,7 +2920,7 @@ void Database::AssignRaidToInstance(uint32 rid, uint32 instance_id) uint32 zone_id = ZoneIDFromInstanceID(instance_id); uint16 version = VersionFromInstanceID(instance_id); - if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM raid_members WHERE raidid=%u", rid), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM raid_members WHERE raidid=%u", rid), errbuf, &result)) { safe_delete_array(query); @@ -2934,7 +2934,7 @@ void Database::AssignRaidToInstance(uint32 rid, uint32 instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -3012,7 +3012,7 @@ bool Database::GlobalInstance(uint16 instance_id) return false; } } - else + else { safe_delete_array(query); return false; @@ -3125,7 +3125,7 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win) } } -bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, +bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l) { char errbuf[MYSQL_ERRMSG_SIZE]; @@ -3134,7 +3134,7 @@ bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, u MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, " - "`guk_losses`, `mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u", + "`guk_losses`, `mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u", char_id), errbuf, &result)) { safe_delete_array(query); @@ -3154,7 +3154,7 @@ bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, u mysql_free_result(result); return true; } - else + else { safe_delete_array(query); return false; diff --git a/common/database.h b/common/database.h index f494484e0..fd05a7033 100644 --- a/common/database.h +++ b/common/database.h @@ -76,7 +76,7 @@ EventLogDetails_Struct eld[255]; }; -// Added By Hogie +// Added By Hogie // INSERT into variables (varname,value) values('decaytime [minlevel] [maxlevel]','[number of seconds]'); // IE: decaytime 1 54 = Levels 1 through 54 // decaytime 55 100 = Levels 55 through 100 @@ -106,7 +106,7 @@ public: Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port); bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port); ~Database(); - + /* * General Character Related Stuff */ @@ -175,7 +175,7 @@ public: * Adventure related. */ void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win); - bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w, + bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l); /* @@ -194,7 +194,7 @@ public: bool GetLiveChar(uint32 account_id, char* cname); uint8 GetAgreementFlag(uint32 acctid); void SetAgreementFlag(uint32 acctid); - + /* * Groups */ @@ -202,7 +202,7 @@ public: void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false); void ClearGroup(uint32 gid = 0); char* GetGroupLeaderForLogin(const char* name,char* leaderbuf); - + void SetGroupLeaderName(uint32 gid, const char* name); char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr); @@ -224,7 +224,7 @@ public: bool LoadVariables(); uint32 LoadVariables_MQ(char** query); bool LoadVariables_result(MYSQL_RES* result); - + /* * General Queries */ @@ -243,22 +243,22 @@ public: bool LoadPTimers(uint32 charid, PTimerList &into); void ClearPTimers(uint32 charid); void ClearMerchantTemp(); - void SetLFP(uint32 CharID, bool LFP); + void SetLFP(uint32 CharID, bool LFP); void SetLFG(uint32 CharID, bool LFG); void SetFirstLogon(uint32 CharID, uint8 firstlogon); - void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon); + void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon); void AddReport(std::string who, std::string against, std::string lines); - + protected: void HandleMysqlError(uint32 errnum); - + private: void DBInitVars(); - + uint32 max_zonename; char** zonename_array; - + Mutex Mvarcache; uint32 varcache_max; VarCache_Struct** varcache_array; diff --git a/common/dbasync.cpp b/common/dbasync.cpp index 31e956180..ba13ab2f6 100644 --- a/common/dbasync.cpp +++ b/common/dbasync.cpp @@ -41,11 +41,11 @@ void AsyncLoadVariables(DBAsync *dba, Database *db) { //which will get signaled when somebody puts something on the queue ThreadReturnType DBAsyncLoop(void* tmp) { DBAsync* dba = (DBAsync*) tmp; - + #ifndef WIN32 _log(COMMON__THREADS, "Starting DBAsyncLoop with thread ID %d", pthread_self()); #endif - + dba->MLoopRunning.lock(); while (dba->RunLoop()) { //wait before working so we check the loop condition @@ -60,11 +60,11 @@ ThreadReturnType DBAsyncLoop(void* tmp) { // Sleep(ASYNC_LOOP_GRANULARITY); } dba->MLoopRunning.unlock(); - + #ifndef WIN32 _log(COMMON__THREADS, "Ending DBAsyncLoop with thread ID %d", pthread_self()); #endif - + THREAD_RETURN(nullptr); } @@ -92,14 +92,14 @@ bool DBAsync::StopThread() { ret = pRunLoop; pRunLoop = false; MRunLoop.unlock(); - + //signal the condition so we exit the loop if were waiting CInList.Signal(); - + //this effectively waits for the processing thread to finish MLoopRunning.lock(); MLoopRunning.unlock(); - + return ret; } @@ -120,10 +120,10 @@ uint32 DBAsync::AddWork(DBAsyncWork** iWork, uint32 iDelay) { #endif *iWork = 0; MInList.unlock(); - + //wake up the processing thread and tell it to get to work. CInList.Signal(); - + return ret; } @@ -268,7 +268,7 @@ void DBAsync::CheckTimeout() { MFQList.unlock(); } catch(...){ - + } } diff --git a/common/dbasync.h b/common/dbasync.h index d6db825df..f65f9cb58 100644 --- a/common/dbasync.h +++ b/common/dbasync.h @@ -31,10 +31,10 @@ protected: Condition CInList; bool RunLoop(); void Process(); - + private: virtual void CheckTimeout(); - + void ProcessWork(DBAsyncWork* iWork, bool iSleep = true); void DispatchWork(DBAsyncWork* iWork); inline uint32 GetNextID() { return pNextID++; } @@ -64,7 +64,7 @@ private: /* DB Work Complete Callback: - This will be called under the DBAsync thread! Never access any non-threadsafe + This will be called under the DBAsync thread! Never access any non-threadsafe data/functions/classes. (ie: zone, entitylist, client, etc are not threadsafe) Function prototype: return value: true if we should delete the data, false if we should keep it @@ -103,7 +103,7 @@ public: // Pops finished queries off the work DBAsyncQuery* PopAnswer(); uint32 QueryCount(); - + Database *GetDB() const { return(m_db); } bool CheckTimeout(uint32 iFQTimeout); diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 504843db0..57e754b31 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -190,7 +190,7 @@ bool DBcore::Open(uint32* errnum, char* errbuf) { /* Added CLIENT_FOUND_ROWS flag to the connect otherwise DB update calls would say 0 rows affected when the value already equalled - what the function was tring to set it to, therefore the function would think it failed + what the function was tring to set it to, therefore the function would think it failed */ uint32 flags = CLIENT_FOUND_ROWS; if (pCompress) diff --git a/common/dbcore.h b/common/dbcore.h index 2e2290f95..b43752c1f 100644 --- a/common/dbcore.h +++ b/common/dbcore.h @@ -26,7 +26,7 @@ public: uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen); void ping(); MYSQL* getMySQL(){ return &mysql; } - + protected: bool Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase, uint32 iPort, uint32* errnum = 0, char* errbuf = 0, bool iCompress = false, bool iSSL = false); private: diff --git a/common/dbmemshare.cpp b/common/dbmemshare.cpp index c8e917791..4b7fc3cd4 100644 --- a/common/dbmemshare.cpp +++ b/common/dbmemshare.cpp @@ -29,7 +29,7 @@ int32 Database::GetDoorsCount(uint32* oMaxID) { delete[] query; return -1; } - + return -1; } diff --git a/common/debug.cpp b/common/debug.cpp index ebeed542f..d621d2854 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -140,7 +140,7 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) { time_t aclock; struct tm *newtime; - + time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ @@ -210,7 +210,7 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list time_t aclock; struct tm *newtime; - + time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ @@ -273,7 +273,7 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { time_t aclock; struct tm *newtime; - + time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ @@ -347,7 +347,7 @@ bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 ski LockMutex lock(&MLog[id]); if (!logFileValid) return false; //check again for threading race reasons (to avoid two mutexes) - + write(id, "Dumping Packet: %i", size); // Output as HEX int j = 0; char* ascii = new char[cols+1]; memset(ascii, 0, cols+1); @@ -382,7 +382,7 @@ bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 ski safe_delete_array(ascii); return true; } - + void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) { if (!logFileValid) return; diff --git a/common/debug.h b/common/debug.h index 62641f53a..43a4a9833 100644 --- a/common/debug.h +++ b/common/debug.h @@ -106,19 +106,19 @@ public: Crash, MaxLogID }; - + //these are callbacks called for each typedef void (* msgCallbackBuf)(LogIDs id, const char *buf, uint8 size, uint32 count); typedef void (* msgCallbackFmt)(LogIDs id, const char *fmt, va_list ap); typedef void (* msgCallbackPva)(LogIDs id, const char *prefix, const char *fmt, va_list ap); - + void SetAllCallbacks(msgCallbackFmt proc); void SetAllCallbacks(msgCallbackBuf proc); void SetAllCallbacks(msgCallbackPva proc); void SetCallback(LogIDs id, msgCallbackFmt proc); void SetCallback(LogIDs id, msgCallbackBuf proc); void SetCallback(LogIDs id, msgCallbackPva proc); - + bool writebuf(LogIDs id, const char *buf, uint8 size, uint32 count); bool write(LogIDs id, const char *fmt, ...); bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); @@ -137,7 +137,7 @@ private: 8 = use stderr instead (2 must be set) */ uint8 pLogStatus[MaxLogID]; - + msgCallbackFmt logCallbackFmt[MaxLogID]; msgCallbackBuf logCallbackBuf[MaxLogID]; msgCallbackPva logCallbackPva[MaxLogID]; diff --git a/common/deity.h b/common/deity.h index beff69134..bb9e1bf1d 100644 --- a/common/deity.h +++ b/common/deity.h @@ -18,7 +18,7 @@ #ifndef DEITY_H #define DEITY_H -/* +/* ** Diety List */ #define DEITY_AGNOSTIC 396 //drop the high bit for 140 @@ -37,7 +37,7 @@ #define DEITY_TUNARE 215 //Guessed: -#define DEITY_BERTOX 201 +#define DEITY_BERTOX 201 #define DEITY_RODCET 212 #define DEITY_VEESHAN 216 diff --git a/common/emu_opcodes.cpp b/common/emu_opcodes.cpp index 6075e7d86..90dea14f6 100644 --- a/common/emu_opcodes.cpp +++ b/common/emu_opcodes.cpp @@ -21,13 +21,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA const char *OpcodeNames[_maxEmuOpcode+1] = { "OP_Unknown", - + //a preprocessor hack so we dont have to maintain two lists #define N(x) #x #include "emu_oplist.h" #include "mail_oplist.h" #undef N - + "" }; diff --git a/common/emu_oplist.h b/common/emu_oplist.h index 4b7357efe..bd83a6f30 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -413,7 +413,7 @@ N(OP_PetBuffWindow), N(OP_RaidJoin), N(OP_Translocate), N(OP_Sacrifice), -N(OP_KeyRing), +N(OP_KeyRing), N(OP_PopupResponse), N(OP_DeleteCharge), N(OP_PotionBelt), diff --git a/common/eq_constants.h b/common/eq_constants.h index 039f80006..5faf66fdc 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef EQ_CONSTANTS_H -#define EQ_CONSTANTS_H +#define EQ_CONSTANTS_H #include "skills.h" @@ -170,7 +170,7 @@ typedef enum { _eaMaxAppearance } EmuAppearance; -/* +/* ** Diety List */ #define DEITY_UNKNOWN 0 @@ -190,11 +190,11 @@ typedef enum { #define DEITY_TUNARE 215 //Guessed: -#define DEITY_BERT 201 +#define DEITY_BERT 201 #define DEITY_RODCET 212 #define DEITY_VEESHAN 216 -// msg_type's for custom usercolors +// msg_type's for custom usercolors #define MT_Say 256 #define MT_Tell 257 #define MT_Group 258 @@ -435,33 +435,33 @@ typedef enum { #define STAT_HASTE 19 #define STAT_DAMAGE_SHIELD 20 - /** - * Recast timer types. Used as an off set to charProfileStruct timers. - */ - enum RecastTypes - { - RecastTimer0 = 0, - RecastTimer1, - WeaponHealClickTimer, // 2 - MuramiteBaneNukeClickTimer, // 3 - RecastTimer4, - DispellClickTimer, // 5 (also click heal orbs?) - EpicTimer, // 6 - OoWBPClickTimer, // 7 - VishQuestClassItemTimer, // 8 - HealPotionTimer, // 9 - RecastTimer10, - RecastTimer11, - RecastTimer12, - RecastTimer13, - RecastTimer14, - RecastTimer15, - RecastTimer16, - RecastTimer17, - RecastTimer18, - ModRodTimer // 19 + /** + * Recast timer types. Used as an off set to charProfileStruct timers. + */ + enum RecastTypes + { + RecastTimer0 = 0, + RecastTimer1, + WeaponHealClickTimer, // 2 + MuramiteBaneNukeClickTimer, // 3 + RecastTimer4, + DispellClickTimer, // 5 (also click heal orbs?) + EpicTimer, // 6 + OoWBPClickTimer, // 7 + VishQuestClassItemTimer, // 8 + HealPotionTimer, // 9 + RecastTimer10, + RecastTimer11, + RecastTimer12, + RecastTimer13, + RecastTimer14, + RecastTimer15, + RecastTimer16, + RecastTimer17, + RecastTimer18, + ModRodTimer // 19 }; - + enum GroupUpdateAction { GUA_Joined = 0, @@ -593,7 +593,7 @@ enum InventorySlot //////////////////////// // Equip slots //////////////////////// - + SLOT_CHARM = 0, SLOT_EAR01 = 1, SLOT_HEAD = 2, @@ -616,38 +616,38 @@ enum InventorySlot SLOT_FEET = 19, SLOT_WAIST = 20, SLOT_AMMO = 21, - + //////////////////////// // All other slots //////////////////////// SLOT_PERSONAL_BEGIN = 22, SLOT_PERSONAL_END = 29, - + SLOT_CURSOR = 30, - + SLOT_CURSOR_END = (int16)0xFFFE, // Last item on cursor queue // Cursor bag slots are 331->340 (10 slots) - + // Personal Inventory Slots // Slots 1 through 8 are slots 22->29 // Inventory bag slots are 251->330 (10 slots per bag) - + // Tribute slots are 400-404? (upper bound unknown) // storing these in worn item's map - + // Bank slots // Bank slots 1 through 16 are slots 2000->2015 // Bank bag slots are 2031->2190 - + // Shared bank slots // Shared bank slots 1 through 2 are slots 2500->2501 // Shared bank bag slots are 2531->2550 - + // Trade session slots // Trade slots 1 through 8 are slots 3000->3007 // Trade bag slots are technically 0->79 when passed to client, // but in our code, we treat them as slots 3100->3179 - + // Slot used in OP_TradeSkillCombine for world tradeskill containers SLOT_TRADESKILL = 1000, SLOT_AUGMENT = 1001, diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 1be8eddc5..9b4a15f80 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -547,7 +547,7 @@ struct BuffRemoveRequest_Struct struct PetBuff_Struct { /*000*/ uint32 petid; /*004*/ uint32 spellid[BUFF_COUNT]; -/*104*/ uint32 unknown700; +/*104*/ uint32 unknown700; /*108*/ uint32 unknown701; /*112*/ uint32 unknown702; /*116*/ uint32 unknown703; @@ -867,7 +867,7 @@ struct PlayerProfile_Struct /*0116*/ uint32 level; // Level of player (might be one byte) /*0120*/ BindStruct binds[5]; // Bind points (primary is first, home city is fifth) /*0220*/ uint32 deity; // deity -/*0224*/ uint32 guild_id; +/*0224*/ uint32 guild_id; /*0228*/ uint32 birthday; // characters bday /*0232*/ uint32 lastlogin; // last login or zone time /*0236*/ uint32 timePlayedMin; // in minutes @@ -1906,7 +1906,7 @@ struct AdventureFinish_Struct{ }; struct Weblink_Struct{ -/*000*/ char weblink[1]; +/*000*/ char weblink[1]; /*004*/ }; @@ -2040,22 +2040,22 @@ struct Illusion_Struct_Old { struct QuestReward_Struct { /*000*/ uint32 from_mob; // ID of mob awarding the client -/*004*/ uint32 unknown004; -/*008*/ uint32 unknown008; -/*012*/ uint32 unknown012; -/*016*/ uint32 unknown016; -/*020*/ uint32 unknown020; +/*004*/ uint32 unknown004; +/*008*/ uint32 unknown008; +/*012*/ uint32 unknown012; +/*016*/ uint32 unknown016; +/*020*/ uint32 unknown020; /*024*/ uint32 silver; // Gives silver to the client /*028*/ uint32 gold; // Gives gold to the client /*032*/ uint32 platinum; // Gives platinum to the client -/*036*/ uint32 unknown036; -/*040*/ uint32 unknown040; -/*044*/ uint32 unknown044; -/*048*/ uint32 unknown048; -/*052*/ uint32 unknown052; -/*056*/ uint32 unknown056; -/*060*/ uint32 unknown060; -/*064*/ uint32 unknown064; +/*036*/ uint32 unknown036; +/*040*/ uint32 unknown040; +/*044*/ uint32 unknown044; +/*048*/ uint32 unknown048; +/*052*/ uint32 unknown052; +/*056*/ uint32 unknown056; +/*060*/ uint32 unknown060; +/*064*/ uint32 unknown064; /*068*/ }; @@ -2760,7 +2760,7 @@ struct BarterSearchRequest_Struct { struct BuyerItemSearchLinkRequest_Struct { /*000*/ uint32 Action; // 0x00000015 -/*004*/ uint32 ItemID; +/*004*/ uint32 ItemID; /*008*/ uint32 Unknown008; /*012*/ uint32 Unknown012; }; @@ -3435,7 +3435,7 @@ struct MerchantList{ uint32 item; int16 faction_required; int8 level_required; - uint16 alt_currency_cost; + uint16 alt_currency_cost; }; struct TempMerchantList{ uint32 npcid; @@ -4195,7 +4195,7 @@ struct RespawnWindow_Struct { /** * Shroud spawn. For others shrouding, this has their spawnId and * spawnStruct. - * + * * Length: 586 * OpCode: OP_Shroud */ @@ -4650,7 +4650,7 @@ struct GroupMakeLeader_Struct //any items come after in much the same way adventure merchant items do except there is no theme included #define ALT_CURRENCY_OP_POPULATE 8 #define ALT_CURRENCY_OP_UPDATE 7 - + //Server -> Client //Populates the initial Alternate Currency Window struct AltCurrencyPopulateEntry_Struct @@ -4681,7 +4681,7 @@ struct AltCurrencyUpdate_Struct { /*084*/ uint32 unknown084; //seen 0 }; -//Client -> Server +//Client -> Server //When an item is selected while the alt currency merchant window is open struct AltCurrencySelectItem_Struct { /*000*/ uint32 merchant_entity_id; @@ -4711,7 +4711,7 @@ struct AltCurrencySelectItem_Struct { //eg: "I will give you no doubloons for a cloth cap." //Probably also sends amounts somewhere struct AltCurrencySelectItemReply_Struct { -/*000*/ uint32 unknown000; +/*000*/ uint32 unknown000; /*004*/ uint8 unknown004; //0xff /*005*/ uint8 unknown005; //0xff /*006*/ uint8 unknown006; //0xff @@ -4839,7 +4839,7 @@ struct Membership_Entry_Struct { /*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300 /*004*/ uint32 bitwise_entry; // Seen 16 to 65536 - Skips 4096 -/*008*/ +/*008*/ }; struct Membership_Setting_Struct @@ -4847,7 +4847,7 @@ struct Membership_Setting_Struct /*000*/ uint32 setting_index; // 0, 1, or 2 /*004*/ uint32 setting_id; // 0 to 21 /*008*/ int32 setting_value; // All can be 0, 1, or -1 -/*012*/ +/*012*/ }; struct Membership_Details_Struct @@ -4891,7 +4891,7 @@ struct MercenaryList_Struct { /*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0057*/ uint8 MercUnk04; // Seen 1 +/*0057*/ uint8 MercUnk04; // Seen 1 /*0058*/ char MercName[1]; // Null Terminated Mercenary Name (00 at merchants) }; @@ -4913,7 +4913,7 @@ struct MercenaryListEntry_Struct { /*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0057*/ uint8 MercUnk04; // Seen 1 +/*0057*/ uint8 MercUnk04; // Seen 1 /*0058*/ char MercName[1]; // Null Terminated Mercenary Name (00 at merchants) /*0000*/ MercenaryStance_Struct Stances[MAX_MERC_STANCES]; // Count Varies, but hard set to 5 max for now - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc (1 to 9 as of April 2012) }; @@ -4953,7 +4953,7 @@ struct MercenaryData_Struct { /*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0057*/ uint8 MercUnk04; // Seen 1 +/*0057*/ uint8 MercUnk04; // Seen 1 /*0058*/ char MercName[64]; // Null Terminated Mercenary Name (00 at merchants) /*0000*/ MercenaryStance_Struct Stances[MAX_MERC_STANCES]; // Count Varies, but hard set to 2 for now - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc (1 to 9 as of April 2012) /*0000*/ uint32 MercUnk05; // Seen 1 - Extra Merc Data field that differs from MercenaryListEntry_Struct @@ -4963,7 +4963,7 @@ struct MercenaryData_Struct { // [OPCode: 0x6537] On Live as of April 2 2012 [Server->Client] // Should be named OP_MercenaryDataResponse, but the current opcode using that name should be renamed first // Size varies if mercenary is hired or if browsing Mercenary Merchant -// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 +// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 struct MercenaryDataUpdate_Struct { /*0000*/ int32 MercStatus; // Seen 0 with merc and -1 with no merc hired /*0004*/ uint32 MercCount; // Seen 1 with 1 merc hired and 0 with no merc hired diff --git a/common/eqemu_exception.cpp b/common/eqemu_exception.cpp index 47f023e6f..c247e1a0a 100644 --- a/common/eqemu_exception.cpp +++ b/common/eqemu_exception.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -18,17 +18,17 @@ #include "eqemu_exception.h" -namespace EQEmu +namespace EQEmu { - Exception::Exception(const char* name, const std::string& description, const char* file, long line) - : line_(line), + Exception::Exception(const char* name, const std::string& description, const char* file, long line) + : line_(line), file_(file), desc_(description), name_(name) { } - - Exception::Exception(const Exception& e) + + Exception::Exception(const Exception& e) : line_(e.line_), file_(e.file_), desc_(e.desc_), @@ -37,7 +37,7 @@ namespace EQEmu } #ifdef EQEMU_RVALUE_MOVE - Exception::Exception(const Exception&& e) + Exception::Exception(const Exception&& e) : line_(e.line_), file_(e.file_), desc_(e.desc_), @@ -45,7 +45,7 @@ namespace EQEmu { } #endif - + void Exception::operator=(const Exception& e) { line_ = e.line_; file_ = e.file_; diff --git a/common/eqemu_exception.h b/common/eqemu_exception.h index cf6ede925..2ccd75be0 100644 --- a/common/eqemu_exception.h +++ b/common/eqemu_exception.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -30,7 +30,7 @@ namespace EQEmu */ class Exception : public std::exception { public: - + //! Detailed Constructor /*! \param name The name given for this exception. @@ -39,55 +39,55 @@ namespace EQEmu \param line The line number for this exception. */ Exception(const char* name, const std::string& description, const char* file, long line); - + //! Copy Constructor Exception(const Exception& e); - + //! Move Constructor #ifdef EQEMU_RVALUE_MOVE Exception(const Exception&& e); #endif - + //! Destructor ~Exception() throw() { } - + //! Assignment Operator void operator=(const Exception& e); //! Get Name /*! - Gets the name of the exception as it was when it was created. + Gets the name of the exception as it was when it was created. These are typically descriptive categories that the exception would fall under. */ virtual const std::string& name() const { return name_; } - + //! Get Basic Description /*! - Gets the description of the exception as it was when it was created. + Gets the description of the exception as it was when it was created. This tends to explain the circumstances of why the exception was thrown. */ virtual const std::string& description() const { return desc_; } - + //! Get Full Description /*! - Gets a full description for this exception. + Gets a full description for this exception. This is a string containing the name, description, file and line number in a custom format. This string is created the first time the full_description is accessed. */ virtual const std::string& full_description() const; - + //! Get File Name /*! Gets the name of the file this exception was thrown from. */ virtual const std::string& file() const { return file_; } - + //! Get File Line /*! Gets the file line this exception was thrown from. */ virtual const long& line() const { return line_; } - + //! std::exception overload /*! Overload from std::exception diff --git a/common/eqtime.cpp b/common/eqtime.cpp index 248948aa6..e168f238f 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -145,7 +145,7 @@ bool EQTime::saveFile(const char *filename) return false; } //Enable for debugging - //cout << "SAVE: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << endl; + //cout << "SAVE: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << endl; of << EQT_VERSION << endl; of << (long)eqTime.start_eqtime.day << endl; of << (long)eqTime.start_eqtime.hour << endl; @@ -182,7 +182,7 @@ bool EQTime::loadFile(const char *filename) //in >> eqTime.start_eqtime.hour; in >> in_data; eqTime.start_eqtime.hour = in_data; - in.ignore(80, '\n'); + in.ignore(80, '\n'); //in >> eqTime.start_eqtime.minute; in >> in_data; in.ignore(80, '\n'); @@ -195,7 +195,7 @@ bool EQTime::loadFile(const char *filename) in.ignore(80, '\n'); in >> eqTime.start_realtime; //Enable for debugging... - //cout << "LOAD: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << endl; + //cout << "LOAD: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << endl; in.close(); return true; } @@ -228,7 +228,7 @@ bool EQTime::IsTimeBefore(TimeOfDay_Struct *base, TimeOfDay_Struct *test) { void EQTime::AddMinutes(uint32 minutes, TimeOfDay_Struct *to) { uint32 cur; - + //minutes start at 0, everything else starts at 1 cur = to->minute; cur += minutes; diff --git a/common/eqtime.h b/common/eqtime.h index 5a60db27f..50bb4b562 100644 --- a/common/eqtime.h +++ b/common/eqtime.h @@ -34,13 +34,13 @@ public: //Set functions int setEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real); void setEQTimeZone(int32 in_timezone) { timezone=in_timezone; } - + //Time math/logic functions static bool IsTimeBefore(TimeOfDay_Struct *base, TimeOfDay_Struct *test); //is test before base static void AddMinutes(uint32 minutes, TimeOfDay_Struct *to); - + static void ToString(TimeOfDay_Struct *t, string &str); - + //Database functions //bool loadDB(Database q); //bool setDB(Database q); diff --git a/common/errmsg.h b/common/errmsg.h index 8087c5269..03863ec61 100644 --- a/common/errmsg.h +++ b/common/errmsg.h @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - + You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, diff --git a/common/extprofile.cpp b/common/extprofile.cpp index d4793873c..b66ada553 100644 --- a/common/extprofile.cpp +++ b/common/extprofile.cpp @@ -35,10 +35,10 @@ bool SetExtendedProfile(ExtendedProfile_Struct *to, char *old, unsigned int len) memcpy(to, old, sizeof(ExtendedProfile_Struct)); return(true); } - + //convert an old block of memory of size old to the new struct //and store the new results in 'to' - + //generic converter that will work as long as the structre //only grows, and nothign gets re-arranged if(len < sizeof(ExtendedProfile_Struct)) { @@ -46,7 +46,7 @@ bool SetExtendedProfile(ExtendedProfile_Struct *to, char *old, unsigned int len) memcpy(to, old, len); return(true); } - + return(false); } diff --git a/common/extprofile.h b/common/extprofile.h index adbf74bc1..183f98206 100644 --- a/common/extprofile.h +++ b/common/extprofile.h @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef EXTENDED_PROFILE_H -#define EXTENDED_PROFILE_H +#define EXTENDED_PROFILE_H #include "eq_packet_structs.h" #include "Item.h" @@ -27,11 +27,11 @@ /* This is a place to store data that dosent have a home in the official player profile. - + Try not to expand or re-arrange thing in this struct to make conversion between sizes easier. if something gets removed from here, just turn it into an unused - item, so conversion is not needed. Then reuse old unused values if + item, so conversion is not needed. Then reuse old unused values if possible later instead of adding more, so long as old values left over would not be extrememly unpleasent side effects. */ @@ -43,7 +43,7 @@ struct ExtendedProfile_Struct { SpellBuff_Struct pet_buffs[BUFF_COUNT]; uint32 pet_items[MAX_MATERIALS]; char merc_name[64]; - + uint32 aa_effects; uint32 perAA; //% of exp going to AAs uint32 expended_aa; // Total of expended AA diff --git a/common/faction.h b/common/faction.h index ca9f4107d..ae41a9286 100644 --- a/common/faction.h +++ b/common/faction.h @@ -28,9 +28,9 @@ enum FACTION_VALUE { FACTION_WARMLY = 2, FACTION_KINDLY = 3, FACTION_AMIABLE = 4, - + FACTION_INDIFFERENT = 5, - + FACTION_APPREHENSIVE = 6, FACTION_DUBIOUS = 7, FACTION_THREATENLY = 8, @@ -63,13 +63,13 @@ struct Faction { }; typedef std::map faction_map; -struct NPCFaction -{ +struct NPCFaction +{ uint32 factionID; int32 value_mod; int8 npc_value; - uint8 temp; -}; + uint8 temp; +}; const char *FactionValueToString(FACTION_VALUE fv); FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value); diff --git a/common/features.h b/common/features.h index f418f1bb5..938cb9cf7 100644 --- a/common/features.h +++ b/common/features.h @@ -22,7 +22,7 @@ This file defines many optional features for the emu as well as various parameters used by the emu. - + If ambitious, most of these could prolly be turned into database variables, but the really frequently run pieces of code, should not be done that way for speed reasons IMO @@ -185,7 +185,7 @@ enum { //timer settings, all in milliseconds }; enum { //some random constants - //each of these attack modifiers are added to the NPC's level to determine their + //each of these attack modifiers are added to the NPC's level to determine their //probability of executing such an attack (which may or may not hit) NPCDualAttackModifier = 20, NPCTripleAttackModifier = 0, @@ -200,7 +200,7 @@ enum { //some random constants //an npc can be and still let the theif PP them #define THIEF_PICKPOCKET_OVER 5 -//this is the % chance that an NPC will dual wield a 2nd weapon +//this is the % chance that an NPC will dual wield a 2nd weapon //in its loot table, if it is able to. //Aug 2007: was 5% chance.. changed to 100% by default since that seems more normal //Kept it intact codewise incase someone wants to or is already using it. @@ -221,7 +221,7 @@ enum { //some random constants //minimum level to do alchemy #define MIN_LEVEL_ALCHEMY 25 -//chance ratio that a +//chance ratio that a #define THREATENLY_ARRGO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly // max factions per npc faction list diff --git a/common/fixed_memory_hash_set.h b/common/fixed_memory_hash_set.h index d020f1b80..f2235e953 100644 --- a/common/fixed_memory_hash_set.h +++ b/common/fixed_memory_hash_set.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -25,7 +25,7 @@ namespace EQEmu { - /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an + /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an allocator for (shared memory), we assume all keys are unsigned int */ template @@ -41,7 +41,7 @@ namespace EQEmu { Constructor which initializes the hash set \param data Raw data \param size Raw data size - \param element_count Max number of possible unique elements that can be inserted. + \param element_count Max number of possible unique elements that can be inserted. \param max_element_id Number of offsets to store: eg highest "key" that will be used. */ FixedMemoryHashSet(byte *data, size_type size, key_type element_count, key_type max_element_id) { @@ -69,7 +69,7 @@ namespace EQEmu { } /*! - Constructor which does not initialize the hash set. Builds the hash set from what data is + Constructor which does not initialize the hash set. Builds the hash set from what data is stored in the data pointer passed. \param data Raw data \param size Raw data size @@ -136,7 +136,7 @@ namespace EQEmu { elements_ = other.elements_; return *this; } - + //! Returns whether the set is empty (has 0 elements) or not bool empty() const { return current_elements_ == 0; @@ -156,7 +156,7 @@ namespace EQEmu { key_type max_key() const { return offset_count_ > 0 ? (offset_count_ - 1) : 0; } - + /*! Retrieve value operator \param i Index to retrieve the value from @@ -229,7 +229,7 @@ namespace EQEmu { } } - //! Calculates how much memory we should allocate based on element size and count + //! Calculates how much memory we should allocate based on element size and count static size_type estimated_size(key_type element_count, key_type max_elements) { size_type total_size = 3 * sizeof(key_type); total_size += sizeof(key_type) * (max_elements + 1); diff --git a/common/fixed_memory_variable_hash_set.h b/common/fixed_memory_variable_hash_set.h index 7c3b0b004..67cbb441e 100644 --- a/common/fixed_memory_variable_hash_set.h +++ b/common/fixed_memory_variable_hash_set.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -25,7 +25,7 @@ namespace EQEmu { - /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an + /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an allocator for (shared memory), we assume all keys are unsigned int, values are a pointer and size */ template @@ -49,17 +49,17 @@ namespace EQEmu { remaining_size_ = size_ - (sizeof(key_type) * 3) - (sizeof(key_type) * (max_element_id + 1)); byte *ptr = data; - *reinterpret_cast(ptr) = max_element_id + 1; + *reinterpret_cast(ptr) = max_element_id + 1; offset_count_ = max_element_id + 1; ptr += sizeof(key_type); *reinterpret_cast(ptr) = remaining_size_; ptr += sizeof(key_type); - + *reinterpret_cast(ptr) = 0; current_offset_ = 0; ptr += sizeof(key_type); - + offsets_ = reinterpret_cast(ptr); memset(ptr, 0xFFFFFFFFU, sizeof(key_type) * (max_element_id + 1)); @@ -69,7 +69,7 @@ namespace EQEmu { } /*! - Constructor which does not initialize the hash set. Builds the hash set from what data is + Constructor which does not initialize the hash set. Builds the hash set from what data is stored in the data pointer passed. \param data Raw data \param size Raw data size @@ -87,7 +87,7 @@ namespace EQEmu { current_offset_ = *reinterpret_cast(ptr); ptr += sizeof(key_type); - + offsets_ = reinterpret_cast(ptr); ptr += sizeof(key_type) * offset_count_; @@ -135,7 +135,7 @@ namespace EQEmu { elements_ = other.elements_; return *this; } - + //! Returns the number of bytes in the set currently size_type size() const { return size_ - remaining_size_; @@ -150,7 +150,7 @@ namespace EQEmu { key_type max_key() const { return offset_count_ > 0 ? (offset_count_ - 1) : 0; } - + /*! Retrieve value operator \param i Index to retrieve the value from @@ -208,7 +208,7 @@ namespace EQEmu { if(i >= offset_count_) { EQ_EXCEPT("Fixed Memory Variable Hash Set", "Index out of range."); } - + if(size > remaining_size_) { EQ_EXCEPT("Fixed Memory Hash Set", "Not enough room in hash set to insert this value."); } diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 7a97adeba..a5b29ce3e 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -40,22 +40,22 @@ BaseGuildManager::~BaseGuildManager() { } bool BaseGuildManager::LoadGuilds() { - + ClearGuilds(); - + if(m_db == nullptr) { _log(GUILDS__DB, "Requested to load guilds when we have no database object."); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; map::iterator res; - + // load up all the guilds - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT id, name, leader, minstatus, motd, motd_setter,channel,url FROM guilds"), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guilds '%s': %s", query, errbuf); safe_delete_array(query); @@ -66,9 +66,9 @@ bool BaseGuildManager::LoadGuilds() { _CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]); } mysql_free_result(result); - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks"), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guild ranks '%s': %s", query, errbuf); safe_delete_array(query); @@ -82,15 +82,15 @@ bool BaseGuildManager::LoadGuilds() { _log(GUILDS__ERROR, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } - + res = m_guilds.find(guild_id); if(res == m_guilds.end()) { _log(GUILDS__ERROR, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } - + RankInfo &rank = res->second->ranks[rankn]; - + rank.name = row[2]; rank.permissions[GUILD_HEAR] = (row[3][0] == '1')?true:false; rank.permissions[GUILD_SPEAK] = (row[4][0] == '1')?true:false; @@ -102,7 +102,7 @@ bool BaseGuildManager::LoadGuilds() { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1')?true:false; } mysql_free_result(result); - + return(true); } @@ -111,16 +111,16 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { _log(GUILDS__DB, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; map::iterator res; GuildInfo *info; - + // load up all the guilds - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT name, leader, minstatus, motd, motd_setter, channel,url FROM guilds WHERE id=%lu", (unsigned long)guild_id), errbuf, &result)) { _log(GUILDS__ERROR, "Error reloading guilds '%s': %s", query, errbuf); safe_delete_array(query); @@ -135,9 +135,9 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { return(false); } mysql_free_result(result); - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace " "FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id), errbuf, &result)) { _log(GUILDS__ERROR, "Error reloading guild ranks '%s': %s", query, errbuf); @@ -145,7 +145,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { return(false); } safe_delete_array(query); - + while((row = mysql_fetch_row(result))) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { @@ -153,7 +153,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { continue; } RankInfo &rank = info->ranks[rankn]; - + rank.name = row[2]; rank.permissions[GUILD_HEAR] = (row[3][0] == '1')?true:false; rank.permissions[GUILD_SPEAK] = (row[4][0] == '1')?true:false; @@ -165,23 +165,23 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1')?true:false; } mysql_free_result(result); - + _log(GUILDS__DB, "Successfully refreshed guild %d from the database.", guild_id); - + return(true); } BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, const char *guild_name, uint32 leader_char_id, uint8 minstatus, const char *guild_motd, const char *motd_setter, const char *Channel, const char *URL) { map::iterator res; - + //remove any old entry. res = m_guilds.find(guild_id); if(res != m_guilds.end()) { delete res->second; m_guilds.erase(res); } - + //make the new entry and store it into the map. GuildInfo *info = new GuildInfo; info->name = guild_name; @@ -192,7 +192,7 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con info->url = URL; info->channel = Channel; m_guilds[guild_id] = info; - + //now setup default ranks (everything defaults to false) info->ranks[0].name = "Member"; info->ranks[0].permissions[GUILD_HEAR] = true; @@ -212,7 +212,7 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con info->ranks[2].permissions[GUILD_DEMOTE] = true; info->ranks[2].permissions[GUILD_MOTD] = true; info->ranks[2].permissions[GUILD_WARPEACE] = true; - + return(info); } @@ -221,7 +221,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { _log(GUILDS__DB, "Requested to store guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { @@ -229,26 +229,26 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { return(false); } GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //clear out old `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guilds WHERE id=%lu", (unsigned long)guild_id), errbuf)) { _log(GUILDS__ERROR, "Error clearing old guild record when storing %d '%s': %s", guild_id, query, errbuf); } safe_delete_array(query); - + //clear out old `guild_ranks` entries - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id), errbuf)) { _log(GUILDS__ERROR, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query, errbuf); } safe_delete_array(query); - + //escape our strings. char *name_esc = new char[info->name.length()*2+1]; char *motd_esc = new char[info->motd.length()*2+1]; @@ -256,10 +256,10 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { m_db->DoEscapeString(name_esc, info->name.c_str(), info->name.length()); m_db->DoEscapeString(motd_esc, info->motd.c_str(), info->motd.length()); m_db->DoEscapeString(motd_set_esc, info->motd_setter.c_str(), info->motd_setter.length()); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "INSERT INTO guilds (id,name,leader,minstatus,motd,motd_setter) VALUES(%lu,'%s',%lu,%d,'%s', '%s')", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "INSERT INTO guilds (id,name,leader,minstatus,motd,motd_setter) VALUES(%lu,'%s',%lu,%d,'%s', '%s')", (unsigned long)guild_id, name_esc, (unsigned long)info->leader_char_id, info->minstatus, motd_esc, motd_set_esc), errbuf)) { _log(GUILDS__ERROR, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query, errbuf); @@ -273,16 +273,16 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); - + //now insert the new ranks uint8 rank; for(rank = 0; rank <= GUILD_MAX_RANK; rank++) { const RankInfo &r = info->ranks[rank]; - + char *title_esc = new char[r.name.length()*2+1]; m_db->DoEscapeString(title_esc, r.name.c_str(), r.name.length()); - - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "INSERT INTO guild_ranks (guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace)" " VALUES(%d,%d,'%s',%d,%d,%d,%d,%d,%d,%d,%d)", guild_id, rank, title_esc, @@ -303,9 +303,9 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { safe_delete_array(query); safe_delete_array(title_esc); } - + _log(GUILDS__DB, "Stored guild %d in the database", guild_id); - + return(true); } @@ -314,18 +314,18 @@ uint32 BaseGuildManager::_GetFreeGuildID() { _log(GUILDS__DB, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char query[100]; MYSQL_RES *result; - + //this has got to be one of the more retarded things I have seen. //none the less, im too lazy to rewrite it right now. - + uint16 x; for (x = 1; x < MAX_NUMBER_GUILDS; x++) { snprintf(query, 100, "SELECT id FROM guilds where id=%i;", x); - + if (m_db->RunQuery(query, strlen(query), errbuf, &result)) { if (mysql_num_rows(result) == 0) { mysql_free_result(result); @@ -338,39 +338,39 @@ uint32 BaseGuildManager::_GetFreeGuildID() { LogFile->write(EQEMuLog::Error, "Error in _GetFreeGuildID query '%s': %s", query, errbuf); } } - + _log(GUILDS__ERROR, "Unable to find a free guild ID when requested."); return GUILD_NONE; } - + uint32 BaseGuildManager::CreateGuild(const char* name, uint32 leader_char_id) { uint32 gid = DBCreateGuild(name, leader_char_id); if(gid == GUILD_NONE) return(GUILD_NONE); - + SendGuildRefresh(gid, true, false, false, false); SendCharRefresh(GUILD_NONE, gid, leader_char_id); - + return(gid); } bool BaseGuildManager::DeleteGuild(uint32 guild_id) { if(!DBDeleteGuild(guild_id)) return(false); - + SendGuildDelete(guild_id); - + return(true); } bool BaseGuildManager::RenameGuild(uint32 guild_id, const char* name) { if(!DBRenameGuild(guild_id, name)) return(false); - + SendGuildRefresh(guild_id, true, false, false, false); - + return(true); } @@ -382,23 +382,23 @@ bool BaseGuildManager::SetGuildLeader(uint32 guild_id, uint32 leader_char_id) { return(false); GuildInfo *info = res->second; uint32 old_leader = info->leader_char_id; - + if(!DBSetGuildLeader(guild_id, leader_char_id)) return(false); - + SendGuildRefresh(guild_id, false, false, false, false); SendCharRefresh(GUILD_NONE, guild_id, old_leader); SendCharRefresh(GUILD_NONE, guild_id, leader_char_id); - + return(true); } bool BaseGuildManager::SetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(!DBSetGuildMOTD(guild_id, motd, setter)) return(false); - + SendGuildRefresh(guild_id, false, true, false, false); - + return(true); } @@ -406,9 +406,9 @@ bool BaseGuildManager::SetGuildURL(uint32 GuildID, const char* URL) { if(!DBSetGuildURL(GuildID, URL)) return(false); - + SendGuildRefresh(GuildID, false, true, false, false); - + return(true); } @@ -416,28 +416,28 @@ bool BaseGuildManager::SetGuildChannel(uint32 GuildID, const char* Channel) { if(!DBSetGuildChannel(GuildID, Channel)) return(false); - + SendGuildRefresh(GuildID, false, true, false, false); - + return(true); } bool BaseGuildManager::SetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(rank > GUILD_MAX_RANK && guild_id != GUILD_NONE) return(false); - + //lookup their old guild, if they had one. uint32 old_guild = GUILD_NONE; CharGuildInfo gci; if(GetCharInfo(charid, gci)) { old_guild = gci.guild_id; } - + if(!DBSetGuild(charid, guild_id, rank)) return(false); - + SendCharRefresh(old_guild, guild_id, charid); - + return(true); } @@ -445,12 +445,12 @@ bool BaseGuildManager::SetGuild(uint32 charid, uint32 guild_id, uint8 rank) { bool BaseGuildManager::SetGuildRank(uint32 charid, uint8 rank) { if(rank > GUILD_MAX_RANK) return(false); - + if(!DBSetGuildRank(charid, rank)) return(false); - + SendCharRefresh(GUILD_NONE, 0, charid); - + return(true); } @@ -458,9 +458,9 @@ bool BaseGuildManager::SetGuildRank(uint32 charid, uint8 rank) { bool BaseGuildManager::SetBankerFlag(uint32 charid, bool is_banker) { if(!DBSetBankerFlag(charid, is_banker)) return(false); - + SendRankUpdate(charid); - + return(true); } @@ -468,7 +468,7 @@ bool BaseGuildManager::SetAltFlag(uint32 charid, bool is_alt) { if(!DBSetAltFlag(charid, is_alt)) return(false); - + SendRankUpdate(charid); return(true); @@ -477,18 +477,18 @@ bool BaseGuildManager::SetAltFlag(uint32 charid, bool is_alt) bool BaseGuildManager::SetTributeFlag(uint32 charid, bool enabled) { if(!DBSetTributeFlag(charid, enabled)) return(false); - + SendCharRefresh(GUILD_NONE, 0, charid); - + return(true); } bool BaseGuildManager::SetPublicNote(uint32 charid, const char *note) { if(!DBSetPublicNote(charid, note)) return(false); - + SendCharRefresh(GUILD_NONE, 0, charid); - + return(true); } @@ -497,24 +497,24 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { uint32 new_id = _GetFreeGuildID(); if(new_id == GUILD_NONE) return(GUILD_NONE); - + //now make the guild record in our local manager. //this also sets up the default ranks for us. _CreateGuild(new_id, name, leader, 0, "", "", "", ""); - + //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { _log(GUILDS__ERROR, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - + _log(GUILDS__DB, "Created guild %d in the database.", new_id); - + return(new_id); } bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { - + //remove the local entry map::iterator res; res = m_guilds.find(guild_id); @@ -522,32 +522,32 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { delete res->second; m_guilds.erase(res); } - + if(m_db == nullptr) { _log(GUILDS__DB, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } - + char *query = 0; - + //clear out old `guilds` entry - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guilds WHERE id=%lu", (unsigned long)guild_id), "clearing old guild record"); - + //clear out old `guild_ranks` entries - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id), "clearing old guild_ranks records"); - + //clear out people belonging to this guild. - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_members WHERE guild_id=%lu", (unsigned long)guild_id), "clearing chars in guild"); - + // Delete the guild bank - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id), "deleting guild bank"); - + _log(GUILDS__DB, "Deleted guild %d from the database.", guild_id); - + return(true); } @@ -556,24 +556,24 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { _log(GUILDS__DB, "Requested to rename guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(name); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, name, len); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guilds SET name='%s' WHERE id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guilds SET name='%s' WHERE id=%d", esc, guild_id), errbuf)) { _log(GUILDS__ERROR, "Error renaming guild %d '%s': %s", guild_id, query, errbuf); @@ -583,11 +583,11 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); - + info->name = name; //update our local record. - + return(true); } @@ -596,19 +596,19 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { _log(GUILDS__DB, "Requested to set the leader for guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guilds SET leader='%d' WHERE id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guilds SET leader='%d' WHERE id=%d", leader, guild_id), errbuf)) { _log(GUILDS__ERROR, "Error changing leader on guild %d '%s': %s", guild_id, query, errbuf); @@ -616,18 +616,18 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { return(false); } safe_delete_array(query); - + //set the old leader to officer if(!DBSetGuildRank(info->leader_char_id, GUILD_OFFICER)) return(false); //set the new leader to leader if(!DBSetGuildRank(leader, GUILD_LEADER)) return(false); - + _log(GUILDS__DB, "Set guild leader for guild %d to %d in the database", guild_id, leader); - + info->leader_char_id = leader; //update our local record. - + return(true); } @@ -636,16 +636,16 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c _log(GUILDS__DB, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(motd); uint32 len2 = strlen(setter); @@ -653,10 +653,10 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c char *esc_set = new char[len2*2+1]; m_db->DoEscapeString(esc, motd, len); m_db->DoEscapeString(esc_set, setter, len2); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guilds SET motd='%s',motd_setter='%s' WHERE id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guilds SET motd='%s',motd_setter='%s' WHERE id=%d", esc, esc_set, guild_id), errbuf)) { _log(GUILDS__ERROR, "Error setting MOTD for guild %d '%s': %s", guild_id, query, errbuf); @@ -668,12 +668,12 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(query); safe_delete_array(esc); safe_delete_array(esc_set); - + _log(GUILDS__DB, "Set MOTD for guild %d in the database", guild_id); - + info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. - + return(true); } @@ -681,7 +681,7 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) { if(m_db == nullptr) return(false); - + map::const_iterator res; res = m_guilds.find(GuildID); @@ -690,17 +690,17 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(URL); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, URL, len); - + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "UPDATE guilds SET url='%s' WHERE id=%d", esc, GuildID), errbuf)) { _log(GUILDS__ERROR, "Error setting URL for guild %d '%s': %s", GuildID, query, errbuf); @@ -710,11 +710,11 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Set URL for guild %d in the database", GuildID); - + info->url = URL; //update our local record. - + return(true); } @@ -722,7 +722,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) { if(m_db == nullptr) return(false); - + map::const_iterator res; res = m_guilds.find(GuildID); @@ -731,17 +731,17 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(Channel); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, Channel, len); - + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "UPDATE guilds SET channel='%s' WHERE id=%d", esc, GuildID), errbuf)) { _log(GUILDS__ERROR, "Error setting Channel for guild %d '%s': %s", GuildID, query, errbuf); @@ -751,11 +751,11 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Set Channel for guild %d in the database", GuildID); - + info->channel = Channel; //update our local record. - + return(true); } @@ -764,13 +764,13 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { _log(GUILDS__DB, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + if(guild_id != GUILD_NONE) { - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "REPLACE INTO guild_members (char_id,guild_id,rank) VALUES(%d,%d,%d)", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "REPLACE INTO guild_members (char_id,guild_id,rank) VALUES(%d,%d,%d)", charid, guild_id, rank), errbuf)) { _log(GUILDS__ERROR, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query, errbuf); @@ -778,8 +778,8 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { return(false); } } else { - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "DELETE FROM guild_members WHERE char_id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "DELETE FROM guild_members WHERE char_id=%d", charid), errbuf)) { _log(GUILDS__ERROR, "Error removing char %d from guild '%s': %s", charid, guild_id, query, errbuf); @@ -788,23 +788,23 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { } } safe_delete_array(query); - + _log(GUILDS__DB, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); - + return(true); } bool BaseGuildManager::DBSetGuildRank(uint32 charid, uint8 rank) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET rank=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET rank=%d WHERE char_id=%d", rank, charid), "setting a guild member's rank")); } bool BaseGuildManager::DBSetBankerFlag(uint32 charid, bool is_banker) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET banker=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET banker=%d WHERE char_id=%d", is_banker?1:0, charid), "setting a guild member's banker flag")); } @@ -830,7 +830,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) safe_delete_array(query); if(mysql_num_rows(result) != 1) - return false; + return false; row = mysql_fetch_row(result); @@ -845,8 +845,8 @@ bool BaseGuildManager::DBSetAltFlag(uint32 charid, bool is_alt) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET alt=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET alt=%d WHERE char_id=%d", is_alt?1:0, charid), "setting a guild member's alt flag")); } @@ -872,7 +872,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) safe_delete_array(query); if(mysql_num_rows(result) != 1) - return false; + return false; row = mysql_fetch_row(result); @@ -885,26 +885,26 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) bool BaseGuildManager::DBSetTributeFlag(uint32 charid, bool enabled) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET tribute_enable=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET tribute_enable=%d WHERE char_id=%d", enabled?1:0, charid), "setting a guild member's tribute flag")); } bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if(m_db == nullptr) return(false); - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(note); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, note, len); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET public_note='%s' WHERE char_id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET public_note='%s' WHERE char_id=%d", esc, charid), errbuf)) { _log(GUILDS__ERROR, "Error setting public note for char %d '%s': %s", charid, query, errbuf); @@ -914,18 +914,18 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Set public not for char %d", charid); - + return(true); } bool BaseGuildManager::_RunQuery(char *&query, int len, const char *errmsg) { if(m_db == nullptr) return(false); - + char errbuf[MYSQL_ERRMSG_SIZE]; - + if (!m_db->RunQuery(query, len, errbuf)) { _log(GUILDS__ERROR, "Error %s: '%s': %s", errmsg, query, errbuf); @@ -933,7 +933,7 @@ bool BaseGuildManager::_RunQuery(char *&query, int len, const char *errmsg) { return(false); } safe_delete_array(query); - + return(true); } @@ -959,7 +959,7 @@ static void ProcessGuildMember(MYSQL_ROW &row, CharGuildInfo &into) { into.level = atoi(row[3]); into.time_last_on = atoul(row[4]); into.zone_id = atoi(row[5]); - + //fields from `guild_members`, leave at defaults if missing into.guild_id = row[6] ? atoi(row[6]) : GUILD_NONE; into.rank = row[7] ? atoi(row[7]) : (GUILD_MAX_RANK+1); @@ -969,7 +969,7 @@ static void ProcessGuildMember(MYSQL_ROW &row, CharGuildInfo &into) { into.banker = row[11]? (row[11][0] == '0'?false:true) : false; into.public_note = row[12]? row[12] : ""; into.alt = row[13]? (row[13][0] == '0'?false:true) : false; - + //a little sanity checking/cleanup if(into.guild_id == 0) into.guild_id = GUILD_NONE; @@ -980,17 +980,17 @@ static void ProcessGuildMember(MYSQL_ROW &row, CharGuildInfo &into) { bool BaseGuildManager::GetEntireGuild(uint32 guild_id, vector &members) { members.clear(); - + if(m_db == nullptr) return(false); - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, GuildMemberBaseQuery " WHERE g.guild_id=%d", guild_id ), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guild member list '%s': %s", query, errbuf); @@ -998,16 +998,16 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, vector & return(false); } safe_delete_array(query); - + while ((row = mysql_fetch_row(result))) { CharGuildInfo *ci = new CharGuildInfo; ProcessGuildMember(row, *ci); members.push_back(ci); } mysql_free_result(result); - + _log(GUILDS__DB, "Retreived entire guild member list for guild %d from the database", guild_id); - + return(true); } @@ -1016,19 +1016,19 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { _log(GUILDS__DB, "Requested char info on %s when we have no database object.", char_name); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + //escape our strings. uint32 nl = strlen(char_name); char *esc = new char[nl*2+1]; m_db->DoEscapeString(esc, char_name, nl); - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, GuildMemberBaseQuery " WHERE c.name='%s'", esc ), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guild member '%s': %s", query, errbuf); @@ -1038,7 +1038,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { } safe_delete_array(query); safe_delete_array(esc); - + bool ret = true; if ((row = mysql_fetch_row(result))) { ProcessGuildMember(row, into); @@ -1047,10 +1047,10 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { ret = true; } mysql_free_result(result); - + return(ret); - - + + } bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { @@ -1058,14 +1058,14 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { _log(GUILDS__DB, "Requested char info on %d when we have no database object.", char_id); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, #ifdef BOTS GuildMemberBaseQuery " WHERE c.id=%d AND c.mobtype = 'C'", char_id #else @@ -1077,7 +1077,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { return(false); } safe_delete_array(query); - + bool ret = true; if ((row = mysql_fetch_row(result))) { ProcessGuildMember(row, into); @@ -1086,18 +1086,18 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { ret = true; } mysql_free_result(result); - + return(ret); - + } //returns ownership of the buffer. uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) const { //dynamic structs will make this a lot less painful. - + length = sizeof(GuildsList_Struct); uint8 *buffer = new uint8[length]; - + //a bit little better than memsetting the whole thing... uint32 r,pos; for(r = 0, pos = 0; r <= MAX_NUMBER_GUILDS; r++, pos += 64) { @@ -1106,9 +1106,9 @@ uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) co // so just fill unused entries with an empty string instead. buffer[pos] = '\0'; } - + strn0cpy((char *) buffer, head_name, 64); - + map::const_iterator cur, end; cur = m_guilds.begin(); end = m_guilds.end(); @@ -1170,7 +1170,7 @@ bool BaseGuildManager::GetGuildMOTD(uint32 guild_id, char *motd_buffer, char *se strn0cpy(setter_buffer, res->second->motd_setter.c_str(), 64); return(true); } - + bool BaseGuildManager::GetGuildURL(uint32 GuildID, char *URLBuffer) const { map::const_iterator res; @@ -1181,7 +1181,7 @@ bool BaseGuildManager::GetGuildURL(uint32 GuildID, char *URLBuffer) const return(true); } - + bool BaseGuildManager::GetGuildChannel(uint32 GuildID, char *ChannelBuffer) const { map::const_iterator res; @@ -1191,7 +1191,7 @@ bool BaseGuildManager::GetGuildChannel(uint32 GuildID, char *ChannelBuffer) cons strn0cpy(ChannelBuffer, res->second->channel.c_str(), 128); return(true); } - + bool BaseGuildManager::GuildExists(uint32 guild_id) const { if(guild_id == GUILD_NONE) return(false); @@ -1242,19 +1242,19 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { _log(GUILDS__PERMISSIONS, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { _log(GUILDS__PERMISSIONS, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } - + bool granted = (res->second->minstatus <= status); - - _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + + _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); - + return(granted); } @@ -1271,15 +1271,15 @@ bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } - + bool granted = res->second->ranks[rank].permissions[act]; - + _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", - res->second->name.c_str(), guild_id, - res->second->ranks[rank].name.c_str(), rank, - GuildActionNames[act], act, + res->second->name.c_str(), guild_id, + res->second->ranks[rank].name.c_str(), rank, + GuildActionNames[act], act, granted?"granted":"denied"); - + return(granted); } @@ -1318,7 +1318,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; - + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "select guild_id from guild_members where char_id in (select id from character_ where account_id = %i) and rank = 2", @@ -1329,10 +1329,10 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) return 0; } safe_delete_array(query); - + uint32 Rows = mysql_num_rows(result); mysql_free_result(result); - + return Rows; } @@ -1345,7 +1345,7 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { // int i; MYSQL_RES *result; MYSQL_ROW row; - + for (int a = 0; a < 512; a++) { guilds[a].leader = 0; guilds[a].databaseID = 0; @@ -1376,7 +1376,7 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { Sleep(0); } - + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, eqid, name, leader, minstatus, rank0title, rank1, rank1title, rank2, rank2title, rank3, rank3title, rank4, rank4title, rank5, rank5title from guilds"), errbuf, &result)) { safe_delete_array(query); @@ -1422,7 +1422,7 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { guilds[guildeqid].rank[i].motd = 0; guilds[guildeqid].rank[i].warpeace = 0; } - + if (guilds[guildeqid].rank[i].rankname[0] == 0) snprintf(guilds[guildeqid].rank[i].rankname, 100, "Guild Rank %i", i); } @@ -1438,7 +1438,7 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { safe_delete_array(query); return false; } - + return false; } @@ -1462,7 +1462,7 @@ bool Database::GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr) { char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, eqid, name, leader, minstatus, rank0title, rank1, rank1title, rank2, rank2title, rank3, rank3title, rank4, rank4title, rank5, rank5title from guilds where eqid=%i;", guildeqid), errbuf, &result)) { safe_delete_array(query); @@ -1504,7 +1504,7 @@ bool Database::GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr) { gr->rank[i].motd = 0; gr->rank[i].warpeace = 0; } - + if (gr->rank[i].rankname[0] == 0) snprintf(gr->rank[i].rankname, 100, "Guild Rank %i", i); } @@ -1547,7 +1547,7 @@ bool Database::GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr) { safe_delete_array(query); return false; } - + return false; } diff --git a/common/guild_base.h b/common/guild_base.h index 0b3e2269e..f27afb3d0 100644 --- a/common/guild_base.h +++ b/common/guild_base.h @@ -17,7 +17,7 @@ public: uint16 level; uint32 time_last_on; uint32 zone_id; - + //fields from `guild_members` uint32 guild_id; uint8 rank; @@ -34,13 +34,13 @@ class BaseGuildManager { public: BaseGuildManager(); virtual ~BaseGuildManager(); - + //this must be called before doing anything else with this object void SetDatabase(Database *db) { m_db = db; } - + bool LoadGuilds(); bool RefreshGuild(uint32 guild_id); - + //guild edit actions. uint32 CreateGuild(const char* name, uint32 leader_char_id); bool DeleteGuild(uint32 guild_id); @@ -48,7 +48,7 @@ public: bool SetGuildMOTD(uint32 guild_id, const char* motd, const char *setter); bool SetGuildURL(uint32 GuildID, const char* URL); bool SetGuildChannel(uint32 GuildID, const char* Channel); - + //character edit actions bool SetGuildLeader(uint32 guild_id, uint32 leader_char_id); bool SetGuild(uint32 charid, uint32 guild_id, uint8 rank); @@ -59,7 +59,7 @@ public: bool GetBankerFlag(uint32 CharID); bool SetTributeFlag(uint32 charid, bool enabled); bool SetPublicNote(uint32 charid, const char *note); - + //queries bool GetCharInfo(const char *char_name, CharGuildInfo &into); bool GetCharInfo(uint32 char_id, CharGuildInfo &into); @@ -82,19 +82,19 @@ public: uint32 NumberInGuild(uint32 guild_id); // bool GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr); // bool EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* grl); - + uint8 *MakeGuildList(const char *head_name, uint32 &length) const; //make a guild list packet, returns ownership of the buffer. - + static const char *const GuildActionNames[_MaxGuildAction]; uint32 DoesAccountContainAGuildLeader(uint32 AccountID); - + protected: //the methods which must be defined by base classes. virtual void SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) = 0; virtual void SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) = 0; virtual void SendRankUpdate(uint32 CharID) = 0; virtual void SendGuildDelete(uint32 guild_id) = 0; - + uint32 DBCreateGuild(const char* name, uint32 leader_char_id); bool DBDeleteGuild(uint32 guild_id); bool DBRenameGuild(uint32 guild_id, const char* name); @@ -110,9 +110,9 @@ protected: bool DBSetPublicNote(uint32 charid, const char *note); bool _RunQuery(char *&query, int len, const char *errmsg); // void DBSetPublicNote(uint32 guild_id,char* charname, char* note); - + bool LocalDeleteGuild(uint32 guild_id); - + class RankInfo { public: RankInfo(); @@ -133,12 +133,12 @@ protected: //tribute is not in here on purpose, since it is only valid in world! RankInfo ranks[GUILD_MAX_RANK+1]; }; - + std::map m_guilds; //we own the pointers in this map void ClearGuilds(); //clears internal structure - + Database *m_db; //we do not own this - + bool _StoreGuildDB(uint32 guild_id); GuildInfo *_CreateGuild(uint32 guild_id, const char *guild_name, uint32 account_id, uint8 minstatus, const char *guild_motd, const char *motd_setter, const char *Channel, const char *URL); uint32 _GetFreeGuildID(); diff --git a/common/guilds.cpp b/common/guilds.cpp index 83dd147d2..3e15c3307 100644 --- a/common/guilds.cpp +++ b/common/guilds.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -63,7 +63,7 @@ uint32 Database::NumberInGuild(uint32 guild_id) { char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + if (RunQuery(query, MakeAnyLenString(&query, "Select count(id) from character_ where guild=%i", guild_id), errbuf, &result)) { safe_delete_array(query); if (mysql_num_rows(result) == 1) { @@ -85,7 +85,7 @@ bool Database::SetGuild(char* name, uint32 guild_id, uint8 guildrank) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET guild=%i, guildrank=%i WHERE name='%s'", guild_id, guildrank, name), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -105,7 +105,7 @@ bool Database::SetGuild(uint32 charid, uint32 guild_id, uint8 guildrank) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET guild=%i, guildrank=%i WHERE id=%i", guild_id, guildrank, charid), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -119,7 +119,7 @@ bool Database::SetGuild(uint32 charid, uint32 guild_id, uint8 guildrank) { safe_delete_array(query); return false; } - + return false; } @@ -129,7 +129,7 @@ bool Database::DeleteGuild(uint32 guild_id) char *query = 0; char *query2 = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guilds WHERE id=%i;", guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) { @@ -146,7 +146,7 @@ bool Database::DeleteGuild(uint32 guild_id) safe_delete_array(query); return false; } - + return false; } @@ -156,7 +156,7 @@ bool Database::RenameGuild(uint32 guild_id, const char* name) { uint32 affected_rows = 0; char buf[65]; DoEscapeString(buf, name, strlen(name)) ; - + if (RunQuery(query, MakeAnyLenString(&query, "Update guilds set name='%s' WHERE id=%i;", buf, guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -169,7 +169,7 @@ bool Database::RenameGuild(uint32 guild_id, const char* name) { safe_delete_array(query); return false; } - + return false; } @@ -192,12 +192,12 @@ bool Database::EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* buf2[GUILD_DEMOTE] = grl->demote + '0'; buf2[GUILD_MOTD] = grl->motd + '0'; buf2[GUILD_WARPEACE] = grl->warpeace + '0'; - + if (ranknum == 0) chars = MakeAnyLenString(&query, "Update guilds set rank%ititle='%s' WHERE id=%i;", ranknum, buf, guild_id); else chars = MakeAnyLenString(&query, "Update guilds set rank%ititle='%s', rank%i='%s' WHERE id=%i;", ranknum, buf, ranknum, buf2, guild_id); - + if (RunQuery(query, chars, errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -210,7 +210,7 @@ bool Database::EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* safe_delete_array(query); return false; } - + return false; } @@ -219,8 +219,8 @@ bool Database::GetGuildNameByID(uint32 guild_id, char * name) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; - MYSQL_ROW row; - + MYSQL_ROW row; + if (RunQuery(query, MakeAnyLenString(&query, "select name from guilds where id='%i'", guild_id), errbuf, &result)) { safe_delete_array(query); row = mysql_fetch_row(result); @@ -234,7 +234,7 @@ bool Database::GetGuildNameByID(uint32 guild_id, char * name) { safe_delete_array(query); return false; } - + return false; } @@ -244,7 +244,7 @@ uint32 Database::GetGuildIDbyLeader(uint32 leader) char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM guilds WHERE leader=%i", leader), errbuf, &result)) { safe_delete_array(query); if (mysql_num_rows(result) == 1) @@ -260,7 +260,7 @@ uint32 Database::GetGuildIDbyLeader(uint32 leader) LogFile->write(EQEMuLog::Error, "Error in Getguild_idbyLeader query '%s': %s", query, errbuf); safe_delete_array(query); } - + return 0; } @@ -269,7 +269,7 @@ bool Database::SetGuildLeader(uint32 guild_id, uint32 leader) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "UPDATE guilds SET leader=%i WHERE id=%i", leader, guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -282,7 +282,7 @@ bool Database::SetGuildLeader(uint32 guild_id, uint32 leader) safe_delete_array(query); return false; } - + return false; } @@ -291,11 +291,11 @@ bool Database::SetGuildMOTD(uint32 guild_id, const char* motd) { char *query = 0; char* motdbuf = 0; uint32 affected_rows = 0; - + motdbuf = new char[(strlen(motd)*2)+3]; DoEscapeString(motdbuf, motd, strlen(motd)) ; - + if (RunQuery(query, MakeAnyLenString(&query, "Update guilds set motd='%s' WHERE id=%i;", motdbuf, guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); delete motdbuf; @@ -311,7 +311,7 @@ bool Database::SetGuildMOTD(uint32 guild_id, const char* motd) { delete motdbuf; return false; } - + return false; } diff --git a/common/ipc_mutex.h b/common/ipc_mutex.h index 1e11325a6..41e1f1731 100644 --- a/common/ipc_mutex.h +++ b/common/ipc_mutex.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -22,10 +22,10 @@ #include namespace EQEmu { - + //! Interprocess Named Binary Semaphore (Mutex) /*! - Important to note: while this can be used to synchronize processes, it is not in itself re-entrant or thread-safe + Important to note: while this can be used to synchronize processes, it is not in itself re-entrant or thread-safe and thus should be used from one thread and non-recursively. It was intended to be a simple synchronization method for our MemoryMappedFile loading. */ @@ -38,16 +38,16 @@ namespace EQEmu { \param name The name of this mutex. */ IPCMutex(std::string name); - + //! Destructor ~IPCMutex(); - + //! Lock the mutex /*! Same basic function as P(): for(;;) { if(S > 0) { S -= 1; break; } } */ bool Lock(); - + //! Unlocks the mutex /*! Same basic function as V(): S += 1; @@ -56,7 +56,7 @@ namespace EQEmu { private: IPCMutex(const IPCMutex&); const IPCMutex& operator=(const IPCMutex&); - + bool locked_; //!< Whether this mutex is locked or not Implementation *imp_; }; diff --git a/common/languages.h b/common/languages.h index 39aee2717..a5b4e5f5b 100644 --- a/common/languages.h +++ b/common/languages.h @@ -1,20 +1,20 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.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; version 2 of the License. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ #ifndef LANGUAGES_H #define LANGUAGES_H #include "../common/types.h" diff --git a/common/linked_list.h b/common/linked_list.h index 491ec5804..7f004407d 100644 --- a/common/linked_list.h +++ b/common/linked_list.h @@ -24,7 +24,7 @@ enum direction{FORWARD,BACKWARD}; template class LinkedListIterator; -template +template class ListElement { private: @@ -56,17 +56,17 @@ public: inline const TYPE& GetData () const { return data ; } void SetData ( const TYPE& d ) { data = d ; } // Quagmire - this may look like a mem leak, but dont change it, this behavior is expected where it's called - void SetLastNext ( ListElement* p ) + void SetLastNext ( ListElement* p ) { GetLast()->SetNext(p); - } - void SetNext (ListElement* n) { next = n ; } - void SetPrev (ListElement* p) { prev = p ; } + } + void SetNext (ListElement* n) { next = n ; } + void SetPrev (ListElement* p) { prev = p ; } void ReplaceData(const TYPE&); }; -template +template class LinkedList { private: @@ -94,20 +94,20 @@ public: friend class LinkedListIterator; }; -template +template class LinkedListIterator { private: LinkedList& list; ListElement* current_element; direction dir; - + public: LinkedListIterator(LinkedList& l,direction d = FORWARD) : list(l), dir(d) {}; void Advance(); const TYPE& GetData(); - bool IsFirst() + bool IsFirst() { if (current_element->GetPrev() == 0) return true; @@ -283,7 +283,7 @@ void LinkedListIterator::Reset() current_element=0; return; } - + if (dir == FORWARD) { current_element = list.first; @@ -389,7 +389,7 @@ template void LinkedList::Append(const TYPE& data) { ListElement* new_element = new ListElement(data); - + if (first == 0) { first = new_element; diff --git a/common/logsys.cpp b/common/logsys.cpp index a7cd2d698..16e365558 100644 --- a/common/logsys.cpp +++ b/common/logsys.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -33,7 +33,7 @@ const char *log_category_names[NUMBER_OF_LOG_CATEGORIES] = { //this array is private to this file, only a const version of it is exposed #define LOG_TYPE(category, type, enabled) { enabled, LOG_ ##category, #category "__" #type }, -static LogTypeStatus real_log_type_info[NUMBER_OF_LOG_TYPES+1] = +static LogTypeStatus real_log_type_info[NUMBER_OF_LOG_TYPES+1] = { #include "logtypes.h" { false, NUMBER_OF_LOG_CATEGORIES, "BAD TYPE" } /* dummy trailing record */ @@ -97,14 +97,14 @@ bool load_log_settings(const char *filename) { #ifdef _WINDOWS if (sscanf(linebuf, "%[^=]=%[^\n]\n", type_name, value) != 2) continue; -#else +#else if (sscanf(linebuf, "%[^=]=%[^\r\n]\n", type_name, value) != 2) continue; #endif - + if(type_name[0] == '\0' || type_name[0] == '#') continue; - + //first make sure we understand the value bool enabled; if(!strcasecmp(value, "on") || !strcasecmp(value, "true") || !strcasecmp(value, "yes") || !strcasecmp(value, "enabled") || !strcmp(value, "1")) @@ -115,7 +115,7 @@ bool load_log_settings(const char *filename) { printf("Unable to parse value '%s' from %s. Skipping line.", value, filename); continue; } - + int r; //first see if it is a category name for(r = 0; r < NUMBER_OF_LOG_CATEGORIES; r++) { @@ -135,7 +135,7 @@ bool load_log_settings(const char *filename) { } continue; } - + for(r = 0; r < NUMBER_OF_LOG_TYPES; r++) { if(!strcasecmp(log_type_info[r].name, type_name)) break; @@ -144,7 +144,7 @@ bool load_log_settings(const char *filename) { printf("Unable to locate log type %s from file %s. Skipping line.", type_name, filename); continue; } - + //got it all figured out, do something now... if(enabled) log_enable(LogType(r)); diff --git a/common/logsys.h b/common/logsys.h index a8c27fdf9..beb6856d7 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -19,9 +19,9 @@ #define LOGSYS_H_ /* - * + * * Usage: - * + * * These are the main functions provided by logsys: * - _log(TYPE, fmt, ...) - Log a message in any context * - mlog(TYPE, fmt, ...) - Zone only. Log a message from a Mob:: context, prefixing it with the mob's name. @@ -32,14 +32,14 @@ * - _pkt(TYPE, BasePacket *) - Log a packet hex dump with header in any context. * - mhex(TYPE, data, length) - Zone only. Log a packet hex dump from a Mob:: context, prefixing it with the mob's name * Types are defined in logtypes.h - * - * - * - * + * + * + * + * * this is very C-ish, not C++ish, but thats how I felt like writting it - * - * - * + * + * + * */ #include @@ -180,7 +180,7 @@ extern bool load_log_settings(const char *filename); #endif /*LOGSYS_H_*/ - + diff --git a/common/logsys_eqemu.cpp b/common/logsys_eqemu.cpp index 56f4f2c5b..31f8621da 100644 --- a/common/logsys_eqemu.cpp +++ b/common/logsys_eqemu.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -33,7 +33,7 @@ void log_messageVA(LogType type, const char *fmt, va_list args) { char prefix_buffer[256]; snprintf(prefix_buffer, 255, "[%s] ", log_type_info[type].name); prefix_buffer[255] = '\0'; - + LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args); } diff --git a/common/logtypes.h b/common/logtypes.h index 156b22f18..2dfa7c61e 100644 --- a/common/logtypes.h +++ b/common/logtypes.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/common/md5.cpp b/common/md5.cpp index f44b590bb..b91d42389 100644 --- a/common/md5.cpp +++ b/common/md5.cpp @@ -61,7 +61,7 @@ MD5::operator const char* () { snprintf(pMD5String, sizeof(pMD5String), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", pMD5[0], pMD5[1], pMD5[2], pMD5[3], pMD5[4], pMD5[5], pMD5[6], pMD5[7], pMD5[8], pMD5[9], pMD5[10], pMD5[11], pMD5[12], pMD5[13], pMD5[14], pMD5[15]); return pMD5String; } - + bool MD5::operator== (const MD5& iMD5) { if (memcmp(pMD5, iMD5.pMD5, 16) == 0) return true; @@ -268,4 +268,4 @@ void MD5::Transform(uint32 hash[4], const uint32 input[16]) { MD5STEP(F4, b, c, d, a, input[ 9]+0xeb86d391, 21); hash[0] += a; hash[1] += b; hash[2] += c; hash[3] += d; -} +} diff --git a/common/md5.h b/common/md5.h index 958443c96..13dfd5f9e 100644 --- a/common/md5.h +++ b/common/md5.h @@ -11,7 +11,7 @@ public: uint32 input[16]; }; static void Generate(const uint8* buf, uint32 len, uint8 digest[16]); - + static void Init(struct MD5Context *context); static void Update(struct MD5Context *context, const uint8 *buf, uint32 len); static void Final(uint8 digest[16], struct MD5Context *context); @@ -21,7 +21,7 @@ public: MD5(const char* buf, uint32 len); MD5(const uint8 buf[16]); MD5(const char* iMD5String); - + void Generate(const char* iString); void Generate(const uint8* buf, uint32 len); bool Set(const uint8 buf[16]); diff --git a/common/memory_mapped_file.cpp b/common/memory_mapped_file.cpp index ca2ae0c6d..c12eafeaf 100644 --- a/common/memory_mapped_file.cpp +++ b/common/memory_mapped_file.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -40,45 +40,45 @@ namespace EQEmu { #endif }; - MemoryMappedFile::MemoryMappedFile(std::string filename, uint32 size) + MemoryMappedFile::MemoryMappedFile(std::string filename, uint32 size) : filename_(filename), size_(size) { imp_ = new Implementation; - + #ifdef _WINDOWS DWORD total_size = size + sizeof(shared_memory_struct); - HANDLE file = CreateFile(filename.c_str(), - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, + HANDLE file = CreateFile(filename.c_str(), + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, 0, nullptr); - + if(file == INVALID_HANDLE_VALUE) { EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); } - + imp_->mapped_object_ = CreateFileMapping(file, nullptr, - PAGE_READWRITE, + PAGE_READWRITE, 0, total_size, filename.c_str()); - + if(!imp_->mapped_object_) { EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); } - + memory_ = reinterpret_cast(MapViewOfFile(imp_->mapped_object_, FILE_MAP_ALL_ACCESS, 0, - 0, + 0, total_size)); - + if(!memory_) { EQ_EXCEPT("Shared Memory", "Could not map a view of the shared memory file."); } - + #else size_t total_size = size + sizeof(shared_memory_struct); imp_->fd_ = open(filename.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); @@ -98,11 +98,11 @@ namespace EQEmu { } #endif } - - MemoryMappedFile::MemoryMappedFile(std::string filename) + + MemoryMappedFile::MemoryMappedFile(std::string filename) : filename_(filename) { imp_ = new Implementation; - + //get existing size FILE *f = fopen(filename.c_str(), "rb"); if(!f) { @@ -115,39 +115,39 @@ namespace EQEmu { #ifdef _WINDOWS DWORD total_size = size + sizeof(shared_memory_struct); - HANDLE file = CreateFile(filename.c_str(), - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, + HANDLE file = CreateFile(filename.c_str(), + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, 0, nullptr); - + if(file == INVALID_HANDLE_VALUE) { EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); } - + imp_->mapped_object_ = CreateFileMapping(file, nullptr, - PAGE_READWRITE, + PAGE_READWRITE, 0, total_size, filename.c_str()); - + if(!imp_->mapped_object_) { EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); } - + memory_ = reinterpret_cast(MapViewOfFile(imp_->mapped_object_, FILE_MAP_ALL_ACCESS, 0, - 0, + 0, total_size)); - + if(!memory_) { EQ_EXCEPT("Shared Memory", "Could not map a view of the shared memory file."); } - + #else size_t total_size = size + sizeof(shared_memory_struct); imp_->fd_ = open(filename.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); @@ -182,7 +182,7 @@ namespace EQEmu { #endif delete imp_; } - + void MemoryMappedFile::ZeroFile() { memset(reinterpret_cast(memory_), 0, sizeof(shared_memory_struct)); memset(memory_->data, 0, size_); diff --git a/common/memory_mapped_file.h b/common/memory_mapped_file.h index e4de4c728..8ab588f34 100644 --- a/common/memory_mapped_file.h +++ b/common/memory_mapped_file.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -26,7 +26,7 @@ namespace EQEmu { //! Memory Backed Shared Memory /*! - Allows us to create shared memory that is backed by a file on both windows and unix platforms that + Allows us to create shared memory that is backed by a file on both windows and unix platforms that works in a consistent manner. Non-copyable. */ class MemoryMappedFile { @@ -40,15 +40,15 @@ namespace EQEmu { }; public: //! Constructor - /*! + /*! Creates a mmf for the given filename and of size. \param filename Actual filename of the mmf. \param size Size in bytes of the mmf. */ MemoryMappedFile(std::string filename, uint32 size); - + //! Constructor - /*! + /*! Creates a mmf for the given filename and gets the size based on the existing size. \param filename Actual filename of the mmf. */ @@ -59,19 +59,19 @@ namespace EQEmu { //! Get Data Operator inline void *operator->() const { return memory_->data; } - + //! Get Data Function inline void *Get() const { return memory_->data; } - + //! Get Size Function inline uint32 Size() const { return memory_->size; } - + //! Zeros all the memory in the file, and set it to be unloaded void ZeroFile(); private: //! Copy Constructor MemoryMappedFile(const MemoryMappedFile&); - + //! Assignment Operator const MemoryMappedFile& operator=(const MemoryMappedFile&); diff --git a/common/opcode_dispatch.h b/common/opcode_dispatch.h index a57408b66..352fc62ef 100644 --- a/common/opcode_dispatch.h +++ b/common/opcode_dispatch.h @@ -16,7 +16,7 @@ There are currently eight (times two) dispatch modes possible, the different modes for a given state differ only in the arguments which are passed to the dispatch function. -The variable length versions ensure that the packet is +The variable length versions ensure that the packet is AT LEAST as long as the supplied structure. The variable length versions should only be used when the packet @@ -76,7 +76,7 @@ IN_Cz(OP_ReqNewZone); IN_Cz(OP_SendExpZonein); //IN_Cr(OP_ZoneComplete); -//these three should stay raw, since we ignore their contents and +//these three should stay raw, since we ignore their contents and //they overlap with the connected opcodes IN_Cr(OP_SpawnAppearance); IN_Cr(OP_WearChange); @@ -477,14 +477,14 @@ OUT(OP_ZoneEntry, ServerZoneEntry_Struct); void Handle_##op (); #define INr(op) \ void Handle_##op (const EQApplicationPacket *app); -#define OUT_C(op, s) -#define OUT_Cv(op, s) -#define OUT_Cz(op) -#define OUT_Cr(op) -#define OUT(op, s) -#define OUTv(op, s) -#define OUTz(op) -#define OUTr(op) +#define OUT_C(op, s) +#define OUT_Cv(op, s) +#define OUT_Cz(op) +#define OUT_Cr(op) +#define OUT(op, s) +#define OUTv(op, s) +#define OUTz(op) +#define OUTr(op) #include "opcode_dispatch.h" #undef IN_C #undef IN_Cr @@ -514,7 +514,7 @@ public: RawOpcodeDispatcher(proc p) { d = p; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { (on->*d)(app); } @@ -528,7 +528,7 @@ public: ZeroOpcodeDispatcher(proc p) { d = p; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { if(app->size != 0) { //error.. @@ -548,7 +548,7 @@ public: d = p; struct_name = sn; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { if(app->size != sizeof(T)) { //error.. @@ -557,7 +557,7 @@ public: T * tmp = (T *) app->pBuffer; (on->*d)(tmp); } - + protected: proc d; const char *struct_name; @@ -571,7 +571,7 @@ public: d = p; struct_name = sn; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { if(app->size < sizeof(T)) { //error.. @@ -580,13 +580,13 @@ public: T * tmp = (T *) app->pBuffer; (on->*d)(tmp, app->size); } - + protected: proc d; const char *struct_name; }; - + //... client_packet.cpp void MapOpcodes() { @@ -607,14 +607,14 @@ void MapOpcodes() { ConnectedOpcodes[op] = new ZeroOpcodeDispatcher(&Client::Handle_##op); #define INr(op) \ ConnectedOpcodes[op] = new RawOpcodeDispatcher(&Client::Handle_##op); -#define OUT_C(op, s) -#define OUT_Cv(op, s) -#define OUT_Cz(op) -#define OUT_Cr(op) -#define OUT(op, s) -#define OUTv(op, s) -#define OUTz(op) -#define OUTr(op) +#define OUT_C(op, s) +#define OUT_Cv(op, s) +#define OUT_Cz(op) +#define OUT_Cr(op) +#define OUT(op, s) +#define OUTv(op, s) +#define OUTz(op) +#define OUTr(op) #include "opcode_dispatch.h" #undef IN_C #undef IN_Cr diff --git a/common/opcodemgr.cpp b/common/opcodemgr.cpp index 06e2bfab2..71bf97b7c 100644 --- a/common/opcodemgr.cpp +++ b/common/opcodemgr.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -37,9 +37,9 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, fprintf(stderr, "Unable to open opcodes file '%s'. Thats bad.\n", filename); return(false); } - + map eq; - + //load the opcode file into eq, could swap in a nice XML parser here char line[2048]; int lineno = 0; @@ -49,11 +49,11 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, line[0] = '\0'; //for blank line at end of file if(fgets(line, sizeof(line), opf) == nullptr) break; - + //ignore any line that dosent start with OP_ if(line[0] != 'O' || line[1] != 'P' || line[2] != '_') continue; - + char *num = line+3; //skip OP_ //look for the = sign while(*num != '=' && *num != '\0') { @@ -66,19 +66,19 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, } *num = '\0'; //null terminate the name num++; //num should point to the opcode - + //read the opcode if(sscanf(num, "0x%hx", &curop) != 1) { if(report_errors) fprintf(stderr, "Malformed opcode at %s:%d\n", filename, lineno); continue; } - + //we have a name and our opcode... stick it in the map eq[line] = curop; } fclose(opf); - - + + //do the mapping and store them in the shared memory array bool ret = true; EmuOpcode emu_op; @@ -92,7 +92,7 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, if(report_errors) printf("I will let you continue, since you may have gotten all the opcodes you need.\n"); break; } - + //find the opcode in the file res = eq.find(op_name); if(res == eq.end()) { @@ -100,11 +100,11 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, //ret = false; continue; //continue to give them a list of all missing opcodes } - + //ship the mapping off to shared mem. s->Set(emu_op, res->second); } - + return(ret); } @@ -148,17 +148,17 @@ bool RegularOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) NormalMemStrategy s; s.it = this; MOpcodes.lock(); - + loaded = true; eq_to_emu = new EmuOpcode[MAX_EQ_OPCODE]; emu_to_eq = new uint16[_maxEmuOpcode]; EQOpcodeCount = MAX_EQ_OPCODE; EmuOpcodeCount = _maxEmuOpcode; - + //dont need to set eq_to_emu cause every element should get a value memset(eq_to_emu, 0, sizeof(EmuOpcode)*MAX_EQ_OPCODE); memset(emu_to_eq, 0, sizeof(uint16)*_maxEmuOpcode); - + bool ret = LoadOpcodesFile(filename, &s, report_errors); MOpcodes.unlock(); return ret; @@ -167,15 +167,15 @@ bool RegularOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) bool RegularOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) { if(!loaded) return(LoadOpcodes(filename)); - + NormalMemStrategy s; s.it = this; MOpcodes.lock(); - + memset(eq_to_emu, 0, sizeof(uint16)*MAX_EQ_OPCODE); - + bool ret = LoadOpcodesFile(filename, &s, report_errors); - + MOpcodes.unlock(); return(ret); } @@ -209,12 +209,12 @@ EmuOpcode RegularOpcodeManager::EQToEmu(const uint16 eq_op) { } void RegularOpcodeManager::SetOpcode(EmuOpcode emu_op, uint16 eq_op) { - + //clear out old mapping uint16 oldop = emu_to_eq[emu_op]; if(oldop != 0) eq_to_emu[oldop] = OP_Unknown; - + //use our strategy, since we have it NormalMemStrategy s; s.it = this; @@ -233,7 +233,7 @@ NullOpcodeManager::NullOpcodeManager() : MutableOpcodeManager() { } - + bool NullOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { return(true); } @@ -241,7 +241,7 @@ bool NullOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { bool NullOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) { return(true); } - + uint16 NullOpcodeManager::EmuToEQ(const EmuOpcode emu_op) { return(0); } @@ -254,7 +254,7 @@ EmptyOpcodeManager::EmptyOpcodeManager() : MutableOpcodeManager() { } - + bool EmptyOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { return(true); } @@ -262,7 +262,7 @@ bool EmptyOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { bool EmptyOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) { return(true); } - + uint16 EmptyOpcodeManager::EmuToEQ(const EmuOpcode emu_op) { map::iterator f; f = emu_to_eq.find(emu_op); diff --git a/common/opcodemgr.h b/common/opcodemgr.h index dba37c881..14e6fde7a 100644 --- a/common/opcodemgr.h +++ b/common/opcodemgr.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -38,18 +38,18 @@ class OpcodeManager { public: OpcodeManager(); virtual ~OpcodeManager() {} - + virtual bool Mutable() { return(false); } virtual bool LoadOpcodes(const char *filename, bool report_errors = false) = 0; virtual bool ReloadOpcodes(const char *filename, bool report_errors = false) = 0; - + virtual uint16 EmuToEQ(const EmuOpcode emu_op) = 0; virtual EmuOpcode EQToEmu(const uint16 eq_op) = 0; - + static const char *EmuToName(const EmuOpcode emu_op); const char *EQToName(const uint16 emu_op); EmuOpcode NameSearch(const char *name); - + //This has to be public for stupid visual studio class OpcodeSetStrategy { public: @@ -61,7 +61,7 @@ protected: bool loaded; //true if all opcodes loaded Mutex MOpcodes; //this only protects the local machine //in a shared manager, this dosent protect others - + static bool LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors); }; @@ -77,13 +77,13 @@ public: class SharedOpcodeManager : public OpcodeManager { public: virtual ~SharedOpcodeManager() {} - + virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + protected: class SharedMemStrategy : public OpcodeManager::OpcodeSetStrategy { public: @@ -99,17 +99,17 @@ class RegularOpcodeManager : public MutableOpcodeManager { public: RegularOpcodeManager(); virtual ~RegularOpcodeManager(); - + virtual bool Editable() { return(true); } virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + //implement our editing interface virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op); - + protected: class NormalMemStrategy : public OpcodeManager::OpcodeSetStrategy { public: @@ -118,7 +118,7 @@ protected: void Set(EmuOpcode emu_op, uint16 eq_op); }; friend class NormalMemStrategy; - + uint16 *emu_to_eq; EmuOpcode *eq_to_emu; uint32 EQOpcodeCount; @@ -129,13 +129,13 @@ protected: class NullOpcodeManager : public MutableOpcodeManager { public: NullOpcodeManager(); - + virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + //fake it, just used for testing anyways virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op) {} }; @@ -146,13 +146,13 @@ public: class EmptyOpcodeManager : public MutableOpcodeManager { public: EmptyOpcodeManager(); - + virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + //fake it, just used for testing anyways virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op); protected: diff --git a/common/packet_dump.cpp b/common/packet_dump.cpp index 1a1d26d3a..1b6a9710d 100644 --- a/common/packet_dump.cpp +++ b/common/packet_dump.cpp @@ -55,8 +55,8 @@ void DumpPacketHex(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { return; // Output as HEX char output[4]; - int j = 0; - char* ascii = new char[cols+1]; + int j = 0; + char* ascii = new char[cols+1]; memset(ascii, 0, cols+1); uint32 i; for(i=skip; i> 3; - + uint64 swap = data[0]; data[0] = data[len/2]; data[len/2] = swap; - + for(uint32 i=0; i>0x19)|(data[i]<<0x27))+0x422437A9; @@ -61,11 +61,11 @@ void EncryptZoneSpawnPacket(uchar* pBuffer, uint32 size) { uint64 crypt = 0x0000; uint64 next_crypt; uint32 len = size >> 3; - + uint64 swap = data[0]; data[0] = data[len/2]; data[len/2] = swap; - + for(uint32 i=0; i>0x23))+0x659365E7; @@ -101,7 +101,7 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou static bool inited = false; static z_stream zstream; int zerror; - + if(in_data == nullptr && out_data == nullptr && in_length == 0 && max_out_length == 0) { //special delete state deflateEnd(&zstream); @@ -114,7 +114,7 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou zstream.opaque = Z_NULL; deflateInit(&zstream, Z_FINISH); } - + zstream.next_in = const_cast(in_data); zstream.avail_in = in_length; /* zstream.zalloc = Z_NULL; @@ -124,9 +124,9 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou zstream.next_out = out_data; zstream.avail_out = max_out_length; zerror = deflate(&zstream, Z_FINISH); - + deflateReset(&zstream); - + if (zerror == Z_STREAM_END) { // deflateEnd(&zstream); @@ -141,11 +141,11 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou if(in_data == nullptr) { return(0); } - + z_stream zstream; memset(&zstream, 0, sizeof(zstream)); int zerror; - + zstream.next_in = const_cast(in_data); zstream.avail_in = in_length; zstream.zalloc = eqemu_alloc_func; @@ -155,7 +155,7 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou zstream.next_out = out_data; zstream.avail_out = max_out_length; zerror = deflate(&zstream, Z_FINISH); - + if (zerror == Z_STREAM_END) { deflateEnd(&zstream); @@ -174,7 +174,7 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint static bool inited = false; static z_stream zstream; int zerror; - + if(indata == nullptr && outdata == nullptr && indatalen == 0 && outdatalen == 0) { //special delete state inflateEnd(&zstream); @@ -194,16 +194,16 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint zstream.zalloc = eqemu_alloc_func; zstream.zfree = eqemu_free_func; zstream.opaque = Z_NULL; - - i = inflateInit2( &zstream, 15 ); - if (i != Z_OK) { + + i = inflateInit2( &zstream, 15 ); + if (i != Z_OK) { return 0; } - + zerror = inflate( &zstream, Z_FINISH ); - + inflateReset(&zstream); - + if(zerror == Z_STREAM_END) { return zstream.total_out; } @@ -217,22 +217,22 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint DumpPacket(indata-16, indatalen+16); #endif } - + if (zerror == -4 && zstream.msg == 0) { return 0; } - + return 0; } #else if(indata == nullptr) return(0); - + z_stream zstream; int zerror = 0; int i; - + zstream.next_in = const_cast(indata); zstream.avail_in = indatalen; zstream.next_out = outdata; @@ -240,14 +240,14 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint zstream.zalloc = eqemu_alloc_func; zstream.zfree = eqemu_free_func; zstream.opaque = Z_NULL; - - i = inflateInit2( &zstream, 15 ); - if (i != Z_OK) { + + i = inflateInit2( &zstream, 15 ); + if (i != Z_OK) { return 0; } - + zerror = inflate( &zstream, Z_FINISH ); - + if(zerror == Z_STREAM_END) { inflateEnd( &zstream ); return zstream.total_out; @@ -262,12 +262,12 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint DumpPacket(indata-16, indatalen+16); #endif } - + if (zerror == -4 && zstream.msg == 0) { return 0; } - + zerror = inflateEnd( &zstream ); return 0; } @@ -293,30 +293,30 @@ uint64 rorl(uint64 in, uint8 bits) { uint32 CRCLookup(uchar idx) { if (idx == 0) return 0x00000000; - + if (idx == 1) return 0x77073096; - + if (idx == 2) return roll(CRCLookup(1), 1); - + if (idx == 4) return 0x076DC419; - + for (uchar b=7; b>0; b--) { uchar bv = 1 << b; - + if (!(idx ^ bv)) { // bit is only one set return ( roll(CRCLookup (4), b - 2) ); } - + if (idx&bv) { // bit is set return( CRCLookup(bv) ^ CRCLookup(idx&(bv - 1)) ); } } - + //Failure return false; } @@ -325,10 +325,10 @@ uint32 GenerateCRC(uint32 b, uint32 bufsize, uchar *buf) { uint32 CRC = (b ^ 0xFFFFFFFF); uint32 bufremain = bufsize; uchar* bufptr = buf; - + while (bufremain--) { CRC = CRCLookup((uchar)(*(bufptr++)^ (CRC&0xFF))) ^ (CRC >> 8); } - + return (htonl (CRC ^ 0xFFFFFFFF)); } diff --git a/common/packetfile.cpp b/common/packetfile.cpp index ad4937e0d..bbd251968 100644 --- a/common/packetfile.cpp +++ b/common/packetfile.cpp @@ -3,7 +3,7 @@ #else #include #endif - + #include #include #include @@ -32,15 +32,15 @@ bool PacketFileWriter::SetPacketStamp(const char *name, uint32 stamp) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + unsigned long magic = 0; - + if(fread(&magic, sizeof(magic), 1, in) != 1) { fprintf(stderr, "Error reading header from packet file: %s\n", strerror(errno)); fclose(in); return(false); } - + PacketFileReader *ret = NULL; if(magic == OLD_PACKET_FILE_MAGIC) { OldPacketFileHeader *pos = 0; @@ -69,33 +69,33 @@ bool PacketFileWriter::SetPacketStamp(const char *name, uint32 stamp) { fclose(in); return(false); } - + fclose(in); return(true); } - + bool PacketFileWriter::OpenFile(const char *name) { CloseFile(); - + printf("Opening packet file: %s\n", name); - + out = fopen(name, "wb"); if(out == NULL) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + PacketFileHeader head; head.packet_file_magic = PACKET_FILE_MAGIC; head.packet_file_version = PACKET_FILE_CURRENT_VERSION; head.packet_file_stamp = time(NULL); - + if(fwrite(&head, sizeof(head), 1, out) != 1) { fprintf(stderr, "Error writting header to packet file: %s\n", strerror(errno)); fclose(out); return(false); } - + return(true); } @@ -110,13 +110,13 @@ void PacketFileWriter::CloseFile() { void PacketFileWriter::WritePacket(uint16 eq_op, uint32 packlen, const unsigned char *packet, bool to_server, const struct timeval &tv) { if(out == NULL) return; - + _WriteBlock(eq_op, packet, packlen, to_server, tv); - + /* Could log only the packets we care about, but this is most of the stream, so just log them all... - + switch(eq_op) { case OP_NewZone: case OP_ZoneSpawns: @@ -139,23 +139,23 @@ void PacketFileWriter::WritePacket(uint16 eq_op, uint32 packlen, const unsigned bool PacketFileWriter::_WriteBlock(uint16 eq_op, const void *d, uint16 len, bool to_server, const struct timeval &tv) { if(out == NULL) return(false); - + PacketFileSection s; s.opcode = eq_op; s.len = len; s.tv_sec = tv.tv_sec; s.tv_msec = tv.tv_usec/1000; - + if(to_server) SetToServer(s); else SetToClient(s); - + if(fwrite(&s, sizeof(s), 1, out) != 1) { fprintf(stderr, "Error writting block header: %s\n", strerror(errno)); return(false); } - + if(fwrite(d, 1, len, out) != len) { fprintf(stderr, "Error writting block body: %s\n", strerror(errno)); return(false); @@ -163,7 +163,7 @@ bool PacketFileWriter::_WriteBlock(uint16 eq_op, const void *d, uint16 len, bool if(force_flush) fflush(out); - + return(true); } @@ -179,15 +179,15 @@ PacketFileReader *PacketFileReader::OpenPacketFile(const char *name) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(NULL); } - + unsigned long magic = 0; - + if(fread(&magic, sizeof(magic), 1, in) != 1) { fprintf(stderr, "Error reading header to packet file: %s\n", strerror(errno)); fclose(in); return(NULL); } - + PacketFileReader *ret = NULL; if(magic == OLD_PACKET_FILE_MAGIC) { ret = new OldPacketFileReader(); @@ -198,12 +198,12 @@ PacketFileReader *PacketFileReader::OpenPacketFile(const char *name) { fclose(in); return(NULL); } - + if(!ret->OpenFile(name)) { safe_delete(ret); return(NULL); } - + return(ret); } @@ -220,26 +220,26 @@ OldPacketFileReader::OldPacketFileReader() OldPacketFileReader::~OldPacketFileReader() { CloseFile(); } - + bool OldPacketFileReader::OpenFile(const char *name) { CloseFile(); - + //printf("Opening packet file: %s\n", name); - + in = fopen(name, "rb"); if(in == NULL) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + OldPacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { fprintf(stderr, "Error reading header to packet file: %s\n", strerror(errno)); fclose(in); return(false); } - + if(head.packet_file_magic != OLD_PACKET_FILE_MAGIC) { fclose(in); if(head.packet_file_magic > (OLD_PACKET_FILE_MAGIC)) { @@ -249,16 +249,16 @@ bool OldPacketFileReader::OpenFile(const char *name) { } return(false); } - + uint32 now = time(NULL); if(head.packet_file_stamp > now) { fprintf(stderr, "Error: invalid timestamp in file. Your clock or the collector's is wrong (%d sec ahead).\n", head.packet_file_stamp-now); fclose(in); return(false); } - + packet_file_stamp = head.packet_file_stamp; - + return(true); } @@ -274,14 +274,14 @@ bool OldPacketFileReader::ResetFile() { if(in == NULL) return(false); rewind(in); - + //gotta read past the header again OldPacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { return(false); } - + return(true); } @@ -290,23 +290,23 @@ bool OldPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch return(false); if(feof(in)) return(false); - + OldPacketFileSection s; - + if(fread(&s, sizeof(s), 1, in) != 1) { if(!feof(in)) fprintf(stderr, "Error reading section header: %s\n", strerror(errno)); return(false); } - + eq_op = s.opcode; - + if(packlen < s.len) { fprintf(stderr, "Packet buffer is too small! %d < %d, skipping\n", packlen, s.len); fseek(in, s.len, SEEK_CUR); return(false); } - + if(fread(packet, 1, s.len, in) != s.len) { if(feof(in)) fprintf(stderr, "Error: EOF encountered when expecting packet data.\n"); @@ -314,12 +314,12 @@ bool OldPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch fprintf(stderr, "Error reading packet body: %s\n", strerror(errno)); return(false); } - + packlen = s.len; to_server = false; tv.tv_sec = 0; tv.tv_usec = 0; - + return(true); } @@ -333,26 +333,26 @@ NewPacketFileReader::NewPacketFileReader() NewPacketFileReader::~NewPacketFileReader() { CloseFile(); } - + bool NewPacketFileReader::OpenFile(const char *name) { CloseFile(); - + //printf("Opening packet file: %s\n", name); - + in = fopen(name, "rb"); if(in == NULL) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + PacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { fprintf(stderr, "Error reading header to packet file: %s\n", strerror(errno)); fclose(in); return(false); } - + if(head.packet_file_magic != PACKET_FILE_MAGIC) { fclose(in); if(head.packet_file_magic == (PACKET_FILE_MAGIC+1)) { @@ -362,16 +362,16 @@ bool NewPacketFileReader::OpenFile(const char *name) { } return(false); } - + uint32 now = time(NULL); if(head.packet_file_stamp > now) { fprintf(stderr, "Error: invalid timestamp in file. Your clock or the collector's is wrong (%d sec ahead).\n", head.packet_file_stamp-now); fclose(in); return(false); } - + packet_file_stamp = head.packet_file_stamp; - + return(true); } @@ -387,14 +387,14 @@ bool NewPacketFileReader::ResetFile() { if(in == NULL) return(false); rewind(in); - + //gotta read past the header again PacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { return(false); } - + return(true); } @@ -403,23 +403,23 @@ bool NewPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch return(false); if(feof(in)) return(false); - + PacketFileSection s; - + if(fread(&s, sizeof(s), 1, in) != 1) { if(!feof(in)) fprintf(stderr, "Error reading section header: %s\n", strerror(errno)); return(false); } - + eq_op = s.opcode; - + if(packlen < s.len) { fprintf(stderr, "Packet buffer is too small! %d < %d, skipping\n", packlen, s.len); fseek(in, s.len, SEEK_CUR); return(false); } - + if(fread(packet, 1, s.len, in) != s.len) { if(feof(in)) fprintf(stderr, "Error: EOF encountered when expecting packet data.\n"); @@ -427,12 +427,12 @@ bool NewPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch fprintf(stderr, "Error reading packet body: %s\n", strerror(errno)); return(false); } - + packlen = s.len; to_server = IsToServer(s); tv.tv_sec = s.tv_sec; tv.tv_usec = 1000*s.tv_msec; - + return(true); } diff --git a/common/packetfile.h b/common/packetfile.h index 35585f83a..bacbbc2b4 100644 --- a/common/packetfile.h +++ b/common/packetfile.h @@ -49,17 +49,17 @@ class PacketFileWriter { public: PacketFileWriter(bool force_flush); ~PacketFileWriter(); - + bool OpenFile(const char *name); void CloseFile(); - + void WritePacket(uint16 eq_op, uint32 packlen, const unsigned char *packet, bool to_server, const struct timeval &tv); - + static bool SetPacketStamp(const char *file, uint32 stamp); - + protected: bool _WriteBlock(uint16 eq_op, const void *d, uint16 len, bool to_server, const struct timeval &tv); - + //gzFile out; FILE *out; bool force_flush; @@ -69,20 +69,20 @@ protected: class PacketFileReader { public: PacketFileReader(); - + virtual bool OpenFile(const char *name) = 0; virtual void CloseFile() = 0; virtual bool ResetFile() = 0; //aka rewind - + virtual bool ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned char *packet, bool &to_server, struct timeval &tv) = 0; - + time_t GetStamp() { return(time_t(packet_file_stamp)); } - + //factory method to open the right packet file. static PacketFileReader *OpenPacketFile(const char *name); - + protected: - + uint32 packet_file_stamp; }; @@ -90,38 +90,38 @@ class OldPacketFileReader : public PacketFileReader { public: OldPacketFileReader(); virtual ~OldPacketFileReader(); - + bool OpenFile(const char *name); void CloseFile(); bool ResetFile(); //aka rewind - + bool ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned char *packet, bool &to_server, struct timeval &tv); - + time_t GetStamp() { return(time_t(packet_file_stamp)); } - + protected: - + //gzFile in; - FILE *in; + FILE *in; }; class NewPacketFileReader: public PacketFileReader { public: NewPacketFileReader(); virtual ~NewPacketFileReader(); - + bool OpenFile(const char *name); void CloseFile(); bool ResetFile(); //aka rewind - + bool ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned char *packet, bool &to_server, struct timeval &tv); - + time_t GetStamp() { return(time_t(packet_file_stamp)); } - + protected: - + //gzFile in; - FILE *in; + FILE *in; }; diff --git a/common/patches/Client62.cpp b/common/patches/Client62.cpp index 1a535a7f0..6f5f52fbf 100644 --- a/common/patches/Client62.cpp +++ b/common/patches/Client62.cpp @@ -19,7 +19,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -35,35 +35,35 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -138,10 +138,10 @@ ENCODE(OP_SendCharInfo) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 2 is for 6.2 if (emu->clientver <= 2 ) @@ -178,7 +178,7 @@ ENCODE(OP_SendAATable) { OUT(abilities[r].slot); } } - + FINISH_ENCODE(); } @@ -199,19 +199,19 @@ ENCODE(OP_DeleteSpawn) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + memset(eq->unknown3224, 0xff, 448); memset(eq->unknown3704, 0xff, 32); - + // OUT(checksum); OUT(gender); OUT(race); OUT(class_); OUT(level); eq->level2 = emu->level; - + eq->bind_zone_id = emu->binds[0].zoneId; eq->bind_x[0] = emu->binds[0].x; eq->bind_y[0] = emu->binds[0].y; @@ -222,8 +222,8 @@ ENCODE(OP_PlayerProfile) { eq->zone_safe_y = emu->binds[4].y; eq->zone_safe_z = emu->binds[4].z; eq->zone_safe_heading = emu->binds[4].heading; - - + + OUT(deity); OUT(intoxication); OUT_array(spellSlotRefresh, structs::MAX_PP_MEMSPELL); @@ -361,10 +361,10 @@ ENCODE(OP_PlayerProfile) { OUT(raidAutoconsent); OUT(guildAutoconsent); // OUT(showhelm); - + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -408,11 +408,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -420,16 +420,16 @@ ENCODE(OP_ZoneSpawns) { delete in; return; } - + //make the EQ struct. in->size = sizeof(structs::Spawn_Struct)*entrycount; in->pBuffer = new unsigned char[in->size]; structs::Spawn_Struct *eq = (structs::Spawn_Struct *) in->pBuffer; - + //zero out the packet. We could avoid this memset by setting all fields (including unknowns) //in the loop. memset(in->pBuffer, 0, in->size); - + //do the transform... int r; int k; @@ -492,7 +492,7 @@ ENCODE(OP_ZoneSpawns) { eq->lfg = emu->lfg; eq->flymode = emu->flymode; } - + //kill off the emu structure and send the eq packet. delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); @@ -503,7 +503,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; @@ -532,7 +532,7 @@ ENCODE(OP_CharInventory) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -543,7 +543,7 @@ ENCODE(OP_CharInventory) { return; } InternalSerializedItem_Struct *eq = (InternalSerializedItem_Struct *) in->pBuffer; - + //do the transform... int r; string serial_string; @@ -556,7 +556,7 @@ ENCODE(OP_CharInventory) { } else { _log(NET__STRUCTS, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.",eq->slot_id); } - + } in->size = serial_string.length(); @@ -571,39 +571,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -611,14 +611,14 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct - + //nice helper macro /*#define SlideStructString(field, str) \ strcpy(e->field, str.c_str()); \ @@ -632,7 +632,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -647,7 +647,7 @@ ENCODE(OP_GuildMemberList) { e->zone_id = htons(emu_e->zone_id); #undef SlideStructString #undef PutFieldN - + e++; } } @@ -661,9 +661,9 @@ ENCODE(OP_ReadBook) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; - + BookText_Struct *emu_BookText_Struct = (BookText_Struct *)__emu_buffer; in->size = sizeof(structs::BookText_Struct) + strlen(emu_BookText_Struct->booktext); @@ -857,14 +857,14 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { IN(augments[r]); } IN(link_hash); - + FINISH_DIRECT_DECODE(); } @@ -918,7 +918,7 @@ DECODE(OP_WhoAllRequest) { IN(lvlhigh); IN(gmlookup); emu->type = 3; - + FINISH_DIRECT_DECODE(); } @@ -983,7 +983,7 @@ char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 d } } - + *length=MakeAnyLenString(&serialization, "%.*s%s" // For leading quotes (and protection) if a subitem; "%s" // Instance data diff --git a/common/patches/Client62.h b/common/patches/Client62.h index e34b8cb48..f4a70bc90 100644 --- a/common/patches/Client62.h +++ b/common/patches/Client62.h @@ -7,31 +7,31 @@ class EQStreamIdentifier; namespace Client62 { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "Client62_ops.h" }; - + }; #endif /*CLIENT62_H_*/ diff --git a/common/patches/Client62_structs.h b/common/patches/Client62_structs.h index aa48fc0e6..c03777610 100644 --- a/common/patches/Client62_structs.h +++ b/common/patches/Client62_structs.h @@ -62,7 +62,7 @@ struct DuelResponse_Struct }; /* Cofruben: - Adventure stuff,not a net one,just one for our use + Adventure stuff,not a net one,just one for our use */ static const uint32 ADVENTURE_COLLECT = 0; static const uint32 ADVENTURE_MASSKILL = 1; @@ -155,15 +155,15 @@ struct CharacterSelect_Struct { ** */ -/* -** Generic Spawn Struct -** Length: 383 Octets -** Used in: +/* +** Generic Spawn Struct +** Length: 383 Octets +** Used in: ** spawnZoneStruct ** dbSpawnStruct ** petStruct ** newSpawnStruct -*/ +*/ struct Spawn_Struct { /*0000*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse,a @@ -188,9 +188,9 @@ struct Spawn_Struct signed padding0070:19; // ***Placeholder /*0074*/ uint16 deity; // Player's Deity /*0076*/ uint8 unknown[2]; -/*0078*/ union +/*0078*/ union { - struct + struct { /*0078*/ uint32 equip_helmet; // Equipment: Helmet Visual /*0082*/ uint32 equip_chest; // Equipment: Chest Visual @@ -223,9 +223,9 @@ struct Spawn_Struct /*0166*/ uint8 is_npc; // 0=no, 1=yes /*0167*/ uint8 flymode; //seems to be 3 for 'useable' npc classes /*0168*/ uint32 guildID; // Current guild -/*0172*/ union +/*0172*/ union { - struct + struct { /*0172*/ Color_Struct color_helmet; // Color of helmet item /*0176*/ Color_Struct color_chest; // Color of chest item @@ -246,12 +246,12 @@ struct Spawn_Struct /*0217*/ uint8 beardcolor; // Beard color /*0218*/ float size; // Model size /*0222*/ uint8 findable; // 0=can't be found, 1=can be found -/*0223*/ float unknown_float; +/*0223*/ float unknown_float; /*0227*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) /*0259*/ uint8 unknown0259[4]; //[0] is sometimes 100 /*0263*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader /*0264*/ uint8 unknown0264[3]; -union +union { /*0267*/ uint8 equip_chest2; // Second place in packet for chest texture (usually 0xFF in live packets) // Not sure why there are 2 of them, but it effects chest texture! @@ -337,9 +337,9 @@ struct NewZone_Struct { ** Length: 12 Bytes ** */ -struct MemorizeSpell_Struct { -uint32 slot; // Spot in the spell book/memorized slot -uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) +struct MemorizeSpell_Struct { +uint32 slot; // Spot in the spell book/memorized slot +uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming uint32 unknown12; }; @@ -373,20 +373,20 @@ struct DeleteSpell_Struct }; struct ManaChange_Struct -{ +{ uint32 new_mana; // New Mana AMount uint32 stamina; uint32 spell_id; uint32 unknown12; }; -struct SwapSpell_Struct -{ - uint32 from_slot; - uint32 to_slot; +struct SwapSpell_Struct +{ + uint32 from_slot; + uint32 to_slot; -}; +}; struct BeginCast_Struct { @@ -526,8 +526,8 @@ struct CharCreate_Struct /*0092*/ int32 hairstyle; /*0096*/ uint32 deity; ///*0072*/ int32 deity; - - + + // 0 = odus // 1 = qeynos // 2 = halas @@ -563,7 +563,7 @@ struct CharCreate_Struct struct AA_Array { uint32 AA; - uint32 value; + uint32 value; }; @@ -603,7 +603,7 @@ struct Bandolier_Struct { struct PotionBelt_Struct { BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; }; - + static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY); @@ -650,17 +650,17 @@ struct PlayerProfile_Struct /*0200*/ float bind_heading[4]; // /*0216*/ float zone_safe_heading; /*0220*/ uint32 deity; // deity -/*0224*/ uint32 guild_id; +/*0224*/ uint32 guild_id; /*0228*/ uint32 birthday; // characters bday /*0232*/ uint32 lastlogin; // last login or zone time /*0236*/ uint32 timePlayedMin; // in minutes -/*0240*/ uint8 pvp; +/*0240*/ uint8 pvp; /*0241*/ uint8 level2; //no idea why this is here, but thats how it is on live /*0242*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon /*0243*/ uint8 gm; /*0244*/ uint8 guildrank; /*0245*/ uint8 unknown0245[7]; // -/*0252*/ uint32 intoxication; +/*0252*/ uint32 intoxication; /*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms /*0292*/ uint32 abilitySlotRefresh; /*0296*/ uint8 haircolor; // Player hair color @@ -684,7 +684,7 @@ struct PlayerProfile_Struct /*2416*/ char suffix[32]; //length might be wrong /*2448*/ uint32 guildid2; // /*2452*/ uint32 exp; // Current Experience -/*2456*/ uint32 unknown1496; +/*2456*/ uint32 unknown1496; /*2460*/ uint32 points; // Unspent Practice points /*2464*/ uint32 mana; // current mana /*2468*/ uint32 cur_hp; // current hp @@ -701,7 +701,7 @@ struct PlayerProfile_Struct /*2552*/ uint8 languages[MAX_PP_LANGUAGE]; /*2580*/ uint8 unknown1620[4]; /*2584*/ uint32 spell_book[MAX_PP_SPELLBOOK]; -/*4184*/ uint8 unknown3224[448]; // all 0xff +/*4184*/ uint8 unknown3224[448]; // all 0xff /*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL]; /*4668*/ uint8 unknown3704[32]; // /*4700*/ float y; // Player y position @@ -741,7 +741,7 @@ struct PlayerProfile_Struct /*5476*/ int32 hunger_level; /*5480*/ int32 thirst_level; /*5484*/ uint32 ability_up; -/*5488*/ char unknown4524[16]; +/*5488*/ char unknown4524[16]; /*5504*/ uint16 zone_id; // Current zone of the player /*5506*/ uint16 zoneInstance; // Instance ID /*5508*/ SpellBuff_Struct buffs[BUFF_COUNT]; // Buffs currently on the player @@ -900,7 +900,7 @@ struct BindWound_Struct /* ** Type: Zone Change Request (before hand) -** Length: 88 bytes +** Length: 88 bytes ** OpCode: a320 */ @@ -923,7 +923,7 @@ struct RequestClientZoneChange_Struct { /*08*/ float x; /*12*/ float z; /*16*/ float heading; -/*20*/ uint32 type; //unknown... values +/*20*/ uint32 type; //unknown... values }; struct Animation_Struct { @@ -1203,13 +1203,13 @@ struct TradeMoneyUpdate_Struct{ ** Surname struct ** Size: 100 bytes */ -struct Surname_Struct -{ +struct Surname_Struct +{ /*0000*/ char name[64]; /*0064*/ uint32 unknown0064; /*0068*/ char lastname[32]; /*0100*/ -}; +}; struct GuildsListEntry_Struct { char name[64]; @@ -1465,7 +1465,7 @@ struct Merchant_Click_Struct { /*000*/ uint32 npcid; // Merchant NPC's entity id /*004*/ uint32 playerid; /*008*/ uint32 command; //1=open, 0=cancel/close -/*012*/ float rate; //cost multiplier, dosent work anymore +/*012*/ float rate; //cost multiplier, dosent work anymore }; /* Unknowns: @@ -1584,7 +1584,7 @@ struct Illusion_Struct { /*068*/ uint16 race; /*070*/ char unknown070[2]; /*072*/ uint8 gender; -/*073*/ uint8 texture; +/*073*/ uint8 texture; /*074*/ uint8 helmtexture; /*075*/ uint8 unknown075; /*076*/ uint32 face; @@ -1636,14 +1636,14 @@ struct GroupCancel_Struct { uint8 toggle; }; -struct GroupUpdate_Struct { +struct GroupUpdate_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; /*0388*/ char leadersname[64]; }; -struct GroupUpdate2_Struct { +struct GroupUpdate2_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; @@ -1652,7 +1652,7 @@ struct GroupUpdate2_Struct { /*0580*/ uint8 unknown[188]; /*0768*/ }; -struct GroupJoin_Struct { +struct GroupJoin_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[64]; @@ -1666,10 +1666,10 @@ struct FaceChange_Struct { /*003*/ uint8 eyecolor2; /*004*/ uint8 hairstyle; /*005*/ uint8 beard; // vesuvias -/*006*/ uint8 face; +/*006*/ uint8 face; //vesuvias: //there are only 10 faces for barbs changing woad just -//increase the face value by ten so if there were 8 woad +//increase the face value by ten so if there were 8 woad //designs then there would be 80 barb faces }; @@ -1751,11 +1751,11 @@ struct Who_All_Struct { // 76 length total /*140*/ }; -struct Stun_Struct { // 4 bytes total +struct Stun_Struct { // 4 bytes total uint32 duration; // Duration of stun }; -struct AugmentItem_Struct { +struct AugmentItem_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ int32 augment_slot; @@ -1769,11 +1769,11 @@ struct Emote_Struct { /*1028*/ }; -// Inspect -struct Inspect_Struct { - uint16 TargetID; - uint16 PlayerID; -}; +// Inspect +struct Inspect_Struct { + uint16 TargetID; + uint16 PlayerID; +}; //OP_InspectAnswer struct InspectResponse_Struct{//Cofruben:need to send two of this for the inspect response. /*000*/ uint32 TargetID; @@ -1958,7 +1958,7 @@ struct CloseContainer_Struct { /* ** Generic Door Struct ** Length: 52 Octets -** Used in: +** Used in: ** cDoorSpawnsStruct(f721) ** */ @@ -2557,7 +2557,7 @@ struct Split_Struct ** Last Updated: Oct-15-2003 ** */ -struct NewCombine_Struct { +struct NewCombine_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ @@ -2862,7 +2862,7 @@ struct RaidDetails_Struct { /*000*/ uint32 action; //=6,20 /*004*/ char leader_name[64]; /*068*/ uint32 unknown68[4]; -/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order +/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order /*128*/ uint8 unknown128[142]; /*354*/ uint32 leader_id; }; @@ -3022,7 +3022,7 @@ struct AA_Action { }; struct AA_Skills { //this should be removed and changed to AA_Array -/*00*/ uint32 aa_skill; +/*00*/ uint32 aa_skill; /*04*/ uint32 aa_value; }; @@ -3053,13 +3053,13 @@ struct AATable_Struct { struct Weather_Struct { uint32 val1; //generall 0x000000FF uint32 type; //0x31=rain, 0x02=snow(i think), 0 = normal - uint32 mode; + uint32 mode; }; struct ZoneInUnknown_Struct { uint32 val1; uint32 val2; - uint32 val3; + uint32 val3; }; struct MobHealth_Struct { diff --git a/common/patches/RoF.cpp b/common/patches/RoF.cpp index 0f62d1081..b6eeb49d0 100644 --- a/common/patches/RoF.cpp +++ b/common/patches/RoF.cpp @@ -22,7 +22,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -38,37 +38,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -103,7 +103,7 @@ const EQClientVersion Strategy::ClientVersion() const { return EQClientRoF; } - + #include "SSDefine.h" // Converts Titanium Slot IDs to RoF Slot IDs for use in Encodes @@ -134,7 +134,7 @@ static inline structs::ItemSlotStruct TitaniumToRoFSlot(uint32 TitaniumSlot) { RoFSlot.MainSlot += 1; } - + } /*else if (TitaniumSlot < 51) // Cursor Buffer { @@ -430,13 +430,13 @@ ENCODE(OP_TaskHistoryReply) // Skip past Text2 while(in->ReadUInt8()) ++Text2Length; - + in->ReadUInt32(); in->ReadUInt32(); in->ReadUInt32(); uint32 ZoneID = in->ReadUInt32(); in->ReadUInt32(); - + // Skip past Text3 while(in->ReadUInt8()) ++Text3Length; @@ -444,7 +444,7 @@ ENCODE(OP_TaskHistoryReply) char ZoneNumber[10]; sprintf(ZoneNumber, "%i", ZoneID); - + OutboundPacketSize += (24 + Text1Length + 1 + Text2Length + Text3Length + 1 + 7 + (strlen(ZoneNumber) * 2)); } @@ -478,7 +478,7 @@ ENCODE(OP_TaskHistoryReply) outapp->WriteUInt32(Text2Length); in->SetReadPosition(CurrentPosition); - + // Copy Text2 while(uint8 c = in->ReadUInt8()) outapp->WriteUInt8(c); @@ -494,11 +494,11 @@ ENCODE(OP_TaskHistoryReply) sprintf(ZoneNumber, "%i", ZoneID); outapp->WriteUInt32(2); - outapp->WriteUInt8(0x2d); // "-" + outapp->WriteUInt8(0x2d); // "-" outapp->WriteUInt8(0x31); // "1" outapp->WriteUInt32(2); - outapp->WriteUInt8(0x2d); // "-" + outapp->WriteUInt8(0x2d); // "-" outapp->WriteUInt8(0x31); // "1" outapp->WriteString(ZoneNumber); @@ -509,7 +509,7 @@ ENCODE(OP_TaskHistoryReply) outapp->WriteUInt8(c); outapp->WriteUInt8(0); // Text3 has a null terminator - + outapp->WriteUInt8(0x31); // "1" outapp->WriteString(ZoneNumber); } @@ -565,7 +565,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -601,7 +601,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in RoF packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -660,7 +660,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } */ @@ -668,8 +668,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -688,10 +688,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; //eq->total_chars = 10; @@ -747,9 +747,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -780,10 +780,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 5 is for Live if (emu->clientver <= 5 ) @@ -869,9 +869,9 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt8(emu->level); // Level outapp->WriteUInt8(emu->level); // Level1 - + outapp->WriteUInt32(5); // Bind count - + for(int r = 0; r < 5; r++) { outapp->WriteUInt32(emu->binds[r].zoneId); @@ -885,7 +885,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->intoxication); outapp->WriteUInt32(10); // Unknown count - + for(int r = 0; r < 10; r++) { outapp->WriteUInt32(0); // Unknown @@ -1072,7 +1072,7 @@ ENCODE(OP_PlayerProfile) } outapp->WriteUInt32(structs::MAX_PP_SPELLBOOK); // Spellbook slots - + for(uint32 r = 0; r < MAX_PP_SPELLBOOK; r++) { outapp->WriteUInt32(emu->spell_book[r]); @@ -1469,7 +1469,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->air_remaining); // ? // PVP Stats - + outapp->WriteUInt32(emu->PVPKills); outapp->WriteUInt32(emu->PVPDeaths); outapp->WriteUInt32(emu->PVPCurrentPoints); @@ -1479,7 +1479,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->PVPCurrentKillStreak); // Last PVP Kill - + outapp->WriteString(emu->PVPLastKill.Name); outapp->WriteUInt32(emu->PVPLastKill.Level); outapp->WriteUInt32(emu->PVPLastKill.Race); @@ -1489,7 +1489,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->PVPLastKill.Points); // Last PVP Death - + outapp->WriteString(emu->PVPLastDeath.Name); outapp->WriteUInt32(emu->PVPLastDeath.Level); outapp->WriteUInt32(emu->PVPLastDeath.Race); @@ -1555,7 +1555,7 @@ ENCODE(OP_PlayerProfile) outapp->size = outapp->GetWritePosition(); outapp->SetWritePosition(4); outapp->WriteUInt32(outapp->size - 9); - + CRC32::SetEQChecksum(outapp->pBuffer, outapp->size - 1, 8); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -1601,7 +1601,7 @@ ENCODE(OP_NewZone) { OUT(SuspendBuffs); eq->FogDensity = emu->fog_density; - + /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown800 = -1; eq->unknown844 = 600; @@ -1684,7 +1684,7 @@ ENCODE(OP_PetBuffWindow) __packet->size = sz; __packet->pBuffer = new unsigned char[sz]; memset(__packet->pBuffer, 0, sz); - + __packet->WriteUInt32(emu->petid); __packet->WriteUInt32(0); // PlayerID ? __packet->WriteUInt8(1); // 1 indicates all buffs on the pet (0 to add or remove a single buff) @@ -1698,7 +1698,7 @@ ENCODE(OP_PetBuffWindow) __packet->WriteUInt32(emu->spellid[i]); __packet->WriteUInt32(emu->ticsremaining[i]); __packet->WriteUInt32(0); // Unknown - __packet->WriteString(""); + __packet->WriteString(""); } } __packet->WriteUInt8(0); // Unknown @@ -1744,7 +1744,7 @@ ENCODE(OP_Barter) delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); - + } ENCODE(OP_BazaarSearch) @@ -1808,11 +1808,11 @@ ENCODE(OP_ZoneSpawns) //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -1821,7 +1821,7 @@ ENCODE(OP_ZoneSpawns) return; } - + //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); emu = (Spawn_Struct *) __emu_buffer; @@ -1830,7 +1830,7 @@ ENCODE(OP_ZoneSpawns) char *Buffer = (char *) in->pBuffer, *BufferStart; - + int r; int k; for(r = 0; r < entrycount; r++, emu++) { @@ -1848,7 +1848,7 @@ ENCODE(OP_ZoneSpawns) if(strlen(emu->suffix)) PacketSize += strlen(emu->suffix) + 1; - + bool ShowName = 1; if(emu->bodytype >= 66) { @@ -1902,7 +1902,7 @@ ENCODE(OP_ZoneSpawns) Bitfields->targetable = 1; Bitfields->targetable_with_hotkey = (emu->IsMercenary ? 0 : 1); Bitfields->showname = ShowName; - + // Not currently found // Bitfields->statue = 0; // Bitfields->buyer = 0; @@ -1912,7 +1912,7 @@ ENCODE(OP_ZoneSpawns) uint8 OtherData = 0; if(strlen(emu->title)) - OtherData = OtherData | 16; + OtherData = OtherData | 16; if(strlen(emu->suffix)) OtherData = OtherData | 32; @@ -1949,7 +1949,7 @@ ENCODE(OP_ZoneSpawns) VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->runspeed); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->race); - + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // ShowEQ calls this 'Holding' VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->deity); if(emu->NPC) @@ -2041,7 +2041,7 @@ ENCODE(OP_ZoneSpawns) Position->deltaZ = emu->deltaZ; Buffer += sizeof(structs::Spawn_Struct_Position); - + if(strlen(emu->title)) { VARSTRUCT_ENCODE_STRING(Buffer, emu->title); @@ -2052,7 +2052,7 @@ ENCODE(OP_ZoneSpawns) VARSTRUCT_ENCODE_STRING(Buffer, emu->suffix); } - Buffer += 8; + Buffer += 8; VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->IsMercenary); VARSTRUCT_ENCODE_STRING(Buffer, "0000000000000000"); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); @@ -2067,7 +2067,7 @@ ENCODE(OP_ZoneSpawns) //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } - + delete in; } @@ -2075,7 +2075,7 @@ ENCODE(OP_MercenaryDataResponse) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryMerchantList_Struct *emu = (MercenaryMerchantList_Struct *) __emu_buffer; @@ -2139,7 +2139,7 @@ ENCODE(OP_MercenaryDataUpdate) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryDataUpdate_Struct *emu = (MercenaryDataUpdate_Struct *) __emu_buffer; @@ -2219,7 +2219,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -2261,7 +2261,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -2269,7 +2269,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -2282,7 +2282,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -2326,42 +2326,42 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + // Guild ID buffer += sizeof(uint32); //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -2369,12 +2369,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -2387,7 +2387,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -2404,15 +2404,15 @@ ENCODE(OP_GuildMemberList) { e->zone_id = htons(emu_e->zone_id); e->unknown_one2 = htonl(1); e->unknown04 = 0; - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -2465,7 +2465,7 @@ ENCODE(OP_GroundSpawn) in->size = strlen(emu->object_name) + sizeof(Object_Struct) - 1; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->drop_id); @@ -2484,7 +2484,7 @@ ENCODE(OP_GroundSpawn) VARSTRUCT_ENCODE_TYPE(int32, OutBuffer, emu->object_type); // Unknown, observed 0x00000014 delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -2504,7 +2504,7 @@ ENCODE(OP_ClickObjectAction) { ENCODE(OP_SendMembership) { ENCODE_LENGTH_EXACT(Membership_Struct); SETUP_DIRECT_ENCODE(Membership_Struct, structs::Membership_Struct); - + eq->membership = emu->membership; eq->races = emu->races; eq->classes = emu->classes; @@ -2677,7 +2677,7 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strncpy(eq->worldshortname, emu->worldshortname, sizeof(eq->worldshortname)); - + //OUT(enablevoicemacros); // These two are lost, but must be one of the 1s in unknown[249] //OUT(enablemail); OUT(enable_pvp); @@ -3030,7 +3030,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -3083,7 +3083,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -3096,7 +3096,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -3173,7 +3173,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -3331,7 +3331,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - + //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); if((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { @@ -3377,10 +3377,10 @@ ENCODE(OP_GroupUpdate) { // Group Update2 //_log(NET__ERROR, "Struct is GroupUpdate2"); - + unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*) __emu_buffer; - + //_log(NET__ERROR, "Yourname is %s", gu2->yourname); int MemberCount = 1; @@ -3402,7 +3402,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; - + // Header VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Think this should be SpawnID, but it doesn't seem to matter VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberCount); @@ -3410,7 +3410,7 @@ ENCODE(OP_GroupUpdate) // Leader // - + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_STRING(Buffer, gu2->yourname); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); @@ -3452,7 +3452,7 @@ ENCODE(OP_GroupUpdate) GLAAus->NPCMarkerID = gu2->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &gu2->leader_aas, sizeof(GLAAus->LeaderAAs)); - + dest->FastQueuePacket(&outapp); delete in; @@ -3490,7 +3490,7 @@ ENCODE(OP_ChannelMessage) in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sender); @@ -3538,7 +3538,7 @@ ENCODE(OP_GuildsList) } InBuffer += 64; } - + PacketSize++; // Appears to be an extra 0x00 at the very end. in->size = PacketSize; @@ -3625,7 +3625,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -3682,7 +3682,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -3708,7 +3708,7 @@ ENCODE(OP_BuffCreate) __packet->size = sz; __packet->pBuffer = new unsigned char[sz]; memset(__packet->pBuffer, 0, sz); - + __packet->WriteUInt32(emu->entity_id); __packet->WriteUInt32(0); // PlayerID ? __packet->WriteUInt8(1); // 1 indicates all buffs on the player (0 to add or remove a single buff) @@ -3727,7 +3727,7 @@ ENCODE(OP_BuffCreate) __packet->WriteUInt32(emu->entries[i].spell_id); __packet->WriteUInt32(emu->entries[i].tics_remaining); __packet->WriteUInt32(0); // Unknown - __packet->WriteString(""); + __packet->WriteString(""); } __packet->WriteUInt8(0); // Unknown @@ -3779,7 +3779,7 @@ ENCODE(OP_SpawnAppearance) dest->FastQueuePacket(&in, ack_req); return; } - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; @@ -3790,7 +3790,7 @@ ENCODE(OP_SpawnAppearance) css->Unknown12 = 1.0f; dest->FastQueuePacket(&outapp, ack_req); - + delete in; } @@ -3857,7 +3857,7 @@ ENCODE(OP_RespondAA) { FINISH_ENCODE(); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -3880,7 +3880,7 @@ ENCODE(OP_AltCurrency) if(opcode == 8) { AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; @@ -4064,7 +4064,7 @@ DECODE(OP_PetCommands) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -4073,7 +4073,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -4094,7 +4094,7 @@ DECODE(OP_ShopRequest) { FINISH_DIRECT_DECODE(); } -DECODE(OP_GuildRemove) +DECODE(OP_GuildRemove) { DECODE_LENGTH_EXACT(structs::GuildCommand_Struct); SETUP_DIRECT_DECODE(GuildCommand_Struct, structs::GuildCommand_Struct); @@ -4105,7 +4105,7 @@ DECODE(OP_GuildRemove) FINISH_DIRECT_DECODE(); } -DECODE(OP_GuildDemote) +DECODE(OP_GuildDemote) { DECODE_LENGTH_EXACT(structs::GuildDemoteStruct); SETUP_DIRECT_DECODE(GuildDemoteStruct, structs::GuildDemoteStruct); @@ -4144,7 +4144,7 @@ DECODE(OP_InspectRequest) { /*DECODE(OP_InspectAnswer) { DECODE_LENGTH_EXACT(structs::InspectResponse_Struct); SETUP_DIRECT_DECODE(InspectResponse_Struct, structs::InspectResponse_Struct); - + IN(TargetID); IN(playerid); @@ -4278,7 +4278,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -4287,7 +4287,7 @@ DECODE(OP_ItemLinkClick) { // Max Augs is now 6, but no code to support that many yet IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -4331,7 +4331,7 @@ DECODE(OP_ShopPlayerBuy) } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -4351,7 +4351,7 @@ DECODE(OP_ClientUpdate) { DECODE(OP_CharacterCreate) { DECODE_LENGTH_EXACT(structs::CharCreate_Struct); SETUP_DIRECT_DECODE(CharCreate_Struct, structs::CharCreate_Struct); - + IN(gender); IN(race); IN(class_); @@ -4361,7 +4361,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(beard); IN(beardcolor); @@ -4396,7 +4396,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -4842,7 +4842,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint const Item_Struct *item = inst->GetItem(); //_log(NET__ERROR, "Serialize called for: %s", item->Name); - + RoF::structs::ItemSerializationHeader hdr; //sprintf(hdr.unknown000, "06e0002Y1W00"); @@ -5090,7 +5090,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint //_log(NET__ERROR, "ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); RoF::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -5306,7 +5306,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); diff --git a/common/patches/RoF.h b/common/patches/RoF.h index 411a0a99b..fc2e94c95 100644 --- a/common/patches/RoF.h +++ b/common/patches/RoF.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace RoF { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "RoF_ops.h" }; - + }; diff --git a/common/patches/RoF_structs.h b/common/patches/RoF_structs.h index f3565d2ce..194bbdad0 100644 --- a/common/patches/RoF_structs.h +++ b/common/patches/RoF_structs.h @@ -32,21 +32,21 @@ struct WorldObjectsSent_Struct { struct ItemSlotStruct { /*000*/ int16 SlotType; // Worn and Normal inventory = 0, Bank = 1, Shared Bank = 2, Delete Item = -1 /*002*/ int16 Unknown02; -/*004*/ int16 MainSlot; +/*004*/ int16 MainSlot; /*006*/ int16 SubSlot; /*008*/ int16 AugSlot; // Guessing - Seen 0xffff /*010*/ int16 Unknown01; // Normally 0 - Seen 13262 when deleting an item, but didn't match item ID -/*012*/ +/*012*/ }; // New for RoF - Used for Merchant_Purchase_Struct // Can't sellfrom other than main inventory so Slot Type is not needed. struct MainInvItemSlotStruct { -/*000*/ int16 MainSlot; +/*000*/ int16 MainSlot; /*002*/ int16 SubSlot; /*004*/ int16 AugSlot; /*006*/ int16 Unknown01; -/*008*/ +/*008*/ }; /* Name Approval Struct */ @@ -217,7 +217,7 @@ struct Membership_Entry_Struct { /*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300 /*004*/ uint32 bitwise_entry; // Seen 16 to 65536 - Skips 4096 -/*008*/ +/*008*/ }; struct Membership_Setting_Struct @@ -225,7 +225,7 @@ struct Membership_Setting_Struct /*000*/ uint32 setting_index; // 0, 1, or 2 /*004*/ uint32 setting_id; // 0 to 21 /*008*/ int32 setting_value; // All can be 0, 1, or -1 -/*012*/ +/*012*/ }; struct Membership_Details_Struct @@ -249,7 +249,7 @@ struct Membership_Struct /*008*/ uint32 classes; // Seen ff ff 01 01 /*012*/ uint32 entrysize; // Seen 22 /*016*/ int32 entries[22]; // Most -1, 1, and 0 for Gold Status -/*104*/ +/*104*/ }; @@ -328,7 +328,7 @@ struct Spawn_Struct_Position signed padding0001:1; /*004*/ signed deltaX:13; // change in x - signed deltaHeading:10;// change in heading + signed deltaHeading:10;// change in heading signed padding0008:9; /*008*/ signed deltaY:13; @@ -343,7 +343,7 @@ struct Spawn_Struct_Position signed padding0020:7; }; -/* +/* struct Spawn_Struct_Position { signed padding0000:12; // ***Placeholder @@ -461,7 +461,7 @@ struct Spawn_Struct /*0000*/ //char suffix[0]; // only read if(hasTitleOrSuffix & 8) char unknown20[8]; uint8 IsMercenary; // If NPC == 1 and this == 1, then the NPC name is Orange. -/*0000*/ char unknown21[55]; +/*0000*/ char unknown21[55]; }; @@ -638,7 +638,7 @@ struct BeginCast_Struct /*000*/ uint32 spell_id; /*004*/ uint16 caster_id; /*006*/ uint32 cast_time; // in miliseconds -/*010*/ +/*010*/ }; struct CastSpell_Struct @@ -707,7 +707,7 @@ struct SpellBuffFade_Struct_Live { /*008*/ float unknown008; /*012*/ uint32 spellid; /*016*/ uint32 duration; -/*020*/ uint32 playerId; // Global player ID? +/*020*/ uint32 playerId; // Global player ID? /*024*/ uint8 unknown0028[68]; /*092*/ uint32 slotid; /*096*/ uint32 bufffade; @@ -917,10 +917,10 @@ struct BindStruct { struct PlayerProfile_Struct { /*00000*/ uint32 checksum; // -/*00004*/ uint32 checksum_size; // Value = ( Packet Size - 9 ) -/*00008*/ uint8 checksum_byte; // -/*00009*/ uint8 unknown_rof1[3]; // -/*00012*/ uint32 unknown_rof2; // +/*00004*/ uint32 checksum_size; // Value = ( Packet Size - 9 ) +/*00008*/ uint8 checksum_byte; // +/*00009*/ uint8 unknown_rof1[3]; // +/*00012*/ uint32 unknown_rof2; // /*00016*/ uint8 gender; // Player Gender - 0 Male, 1 Female /*00017*/ uint32 race; // Player race /*00021*/ uint8 class_; // Player class @@ -959,7 +959,7 @@ union /*00544*/ EquipStruct equip_ring2; // Equiptment: Non-visual /*00564*/ EquipStruct equip_waist; // Equiptment: Non-visual /*00584*/ EquipStruct equip_powersource; // Equiptment: Non-visual - /*00604*/ EquipStruct equip_ammo; // Equiptment: Non-visual + /*00604*/ EquipStruct equip_ammo; // Equiptment: Non-visual } equip; /*00184*/ EquipStruct equipment[22]; }; @@ -980,10 +980,10 @@ union /*00899*/ uint32 drakkin_heritage; // /*00903*/ uint32 drakkin_tattoo; // /*00907*/ uint32 drakkin_details; // -/*00911*/ uint8 unknown_rof6; // +/*00911*/ uint8 unknown_rof6; // /*00912*/ int8 unknown_rof7; // seen -1 -/*00913*/ uint8 unknown_rof8; // -/*00914*/ uint8 unknown_rof9; // +/*00913*/ uint8 unknown_rof8; // +/*00914*/ uint8 unknown_rof9; // /*00915*/ uint8 unknown_rof10; // Seen 1 or 0 (on a female?) /*00916*/ float height; // Seen 7.0 (barb), 5.0 (woodelf), 5.5 (halfelf) /*00920*/ float unknown_rof11; // Seen 3.0 @@ -1035,7 +1035,7 @@ union /*12897*/ uint32 copper_cursor; // Copper Pieces on cursor /*12901*/ uint32 intoxication; // Alcohol level (in ticks till sober?) - Position Guessed /*12905*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3) - Position Guessed -/*12909*/ uint32 unknown_rof19; // +/*12909*/ uint32 unknown_rof19; // /*12913*/ uint32 thirst_level; // Drink (ticks till next drink) - Position Guessed /*12917*/ uint32 hunger_level; // Food (ticks till next eat) - Position Guessed /*12921*/ uint32 aapoints_spent; // Number of spent AA points @@ -1046,7 +1046,7 @@ union /*12941*/ uint32 aa_spent_class; // Seen 103 /*12945*/ uint32 aa_spent_special; // Seen 0 /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 -/*12953*/ uint16 unknown_rof20; // +/*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 /*12959*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 @@ -1057,15 +1057,15 @@ union /*13760*/ int32 mana_total; // Guessed - Only seen on casters so far - Matches above field if caster /*13764*/ uint32 unknown_rof22[12]; // Same for all seen PPs - 48 bytes: /* -19 00 00 00 19 00 00 00 19 00 00 00 0f 00 00 00 -0f 00 00 00 0f 00 00 00 0f 00 00 00 1f 85 eb 3e +19 00 00 00 19 00 00 00 19 00 00 00 0f 00 00 00 +0f 00 00 00 0f 00 00 00 0f 00 00 00 1f 85 eb 3e 33 33 33 3f 08 00 00 00 02 00 00 00 01 00 00 00 */ /*13812*/ uint32 unknown_rof23; // Seen 5, 19, and 20 in examples -/*13816*/ uint32 unknown_rof24[4]; // +/*13816*/ uint32 unknown_rof24[4]; // /*13832*/ uint32 unknown_rof25[2]; // Seen random numbers from 0 to 2165037 /*13840*/ uint32 unknown_rof26; // Seen 106 -//END SUB-STRUCT used for shrouding. +//END SUB-STRUCT used for shrouding. /*13844*/ uint32 name_str_len; // Seen 64 /*13848*/ char name[64]; // Name of player - 19960 for Live 1180 difference /*13912*/ uint32 last_name_str_len; // Seen 32 @@ -1086,34 +1086,34 @@ union /*14024*/ float heading; // Players heading /*14028*/ uint32 air_remaining; // Air supply (seconds) /*14032*/ int32 unknown_rof28; // Seen -1 -/*14036*/ uint8 unknown_rof29[10]; // +/*14036*/ uint8 unknown_rof29[10]; // /*14046*/ uint32 unknown_rof30; // Random large number or 0 -/*14050*/ uint32 unknown_rof31; // -/*14054*/ uint32 unknown32_count; // Seen 5 -/*14058*/ uint8 unknown_rof32[29]; // +/*14050*/ uint32 unknown_rof31; // +/*14054*/ uint32 unknown32_count; // Seen 5 +/*14058*/ uint8 unknown_rof32[29]; // /*14087*/ uint32 unknown33_count; // Seen 32 for melee/hybrid and 21 for druid, 34 for mage /*14091*/ uint32 unknown_rof33[64]; // Struct contains 2 ints, so double 32 count (Variable Sized) // Position Varies after this point - Really starts varying at Bandolier names, but if no names set it starts here /*00000*/ int32 unknown_rof34; // Seen -1 /*00000*/ int32 unknown_rof35; // Seen -1 -/*00000*/ uint8 unknown_rof36[18]; // +/*00000*/ uint8 unknown_rof36[18]; // /*00000*/ uint32 unknown37_count; // Seen 5 /*00000*/ int32 unknown_rof37[10]; // Alternates -1 and 0 - Struct contains 2 ints /*00000*/ uint32 unknown38_count; // Seen 10 /*00000*/ int32 unknown_rof38[20]; // Alternates -1 and 0 - Struct contains 2 ints -/*00000*/ uint8 unknown_rof39[137]; // +/*00000*/ uint8 unknown_rof39[137]; // /*00000*/ float unknown_rof40; // Seen 1.0 -/*00000*/ uint32 unknown_rof41[9]; // +/*00000*/ uint32 unknown_rof41[9]; // /*00000*/ uint32 unknown_rof42; // Seen 0 or 1 /*00000*/ uint32 unknown_string1_count; // Seen 64 -/*00000*/ char unknown_string1[64]; // -/*00000*/ uint8 unknown_rof43[30]; // +/*00000*/ char unknown_string1[64]; // +/*00000*/ uint8 unknown_rof43[30]; // /*00000*/ uint32 unknown_string2_count; // Seen 64 -/*00000*/ char unknown_string2[64]; // +/*00000*/ char unknown_string2[64]; // /*00000*/ uint32 unknown_string3_count; // Seen 64 -/*00000*/ char unknown_string3[64]; // +/*00000*/ char unknown_string3[64]; // /*00000*/ uint32 unknown_rof44; // Seen 0 or 50 -/*00000*/ uint8 unknown_rof45[663]; // +/*00000*/ uint8 unknown_rof45[663]; // /*00000*/ uint32 char_id; // Guessed based on char creation date and values /*00000*/ uint8 unknown_rof46; // Seen 0 or 1 /*00000*/ uint32 unknown_rof47; // Seen 6 @@ -1121,7 +1121,7 @@ union /*00000*/ uint32 unknown_rof49; // Seen 64 /*00000*/ uint8 unknown_rof50[256]; // Seen mostly 0s, but one example had a 2 in the middle /*00000*/ uint32 unknown_rof51; // Seen 100 or 0 -/*00000*/ uint8 unknown_rof52[82]; // +/*00000*/ uint8 unknown_rof52[82]; // /*00000*/ uint32 unknown_rof53; // Seen 50 uint8 unknown_rof54[1325]; // Unknown Section @@ -1418,7 +1418,7 @@ struct CombatDamage_Struct /* 21 */ uint8 unknown19[9]; // was [9] /* 30 */ }; - + /* ** Consider Struct @@ -1431,7 +1431,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1526,7 +1526,7 @@ struct PlayerPositionUpdateServer_Struct signed y_pos:19; // y coord unsigned padding:1; /*0008*/ signed delta_x:13; // change in x - signed delta_heading:10;// change in heading + signed delta_heading:10;// change in heading signed padding0008:9; /*0012*/ signed delta_y:13; // change in y signed z_pos:19; // z coord @@ -1555,14 +1555,14 @@ struct PlayerPositionUpdateClient_Struct /*0014*/ float x_pos; // x coord (2nd loc value) /*0018*/ float y_pos; // y coord (1st loc value) /*0022*/ signed delta_heading:10; // change in heading - unsigned animation:10; // ***Placeholder + unsigned animation:10; // ***Placeholder unsigned padding0024:12; // animation /*0026*/ float delta_z; // Change in z /*0030*/ float delta_x; // Change in x /*0034*/ float z_pos; // z coord (3rd loc value) /*0038*/ unsigned heading:12; // Directional heading - unsigned padding0040:10; // ***Placeholder - unsigned padding0041:10; // ***Placeholder + unsigned padding0040:10; // ***Placeholder + unsigned padding0041:10; // ***Placeholder /*0042*/ }; @@ -2004,7 +2004,7 @@ struct Merchant_Click_Struct { /*012*/ float rate; // cost multiplier, dosent work anymore /*016*/ int32 unknown01; // Seen 3 from Server or -1 from Client /*020*/ int32 unknown02; // Seen 2592000 from Server or -1 from Client -/*024*/ +/*024*/ }; /* Unknowns: @@ -2097,7 +2097,7 @@ struct AltCurrencyUpdate_Struct { /*084*/ uint32 unknown084; //seen 0 }; -//Client -> Server +//Client -> Server //When an item is selected while the alt currency merchant window is open struct AltCurrencySelectItem_Struct { /*000*/ uint32 merchant_entity_id; @@ -2128,7 +2128,7 @@ struct AltCurrencySelectItem_Struct { //eg: "I will give you no doubloons for a cloth cap." //Probably also sends amounts somewhere struct AltCurrencySelectItemReply_Struct { -/*000*/ uint32 unknown000; +/*000*/ uint32 unknown000; /*004*/ uint8 unknown004; //0xff /*005*/ uint8 unknown005; //0xff /*006*/ uint8 unknown006; //0xff @@ -2232,7 +2232,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -2501,7 +2501,7 @@ struct Who_All_Struct { // 156 length total /*080*/ uint32 gmlookup; // FF FF = not doing /who all gm /*084*/ uint32 guildid; // Also used for Buyer/Trader/LFG /*152*/ uint32 type; // 0 = /who 3 = /who all -/*156*/ +/*156*/ }; struct Stun_Struct { // 8 bytes total @@ -2637,9 +2637,9 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint16 invslot; // Is the slot, but the RoF conversion causes it to fail. Turned to 0 since it isnt required anyway. /*0008*/ uint32 unknown006; // Seen FFFFFFFF -/*0010*/ uint16 unknown008; // seen 0000 +/*0010*/ uint16 unknown008; // seen 0000 /*0012*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0016*/ uint32 unknown0012; +/*0016*/ uint32 unknown0012; /*0020*/ uint16 unknown0016; /*0022*/ char txtfile[8194]; }; @@ -2735,7 +2735,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -3046,7 +3046,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3242,13 +3242,13 @@ struct GuildMemberEntry_Struct { char name[1]; // variable length uint32 level; uint32 banker; // 1=yes, 0=no - uint32 class_; - uint32 rank; - uint32 time_last_on; - uint32 tribute_enable; + uint32 class_; + uint32 rank; + uint32 time_last_on; + uint32 tribute_enable; uint32 unknown01; // Seen 0 uint32 total_tribute; // total guild tribute donated, network byte order - uint32 last_tribute; // unix timestamp + uint32 last_tribute; // unix timestamp uint32 unknown_one; // unknown, set to 1 char public_note[1]; // variable length. uint16 zoneinstance; // Seen 0s or -1 in RoF @@ -3258,7 +3258,7 @@ struct GuildMemberEntry_Struct { }; //just for display purposes, this is not actually used in the message encoding other than for size. -struct GuildMembers_Struct { +struct GuildMembers_Struct { char player_name[1]; // variable length. uint32 guildid; // Was unknown02 - network byte order uint32 count; // network byte order @@ -3695,7 +3695,7 @@ struct TaskDescription_Struct { /*044*/ uint16 unknown39; /*046*/ char reward_link[1]; //variable length, 0 terminated /*047*/ uint32 unknown43; //maybe crystal count? -/*051*/ +/*051*/ }; #endif @@ -3724,7 +3724,7 @@ struct TaskActivity_Struct { /*032*/ char Text1[1]; // Variable length - Null terminated /*000*/ uint32 Text2Len; // Lenth of the following string /*000*/ char Text2[1]; // Variable length - not Null terminated -/*000*/ uint32 GoalCount; +/*000*/ uint32 GoalCount; /*000*/ uint32 String1Len; // Lenth of the following string - Seen 2 /*000*/ char String1[1]; // Numeric String - Seen "-1" - not Null terminated /*000*/ uint32 String2Len; // Lenth of the following string - Seen 2 @@ -4338,7 +4338,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -4468,9 +4468,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; @@ -4549,7 +4549,7 @@ struct ItemQuaternaryBodyStruct int32 clairvoyance; uint8 unknown18; //Power Source Capacity or evolve filename? uint32 evolve_string; // Some String, but being evolution related is just a guess - uint8 unknown19; + uint8 unknown19; uint32 unknown20; // Bard Stuff? //uint32 unknown21; uint8 unknown22; @@ -4559,7 +4559,7 @@ struct ItemQuaternaryBodyStruct float unknown26; float unknown27; uint32 unknown_RoF6; // 0 New to March 21 2012 client - uint32 unknown28; // 0xffffffff + uint32 unknown28; // 0xffffffff uint16 unknown29; uint32 unknown30; // 0xffffffff uint16 unknown31; diff --git a/common/patches/SSDefine.h b/common/patches/SSDefine.h index ea301e0de..23d5dbbad 100644 --- a/common/patches/SSDefine.h +++ b/common/patches/SSDefine.h @@ -1,5 +1,5 @@ -#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, EQStream *dest, bool ack_req) +#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, EQStream *dest, bool ack_req) #define DECODE(x) void Strategy::Decode_##x(EQApplicationPacket *__packet) #define StructDist(in, f1, f2) (uint32(&in->f2)-uint32(&in->f1)) @@ -10,9 +10,9 @@ /* - * + * * for encoders - * + * */ //more complex operations and variable length packets #define FASTQUEUE(packet) dest->FastQueuePacket(&packet, ack_req); @@ -55,7 +55,7 @@ #define FAIL_ENCODE() \ delete[] __emu_buffer; \ delete __packet; - + //call to finish an encoder using SETUP_DIRECT_ENCODE #define FINISH_ENCODE() \ delete[] __emu_buffer; \ @@ -93,9 +93,9 @@ /* - * + * * for decoders: - * + * */ //simple buffer-to-buffer movement for fixed length packets @@ -118,10 +118,10 @@ #define FAIL_DIRECT_DECODE() \ delete[] __eq_buffer; \ p->SetOpcode(OP_Unknown); - + //call to finish an encoder using SETUP_DIRECT_DECODE #define FINISH_DIRECT_DECODE() \ - delete[] __eq_buffer; + delete[] __eq_buffer; //check length of packet before decoding. Call before setup. #define DECODE_LENGTH_EXACT(struct_) \ diff --git a/common/patches/SoD.cpp b/common/patches/SoD.cpp index 7cbeae210..729388c41 100644 --- a/common/patches/SoD.cpp +++ b/common/patches/SoD.cpp @@ -22,7 +22,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -38,37 +38,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -98,7 +98,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientSoD; @@ -115,7 +115,7 @@ static inline uint32 TitaniumToSoDSlot(uint32 TitaniumSlot) { { SoDSlot = TitaniumSlot + 1; } - else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor + else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor { SoDSlot = TitaniumSlot + 11; } @@ -134,20 +134,20 @@ static inline uint32 TitaniumToSoDSlot(uint32 TitaniumSlot) { else { SoDSlot = TitaniumSlot; - } - + } + return SoDSlot; } // Converts SoD Slot IDs to Titanium Slot IDs for use in Decodes static inline uint32 SoDToTitaniumSlot(uint32 SoDSlot) { uint32 TitaniumSlot = 0; - + if(SoDSlot >= 22 && SoDSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots { TitaniumSlot = SoDSlot - 1; } - else if(SoDSlot >= 262 && SoDSlot <= 351) // Bag Slots for Normal Inventory and Cursor + else if(SoDSlot >= 262 && SoDSlot <= 351) // Bag Slots for Normal Inventory and Cursor { TitaniumSlot = SoDSlot - 11; } @@ -186,7 +186,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -222,7 +222,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in Live packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -281,7 +281,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -289,8 +289,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -309,10 +309,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; eq->total_chars = 10; @@ -359,9 +359,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -369,8 +369,8 @@ ENCODE(OP_ZoneServerInfo) { OUT_str(ip); OUT(port); FINISH_ENCODE(); - - //this is SUCH bullshit to be doing from down here. but the + + //this is SUCH bullshit to be doing from down here. but the // new client requires us to close immediately following this // packet, so do it. //dest->Close(); @@ -379,17 +379,17 @@ ENCODE(OP_ZoneServerInfo) { //hack hack hack ENCODE(OP_SendZonepoints) { ENCODE_LENGTH_ATLEAST(ZonePoints); - + SETUP_VAR_ENCODE(ZonePoints); ALLOC_VAR_ENCODE(structs::ZonePoints, __packet->size); - + memcpy(eq, emu, __packet->size); - + FINISH_ENCODE(); // unknown0xxx[24]; //this is utter crap... the client is waiting for this //certain 0 length opcode to come after the reqclientspawn - //stuff... so this is a dirty way to put it in there. + //stuff... so this is a dirty way to put it in there. // this needs to be done better //EQApplicationPacket hack_test(OP_PetitionUnCheckout, 0); @@ -399,10 +399,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 5 is for SoD if (emu->clientver <= 5 ) @@ -459,13 +459,13 @@ ENCODE(OP_LeadershipExpUpdate) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown4184, 0xff, sizeof(eq->unknown4184)); memset(eq->unknown04396, 0xff, sizeof(eq->unknown04396)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -558,7 +558,7 @@ ENCODE(OP_PlayerProfile) { OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep + //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for(r = 0; r < 4; r++) { OUT_str(bandoliers[r].name); @@ -681,12 +681,12 @@ const uint8 bytes[] = { }; memcpy(eq->unknown12864, bytes, sizeof(bytes)); - - + + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -721,7 +721,7 @@ ENCODE(OP_NewZone) { OUT_str(zone_short_name2); OUT(zone_id); OUT(zone_instance); - OUT(SuspendBuffs); + OUT(SuspendBuffs); /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown800 = -1; eq->unknown844 = 600; @@ -867,7 +867,7 @@ ENCODE(OP_Barter) delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); - + } ENCODE(OP_InspectRequest) { @@ -946,11 +946,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -959,7 +959,7 @@ ENCODE(OP_ZoneSpawns) { return; } - + //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); emu = (Spawn_Struct *) __emu_buffer; @@ -968,7 +968,7 @@ ENCODE(OP_ZoneSpawns) { char *Buffer = (char *) in->pBuffer; - + int r; int k; for(r = 0; r < entrycount; r++, emu++) { @@ -1141,7 +1141,7 @@ ENCODE(OP_ZoneSpawns) { { VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); } - + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->curHp); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->haircolor); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->beardcolor); @@ -1199,7 +1199,7 @@ ENCODE(OP_ZoneSpawns) { Position->deltaZ = emu->deltaZ; Buffer += sizeof(structs::Spawn_Struct_Position); - + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) { for(k = 0; k < 9; ++k) @@ -1254,7 +1254,7 @@ ENCODE(OP_ZoneSpawns) { dest->FastQueuePacket(&outapp, ack_req); } - + delete in; } @@ -1262,7 +1262,7 @@ ENCODE(OP_MercenaryDataResponse) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryMerchantList_Struct *emu = (MercenaryMerchantList_Struct *) __emu_buffer; @@ -1329,7 +1329,7 @@ ENCODE(OP_MercenaryDataUpdate) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryDataUpdate_Struct *emu = (MercenaryDataUpdate_Struct *) __emu_buffer; @@ -1400,7 +1400,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -1442,7 +1442,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -1450,7 +1450,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -1463,7 +1463,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -1507,39 +1507,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -1547,12 +1547,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -1568,7 +1568,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -1582,15 +1582,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -1741,16 +1741,16 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strcpy(eq->worldshortname, emu->worldshortname); - + OUT(enablevoicemacros); OUT(enablemail); OUT(enable_pvp); OUT(enable_FV); - + // These next two need to be set like this for the Tutorial Button to work. eq->unknown263[0] = 0; eq->unknown263[2] = 1; - + FINISH_ENCODE(); } @@ -1977,7 +1977,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -2030,7 +2030,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -2043,7 +2043,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -2120,7 +2120,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -2273,7 +2273,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2330,7 +2330,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2359,7 +2359,7 @@ ENCODE(OP_TargetBuffs) uchar *ptr = __packet->pBuffer; *((uint32*)ptr) = emu->entity_id; ptr += sizeof(uint32); - + *((uint16*)ptr) = emu->count; ptr += sizeof(uint16); @@ -2401,7 +2401,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - + //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); if((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { @@ -2447,10 +2447,10 @@ ENCODE(OP_GroupUpdate) { // Group Update2 //_log(NET__ERROR, "Struct is GroupUpdate2"); - + unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*) __emu_buffer; - + //_log(NET__ERROR, "Yourname is %s", gu2->yourname); int MemberCount = 1; @@ -2472,7 +2472,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; - + // Header VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Think this should be SpawnID, but it doesn't seem to matter VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberCount); @@ -2480,7 +2480,7 @@ ENCODE(OP_GroupUpdate) // Leader // - + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_STRING(Buffer, gu2->yourname); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); @@ -2522,7 +2522,7 @@ ENCODE(OP_GroupUpdate) GLAAus->NPCMarkerID = gu2->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &gu2->leader_aas, sizeof(GLAAus->LeaderAAs)); - + dest->FastQueuePacket(&outapp); delete in; @@ -2548,7 +2548,7 @@ ENCODE(OP_GroupUpdate) dest->FastQueuePacket(&outapp); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -2689,7 +2689,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -2697,7 +2697,7 @@ DECODE(OP_ItemLinkClick) { } IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -2740,7 +2740,7 @@ DECODE(OP_ShopPlayerBuy) } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -2771,7 +2771,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(deity); IN(STR); @@ -2803,7 +2803,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -3277,7 +3277,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint SoD::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(SoD::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -3452,7 +3452,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); @@ -3512,11 +3512,11 @@ DECODE(OP_Bug) strn0cpy(emu->target_name, eq->target_name, sizeof(emu->target_name)); strn0cpy(emu->bug, eq->bug, sizeof(emu->bug)); strn0cpy(emu->system_info, eq->system_info, sizeof(emu->system_info)); - + FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -3525,7 +3525,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); diff --git a/common/patches/SoD.h b/common/patches/SoD.h index 7af599e4b..960cd2afa 100644 --- a/common/patches/SoD.h +++ b/common/patches/SoD.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace SoD { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "SoD_ops.h" }; - + }; diff --git a/common/patches/SoD_structs.h b/common/patches/SoD_structs.h index 95f4b22ef..2f1dcd990 100644 --- a/common/patches/SoD_structs.h +++ b/common/patches/SoD_structs.h @@ -621,7 +621,7 @@ struct CharCreate_Struct { /*0000*/ uint32 class_; /*0004*/ uint32 haircolor; -/*0008*/ uint32 beard; +/*0008*/ uint32 beard; /*0012*/ uint32 beardcolor; /*0016*/ uint32 gender; /*0020*/ uint32 race; @@ -845,7 +845,7 @@ struct PlayerProfile_Struct /*04160*/ uint32 INT; // Intelligence - 3c 00 00 00 - 60 /*04164*/ uint32 AGI; // Agility - 5f 00 00 00 - 95 /*04168*/ uint32 WIS; // Wisdom - 46 00 00 00 - 70 -/*04172*/ uint8 unknown04172[28]; // +/*04172*/ uint8 unknown04172[28]; // /*04200*/ uint8 face; // Player face /*04201*/ uint8 unknown02264[147]; // was [175] /*04348*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 480 = 60 pages [1920] @@ -967,7 +967,7 @@ struct PlayerProfile_Struct /*22448*/ uint32 level3; // SoF looks at the level here to determine how many leadership AA you can bank. /*22452*/ uint32 showhelm; // 0=no, 1=yes /*22456*/ uint32 RestTimer; -/*22460*/ uint8 unknown19584[1028]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct +/*22460*/ uint8 unknown19584[1028]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct /*23488*/ }; @@ -1223,7 +1223,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1346,14 +1346,14 @@ struct PlayerPositionUpdateClient_Struct /*0012*/ float y_pos; // y coord (1st loc value) /*0016*/ signed delta_heading:10; // change in heading unsigned padding0036:10; // animation - unsigned padding0016:12; // ***Placeholder + unsigned padding0016:12; // ***Placeholder /*0020*/ float delta_x; // Change in x /*0024*/ float delta_y; // Change in y /*0028*/ float z_pos; // z coord (3rd loc value) /*0032*/ float delta_z; // Change in z -/*0036*/ unsigned animation:10; // ***Placeholder +/*0036*/ unsigned animation:10; // ***Placeholder unsigned heading:12; // Directional heading - unsigned padding0037:10; // ***Placeholder + unsigned padding0037:10; // ***Placeholder /*0040*/ }; @@ -1900,7 +1900,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -1925,15 +1925,15 @@ struct Illusion_Struct { //size: 256 /*079*/ uint8 unknown079; // /*080*/ uint32 face; // /*084*/ uint8 hairstyle; // Some Races don't change Hair Style Properly in SoF -/*085*/ uint8 haircolor; // -/*086*/ uint8 beard; // -/*087*/ uint8 beardcolor; // -/*088*/ float size; // +/*085*/ uint8 haircolor; // +/*086*/ uint8 beard; // +/*087*/ uint8 beardcolor; // +/*088*/ float size; // /*092*/ uint8 unknown092[148]; /*240*/ uint32 unknown240; // Removes armor? -/*244*/ uint32 drakkin_heritage; // -/*248*/ uint32 drakkin_tattoo; // -/*252*/ uint32 drakkin_details; // +/*244*/ uint32 drakkin_heritage; // +/*248*/ uint32 drakkin_tattoo; // +/*252*/ uint32 drakkin_details; // /*256*/ }; @@ -2291,7 +2291,7 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint32 invslot; // The inventory slot the book is in. Not used, but echoed in the response packet. /*0008*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0012*/ uint32 unknown0012; +/*0012*/ uint32 unknown0012; /*0016*/ uint16 unknown0016; /*0018*/ char txtfile[8194]; }; @@ -2392,7 +2392,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -2694,7 +2694,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3893,7 +3893,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -3963,7 +3963,7 @@ struct ItemBodyStruct uint32 FactionMod4; int32 FactionAmt4; //int16 unknown14; - + }; struct AugSlotStruct @@ -3998,9 +3998,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; @@ -4205,7 +4205,7 @@ struct AltCurrencySellItem_Struct { }; struct MercenaryGrade_Struct { -uint32 GradeCountEntry; +uint32 GradeCountEntry; }; // Used by MercenaryListEntry_Struct @@ -4267,7 +4267,7 @@ struct MercenaryData_Struct { // [OPCode: 0x6537] On Live as of April 2 2012 [Server->Client] // Should be named OP_MercenaryDataResponse, but the current opcode using that name should be renamed first // Size varies if mercenary is hired or if browsing Mercenary Merchant -// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 +// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 struct MercenaryDataUpdate_Struct { /*0000*/ int32 MercStatus; // Seen 0 with merc and -1 with no merc hired /*0004*/ uint32 MercCount; // Seen 1 with 1 merc hired and 0 with no merc hired diff --git a/common/patches/SoF.cpp b/common/patches/SoF.cpp index 823f62d11..67610bc30 100644 --- a/common/patches/SoF.cpp +++ b/common/patches/SoF.cpp @@ -22,7 +22,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -38,37 +38,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -98,7 +98,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientSoF; @@ -115,7 +115,7 @@ static inline uint32 TitaniumToSoFSlot(uint32 TitaniumSlot) { { SoFSlot = TitaniumSlot + 1; } - else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor + else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor { SoFSlot = TitaniumSlot + 11; } @@ -134,20 +134,20 @@ static inline uint32 TitaniumToSoFSlot(uint32 TitaniumSlot) { else { SoFSlot = TitaniumSlot; - } - + } + return SoFSlot; } // Converts Sof Slot IDs to Titanium Slot IDs for use in Decodes static inline uint32 SoFToTitaniumSlot(uint32 SoFSlot) { uint32 TitaniumSlot = 0; - + if(SoFSlot >= 22 && SoFSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots { TitaniumSlot = SoFSlot - 1; } - else if(SoFSlot >= 262 && SoFSlot <= 351) // Bag Slots for Normal Inventory and Cursor + else if(SoFSlot >= 262 && SoFSlot <= 351) // Bag Slots for Normal Inventory and Cursor { TitaniumSlot = SoFSlot - 11; } @@ -186,7 +186,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -222,7 +222,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in Live packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -281,7 +281,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -289,8 +289,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -309,10 +309,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; eq->total_chars = 10; @@ -359,9 +359,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -369,8 +369,8 @@ ENCODE(OP_ZoneServerInfo) { OUT_str(ip); OUT(port); FINISH_ENCODE(); - - //this is SUCH bullshit to be doing from down here. but the + + //this is SUCH bullshit to be doing from down here. but the // new client requires us to close immediately following this // packet, so do it. //dest->Close(); @@ -379,17 +379,17 @@ ENCODE(OP_ZoneServerInfo) { //hack hack hack ENCODE(OP_SendZonepoints) { ENCODE_LENGTH_ATLEAST(ZonePoints); - + SETUP_VAR_ENCODE(ZonePoints); ALLOC_VAR_ENCODE(structs::ZonePoints, __packet->size); - + memcpy(eq, emu, __packet->size); - + FINISH_ENCODE(); // unknown0xxx[24]; //this is utter crap... the client is waiting for this //certain 0 length opcode to come after the reqclientspawn - //stuff... so this is a dirty way to put it in there. + //stuff... so this is a dirty way to put it in there. // this needs to be done better //EQApplicationPacket hack_test(OP_PetitionUnCheckout, 0); @@ -399,10 +399,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 4 is for SoF if (emu->clientver <= 4 ) @@ -459,13 +459,13 @@ ENCODE(OP_LeadershipExpUpdate) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown4184, 0xff, sizeof(eq->unknown4184)); memset(eq->unknown04396, 0xff, sizeof(eq->unknown04396)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -558,7 +558,7 @@ ENCODE(OP_PlayerProfile) { OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep + //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for(r = 0; r < 4; r++) { OUT_str(bandoliers[r].name); @@ -681,12 +681,12 @@ const uint8 bytes[] = { }; memcpy(eq->unknown12864, bytes, sizeof(bytes)); - - + + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -722,7 +722,7 @@ ENCODE(OP_NewZone) { OUT(zone_id); OUT(zone_instance); OUT(SuspendBuffs); - + /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown796 = -1; eq->unknown840 = 600; @@ -784,11 +784,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -796,16 +796,16 @@ ENCODE(OP_ZoneSpawns) { delete in; return; } - + //make the EQ struct. in->size = sizeof(structs::Spawn_Struct)*entrycount; in->pBuffer = new unsigned char[in->size]; structs::Spawn_Struct *eq = (structs::Spawn_Struct *) in->pBuffer; - + //zero out the packet. We could avoid this memset by setting all fields (including unknowns) //in the loop. memset(in->pBuffer, 0, in->size); - + //do the transform... int r; int k; @@ -931,7 +931,7 @@ ENCODE(OP_ZoneSpawns) { } char hex[] = "0123456789ABCDEF"; - + eq->lastName[len + 0] = ' '; eq->lastName[len + 1] = code; eq->lastName[len + 2] = '0' + ((ofs / 1000) % 10); @@ -997,14 +997,14 @@ ENCODE(OP_ZoneSpawns) { } }*/ } - - + + //kill off the emu structure and send the eq packet. delete[] __emu_buffer; - + //_log(NET__ERROR, "Sending zone spawns"); //_hex(NET__ERROR, in->pBuffer, in->size); - + dest->FastQueuePacket(&in, ack_req); } @@ -1013,7 +1013,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -1055,7 +1055,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -1063,7 +1063,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -1076,7 +1076,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -1120,39 +1120,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -1160,12 +1160,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -1181,7 +1181,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -1195,15 +1195,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -1325,16 +1325,16 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strcpy(eq->worldshortname, emu->worldshortname); - + OUT(enablevoicemacros); OUT(enablemail); OUT(enable_pvp); OUT(enable_FV); - + // These next two need to be set like this for the Tutorial Button to work. eq->unknown263[0] = 0; eq->unknown263[2] = 1; - + FINISH_ENCODE(); } @@ -1476,7 +1476,7 @@ ENCODE(OP_BazaarSearch) { //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if(entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -1615,7 +1615,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -1668,7 +1668,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -1681,7 +1681,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -1758,7 +1758,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -1819,7 +1819,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1876,7 +1876,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1940,7 +1940,7 @@ ENCODE(OP_OnLevelMessage) FINISH_ENCODE(); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -2078,7 +2078,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -2086,7 +2086,7 @@ DECODE(OP_ItemLinkClick) { } IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -2115,7 +2115,7 @@ DECODE(OP_Consider) { } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -2146,7 +2146,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(deity); IN(STR); @@ -2178,7 +2178,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -2596,7 +2596,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint SoF::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(SoF::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -2771,7 +2771,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); @@ -2817,7 +2817,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint return item_serial; } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -2826,7 +2826,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); diff --git a/common/patches/SoF.h b/common/patches/SoF.h index c3d7da4ce..615bc1f99 100644 --- a/common/patches/SoF.h +++ b/common/patches/SoF.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace SoF { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "SoF_ops.h" }; - + }; diff --git a/common/patches/SoF_opcode_list.h b/common/patches/SoF_opcode_list.h index ec5d8b11c..28a1ce650 100644 --- a/common/patches/SoF_opcode_list.h +++ b/common/patches/SoF_opcode_list.h @@ -3,7 +3,7 @@ // This File is not used in the build, but here as a reference for SoF. // This should be a complete list of all opcodes for SoF. // The list was generated from IDA using a script from the ShowEQ project. -// This file can be removed at any time. +// This file can be removed at any time. // It is only a reference the project to upgrade the emulator to use SoF. 0x10ff, OP_SenseTraps diff --git a/common/patches/SoF_structs.h b/common/patches/SoF_structs.h index 3305719cb..7a778767d 100644 --- a/common/patches/SoF_structs.h +++ b/common/patches/SoF_structs.h @@ -253,7 +253,7 @@ struct Spawn_Struct { /*0614*/ uint8 unknown0614[11]; /*0625*/ uint8 bodytype2; //New Field - Seems to do the same thing as bodytype /*0626*/ uint8 unknown0626[28]; -union +union { /*0654*/ uint8 equip_chest2; // This is Texture for NPCs /*0654*/ uint8 mount_color; // This should be merged into 1 field, "texture" @@ -599,7 +599,7 @@ struct CharCreate_Struct { /*0000*/ uint32 class_; /*0004*/ uint32 haircolor; -/*0008*/ uint32 beard; +/*0008*/ uint32 beard; /*0012*/ uint32 beardcolor; /*0016*/ uint32 gender; /*0020*/ uint32 race; @@ -1200,7 +1200,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1874,7 +1874,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -1899,15 +1899,15 @@ struct Illusion_Struct { //size: 256 /*079*/ uint8 unknown079; // /*080*/ uint32 face; // /*084*/ uint8 hairstyle; // Some Races don't change Hair Style Properly in SoF -/*085*/ uint8 haircolor; // -/*086*/ uint8 beard; // -/*087*/ uint8 beardcolor; // -/*088*/ float size; // +/*085*/ uint8 haircolor; // +/*086*/ uint8 beard; // +/*087*/ uint8 beardcolor; // +/*088*/ float size; // /*092*/ uint8 unknown092[148]; /*240*/ uint32 unknown240; // Removes armor? -/*244*/ uint32 drakkin_heritage; // -/*248*/ uint32 drakkin_tattoo; // -/*252*/ uint32 drakkin_details; // +/*244*/ uint32 drakkin_heritage; // +/*248*/ uint32 drakkin_tattoo; // +/*252*/ uint32 drakkin_details; // /*256*/ }; @@ -2225,7 +2225,7 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint32 invslot; // The inventory slot the book is in. Not used, but echoed in the response packet. /*0008*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0012*/ uint32 unknown0012; +/*0012*/ uint32 unknown0012; /*0016*/ uint16 unknown0016; /*0018*/ char txtfile[8194]; }; @@ -2326,7 +2326,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -2591,7 +2591,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3750,7 +3750,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -3819,7 +3819,7 @@ struct ItemBodyStruct int32 FactionAmt3; uint32 FactionMod4; int32 FactionAmt4; - + }; struct AugSlotStruct @@ -3854,9 +3854,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; diff --git a/common/patches/Titanium.cpp b/common/patches/Titanium.cpp index bfc88040d..bf92ce3c6 100644 --- a/common/patches/Titanium.cpp +++ b/common/patches/Titanium.cpp @@ -20,7 +20,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -36,37 +36,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -96,7 +96,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientTitanium; @@ -147,10 +147,10 @@ ENCODE(OP_SendCharInfo) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for Titanium // clientver 1 is for all clients and 3 is for Titanium if (emu->clientver <= 3 ) @@ -202,13 +202,13 @@ ENCODE(OP_LeadershipExpUpdate) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown4184, 0xff, sizeof(eq->unknown4184)); memset(eq->unknown04396, 0xff, sizeof(eq->unknown04396)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -409,12 +409,12 @@ const uint8 bytes[] = { 0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14 }; memcpy(eq->unknown12864, bytes, sizeof(bytes)); - - + + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -458,11 +458,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -470,16 +470,16 @@ ENCODE(OP_ZoneSpawns) { delete in; return; } - + //make the EQ struct. in->size = sizeof(structs::Spawn_Struct)*entrycount; in->pBuffer = new unsigned char[in->size]; structs::Spawn_Struct *eq = (structs::Spawn_Struct *) in->pBuffer; - + //zero out the packet. We could avoid this memset by setting all fields (including unknowns) //in the loop. memset(in->pBuffer, 0, in->size); - + //do the transform... int r; int k; @@ -571,7 +571,7 @@ ENCODE(OP_ZoneSpawns) { eq->spawnId = emu->spawnId; // eq->unknown0344[4] = emu->unknown0344[4]; eq->lfg = emu->lfg; - + /* if (emu->face == 99) {eq->face = 0;} if (emu->eyecolor1 == 99) {eq->eyecolor1 = 0;} @@ -583,8 +583,8 @@ ENCODE(OP_ZoneSpawns) { */ } - - + + //kill off the emu structure and send the eq packet. delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); @@ -595,7 +595,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; @@ -625,7 +625,7 @@ ENCODE(OP_CharInventory) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -636,7 +636,7 @@ ENCODE(OP_CharInventory) { return; } InternalSerializedItem_Struct *eq = (InternalSerializedItem_Struct *) in->pBuffer; - + //do the transform... int r; string serial_string; @@ -649,7 +649,7 @@ ENCODE(OP_CharInventory) { } else { _log(NET__STRUCTS, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.",eq->slot_id); } - + } in->size = serial_string.length(); @@ -682,7 +682,7 @@ ENCODE(OP_BazaarSearch) { //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if(entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -746,39 +746,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -786,12 +786,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -807,7 +807,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -821,15 +821,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -840,9 +840,9 @@ ENCODE(OP_ReadBook) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; - + BookText_Struct *emu_BookText_Struct = (BookText_Struct *)__emu_buffer; in->size = sizeof(structs::BookText_Struct) + strlen(emu_BookText_Struct->booktext); @@ -915,7 +915,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -1027,7 +1027,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1084,7 +1084,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1182,7 +1182,7 @@ DECODE(OP_InspectRequest) { DECODE(OP_InspectAnswer) { DECODE_LENGTH_EXACT(structs::InspectResponse_Struct); SETUP_DIRECT_DECODE(InspectResponse_Struct, structs::InspectResponse_Struct); - + IN(TargetID); IN(playerid); @@ -1194,7 +1194,7 @@ DECODE(OP_InspectAnswer) { // move arrow item up to last element in server array strn0cpy(emu->itemnames[21], "", sizeof(emu->itemnames[21])); strn0cpy(emu->itemnames[22], eq->itemnames[21], sizeof(emu->itemnames[22])); - + int k; for (k = 0; k <= 20; k++) { IN(itemicons[k]); @@ -1221,13 +1221,13 @@ ENCODE(OP_LFGuild) dest->FastQueuePacket(&in, ack_req); return; } - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, sizeof(structs::LFGuild_PlayerToggle_Struct)); memcpy(outapp->pBuffer, in->pBuffer, sizeof(structs::LFGuild_PlayerToggle_Struct)); dest->FastQueuePacket(&outapp, ack_req); - + delete in; } @@ -1264,14 +1264,14 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { IN(augments[r]); } IN(link_hash); - + FINISH_DIRECT_DECODE(); } @@ -1322,7 +1322,7 @@ DECODE(OP_WhoAllRequest) { IN(lvlhigh); IN(gmlookup); emu->type = 3; - + FINISH_DIRECT_DECODE(); } @@ -1401,7 +1401,7 @@ char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 d } } - + *length=MakeAnyLenString(&serialization, "%.*s%s" // For leading quotes (and protection) if a subitem; "%s" // Instance data diff --git a/common/patches/Titanium.h b/common/patches/Titanium.h index c2ed6136e..337556938 100644 --- a/common/patches/Titanium.h +++ b/common/patches/Titanium.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace Titanium { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "Titanium_ops.h" }; - + }; diff --git a/common/patches/Titanium_structs.h b/common/patches/Titanium_structs.h index d1aef83df..cdd7fccf8 100644 --- a/common/patches/Titanium_structs.h +++ b/common/patches/Titanium_structs.h @@ -63,7 +63,7 @@ struct DuelResponse_Struct }; /* Cofruben: - Adventure stuff,not a net one,just one for our use + Adventure stuff,not a net one,just one for our use */ static const uint32 ADVENTURE_COLLECT = 0; static const uint32 ADVENTURE_MASSKILL = 1; @@ -158,10 +158,10 @@ struct CharacterSelect_Struct { ** */ -/* -** Generic Spawn Struct -** Length: 383 Octets -** Used in: +/* +** Generic Spawn Struct +** Length: 383 Octets +** Used in: ** spawnZoneStruct ** dbSpawnStruct ** petStruct @@ -214,14 +214,14 @@ struct Spawn_Struct { /*0147*/ uint8 unknown0147[4]; /*0151*/ uint8 level; // Spawn Level /*0152*/ uint8 unknown0259[4]; // ***Placeholder -/*0156*/ uint8 beard; // Beard style +/*0156*/ uint8 beard; // Beard style /*0157*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) /*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner /*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader /*0194*/ uint8 unknown0194[3]; -/*0197*/ union +/*0197*/ union { - struct + struct { /*0197*/ uint32 equip_helmet; // Equipment: Helmet Visual /*0201*/ uint32 equip_chest; // Equipment: Chest Visual @@ -255,7 +255,7 @@ struct Spawn_Struct { /*0334*/ uint8 gender; // Gender (0=male, 1=female) /*0335*/ uint8 bodytype; // Bodytype /*0336*/ uint8 unknown0336[3]; -union +union { /*0339*/ uint8 equip_chest2; // Second place in packet for chest texture (usually 0xFF in live packets) // Not sure why there are 2 of them, but it effects chest texture! @@ -264,9 +264,9 @@ union }; /*0340*/ uint32 spawnId; // Spawn Id /*0344*/ uint8 unknown0344[4]; -/*0348*/ union +/*0348*/ union { - struct + struct { /*0348*/ Color_Struct color_helmet; // Color of helmet item /*0352*/ Color_Struct color_chest; // Color of chest item @@ -350,9 +350,9 @@ struct NewZone_Struct { ** Length: 12 Bytes ** */ -struct MemorizeSpell_Struct { -uint32 slot; // Spot in the spell book/memorized slot -uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) +struct MemorizeSpell_Struct { +uint32 slot; // Spot in the spell book/memorized slot +uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming uint32 unknown12; }; @@ -386,20 +386,20 @@ struct DeleteSpell_Struct }; struct ManaChange_Struct -{ +{ uint32 new_mana; // New Mana AMount uint32 stamina; uint32 spell_id; uint32 unknown12; }; -struct SwapSpell_Struct -{ - uint32 from_slot; - uint32 to_slot; +struct SwapSpell_Struct +{ + uint32 from_slot; + uint32 to_slot; -}; +}; struct BeginCast_Struct { @@ -571,7 +571,7 @@ struct CharCreate_Struct struct AA_Array { uint32 AA; - uint32 value; + uint32 value; }; @@ -611,7 +611,7 @@ struct Bandolier_Struct { struct PotionBelt_Struct { BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; }; - + static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY); @@ -625,18 +625,18 @@ struct RaidLeadershipAA_Struct { uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; }; - /** -* A bind point. -* Size: 20 Octets -*/ -struct BindStruct { - /*000*/ uint32 zoneId; - /*004*/ float x; - /*008*/ float y; - /*012*/ float z; - /*016*/ float heading; - /*020*/ -}; + /** +* A bind point. +* Size: 20 Octets +*/ +struct BindStruct { + /*000*/ uint32 zoneId; + /*004*/ float x; + /*008*/ float y; + /*012*/ float z; + /*016*/ float heading; + /*020*/ +}; /* @@ -698,8 +698,8 @@ sed -e 's/_t//g' -e 's/MAX_AA/MAX_PP_AA_ARRAY/g' \ -e 's/thirst/thirst_level/g' \ -e 's/guildstatus/guildrank/g' \ -e 's/airRemaining/air_remaining/g' \ - - + + */ struct PlayerProfile_Struct @@ -741,7 +741,7 @@ struct PlayerProfile_Struct /*02264*/ uint8 face; // Player face /*02265*/ uint8 unknown02264[47]; /*02312*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook -/*03912*/ uint8 unknown4184[448]; // all 0xff after last spell +/*03912*/ uint8 unknown4184[448]; // all 0xff after last spell /*04360*/ uint32 mem_spells[MAX_PP_MEMSPELL]; // List of spells memorized /*04396*/ uint8 unknown04396[32]; /*04428*/ uint32 platinum; // Platinum Pieces on player @@ -752,7 +752,7 @@ struct PlayerProfile_Struct /*04448*/ uint32 gold_cursor; // Gold Pieces on cursor /*04452*/ uint32 silver_cursor; // Silver Pieces on cursor /*04456*/ uint32 copper_cursor; // Copper Pieces on cursor -/*04460*/ uint32 skills[MAX_PP_SKILL]; // List of skills +/*04460*/ uint32 skills[MAX_PP_SKILL]; // List of skills /*04760*/ uint8 unknown04760[236]; /*04996*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3) /*05000*/ uint32 thirst_level; // Drink (ticks till next drink) @@ -778,7 +778,7 @@ struct PlayerProfile_Struct /*13044*/ uint32 lastlogin; // character last save time /*13048*/ uint32 timePlayedMin; // time character played /*13052*/ uint8 pvp; // 1=pvp, 0=not pvp -/*13053*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon +/*13053*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon /*13054*/ uint8 gm; // 0=no, 1=yes (guessing!) /*13055*/ uint8 guildrank; // 0=member, 1=officer, 2=guildleader /*13056*/ uint32 guildbanker; @@ -791,7 +791,7 @@ struct PlayerProfile_Struct /*13116*/ float x; // Players x position /*13120*/ float y; // Players y position /*13124*/ float z; // Players z position -/*13128*/ float heading; // Players heading +/*13128*/ float heading; // Players heading /*13132*/ uint8 unknown13132[4]; // ***Placeholder /*13136*/ uint32 platinum_bank; // Platinum Pieces in Bank /*13140*/ uint32 gold_bank; // Gold Pieces in Bank @@ -805,7 +805,7 @@ struct PlayerProfile_Struct /*13260*/ uint8 unknown13260[16]; /*13276*/ uint16 zone_id; // see zones.h /*13278*/ uint16 zoneInstance; // Instance id -/*13280*/ char groupMembers[MAX_GROUP_MEMBERS][64];// all the members in group, including self +/*13280*/ char groupMembers[MAX_GROUP_MEMBERS][64];// all the members in group, including self /*13664*/ char groupLeader[64]; // Leader of the group ? /*13728*/ uint8 unknown13728[656]; /*14384*/ uint32 entityid; @@ -826,7 +826,7 @@ struct PlayerProfile_Struct /*14572*/ uint32 tribute_active; // 0 = off, 1=on /*14576*/ Tribute_Struct tributes[MAX_PLAYER_TRIBUTES]; // Current tribute loadout /*14616*/ uint32 unknown14616; -/*14620*/ double group_leadership_exp; +/*14620*/ double group_leadership_exp; /*14628*/ double raid_leadership_exp; /*14640*/ uint32 group_leadership_points; // Unspent group lead AA points /*14644*/ uint32 raid_leadership_points; // Unspent raid lead AA points @@ -858,7 +858,7 @@ struct PlayerProfile_Struct /*19580*/ uint32 showhelm; // 0=no, 1=yes /*19584*/ uint8 unknown19584[4]; // ***Placeholder (10/27/2005) /*19588*/ uint32 unknown19588; // *** Placeholder -/*19584*/ +/*19584*/ }; @@ -969,7 +969,7 @@ struct BindWound_Struct /* ** Type: Zone Change Request (before hand) -** Length: 88 bytes +** Length: 88 bytes ** OpCode: a320 */ @@ -992,7 +992,7 @@ struct RequestClientZoneChange_Struct { /*08*/ float x; /*12*/ float z; /*16*/ float heading; -/*20*/ uint32 type; //unknown... values +/*20*/ uint32 type; //unknown... values }; struct Animation_Struct { @@ -1272,13 +1272,13 @@ struct TradeMoneyUpdate_Struct{ ** Surname struct ** Size: 100 bytes */ -struct Surname_Struct -{ +struct Surname_Struct +{ /*0000*/ char name[64]; /*0064*/ uint32 unknown0064; /*0068*/ char lastname[32]; /*0100*/ -}; +}; struct GuildsListEntry_Struct { char name[64]; @@ -1534,7 +1534,7 @@ struct Merchant_Click_Struct { /*000*/ uint32 npcid; // Merchant NPC's entity id /*004*/ uint32 playerid; /*008*/ uint32 command; //1=open, 0=cancel/close -/*012*/ float rate; //cost multiplier, dosent work anymore +/*012*/ float rate; //cost multiplier, dosent work anymore }; /* Unknowns: @@ -1635,7 +1635,7 @@ struct Illusion_Struct { /*068*/ uint16 race; /*070*/ char unknown070[2]; /*072*/ uint8 gender; -/*073*/ uint8 texture; +/*073*/ uint8 texture; /*074*/ uint8 helmtexture; /*075*/ uint8 unknown075; /*076*/ uint32 face; @@ -1686,14 +1686,14 @@ struct GroupCancel_Struct { uint8 toggle; }; -struct GroupUpdate_Struct { +struct GroupUpdate_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; /*0388*/ char leadersname[64]; }; -struct GroupUpdate2_Struct { +struct GroupUpdate2_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; @@ -1702,7 +1702,7 @@ struct GroupUpdate2_Struct { /*0580*/ uint8 unknown[188]; /*0768*/ }; -struct GroupJoin_Struct { +struct GroupJoin_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[64]; @@ -1716,10 +1716,10 @@ struct FaceChange_Struct { /*003*/ uint8 eyecolor2; /*004*/ uint8 hairstyle; /*005*/ uint8 beard; // vesuvias -/*006*/ uint8 face; +/*006*/ uint8 face; //vesuvias: //there are only 10 faces for barbs changing woad just -//increase the face value by ten so if there were 8 woad +//increase the face value by ten so if there were 8 woad //designs then there would be 80 barb faces }; @@ -1801,11 +1801,11 @@ struct Who_All_Struct { // 76 length total /*140*/ }; -struct Stun_Struct { // 4 bytes total +struct Stun_Struct { // 4 bytes total uint32 duration; // Duration of stun }; -struct AugmentItem_Struct { +struct AugmentItem_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ int32 augment_slot; @@ -1819,11 +1819,11 @@ struct Emote_Struct { /*1028*/ }; -// Inspect -struct Inspect_Struct { - uint32 TargetID; - uint32 PlayerID; -}; +// Inspect +struct Inspect_Struct { + uint32 TargetID; + uint32 PlayerID; +}; //OP_InspectAnswer struct InspectResponse_Struct{//Cofruben:need to send two of this for the inspect response. /*000*/ uint32 TargetID; @@ -2005,7 +2005,7 @@ struct CloseContainer_Struct { /* ** Generic Door Struct ** Length: 52 Octets -** Used in: +** Used in: ** cDoorSpawnsStruct(f721) ** */ @@ -2616,7 +2616,7 @@ struct Split_Struct ** Last Updated: Oct-15-2003 ** */ -struct NewCombine_Struct { +struct NewCombine_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ @@ -2882,21 +2882,21 @@ struct UpdateLeadershipAA_Struct { /*12*/ }; -/** -* Leadership AA update -* Length: 32 Octets -* OpCode: LeadExpUpdate -*/ -struct leadExpUpdateStruct { - /*0000*/ uint32 unknown0000; // All zeroes? - /*0004*/ uint32 group_leadership_exp; // Group leadership exp value - /*0008*/ uint32 group_leadership_points; // Unspent group points - /*0012*/ uint32 unknown0012; // Type? - /*0016*/ uint32 unknown0016; // All zeroes? - /*0020*/ uint32 raid_leadership_exp; // Raid leadership exp value - /*0024*/ uint32 raid_leadership_points; // Unspent raid points - /*0028*/ uint32 unknown0028; -}; +/** +* Leadership AA update +* Length: 32 Octets +* OpCode: LeadExpUpdate +*/ +struct leadExpUpdateStruct { + /*0000*/ uint32 unknown0000; // All zeroes? + /*0004*/ uint32 group_leadership_exp; // Group leadership exp value + /*0008*/ uint32 group_leadership_points; // Unspent group points + /*0012*/ uint32 unknown0012; // Type? + /*0016*/ uint32 unknown0016; // All zeroes? + /*0020*/ uint32 raid_leadership_exp; // Raid leadership exp value + /*0024*/ uint32 raid_leadership_points; // Unspent raid points + /*0028*/ uint32 unknown0028; +}; @@ -2939,7 +2939,7 @@ struct RaidDetails_Struct { /*000*/ uint32 action; //=6,20 /*004*/ char leader_name[64]; /*068*/ uint32 unknown68[4]; -/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order +/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order /*128*/ uint8 unknown128[142]; /*354*/ uint32 leader_id; }; @@ -3100,7 +3100,7 @@ struct AA_Action { }; struct AA_Skills { //this should be removed and changed to AA_Array -/*00*/ uint32 aa_skill; +/*00*/ uint32 aa_skill; /*04*/ uint32 aa_value; }; @@ -3131,13 +3131,13 @@ struct AATable_Struct { struct Weather_Struct { uint32 val1; //generall 0x000000FF uint32 type; //0x31=rain, 0x02=snow(i think), 0 = normal - uint32 mode; + uint32 mode; }; struct ZoneInUnknown_Struct { uint32 val1; uint32 val2; - uint32 val3; + uint32 val3; }; struct MobHealth_Struct { diff --git a/common/patches/Underfoot.cpp b/common/patches/Underfoot.cpp index 44c65cc8b..409324e27 100644 --- a/common/patches/Underfoot.cpp +++ b/common/patches/Underfoot.cpp @@ -23,7 +23,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -39,37 +39,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -99,7 +99,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientUnderfoot; @@ -116,7 +116,7 @@ static inline uint32 TitaniumToUnderfootSlot(uint32 TitaniumSlot) { { UnderfootSlot = TitaniumSlot + 1; } - else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor + else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor { UnderfootSlot = TitaniumSlot + 11; } @@ -135,20 +135,20 @@ static inline uint32 TitaniumToUnderfootSlot(uint32 TitaniumSlot) { else { UnderfootSlot = TitaniumSlot; - } - + } + return UnderfootSlot; } // Converts Underfoot Slot IDs to Titanium Slot IDs for use in Decodes static inline uint32 UnderfootToTitaniumSlot(uint32 UnderfootSlot) { uint32 TitaniumSlot = 0; - + if(UnderfootSlot >= 22 && UnderfootSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots { TitaniumSlot = UnderfootSlot - 1; } - else if(UnderfootSlot >= 262 && UnderfootSlot <= 351) // Bag Slots for Normal Inventory and Cursor + else if(UnderfootSlot >= 262 && UnderfootSlot <= 351) // Bag Slots for Normal Inventory and Cursor { TitaniumSlot = UnderfootSlot - 11; } @@ -187,7 +187,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -223,7 +223,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in Underfoot packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -282,7 +282,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -290,8 +290,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -310,10 +310,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; eq->total_chars = 10; @@ -360,9 +360,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -393,10 +393,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 6 is for Underfoot if (emu->clientver <= 6 ) @@ -473,13 +473,13 @@ ENCODE(OP_RespondAA) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown06284, 0xff, sizeof(eq->unknown06284)); memset(eq->unknown07284, 0xff, sizeof(eq->unknown07284)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -554,7 +554,7 @@ ENCODE(OP_PlayerProfile) { OUT(thirst_level); OUT(hunger_level); //PS this needs to be figured out more; but it was 'good enough' - for(r = 0; r < structs::BUFF_COUNT; r++) + for(r = 0; r < structs::BUFF_COUNT; r++) { if(emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0) { @@ -584,7 +584,7 @@ ENCODE(OP_PlayerProfile) { OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep + //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for(r = 0; r < 4; r++) { OUT_str(bandoliers[r].name); @@ -707,10 +707,10 @@ const uint8 bytes[] = { }; memcpy(eq->unknown18020, bytes, sizeof(bytes)); - + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -748,7 +748,7 @@ ENCODE(OP_NewZone) { OUT(SuspendBuffs); eq->FogDensity = emu->fog_density; - + /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown800 = -1; eq->unknown844 = 600; @@ -895,7 +895,7 @@ ENCODE(OP_Barter) delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); - + } ENCODE(OP_BazaarSearch) @@ -958,11 +958,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -971,7 +971,7 @@ ENCODE(OP_ZoneSpawns) { return; } - + //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); emu = (Spawn_Struct *) __emu_buffer; @@ -980,7 +980,7 @@ ENCODE(OP_ZoneSpawns) { char *Buffer = (char *) in->pBuffer; - + int r; int k; for(r = 0; r < entrycount; r++, emu++) { @@ -1153,7 +1153,7 @@ ENCODE(OP_ZoneSpawns) { { VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); } - + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->curHp); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->haircolor); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->beardcolor); @@ -1211,7 +1211,7 @@ ENCODE(OP_ZoneSpawns) { Position->deltaZ = emu->deltaZ; Buffer += sizeof(structs::Spawn_Struct_Position); - + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) { for(k = 0; k < 9; ++k) @@ -1265,7 +1265,7 @@ ENCODE(OP_ZoneSpawns) { dest->FastQueuePacket(&outapp, ack_req); } - + delete in; } @@ -1273,7 +1273,7 @@ ENCODE(OP_MercenaryDataResponse) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryMerchantList_Struct *emu = (MercenaryMerchantList_Struct *) __emu_buffer; @@ -1336,7 +1336,7 @@ ENCODE(OP_MercenaryDataUpdate) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryDataUpdate_Struct *emu = (MercenaryDataUpdate_Struct *) __emu_buffer; @@ -1412,7 +1412,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -1454,7 +1454,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -1462,7 +1462,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -1475,7 +1475,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -1519,39 +1519,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -1559,12 +1559,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -1580,7 +1580,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -1594,15 +1594,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -1655,7 +1655,7 @@ ENCODE(OP_GroundSpawn) in->size = strlen(emu->object_name) + 58; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->drop_id); @@ -1668,7 +1668,7 @@ ENCODE(OP_GroundSpawn) // This next field is actually a float. There is a groundspawn in freeportwest (sack of money sitting on some barrels) which requires this // field to be set to (float)255.0 to appear at all, and also the size field below to be 5, to be the correct size. I think SoD has the same // issue. - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown, observed 0 VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // This appears to be the size field. VARSTRUCT_ENCODE_TYPE(float, OutBuffer, emu->y); @@ -1680,7 +1680,7 @@ ENCODE(OP_GroundSpawn) VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); // Unknown, observed 0x00 delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -1774,7 +1774,7 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strcpy(eq->worldshortname, emu->worldshortname); - + OUT(enablevoicemacros); OUT(enablemail); OUT(enable_pvp); @@ -1795,7 +1795,7 @@ ENCODE(OP_LogServer) { eq->unknown263[23] = 0x80; eq->unknown263[24] = 0x3f; eq->unknown263[33] = 1; - + FINISH_ENCODE(); } @@ -2037,7 +2037,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -2090,7 +2090,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -2103,7 +2103,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -2180,7 +2180,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -2288,7 +2288,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - + //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); if((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { @@ -2334,10 +2334,10 @@ ENCODE(OP_GroupUpdate) { // Group Update2 //_log(NET__ERROR, "Struct is GroupUpdate2"); - + unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*) __emu_buffer; - + //_log(NET__ERROR, "Yourname is %s", gu2->yourname); int MemberCount = 1; @@ -2359,7 +2359,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; - + // Header VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Think this should be SpawnID, but it doesn't seem to matter VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberCount); @@ -2367,7 +2367,7 @@ ENCODE(OP_GroupUpdate) // Leader // - + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_STRING(Buffer, gu2->yourname); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); @@ -2409,7 +2409,7 @@ ENCODE(OP_GroupUpdate) GLAAus->NPCMarkerID = gu2->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &gu2->leader_aas, sizeof(GLAAus->LeaderAAs)); - + dest->FastQueuePacket(&outapp); delete in; @@ -2447,7 +2447,7 @@ ENCODE(OP_ChannelMessage) in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sender); @@ -2495,7 +2495,7 @@ ENCODE(OP_GuildsList) } InBuffer += 64; } - + PacketSize++; // Appears to be an extra 0x00 at the very end. in->size = PacketSize; @@ -2582,7 +2582,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2639,7 +2639,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2753,7 +2753,7 @@ ENCODE(OP_SpawnAppearance) dest->FastQueuePacket(&in, ack_req); return; } - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; @@ -2764,7 +2764,7 @@ ENCODE(OP_SpawnAppearance) css->Unknown12 = 1.0f; dest->FastQueuePacket(&outapp, ack_req); - + delete in; } @@ -2778,7 +2778,7 @@ ENCODE(OP_DisciplineUpdate) FINISH_ENCODE(); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -2801,7 +2801,7 @@ ENCODE(OP_AltCurrency) if(opcode == 8) { AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; @@ -2966,7 +2966,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -2974,7 +2974,7 @@ DECODE(OP_ItemLinkClick) { } IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -3017,7 +3017,7 @@ DECODE(OP_ShopPlayerBuy) } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -3048,7 +3048,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(deity); IN(STR); @@ -3080,7 +3080,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -3682,7 +3682,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint Underfoot::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(Underfoot::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -3880,7 +3880,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); @@ -3926,7 +3926,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint return item_serial; } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -3935,7 +3935,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); diff --git a/common/patches/Underfoot.h b/common/patches/Underfoot.h index 1f1c8312f..fb66a3488 100644 --- a/common/patches/Underfoot.h +++ b/common/patches/Underfoot.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace Underfoot { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "Underfoot_ops.h" }; - + }; diff --git a/common/patches/Underfoot_structs.h b/common/patches/Underfoot_structs.h index 61cd189c7..daa4a0533 100644 --- a/common/patches/Underfoot_structs.h +++ b/common/patches/Underfoot_structs.h @@ -331,7 +331,7 @@ struct Spawn_Struct /*0000*/ //char suffix[0]; // only read if(hasTitleOrSuffix & 8) char unknown20[8]; uint8 IsMercenary; // If NPC == 1 and this == 1, then the NPC name is Orange. -/*0000*/ char unknown21[28]; +/*0000*/ char unknown21[28]; }; @@ -561,7 +561,7 @@ struct SpellBuffFade_Struct_Underfoot { /*012*/ uint32 spellid; /*016*/ uint32 duration; /*020*/ uint32 unknown016; -/*024*/ uint32 playerId; // Global player ID? +/*024*/ uint32 playerId; // Global player ID? /*028*/ uint32 unknown020; /*032*/ uint8 unknown0028[48]; /*080*/ uint32 slotid; @@ -645,7 +645,7 @@ struct CharCreate_Struct { /*0000*/ uint32 class_; /*0004*/ uint32 haircolor; -/*0008*/ uint32 beard; +/*0008*/ uint32 beard; /*0012*/ uint32 beardcolor; /*0016*/ uint32 gender; /*0020*/ uint32 race; @@ -871,7 +871,7 @@ struct PlayerProfile_Struct /*04176*/ uint32 INT; // Intelligence - 3c 00 00 00 - 60 /*04180*/ uint32 AGI; // Agility - 5f 00 00 00 - 95 /*04184*/ uint32 WIS; // Wisdom - 46 00 00 00 - 70 -/*04188*/ uint8 unknown04188[28]; // +/*04188*/ uint8 unknown04188[28]; // /*04216*/ uint8 face; // Player face - Actually uint32? /*04217*/ uint8 unknown04217[147]; // was [175] /*04364*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 720 = 90 pages [2880] was [1920] @@ -906,7 +906,7 @@ struct PlayerProfile_Struct /*18008*/ uint8 unknown18008[8]; /*18016*/ uint32 available_slots; /*18020*/ uint8 unknown18020[80]; // -//END SUB-STRUCT used for shrouding. +//END SUB-STRUCT used for shrouding. /*18100*/ char name[64]; // Name of player /*18164*/ char last_name[32]; // Last name of player /*18196*/ uint8 unknown18196[8]; //#### Not In Titanium #### new to SoF[12] @@ -1000,7 +1000,7 @@ struct PlayerProfile_Struct /*25584*/ uint32 level3; // SoF looks at the level here to determine how many leadership AA you can bank. /*25588*/ uint32 showhelm; // 0=no, 1=yes /*25592*/ uint32 RestTimer; -/*25596*/ uint8 unknown25596[1036]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct +/*25596*/ uint8 unknown25596[1036]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct /*26632*/ }; @@ -1247,7 +1247,7 @@ struct CombatDamage_Struct /* 19 */ uint8 unknown19[9]; // was [9] /* 28 */ }; - + /* ** Consider Struct @@ -1260,7 +1260,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1383,14 +1383,14 @@ struct PlayerPositionUpdateClient_Struct /*0012*/ float y_pos; // y coord (1st loc value) /*0016*/ signed delta_heading:10; // change in heading unsigned padding0036:10; // animation - unsigned padding0016:12; // ***Placeholder + unsigned padding0016:12; // ***Placeholder /*0020*/ float delta_x; // Change in x /*0024*/ float delta_y; // Change in y /*0028*/ float z_pos; // z coord (3rd loc value) /*0032*/ float delta_z; // Change in z -/*0036*/ unsigned animation:10; // ***Placeholder +/*0036*/ unsigned animation:10; // ***Placeholder unsigned heading:12; // Directional heading - unsigned padding0037:10; // ***Placeholder + unsigned padding0037:10; // ***Placeholder /*0040*/ }; @@ -1937,7 +1937,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -1962,15 +1962,15 @@ struct Illusion_Struct { //size: 256 /*079*/ uint8 unknown079; // /*080*/ uint32 face; // /*084*/ uint8 hairstyle; // Some Races don't change Hair Style Properly in SoF -/*085*/ uint8 haircolor; // -/*086*/ uint8 beard; // -/*087*/ uint8 beardcolor; // -/*088*/ float size; // +/*085*/ uint8 haircolor; // +/*086*/ uint8 beard; // +/*087*/ uint8 beardcolor; // +/*088*/ float size; // /*092*/ uint8 unknown092[148]; /*240*/ uint32 unknown240; // Removes armor? -/*244*/ uint32 drakkin_heritage; // -/*248*/ uint32 drakkin_tattoo; // -/*252*/ uint32 drakkin_details; // +/*244*/ uint32 drakkin_heritage; // +/*248*/ uint32 drakkin_tattoo; // +/*252*/ uint32 drakkin_details; // /*256*/ }; @@ -2330,7 +2330,7 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint32 invslot; // The inventory slot the book is in. Not used, but echoed in the response packet. /*0008*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0012*/ uint32 unknown0012; +/*0012*/ uint32 unknown0012; /*0016*/ uint16 unknown0016; /*0018*/ char txtfile[8194]; }; @@ -2431,7 +2431,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -2735,7 +2735,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3942,7 +3942,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -4045,9 +4045,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; @@ -4148,7 +4148,7 @@ struct ItemQuaternaryBodyStruct int32 clairvoyance; uint8 unknown18; //Power Source Capacity or evolve filename? uint32 evolve_string; // Some String, but being evolution related is just a guess - uint8 unknown19; + uint8 unknown19; uint32 unknown20; // Bard Stuff? uint32 unknown21; uint32 unknown22; @@ -4295,7 +4295,7 @@ struct MercenaryListEntry_Struct { /*0041*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0045*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0049*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0053*/ uint8 MercUnk04; // Seen 1 +/*0053*/ uint8 MercUnk04; // Seen 1 /*0054*/ MercenaryStance_Struct Stances[1]; // Count Varies, but hard set to 2 for now - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc (1 to 9 as of April 2012) }; @@ -4342,7 +4342,7 @@ struct MercenaryData_Struct { // [OPCode: 0x6537] On Live as of April 2 2012 [Server->Client] // Should be named OP_MercenaryDataResponse, but the current opcode using that name should be renamed first // Size varies if mercenary is hired or if browsing Mercenary Merchant -// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 +// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 struct MercenaryDataUpdate_Struct { /*0000*/ int32 MercStatus; // Seen 0 with merc and -1 with no merc hired /*0004*/ uint32 MercCount; // Seen 1 with 1 merc hired and 0 with no merc hired diff --git a/common/patches/template.cpp b/common/patches/template.cpp index 017cfb6d3..219e30f71 100644 --- a/common/patches/template.cpp +++ b/common/patches/template.cpp @@ -12,7 +12,7 @@ namespace TEMPLATE { static const char *name = "CHANGEME"; static OpcodeManager *opcodes = NULL; static Strategy struct_strategy; - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == NULL) { @@ -27,16 +27,16 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; - + //register our world signature. signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, name, &opcodes, &struct_strategy); - + //register our zone signature. signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); @@ -44,11 +44,11 @@ void Register(EQStreamIdentifier &into) { } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != NULL) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -85,17 +85,17 @@ std::string Strategy::Describe() const { /*ENCODE(OP_PlayerProfile) { SETUP_DIRECT(PlayerProfile_Struct, structs::PlayerProfile_Struct); - - - + + + FINISH_DIRECT(); } ENCODE(OP_NewZone) { SETUP_DIRECT(PlayerProfile_Struct, structs::PlayerProfile_Struct); - - - + + + FINISH_DIRECT(); }*/ diff --git a/common/patches/template.h b/common/patches/template.h index 9e570cc56..16f869fc1 100644 --- a/common/patches/template.h +++ b/common/patches/template.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace TEMPLATE { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcodes #include "SSDeclare.h" #include "TEMPLATE_ops.h" - + }; - + }; diff --git a/common/perl_EQDB.cpp b/common/perl_EQDB.cpp index 35417b4a7..086a27c73 100644 --- a/common/perl_EQDB.cpp +++ b/common/perl_EQDB.cpp @@ -33,7 +33,7 @@ typedef const char Const_char; #include "EQDB.h" #ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS +#undef THIS #endif @@ -231,7 +231,7 @@ XS(boot_EQDB) char file[256]; strncpy(file, __FILE__, 256); file[255] = 0; - + if(items != 1) fprintf(stderr, "boot_quest does not take any arguments."); char buf[128]; diff --git a/common/perl_EQDBRes.cpp b/common/perl_EQDBRes.cpp index b1753e070..835bea2c8 100644 --- a/common/perl_EQDBRes.cpp +++ b/common/perl_EQDBRes.cpp @@ -193,12 +193,12 @@ XS(XS_EQDBRes_fetch_row_hash) RETVAL = THIS->fetch_row_hash(); ST(0) = sv_newmortal(); if (RETVAL.begin()!=RETVAL.end()) - { + { //NOTE: we are leaking the original ST(0) right now HV *hv = newHV(); sv_2mortal((SV*)hv); ST(0) = newRV((SV*)hv); - + map::const_iterator cur, end; cur = RETVAL.begin(); end = RETVAL.end(); @@ -270,7 +270,7 @@ XS(boot_EQDBRes) char file[256]; strncpy(file, __FILE__, 256); file[255] = 0; - + if(items != 1) fprintf(stderr, "boot_quest does not take any arguments."); char buf[128]; diff --git a/common/profiler.h b/common/profiler.h index 425fb9f2b..10ae404d2 100644 --- a/common/profiler.h +++ b/common/profiler.h @@ -35,15 +35,15 @@ public: inline virtual ~GeneralProfiler() { safe_delete_array(timers); } - + inline double getTotalDuration(unsigned int id) { return(idreset(); } - + RDTSC_Collector *timers; unsigned int count; }; diff --git a/common/ptimer.h b/common/ptimer.h index 919f0cfd4..1220daa92 100644 --- a/common/ptimer.h +++ b/common/ptimer.h @@ -41,7 +41,7 @@ enum { //values for pTimerType pTimerDisciplineReuseEnd = 24, pTimerCombatAbility = 25, pTimerBeggingPickPocket = 26, - + pTimerLayHands = 87, //these IDs are used by client too pTimerHarmTouch = 89, //so dont change them @@ -54,7 +54,7 @@ enum { //values for pTimerType pTimerAAEnd = 2999, pTimerAAEffectStart = 3001, //AA effect timers pTimerAAEffectEnd = 4999, - + pTimerSpellStart = 5000 //Do not put any timer IDs above this one //if needed, increase its starting ID }; @@ -66,13 +66,13 @@ typedef uint16 pTimerType; class PersistentTimer { public: static PersistentTimer *LoadTimer(Database *db, uint32 char_id, pTimerType type); - + PersistentTimer(uint32 char_id, pTimerType type, uint32 duration); PersistentTimer(uint32 char_id, pTimerType type, uint32 start_time, uint32 duration, bool enable); - + bool Expired(Database *db, bool iReset = true); void Start(uint32 set_timer_time=0); - + void SetTimer(uint32 set_timer_time=0); uint32 GetRemainingTime(); inline void Enable() { enabled = true; } @@ -89,11 +89,11 @@ public: protected: uint32 get_current_time(); - + uint32 start_time; uint32 timer_time; bool enabled; - + uint32 _char_id; pTimerType _type; }; @@ -102,13 +102,13 @@ protected: class PTimerList { public: PTimerList(uint32 char_id = 0); - + ~PTimerList(); - + bool Load(Database *db); bool Store(Database *db); bool Clear(Database *db); - + void Start(pTimerType type, uint32 duration); bool Expired(Database *db, pTimerType type, bool reset = true); void Clear(Database *db, pTimerType type); @@ -117,24 +117,24 @@ public: void Disable(pTimerType type); uint32 GetRemainingTime(pTimerType type); PersistentTimer *Get(pTimerType type); - + inline void SetCharID(uint32 char_id) { _char_id = char_id; } - + void ToVector(vector< pair > &out); - + //Clear a timer for a char not logged in //this is not defined on a char which is logged in! static bool ClearOffline(Database *db, uint32 char_id, pTimerType type); - + typedef map::iterator iterator; iterator begin() { return(_list.begin()); } iterator end() { return(_list.end()); } - - + + void AddTimer(pTimerType type, uint32 start_time, uint32 duration, bool enable); protected: uint32 _char_id; - + map _list; }; diff --git a/common/queues.h b/common/queues.h index 66125e650..c6779385a 100644 --- a/common/queues.h +++ b/common/queues.h @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - + You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, diff --git a/common/rdtsc.cpp b/common/rdtsc.cpp index 085387efc..15826d49a 100644 --- a/common/rdtsc.cpp +++ b/common/rdtsc.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -91,35 +91,35 @@ int64 RDTSC_Timer::rdtsc() { void RDTSC_Timer::init() { #ifdef USE_RDTSC int64 before, after, sum; - + int r; sum = 0; // run an average to increase accuracy of clock rate for(r = 0; r < CALIBRATE_LOOPS; r++) { before = rdtsc(); - + //sleep a know duration to figure out clock rate #ifdef _WINDOWS Sleep(SLEEP_TIME); #else usleep(SLEEP_TIME * 1000); //ms * 1000 #endif - + after = rdtsc(); - + sum += after - before; } - + //ticks per sleep / ms per sleep _ticsperms = (sum / CALIBRATE_LOOPS) / SLEEP_TIME; - + #else //if using gettimeofday, this is fixed at 1000 _ticsperms = 1000; #endif // printf("Tics per milisecond: %llu \n", _ticsperms); - - _inited = true; //only want to do this once + + _inited = true; //only want to do this once } //start the timer @@ -145,7 +145,7 @@ RDTSC_Collector::RDTSC_Collector() : RDTSC_Timer() { RDTSC_Collector::RDTSC_Collector(bool start_it) : RDTSC_Timer(start_it) { reset(); } - + void RDTSC_Collector::stop() { RDTSC_Timer::stop(); _sum += RDTSC_Timer::getTicks(); @@ -160,7 +160,7 @@ double RDTSC_Collector::getTotalDuration() { double RDTSC_Collector::getAverage() { return(((double)(getTotalTicks())) / double(_ticsperms * _count)); } - + void RDTSC_Collector::reset() { _sum = 0; _count = 0; diff --git a/common/rdtsc.h b/common/rdtsc.h index b1babfd2b..d73fbaec8 100644 --- a/common/rdtsc.h +++ b/common/rdtsc.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -26,8 +26,8 @@ This class implementes the highest possibly prescision timer which is avaliable on the current archetecture. - - On intel, this uses the rdtsc instruction to get the actual + + On intel, this uses the rdtsc instruction to get the actual clock cycle count, and elsewhere it falls back to gettimeofday All calculations are carried out in 64 bit integers. @@ -39,18 +39,18 @@ class RDTSC_Timer { public: RDTSC_Timer(); RDTSC_Timer(bool start_it); - + void start(); //start the timer virtual void stop(); //stop the timer double getDuration(); //returns the number of miliseconds elapsed - + //access functions int64 getTicks() { return(_end - _start); } static int64 ticksPerMS() { return(_ticsperms); } - + protected: static int64 rdtsc(); - + int64 _start; int64 _end; @@ -67,17 +67,17 @@ class RDTSC_Collector : public RDTSC_Timer { public: RDTSC_Collector(); RDTSC_Collector(bool start_it); - + void reset(); - + void stop(); //stop the timer - + double getTotalDuration(); //returns the number of miliseconds elapsed double getAverage(); - + int64 getTotalTicks() { return(_sum); } int64 getCount() { return(_count); } - + protected: int64 _sum; int64 _count; diff --git a/common/rulesys.h b/common/rulesys.h index 060a44e82..266b75570 100644 --- a/common/rulesys.h +++ b/common/rulesys.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -54,14 +54,14 @@ public: #include "ruletypes.h" _IntRuleCount } IntType; - + typedef enum { #define RULE_REAL(cat, rule, default_value) \ Real__##rule, #include "ruletypes.h" _RealRuleCount } RealType; - + typedef enum { #define RULE_BOOL(cat, rule, default_value) \ Bool__##rule, @@ -85,9 +85,9 @@ public: static const RealType InvalidReal = _RealRuleCount; static const BoolType InvalidBool = _BoolRuleCount; static const CategoryType InvalidCategory = _CatCount; - + static const uint32 _RulesCount = _IntRuleCount+_RealRuleCount+_BoolRuleCount; - + //fetch routines, you should generally use the Rule* macros instead of this int32 GetIntRule (IntType t) const; float GetRealRule(RealType t) const; @@ -109,11 +109,11 @@ public: static int GetRulesetID(Database *db, const char *rulesetname); static std::string GetRulesetName(Database *db, int id); static bool ListRulesets(Database *db, std::map &into); - + void ResetRules(); bool LoadRules(Database *db, const char *ruleset = nullptr); void SaveRules(Database *db, const char *ruleset = nullptr); - + private: RuleManager(); RuleManager(const RuleManager&); @@ -134,7 +134,7 @@ private: RealRule, BoolRule } RuleType; - + static bool _FindRule(const char *rule_name, RuleType &type_into, uint16 &index_into); static const char *_GetRuleName(RuleType type, uint16 index); static int _FindOrCreateRuleset(Database *db, const char *ruleset); @@ -148,7 +148,7 @@ private: uint16 rule_index; //index into its 'type' array } RuleInfo; static const RuleInfo s_RuleInfo[]; - + }; #endif /*RULESYS_H_*/ diff --git a/common/ruletypes.h b/common/ruletypes.h index e5156c474..204763b2b 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -40,11 +40,11 @@ RULE_REAL( Character, AAExpMultiplier, 0.5 ) RULE_REAL( Character, GroupExpMultiplier, 0.5 ) RULE_REAL( Character, RaidExpMultiplier, 0.2 ) RULE_BOOL( Character, UseXPConScaling, true ) -RULE_INT ( Character, LightBlueModifier, 40 ) +RULE_INT ( Character, LightBlueModifier, 40 ) RULE_INT ( Character, BlueModifier, 90 ) RULE_INT ( Character, WhiteModifier, 100 ) RULE_INT ( Character, YellowModifier, 125 ) -RULE_INT ( Character, RedModifier, 150 ) +RULE_INT ( Character, RedModifier, 150 ) RULE_INT ( Character, AutosaveIntervalS, 300 ) //0=disabled RULE_INT ( Character, HPRegenMultiplier, 100) RULE_INT ( Character, ManaRegenMultiplier, 100) @@ -227,7 +227,7 @@ RULE_INT ( Pathing, RouteUpdateFrequencyLong, 5000) // How often a new route wi // When a path has a path node route and it's target changes position, if it has RouteUpdateFrequencyNodeCount or less nodes to go on it's // current path, it will recalculate it's path based on the RouteUpdateFrequencyShort timer, otherwise it will use the // RouteUpdateFrequencyLong timer. -RULE_INT ( Pathing, RouteUpdateFrequencyNodeCount, 5) +RULE_INT ( Pathing, RouteUpdateFrequencyNodeCount, 5) RULE_REAL ( Pathing, MinDistanceForLOSCheckShort, 40000) // (NoRoot). While following a path, only check for LOS to target within this distance. RULE_REAL ( Pathing, MinDistanceForLOSCheckLong, 1000000) // (NoRoot). Min distance when initially attempting to acquire the target. RULE_INT ( Pathing, MinNodesLeftForLOSCheck, 4) // Only check for LOS when we are down to this many path nodes left to run. @@ -321,7 +321,7 @@ RULE_REAL ( Combat, HitFalloffMajor, 50.0) //hit will fall off sharply if we're RULE_REAL ( Combat, HitBonusPerLevel, 1.2) //You gain this % of hit for every level you are above your target RULE_REAL ( Combat, WeaponSkillFalloff, 0.33) //For every weapon skill point that's not maxed you lose this % of hit RULE_REAL ( Combat, ArcheryHitPenalty, 0.25) //Archery has a hit penalty to try to help balance it with the plethora of long term +hit modifiers for it -RULE_REAL ( Combat, AgiHitFactor, 0.01) +RULE_REAL ( Combat, AgiHitFactor, 0.01) RULE_INT ( Combat, MinRangedAttackDist, 25) //Minimum Distance to use Ranged Attacks RULE_BOOL ( Combat, ArcheryBonusRequiresStationary, true) //does the 2x archery bonus chance require a stationary npc RULE_REAL ( Combat, ArcheryBaseDamageBonus, 1) // % Modifier to Base Archery Damage (.5 = 50% base damage, 1 = 100%, 2 = 200%) diff --git a/common/seperator.h b/common/seperator.h index 5957528cb..3031813b6 100644 --- a/common/seperator.h +++ b/common/seperator.h @@ -33,10 +33,10 @@ public: int i; argnum = 0; int len = static_cast(strlen(message_in)); - + if(arglen > len) arglen = len+1; - + //msg = strdup(message); msg = new char[len+1]; strcpy(msg, message_in); diff --git a/common/serverinfo.cpp b/common/serverinfo.cpp index 410da4c26..6a4840f45 100644 --- a/common/serverinfo.cpp +++ b/common/serverinfo.cpp @@ -33,21 +33,21 @@ int GetOS() { OSVERSIONINFO Ver_os; Ver_os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - + if(!(GetVersionEx(&Ver_os))) return 1; - + Ver_build = Ver_os.dwBuildNumber & 0xFFFF; Ver_min = Ver_os.dwMinorVersion; Ver_maj = Ver_os.dwMajorVersion; Ver_pid = Ver_os.dwPlatformId; - + if ((Ver_pid == 1) && (Ver_maj == 4)) { if ((Ver_min < 10) && (Ver_build == 950)) { strcpy(Ver_name, "Microsoft Windows 95"); } - else if ((Ver_min < 10) && + else if ((Ver_min < 10) && ((Ver_build > 950) && (Ver_build <= 1080))) { strcpy(Ver_name, "Microsoft Windows 95 SP1"); @@ -60,7 +60,7 @@ int GetOS() { { strcpy(Ver_name, "Microsoft Windows 98"); } - else if ((Ver_min == 10) && + else if ((Ver_min == 10) && ((Ver_build > 1998) && (Ver_build < 2183))) { strcpy(Ver_name, "Microsoft Windows 98, Service Pack 1"); @@ -99,21 +99,21 @@ int GetOS() { } return 0; -} +} #else #include #include #include - + char* GetOS(char* os_string) { utsname info; if(uname(&info)==0) { snprintf(os_string, 99, "%s %s %s %s %s", info.sysname, info.nodename, info.release, info.version, info.machine); } else { - strncpy(os_string, "Error determining OS & version!", 25); + strncpy(os_string, "Error determining OS & version!", 25); } return os_string; diff --git a/common/servertalk.h b/common/servertalk.h index 26450d872..b78dfada9 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -105,12 +105,12 @@ #define ServerOP_GroupCancelInvite 0x0112 #define ServerOP_InstanceUpdateTime 0x014F -#define ServerOP_AdventureRequest 0x0150 +#define ServerOP_AdventureRequest 0x0150 #define ServerOP_AdventureRequestAccept 0x0151 #define ServerOP_AdventureRequestDeny 0x0152 -#define ServerOP_AdventureRequestCreate 0x0153 -#define ServerOP_AdventureData 0x0154 -#define ServerOP_AdventureDataClear 0x0155 +#define ServerOP_AdventureRequestCreate 0x0153 +#define ServerOP_AdventureData 0x0154 +#define ServerOP_AdventureDataClear 0x0155 #define ServerOP_AdventureCreateDeny 0x0156 #define ServerOP_AdventureDataRequest 0x0157 #define ServerOP_AdventureClickDoor 0x0158 @@ -267,7 +267,7 @@ public: uint8 ReadUInt8() { uint8 value = *(uint8 *)(pBuffer + _rpos); _rpos += sizeof(uint8); return value; } uint32 ReadUInt32() { uint32 value = *(uint32 *)(pBuffer + _rpos); _rpos += sizeof(uint32); return value; } void ReadString(char *str) { uint32 len = static_cast(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; } - + uint32 GetWritePosition() { return _wpos; } uint32 GetReadPosition() { return _rpos; } void SetWritePosition(uint32 Newwpos) { _wpos = Newwpos; } @@ -584,7 +584,7 @@ struct ServerWhoAll_Struct { }; struct ServerFriendsWho_Struct { - uint32 FromID; + uint32 FromID; char FromName[64]; char FriendsString[1]; }; @@ -838,7 +838,7 @@ struct ServerRaidGeneralAction_Struct { struct ServerRaidGroupAction_Struct { //add / remove depends on opcode. char membername[64]; //member who's adding / leaving uint32 gid; //group id to send to. - uint32 rid; //raid id to send to. + uint32 rid; //raid id to send to. }; struct ServerRaidMessage_Struct { diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 6fc251374..a5107215f 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -27,8 +27,8 @@ SharedDatabase::SharedDatabase() } SharedDatabase::SharedDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port) -: Database(host, user, passwd, database, port), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr), - faction_mmf(nullptr), faction_hash(nullptr), loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr), +: Database(host, user, passwd, database, port), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr), + faction_mmf(nullptr), faction_hash(nullptr), loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr), loot_drop_hash(nullptr) { } @@ -49,16 +49,16 @@ bool SharedDatabase::SetHideMe(uint32 account_id, uint8 hideme) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET hideme = %i where id = %i", hideme, account_id), errbuf)) { cerr << "Error in SetGMSpeed query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + safe_delete_array(query); return true; - + } uint8 SharedDatabase::GetGMSpeed(uint32 account_id) @@ -85,14 +85,14 @@ uint8 SharedDatabase::GetGMSpeed(uint32 account_id) } else { - + cerr << "Error in GetGMSpeed query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + return 0; - + } @@ -100,16 +100,16 @@ bool SharedDatabase::SetGMSpeed(uint32 account_id, uint8 gmspeed) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET gmspeed = %i where id = %i", gmspeed, account_id), errbuf)) { cerr << "Error in SetGMSpeed query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + safe_delete_array(query); return true; - + } uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { @@ -170,7 +170,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite MYSQL_RES *result; MYSQL_ROW row; // Delete cursor items - if (!RunQuery(query, MakeAnyLenString(&query, + if (!RunQuery(query, MakeAnyLenString(&query, "SELECT itemid,charges FROM sharedbank " "WHERE acctid=%d AND slotid=%d", account_id, slot_id), errbuf, &result)) { @@ -180,19 +180,19 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite return(true); } safe_delete_array(query); - + row = mysql_fetch_row(result); bool found = false; if(row) { uint32 id = atoi(row[0]); uint16 charges = atoi(row[1]); - + uint16 expect_charges = 0; if(inst->GetCharges() >= 0) expect_charges = inst->GetCharges(); else expect_charges = 0x7FFF; - + if(id == inst->GetItem()->ID && charges == expect_charges) found = true; } @@ -210,23 +210,23 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s //never save tribute slots: if(slot_id >= 400 && slot_id <= 404) return(true); - + if (inst && inst->IsType(ItemClassCommon)) { for(int i=0;i<5;i++) { ItemInst *auginst=inst->GetItem(i); augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } } - + if (slot_id>=2500 && slot_id<=2600) { // Shared bank inventory if (!inst) { // Delete item uint32 account_id = GetAccountIDByChar(char_id); uint32 len_query = MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); - + ret = RunQuery(query, len_query, errbuf); - + // Delete bag slots, if need be if (ret && Inventory::SupportsContainers(slot_id)) { safe_delete_array(query); @@ -234,7 +234,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid>=%i AND slotid<%i", account_id, base_slot_id, (base_slot_id+10)), errbuf); } - + // @merth: need to delete augments here } else { @@ -246,7 +246,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s else charges = 0x7FFF; - uint32 len_query = MakeAnyLenString(&query, + uint32 len_query = MakeAnyLenString(&query, "REPLACE INTO sharedbank " " (acctid,slotid,itemid,charges,custom_data," " augslot1,augslot2,augslot3,augslot4,augslot5)" @@ -256,7 +256,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s inst->GetCustomDataString().c_str(), (unsigned long)augslot[0],(unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4]); - + ret = RunQuery(query, len_query, errbuf); } } @@ -265,7 +265,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s // Delete item ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid=%i", char_id, slot_id), errbuf); - + // Delete bag slots, if need be if (ret && Inventory::SupportsContainers(slot_id)) { safe_delete_array(query); @@ -273,7 +273,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid>=%i AND slotid<%i", char_id, base_slot_id, (base_slot_id+10)), errbuf); } - + // @merth: need to delete augments here } else { @@ -283,24 +283,24 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s else charges = 0x7FFF; // Update/Insert item - uint32 len_query = MakeAnyLenString(&query, + uint32 len_query = MakeAnyLenString(&query, "REPLACE INTO inventory " " (charid,slotid,itemid,charges,instnodrop,custom_data,color," " augslot1,augslot2,augslot3,augslot4,augslot5)" " VALUES(%lu,%lu,%lu,%lu,%lu,'%s',%lu," " %lu,%lu,%lu,%lu,%lu)", - (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, + (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, (unsigned long)(inst->IsInstNoDrop() ? 1:0),inst->GetCustomDataString().c_str(),(unsigned long)inst->GetColor(), (unsigned long)augslot[0],(unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4] ); - + ret = RunQuery(query, len_query, errbuf); } } - + if (!ret) LogFile->write(EQEMuLog::Error, "SaveInventory query '%s': %s", query, errbuf); safe_delete_array(query); - + // Save bag contents, if slot supports bag contents if (inst && inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) { for (uint8 idx=0; idx<10; idx++) { @@ -308,9 +308,9 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } } - + // @merth: need to save augments here - + return ret; } @@ -338,12 +338,12 @@ int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) } else { - + cerr << "Error in GetSharedPlatinum query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + return 0; } @@ -357,7 +357,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) safe_delete_array(query); return false; } - + safe_delete_array(query); return true; } @@ -369,7 +369,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, MYSQL_RES *result; MYSQL_ROW row; const Item_Struct* myitem; - + RunQuery ( query, @@ -394,7 +394,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, myitem = GetItem(itemid); if(!myitem) continue; - ItemInst* myinst = CreateBaseItem(myitem, charges); + ItemInst* myinst = CreateBaseItem(myitem, charges); if(slot < 0) slot = inv->FindFreeSlot(0,0); inv->PutItem(slot, *myinst); @@ -415,7 +415,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { MYSQL_RES *result; MYSQL_ROW row; bool ret = false; - + if (is_charid) { len_query = MakeAnyLenString(&query, "SELECT sb.slotid,sb.itemid,sb.charges,sb.augslot1,sb.augslot2,sb.augslot3,sb.augslot4,sb.augslot5,sb.custom_data from sharedbank sb " @@ -426,7 +426,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { len_query = MakeAnyLenString(&query, "SELECT slotid,itemid,charges,augslot1,augslot2,augslot3,augslot4,augslot5,custom_data from sharedbank WHERE acctid=%i", id); } - + if (RunQuery(query, len_query, errbuf, &result)) { while ((row = mysql_fetch_row(result))) { int16 slot_id = (int16)atoi(row[0]); @@ -439,10 +439,10 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { aug[3] = (uint32)atoi(row[6]); aug[4] = (uint32)atoi(row[7]); const Item_Struct* item = GetItem(item_id); - + if (item) { int16 put_slot_id = SLOT_INVALID; - + ItemInst* inst = CreateBaseItem(item, charges); if (item->ItemClass == ItemClassCommon) { for(int i=0;i<5;i++) { @@ -476,10 +476,10 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { } } } - + put_slot_id = inv->PutItem(slot_id, *inst); safe_delete(inst); - + // Save ptr to item in inventory if (put_slot_id == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, @@ -496,14 +496,14 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); } } - + mysql_free_result(result); ret = true; } else { LogFile->write(EQEMuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", errbuf); } - + safe_delete_array(query); return ret; } @@ -517,12 +517,12 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { MYSQL_RES* result; MYSQL_ROW row; bool ret = false; - + // Retrieve character inventory if (RunQuery(query, MakeAnyLenString(&query, "SELECT slotid,itemid,charges,color,augslot1,augslot2,augslot3,augslot4,augslot5," "instnodrop,custom_data FROM inventory WHERE charid=%i ORDER BY slotid", char_id), errbuf, &result)) { - while ((row = mysql_fetch_row(result))) { + while ((row = mysql_fetch_row(result))) { int16 slot_id = atoi(row[0]); uint32 item_id = atoi(row[1]); uint16 charges = atoi(row[2]); @@ -536,12 +536,12 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; const Item_Struct* item = GetItem(item_id); - + if (item) { int16 put_slot_id = SLOT_INVALID; - + ItemInst* inst = CreateBaseItem(item, charges); - + if(row[10]) { std::string data_str(row[10]); std::string id; @@ -587,10 +587,10 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { if (slot_id>=8000 && slot_id <= 8999) put_slot_id = inv->PushCursor(*inst); - else + else put_slot_id = inv->PutItem(slot_id, *inst); safe_delete(inst); - + // Save ptr to item in inventory if (put_slot_id == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, @@ -605,7 +605,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { } } mysql_free_result(result); - + // Retrieve shared inventory ret = GetSharedBank(char_id, inv, true); } @@ -613,7 +613,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query, errbuf); LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); } - + safe_delete_array(query); return ret; } @@ -626,10 +626,10 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) MYSQL_RES* result; MYSQL_ROW row; bool ret = false; - + // Retrieve character inventory if (RunQuery(query, MakeAnyLenString(&query, "SELECT slotid,itemid,charges,color,augslot1,augslot2,augslot3,augslot4,augslot5," - "instnodrop,custom_data FROM inventory INNER JOIN character_ ch ON ch.id=charid WHERE ch.name='%s' AND ch.account_id=%i ORDER BY slotid", + "instnodrop,custom_data FROM inventory INNER JOIN character_ ch ON ch.id=charid WHERE ch.name='%s' AND ch.account_id=%i ORDER BY slotid", name, account_id), errbuf, &result)) { while ((row = mysql_fetch_row(result))) { @@ -649,7 +649,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) if(!item) continue; - ItemInst* inst = CreateBaseItem(item, charges); + ItemInst* inst = CreateBaseItem(item, charges); inst->SetInstNoDrop(instnodrop); if(row[10]) { @@ -657,7 +657,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) std::string id; std::string value; bool use_id = true; - + for(int i = 0; i < data_str.length(); ++i) { if(data_str[i] == '^') { if(!use_id) { @@ -691,10 +691,10 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) } if (slot_id>=8000 && slot_id <= 8999) put_slot_id = inv->PushCursor(*inst); - else + else put_slot_id = inv->PutItem(slot_id, *inst); safe_delete(inst); - + // Save ptr to item in inventory if (put_slot_id == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, @@ -703,7 +703,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) } } mysql_free_result(result); - + // Retrieve shared inventory ret = GetSharedBank(account_id, inv, false); } @@ -711,7 +711,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query, errbuf); LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); } - + safe_delete_array(query); return ret; } @@ -723,7 +723,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { MYSQL_ROW row; item_count = -1; max_id = 0; - + char query[] = "SELECT MAX(id), count(*) FROM items"; if (RunQuery(query, static_cast(strlen(query)), errbuf, &result)) { row = mysql_fetch_row(result); @@ -810,9 +810,9 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ " from items order by id"; Item_Struct item; if(RunQuery(query, sizeof(query), errbuf, &result)) { - while((row = mysql_fetch_row(result))) { + while((row = mysql_fetch_row(result))) { memset(&item, 0, sizeof(Item_Struct)); - + item.ItemClass = (uint8)atoi(row[ItemField::itemclass]); strcpy(item.Name,row[ItemField::name]); strcpy(item.Lore,row[ItemField::lore]); @@ -1010,7 +1010,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ break; } } - + mysql_free_result(result); } else { @@ -1173,7 +1173,7 @@ bool SharedDatabase::LoadNPCFactionLists() { if(faction_hash) { return true; } - + try { EQEmu::IPCMutex mutex("faction"); mutex.Lock(); @@ -1212,16 +1212,16 @@ bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfi MYSQL_RES* result; MYSQL_ROW row; bool ret = false; - + unsigned long* lengths; - + if (RunQuery(query, MakeAnyLenString(&query, "SELECT profile,zonename,x,y,z,extprofile,instanceid FROM character_ WHERE account_id=%i AND name='%s'", account_id, name), errbuf, &result)) { - if (mysql_num_rows(result) == 1) { + if (mysql_num_rows(result) == 1) { row = mysql_fetch_row(result); lengths = mysql_fetch_lengths(result); if (lengths[0] == sizeof(PlayerProfile_Struct)) { memcpy(pp, row[0], sizeof(PlayerProfile_Struct)); - + if (current_zone) strcpy(current_zone, row[1]); pp->zone_id = GetZoneID(row[1]); @@ -1234,12 +1234,12 @@ bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfi if(current_instance) *current_instance = pp->zoneInstance; - + if(ext) { //SetExtendedProfile handles any conversion SetExtendedProfile(ext, row[5], lengths[5]); } - + // Retrieve character inventory ret = GetInventory(account_id, name, inv); } @@ -1248,13 +1248,13 @@ bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfi lengths[0], sizeof(PlayerProfile_Struct)); } } - + mysql_free_result(result); } else { LogFile->write(EQEMuLog::Error, "GetPlayerProfile query '%s' %s", query, errbuf); } - + safe_delete_array(query); return ret; } @@ -1265,15 +1265,15 @@ bool SharedDatabase::SetPlayerProfile(uint32 account_id, uint32 charid, PlayerPr char* query = 0; uint32 affected_rows = 0; bool ret = false; - + if (RunQuery(query, SetPlayerProfile_MQ(&query, account_id, charid, pp, inv, ext, current_zone, current_instance, MaxXTargets), errbuf, 0, &affected_rows)) { ret = (affected_rows != 0); } - + if (!ret) { LogFile->write(EQEMuLog::Error, "SetPlayerProfile query '%s' %s", query, errbuf); } - + safe_delete_array(query); return ret; } @@ -1290,13 +1290,13 @@ uint32 SharedDatabase::SetPlayerProfile_MQ(char** query, uint32 account_id, uint if(strlen(pp->name) == 0) // Sanity check in case pp never loaded return false; - + end += sprintf(end, "UPDATE character_ SET timelaston=unix_timestamp(now()),name=\'%s\', zonename=\'%s\', zoneid=%u, instanceid=%u, x = %f, y = %f, z = %f, profile=\'", pp->name, GetZoneName(current_zone), current_zone, current_instance, pp->x, pp->y, pp->z); end += DoEscapeString(end, (char*)pp, sizeof(PlayerProfile_Struct)); end += sprintf(end,"\', extprofile=\'"); end += DoEscapeString(end, (char*)ext, sizeof(ExtendedProfile_Struct)); end += sprintf(end,"\',class=%d,level=%d,xtargets=%u WHERE id=%u", pp->class_, pp->level, MaxXTargets, charid); - + return (uint32) (end - (*query)); } @@ -1333,14 +1333,14 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst->PutAugment(this, 3, aug4); inst->PutAugment(this, 4, aug5); } - + return inst; } ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) { ItemInst* inst = nullptr; if (item) { - // if maxcharges is -1 that means it is an unlimited use item. + // if maxcharges is -1 that means it is an unlimited use item. // set it to 1 charge so that it is usable on creation if (charges == 0 && item->MaxCharges == -1) charges = 1; @@ -1349,8 +1349,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new EvoItemInst(item, charges); ((EvoItemInst*)inst)->Initialize(this); } - else - inst = new ItemInst(item, charges); + else + inst = new ItemInst(item, charges); } return inst; } @@ -1363,8 +1363,8 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { if(RuleB(Zone, EnableShadowrest)) { if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried=0 and " - "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", - (RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows)) + "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", + (RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows)) { safe_delete_array(query); return -1; @@ -1373,8 +1373,8 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { else { if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where (UNIX_TIMESTAMP() - " - "UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)), - errbuf, 0, &affected_rows)) + "UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)), + errbuf, 0, &affected_rows)) { safe_delete_array(query); return -1; @@ -1396,7 +1396,7 @@ int32 SharedDatabase::DeleteStalePlayerBackups() { return -1; } safe_delete_array(query); - + return affected_rows; } @@ -1420,7 +1420,7 @@ bool SharedDatabase::GetCommandSettings(map &commands) { safe_delete_array(query); return false; } - + return false; } @@ -1460,11 +1460,11 @@ void SharedDatabase::LoadSkillCaps(void *data) { char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, - "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"), + if(RunQuery(query, MakeAnyLenString(&query, + "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"), errbuf, &result)) { safe_delete_array(query); - + while((row = mysql_fetch_row(result))) { uint8 skillID = atoi(row[0]); uint8 class_ = atoi(row[1]) - 1; @@ -1531,7 +1531,7 @@ uint8 SharedDatabase::GetTrainLevel(uint8 Class_, SkillType Skill, uint8 Level) if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { return 0; } - + uint8 ret = 0; if(Level > static_cast(SkillMaxLevel)) { uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count); @@ -1554,7 +1554,7 @@ uint8 SharedDatabase::GetTrainLevel(uint8 Class_, SkillType Skill, uint8 Level) } } } - + if(ret > GetSkillCap(Class_, Skill, Level)) ret = static_cast(GetSkillCap(Class_, Skill, Level)); @@ -1601,7 +1601,7 @@ int SharedDatabase::GetMaxSpellID() { MYSQL_RES *result; MYSQL_ROW row; int32 ret = 0; - if(RunQuery(query, MakeAnyLenString(&query, "SELECT MAX(id) FROM spells_new"), + if(RunQuery(query, MakeAnyLenString(&query, "SELECT MAX(id) FROM spells_new"), errbuf, &result)) { safe_delete_array(query); row = mysql_fetch_row(result); @@ -1622,11 +1622,11 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { MYSQL_RES *result; MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, - "SELECT * FROM spells_new ORDER BY id ASC"), + if(RunQuery(query, MakeAnyLenString(&query, + "SELECT * FROM spells_new ORDER BY id ASC"), errbuf, &result)) { safe_delete_array(query); - + int tempid = 0; int counter = 0; while (row = mysql_fetch_row(result)) { @@ -1657,7 +1657,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].buffduration=atoi(row[17]); sp[tempid].AEDuration=atoi(row[18]); sp[tempid].mana=atoi(row[19]); - + int y=0; for(y=0; y< EFFECT_COUNT;y++) sp[tempid].base[y]=atoi(row[20+y]); // effect_base_value @@ -1665,26 +1665,26 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].base2[y]=atoi(row[32+y]); // effect_limit_value for(y=0; y< EFFECT_COUNT;y++) sp[tempid].max[y]=atoi(row[44+y]); - + for(y=0; y< 4;y++) sp[tempid].components[y]=atoi(row[58+y]); - + for(y=0; y< 4;y++) sp[tempid].component_counts[y]=atoi(row[62+y]); - + for(y=0; y< 4;y++) sp[tempid].NoexpendReagent[y]=atoi(row[66+y]); - + for(y=0; y< EFFECT_COUNT;y++) sp[tempid].formula[y]=atoi(row[70+y]); - + sp[tempid].goodEffect=atoi(row[83]); sp[tempid].Activated=atoi(row[84]); sp[tempid].resisttype=atoi(row[85]); - + for(y=0; y< EFFECT_COUNT;y++) sp[tempid].effectid[y]=atoi(row[86+y]); - + sp[tempid].targettype = (SpellTargetType) atoi(row[98]); sp[tempid].basediff=atoi(row[99]); int tmp_skill = atoi(row[100]);; @@ -1695,10 +1695,10 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].zonetype=atoi(row[101]); sp[tempid].EnvironmentType=atoi(row[102]); sp[tempid].TimeOfDay=atoi(row[103]); - + for(y=0; y < PLAYER_CLASS_COUNT;y++) sp[tempid].classes[y]=atoi(row[104+y]); - + sp[tempid].CastingAnim=atoi(row[120]); sp[tempid].SpellAffectIndex=atoi(row[123]); sp[tempid].disallow_sit=atoi(row[124]); @@ -1713,7 +1713,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].short_buff_box = atoi(row[154]); sp[tempid].descnum = atoi(row[155]); sp[tempid].effectdescnum = atoi(row[157]); - + sp[tempid].bonushate=atoi(row[162]); sp[tempid].EndurCost=atoi(row[166]); @@ -1810,10 +1810,10 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { uint32 id = static_cast(atoul(row[0])); if(id != current_id) { if(current_id != 0) { - hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + + hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * lt->NumEntries))); } - + memset(loot_table, 0, sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)); current_entry = 0; current_id = id; @@ -1821,7 +1821,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { lt->maxcash = static_cast(atoul(row[2])); lt->avgcoin = static_cast(atoul(row[3])); } - + if(current_entry > 128) { continue; } @@ -1829,18 +1829,18 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { if(!row[4]) { continue; } - + lt->Entries[current_entry].lootdrop_id = static_cast(atoul(row[4])); lt->Entries[current_entry].multiplier = static_cast(atoi(row[5])); lt->Entries[current_entry].droplimit = static_cast(atoi(row[6])); lt->Entries[current_entry].mindrop = static_cast(atoi(row[7])); lt->Entries[current_entry].probability = static_cast(atof(row[8])); - + ++(lt->NumEntries); ++current_entry; } if(current_id != 0) { - hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + + hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * lt->NumEntries))); } @@ -1869,7 +1869,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { uint32 id = static_cast(atoul(row[0])); if(id != current_id) { if(current_id != 0) { - hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + + hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * ld->NumEntries))); } @@ -1894,7 +1894,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { ++current_entry; } if(current_id != 0) { - hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + + hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * ld->NumEntries))); } @@ -1913,11 +1913,11 @@ bool SharedDatabase::LoadLoot() { mutex.Lock(); loot_table_mmf = new EQEmu::MemoryMappedFile("shared/loot_table"); loot_table_hash = new EQEmu::FixedMemoryVariableHashSet( - reinterpret_cast(loot_table_mmf->Get()), + reinterpret_cast(loot_table_mmf->Get()), loot_table_mmf->Size()); loot_drop_mmf = new EQEmu::MemoryMappedFile("shared/loot_drop"); loot_drop_hash = new EQEmu::FixedMemoryVariableHashSet( - reinterpret_cast(loot_drop_mmf->Get()), + reinterpret_cast(loot_drop_mmf->Get()), loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { @@ -1983,11 +1983,11 @@ void SharedDatabase::SetPlayerInspectMessage(char* playername, const InspectMess char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET inspectmessage='%s' WHERE name='%s'", message->text, playername), errbuf)) { cerr << "Error in SetPlayerInspectMessage query '" << query << "' " << errbuf << endl; } - + safe_delete_array(query); } @@ -2018,10 +2018,10 @@ void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Str char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE bots SET BotInspectMessage='%s' WHERE BotID=%i", message->text, botid), errbuf)) { cerr << "Error in SetBotInspectMessage query '" << query << "' " << errbuf << endl; } - + safe_delete_array(query); } diff --git a/common/shareddb.h b/common/shareddb.h index d739bef19..fe20bdee1 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -63,17 +63,17 @@ public: bool GetInventory(uint32 char_id, Inventory* inv); bool GetInventory(uint32 account_id, char* name, Inventory* inv); bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); - - + + string GetBook(const char *txtfile); - + /* * Item Methods */ ItemInst* CreateItem(uint32 item_id, int16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); ItemInst* CreateItem(const Item_Struct* item, int16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); ItemInst* CreateBaseItem(const Item_Struct* item, int16 charges=0); - + /* * Shared Memory crap */ @@ -85,7 +85,7 @@ public: const Item_Struct* IterateItems(uint32* id); const Item_Struct* GetItem(uint32 id); const EvolveInfo* GetEvolveInfo(uint32 loregroup); - + //faction lists void GetFactionListInfo(uint32 &list_count, uint32 &max_lists); const NPCFactionList* GetNPCFactionEntry(uint32 id); @@ -111,7 +111,7 @@ public: void LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID); protected: - + EQEmu::MemoryMappedFile *items_mmf; EQEmu::FixedMemoryHashSet *items_hash; EQEmu::MemoryMappedFile *faction_mmf; diff --git a/common/spdat.cpp b/common/spdat.cpp index 319e94f14..4e0a6c1c6 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -20,7 +20,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) /* solar: General outline of spell casting process - + 1. a) Client clicks a spell bar gem, ability, or item. client_process.cpp gets the op and calls CastSpell() with all the relevant info including @@ -215,7 +215,7 @@ bool IsBeneficialSpell(uint16 spell_id) if(tt != ST_Self && tt != ST_Pet){ if(IsEffectInSpell(spell_id, SE_CancelMagic)) return false; - } + } if(tt == ST_Target || tt == ST_AETarget || tt == ST_Animal || tt == ST_Undead || tt == ST_Pet) { uint16 sai = spells[spell_id].SpellAffectIndex; if(spells[spell_id].resisttype == RESIST_MAGIC){ @@ -347,7 +347,7 @@ bool IsPureNukeSpell(uint16 spell_id) return ( - effect_count == 1 && IsEffectInSpell(spell_id, SE_CurrentHP) && + effect_count == 1 && IsEffectInSpell(spell_id, SE_CurrentHP) && spells[spell_id].buffduration == 0 && IsDamageSpell(spell_id) ); } @@ -364,15 +364,15 @@ bool IsPBAENukeSpell(uint16 spell_id) bool IsAERainNukeSpell(uint16 spell_id) { - return IsValidSpell(spell_id) && IsPureNukeSpell(spell_id) + return IsValidSpell(spell_id) && IsPureNukeSpell(spell_id) && spells[spell_id].aoerange > 0 && spells[spell_id].AEDuration > 1000; } bool IsPartialCapableSpell(uint16 spell_id) { - if(IsPureNukeSpell(spell_id) || - IsFearSpell(spell_id) || - IsEffectInSpell(spell_id, SE_Root) || + if(IsPureNukeSpell(spell_id) || + IsFearSpell(spell_id) || + IsEffectInSpell(spell_id, SE_Root) || IsEffectInSpell(spell_id, SE_Charm)) { return true; @@ -401,7 +401,7 @@ bool IsGroupSpell(uint16 spell_id) IsValidSpell(spell_id) && ( spells[spell_id].targettype == ST_AEBard || - spells[spell_id].targettype == ST_Group || + spells[spell_id].targettype == ST_Group || spells[spell_id].targettype == ST_GroupTeleport ) ); @@ -439,7 +439,7 @@ bool IsEffectInSpell(uint16 spellid, int effect) return false; for(j = 0; j < EFFECT_COUNT; j++) - if(spells[spellid].effectid[j] == effect) + if(spells[spellid].effectid[j] == effect) return true; return false; @@ -460,7 +460,7 @@ bool IsBlankSpellEffect(uint16 spellid, int effect_index) ( effect == SE_Blank || // blank marker ( // spacer - effect == SE_CHA && + effect == SE_CHA && base == 0 && formula == 100 ) @@ -493,7 +493,7 @@ int GetMinLevel(uint16 spell_id) { if(spell.classes[r] < min) min = spell.classes[r]; } - + //if we can't cast the spell return 0 //just so it wont screw up calculations used in other areas of the code if(min == 255) @@ -536,7 +536,7 @@ int GetSpellEffectIndex(uint16 spell_id, int effect) int CanUseSpell(uint16 spellid, int classa, int level) { int level_to_use; - + if(!IsValidSpell(spellid) || classa >= PLAYER_CLASS_COUNT) return 0; @@ -557,7 +557,7 @@ int CanUseSpell(uint16 spellid, int classa, int level) bool BeneficialSpell(uint16 spell_id) { - if (spell_id <= 0 || spell_id >= SPDAT_RECORDS + if (spell_id <= 0 || spell_id >= SPDAT_RECORDS /*|| spells[spell_id].stacking == 27*/ ) { return true; @@ -668,9 +668,9 @@ bool IsDisciplineBuff(uint16 spell_id) if(!IsValidSpell(spell_id)) return false; - if(spells[spell_id].mana == 0 + if(spells[spell_id].mana == 0 && spells[spell_id].short_buff_box == 0 - && (spells[spell_id].EndurCost || spells[spell_id].EndurUpkeep) + && (spells[spell_id].EndurCost || spells[spell_id].EndurUpkeep) && spells[spell_id].targettype == ST_Self) { return true; @@ -836,7 +836,7 @@ int GetSpellEffectDescNum(uint16 spell_id) } } -DmgShieldType GetDamageShieldType(uint16 spell_id) +DmgShieldType GetDamageShieldType(uint16 spell_id) { // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, @@ -844,8 +844,8 @@ DmgShieldType GetDamageShieldType(uint16 spell_id) // if( (spell_id > 0) && (spell_id < SPDAT_RECORDS) ){ - _log(SPELLS__EFFECT_VALUES, "DamageShieldType for spell %i (%s) is %X\n", spell_id, - spells[spell_id].name, spells[spell_id].DamageShieldType); + _log(SPELLS__EFFECT_VALUES, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + spells[spell_id].name, spells[spell_id].DamageShieldType); if(spells[spell_id].DamageShieldType) return (DmgShieldType) spells[spell_id].DamageShieldType; @@ -865,10 +865,10 @@ DmgShieldType GetDamageShieldType(uint16 spell_id) return DS_THORNS; } -bool IsLDoNObjectSpell(uint16 spell_id) +bool IsLDoNObjectSpell(uint16 spell_id) { - if(IsEffectInSpell(spell_id, SE_AppraiseLDonChest) || - IsEffectInSpell(spell_id, SE_DisarmLDoNTrap) || + if(IsEffectInSpell(spell_id, SE_AppraiseLDonChest) || + IsEffectInSpell(spell_id, SE_DisarmLDoNTrap) || IsEffectInSpell(spell_id, SE_UnlockLDoNChest)) { return true; @@ -898,7 +898,7 @@ bool IsHealOverTimeSpell(uint16 spell_id) { } bool IsCompleteHealSpell(uint16 spell_id) { - + if(spell_id == 13 || IsEffectInSpell(spell_id, SE_CompleteHeal) || IsPercentalHealSpell(spell_id) && !IsGroupSpell(spell_id)) return true; else @@ -960,7 +960,7 @@ bool IsGroupHealOverTimeSpell(uint16 spell_id) { bool IsDebuffSpell(uint16 spell_id) { - if(IsBeneficialSpell(spell_id) || IsEffectHitpointsSpell(spell_id) || IsStunSpell(spell_id) || IsMezSpell(spell_id) + if(IsBeneficialSpell(spell_id) || IsEffectHitpointsSpell(spell_id) || IsStunSpell(spell_id) || IsMezSpell(spell_id) || IsCharmSpell(spell_id) || IsSlowSpell(spell_id) || IsEffectInSpell(spell_id, SE_Root) || IsEffectInSpell(spell_id, SE_CancelMagic) || IsEffectInSpell(spell_id, SE_MovementSpeed) || IsFearSpell(spell_id) || IsEffectInSpell(spell_id, SE_Calm)) return false; @@ -980,14 +980,14 @@ bool IsResistDebuffSpell(uint16 spell_id) { bool IsSelfConversionSpell(uint16 spell_id) { - if(GetSpellTargetType(spell_id) == ST_Self && IsEffectInSpell(spell_id, SE_CurrentMana) && IsEffectInSpell(spell_id, SE_CurrentHP) + if(GetSpellTargetType(spell_id) == ST_Self && IsEffectInSpell(spell_id, SE_CurrentMana) && IsEffectInSpell(spell_id, SE_CurrentHP) && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentMana)] > 0 && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentHP)] < 0) return true; else return false; } -uint32 GetMorphTrigger(uint32 spell_id) +uint32 GetMorphTrigger(uint32 spell_id) { for(int i = 0; i < EFFECT_COUNT; ++i) { diff --git a/common/spdat.h b/common/spdat.h index a936f9975..43efe3182 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -80,7 +80,7 @@ enum RESISTTYPE RESIST_CHROMATIC = 6, RESIST_PRISMATIC = 7, RESIST_PHYSICAL = 8, // see Muscle Shock, Back Swing - RESIST_CORRUPTION = 9 + RESIST_CORRUPTION = 9 }; //Target Type IDs @@ -250,17 +250,17 @@ typedef enum { #define SE_CallPet 103 // implemented - Summon Companion #define SE_Translocate 104 // implemented #define SE_AntiGate 105 // implemented - Translocational Anchor -#define SE_SummonBSTPet 106 // implemented +#define SE_SummonBSTPet 106 // implemented //#define SE_Unknown107 107 // not used -#define SE_Familiar 108 // implemented +#define SE_Familiar 108 // implemented #define SE_SummonItemIntoBag 109 // implemented - summons stuff into container //#define SE_Unknown110 110 // not used -#define SE_ResistAll 111 // implemented -#define SE_CastingLevel 112 // implemented -#define SE_SummonHorse 113 // implemented +#define SE_ResistAll 111 // implemented +#define SE_CastingLevel 112 // implemented +#define SE_SummonHorse 113 // implemented #define SE_ChangeAggro 114 // implemented - Hate modifing buffs(ie horrifying visage) #define SE_Hunger 115 // implemented - Song of Sustenance -#define SE_CurseCounter 116 // implemented +#define SE_CurseCounter 116 // implemented #define SE_MagicWeapon 117 // implemented - makes weapon magical #define SE_SingingSkill 118 // *implemented - needs AA conversion #define SE_AttackSpeed3 119 // implemented @@ -288,7 +288,7 @@ typedef enum { #define SE_LimitInstant 141 // implemented #define SE_LimitMinLevel 142 // implemented #define SE_LimitCastTime 143 // implemented -//#define SE_Unknown144 144 // not used +//#define SE_Unknown144 144 // not used #define SE_Teleport2 145 // implemented - Banishment of the Pantheon //#define SE_Unknown146 146 // not used (Lightning Rod) Electrical Resist? (exp. VoA) #define SE_PercentalHeal 147 // implemented @@ -383,7 +383,7 @@ typedef enum { //#define SE_Unknown236 236 // not used #define SE_GivePetGroupTarget 237 // implemented[AA] - (Pet Affinity) #define SE_IllusionPersistence 238 // *not implemented - lends persistence to your illusionary disguises, causing them to last until you die or the illusion is forcibly removed. -#define SE_FeignedCastOnChance 239 // *not implemented as bonus - ability gives you an increasing chance for your feigned deaths to not be revealed by spells cast upon you. +#define SE_FeignedCastOnChance 239 // *not implemented as bonus - ability gives you an increasing chance for your feigned deaths to not be revealed by spells cast upon you. //#define SE_Unknown240 240 // not used [Likely related to above - you become immune to feign breaking on a resisted spell and have a good chance of feigning through a spell that successfully lands upon you.] #define SE_ImprovedReclaimEnergy 241 // not implemented as bonus - increase the amount of mana returned to you when reclaiming your pet. #define SE_ChanceWipeHateList 242 // *not implemented - increases the chance to wipe hate with memory blurr @@ -433,7 +433,7 @@ typedef enum { #define SE_SpellDamage 286 // implemented - adds direct spell damage #define SE_SpellDurationIncByTic 287 // implemented #define SE_SpecialAttackKBProc 288 // implemented[AA] - Chance to to do a knockback from special attacks [AA Dragon Punch]. -#define SE_ImprovedSpellEffect 289 // implemented +#define SE_ImprovedSpellEffect 289 // implemented #define SE_IncreaseRunSpeedCap 290 // implemented[AA] - increases run speed over the hard cap #define SE_Purify 291 // implemented - Removes determental effects #define SE_StrikeThrough2 292 // implemented[AA] - increasing chance of bypassing an opponent's special defenses, such as dodge, block, parry, and riposte. @@ -451,7 +451,7 @@ typedef enum { #define SE_OffhandRiposteFail 304 // not implemented as bonus - enemy cannot riposte offhand attacks #define SE_MitigateDamageShield 305 // implemented - off hand attacks only (Shielding Resistance) #define SE_ArmyOfTheDead 306 // *not implemented NecroAA - This ability calls up to five shades of nearby corpses back to life to serve the necromancer. The soulless abominations will mindlessly fight the target until called back to the afterlife some time later. The first rank summons up to three shades that serve for 60 seconds, and each additional rank adds one more possible shade and increases their duration by 15 seconds -#define SE_Appraisal 307 // *not implemented Rogue AA - This ability allows you to estimate the selling price of an item you are holding on your cursor. +#define SE_Appraisal 307 // *not implemented Rogue AA - This ability allows you to estimate the selling price of an item you are holding on your cursor. #define SE_SuspendMinion 308 // not implemented as bonus #define SE_YetAnotherGate 309 // implemented #define SE_ReduceReuseTimer 310 // implemented @@ -494,23 +494,23 @@ typedef enum { #define SE_ExtraArcheryAttack 347 // not implemented - chance at an additional archery attack (consumes arrow) #define SE_LimitManaCost 348 // implemented #define SE_ShieldEquipHateMod 349 // *not implemented[AA] ie. used to increase melee hate when wearing a shield w/ Shield Specialist AA. -#define SE_ManaBurn 350 // implemented - Drains mana for damage/heal at a defined ratio up to a defined maximum amount of mana. +#define SE_ManaBurn 350 // implemented - Drains mana for damage/heal at a defined ratio up to a defined maximum amount of mana. #define SE_PersistentEffect 351 // *not implemented. creates a trap/totem that casts a spell (spell id + base1?) when anything comes near it. can probably make a beacon for this #define SE_Unknown352 352 // *not implemented - looks to be some type of invulnerability? Test ITC (8755) #define SE_AdditionalAura 353 // *not implemented - allows use of more than 1 aura, aa effect #define SE_Unknown354 354 // *not implemented - looks to be some type of invulnerability? Test DAT (8757) #define SE_Unknown355 355 // *not implemented - looks to be some type of invulnerability? Test LT (8758) //#define SE_Unknown356 356 // not used -//#define SE_Unknown357 357 // *not implemented - (Stunted Growth) Something to do with negate effects? Focus? Chance? -#define SE_CurrentManaOnce 358 // implemented +//#define SE_Unknown357 357 // *not implemented - (Stunted Growth) Something to do with negate effects? Focus? Chance? +#define SE_CurrentManaOnce 358 // implemented #define SE_Invulnerabilty 359 // *not implemented - Invulnerability (Brell's Blessing) #define SE_SpellOnKill 360 // implemented - a buff that has a base1 % to cast spell base2 when you kill a "challenging foe" base3 min level -#define SE_SpellOnDeath 361 // implemented - casts spell on death of buffed +#define SE_SpellOnDeath 361 // implemented - casts spell on death of buffed #define SE_PotionBeltSlots 362 // *not implemented[AA] 'Quick Draw' expands the potion belt by one additional available item slot per rank. #define SE_BandolierSlots 363 // *not implemented[AA] 'Battle Ready' expands the bandolier by one additional save slot per rank. #define SE_TripleAttackChance 364 // implemented #define SE_SpellOnKill2 365 // implemented - chance to trigger a spell on kill when the kill is caused by a specific spell with this effect in it (10470 Venin) -#define SE_ShieldEquipDmgMod 366 // *not implemented - [AA Shield Specialist] - damage bonus to weapon if shield equiped. +#define SE_ShieldEquipDmgMod 366 // *not implemented - [AA Shield Specialist] - damage bonus to weapon if shield equiped. #define SE_SetBodyType 367 // implemented - set body type of base1 so it can be affected by spells that are limited to that type (Plant, Animal, Undead, etc) #define SE_FactionMod 368 // *not implemented - increases faction with base1 (faction id, live won't match up w/ ours) by base2 #define SE_CorruptionCounter 369 // implemented @@ -518,7 +518,7 @@ typedef enum { #define SE_AttackSpeed4 371 // implemented - stackable slow effect 'Inhibit Melee' #define SE_ForageSkill 372 // *not implemented[AA] Will increase the skill cap for those that have the Forage skill and grant the skill and raise the cap to those that do not. #define SE_CastOnWearoff 373 // implemented -#define SE_ApplyEffect 374 // implemented +#define SE_ApplyEffect 374 // implemented #define SE_DotCritDmgIncrease 375 // implemented - Increase damage of DoT critical amount //#define SE_Unknown376 376 // *not implemented - used in 2 spells #define SE_BossSpellTrigger 377 // implemented - spell is cast on fade @@ -572,14 +572,14 @@ typedef enum { #define SE_Display 425 // *not implemented - Illusion: Flying Dragon(21626) #define SE_IncreaseExtTargetWindow 426 // *not implmented[AA] - increases the capacity of your extended target window #define SE_SkillProc 427 // implemented - chance to proc when using a skill(ie taunt) -#define SE_LimitToSkill 428 // implemented - limits what skills will effect a skill proc +#define SE_LimitToSkill 428 // implemented - limits what skills will effect a skill proc #define SE_SkillProc2 429 // implemented - chance to proc when using a skill (most have hit limits) //#define SE_Unknown430 430 // *not implemented - Fear of the Dark(27641) //#define SE_Unknown431 431 // *not implemented - Fear of the Dark(27641) //#define SE_Unknown432 432 // not used //#define SE_Uknonwn433 433 // not used #define SE_CriticalHealChance2 434 // implemented - increase critical heal chance -#define SE_CriticalHealOverTime2 435 // implemented - increase critical heal over time chance +#define SE_CriticalHealOverTime2 435 // implemented - increase critical heal over time chance //#define SE_Unknown432 436 // not used #define SE_Anchor 437 // *not implemented - Teleport Guild Hall Anchor(33099) //#define SE_Unknown438 438 // not used @@ -609,7 +609,7 @@ struct SPDat_Spell_Struct /* 003 */ char teleport_zone[64]; // Teleport zone, pet name summoned, or item summoned /* 004 */ char you_cast[64]; // Message when you cast /* 005 */ char other_casts[64]; // Message when other casts -/* 006 */ char cast_on_you[64]; // Message when spell is cast on you +/* 006 */ char cast_on_you[64]; // Message when spell is cast on you /* 007 */ char cast_on_other[64]; // Message when spell is cast on someone else /* 008 */ char spell_fades[64]; // Spell fades /* 009 */ float range; @@ -636,13 +636,13 @@ struct SPDat_Spell_Struct /* 070 */ uint16 formula[EFFECT_COUNT]; // Spell's value formula /* 082 */ //int LightType; // probaly another effecttype flag /* 083 */ int8 goodEffect; //0=detrimental, 1=Beneficial, 2=Beneficial, Group Only -/* 084 */ int Activated; // probaly another effecttype flag +/* 084 */ int Activated; // probaly another effecttype flag /* 085 */ int resisttype; /* 086 */ int effectid[EFFECT_COUNT]; // Spell's effects /* 098 */ SpellTargetType targettype; // Spell's Target /* 099 */ int basediff; // base difficulty fizzle adjustment /* 100 */ SkillType skill; -/* 101 */ int8 zonetype; // 01=Outdoors, 02=dungeons, ff=Any +/* 101 */ int8 zonetype; // 01=Outdoors, 02=dungeons, ff=Any /* 102 */ int8 EnvironmentType; /* 103 */ int8 TimeOfDay; /* 104 */ uint8 classes[PLAYER_CLASS_COUNT]; // Classes, and their min levels @@ -659,32 +659,32 @@ struct SPDat_Spell_Struct /* 144 */ //int16 new_icon // Spell icon used by the client in uifiles/default/spells??.tga, both for spell gems & buff window. Looks to depreciate icon & memicon /* 145 */ //int16 spellanim; // Doesn't look like it's the same as #doanim, so not sure what this is /* 146 */ int8 uninterruptable; // Looks like anything != 0 is uninterruptable. Values are mostly -1, 0, & 1 (Fetid Breath = 90?) -/* 147 */ int16 ResistDiff; +/* 147 */ int16 ResistDiff; /* 148 */ //int dot_stacking_exempt; /* 149 */ //int deletable; /* 150 */ uint16 RecourseLink; /* 151 */ // 151: -1, 0, or 1 // 152 & 153: all set to 0 -/* 154 */ int8 short_buff_box; // != 0, goes to short buff box. +/* 154 */ int8 short_buff_box; // != 0, goes to short buff box. /* 155 */ int descnum; // eqstr of description of spell /* 156 */ //int typedescnum; // eqstr of type description /* 157 */ int effectdescnum; // eqstr of effect description -/* 158 */ +/* 158 */ /* 162 */ int bonushate; -/* 163 */ +/* 163 */ /* 166 */ int EndurCost; /* 167 */ int8 EndurTimerIndex; /* 168 */ //int IsDisciplineBuff; //Will goto the combat window when cast -/* 169 */ +/* 169 */ /* 173 */ int HateAdded; /* 174 */ int EndurUpkeep; -/* 175 */ +/* 175 */ /* 176 */ int numhits; /* 177 */ int pvpresistbase; /* 178 */ int pvpresistcalc; /* 179 */ int pvpresistcap; /* 180 */ int spell_category; -/* 181 */ +/* 181 */ /* 185 */ int8 can_mgb; // 0=no, -1 or 1 = yes /* 186 */ int dispel_flag; /* 189 */ int MinResist; @@ -702,7 +702,7 @@ struct SPDat_Spell_Struct uint8 DamageShieldType; // This field does not exist in spells_us.txt }; -extern const SPDat_Spell_Struct* spells; +extern const SPDat_Spell_Struct* spells; extern int32 SPDAT_RECORDS; bool IsTargetableAESpell(uint16 spell_id); diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index aeebf7706..99120f029 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -54,7 +54,7 @@ void TimeoutManager::CheckTimeouts() { void TimeoutManager::AddMember(Timeoutable *who) { if(who == nullptr) return; - + DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG diff --git a/common/timeoutmgr.h b/common/timeoutmgr.h index ac968f5b3..50d9369f8 100644 --- a/common/timeoutmgr.h +++ b/common/timeoutmgr.h @@ -38,7 +38,7 @@ public: //this frequency should generally be a multiple of TIMEOUT_GRANULARITY Timeoutable(uint32 check_frequency); virtual ~Timeoutable(); - + virtual void CheckTimeout() = 0; private: @@ -50,15 +50,15 @@ class TimeoutManager { friend class Timeoutable; public: TimeoutManager(); - + void CheckTimeouts(); - + protected: - + //methods called by Timeoutable objects: void AddMember(Timeoutable *who); void DeleteMember(Timeoutable *who); - + vector members; }; diff --git a/common/timer.cpp b/common/timer.cpp index c75f44b51..616581bdd 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -76,9 +76,9 @@ int gettimeofday (timeval *tp, ...) bool Timer::Check(bool iReset) { _CP(Timer_Check); - if (this==0) { - cerr << "Null timer during ->Check()!?\n"; - return true; + if (this==0) { + cerr << "Null timer during ->Check()!?\n"; + return true; } // if (!current_time || !start_time || !timer_time) {cerr << "Timer::Check on a timer that does not have a vital member defined."; // return true;} @@ -92,7 +92,7 @@ bool Timer::Check(bool iReset) } return true; } - + return false; } @@ -106,11 +106,11 @@ void Timer::Enable() { } /* This function set the timer and restart it */ -void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) { +void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) { start_time = current_time; enabled = true; if (set_timer_time != 0) - { + { timer_time = set_timer_time; if (ChangeResetTimer) set_at_trigger = set_timer_time; @@ -158,7 +158,7 @@ void Timer::Trigger() } const uint32 Timer::GetCurrentTime() -{ +{ return current_time; } @@ -172,7 +172,7 @@ const uint32 Timer::GetTimeSeconds() { const uint32 Timer::SetCurrentTime() { - struct timeval read_time; + struct timeval read_time; uint32 this_time; gettimeofday(&read_time,0); @@ -186,7 +186,7 @@ const uint32 Timer::SetCurrentTime() { current_time += this_time - last_time; } - + last_time = this_time; // cerr << "Current time:" << current_time << endl; diff --git a/common/types.h b/common/types.h index 21f530467..258ee992c 100644 --- a/common/types.h +++ b/common/types.h @@ -74,7 +74,7 @@ typedef const char Const_char; //for perl XS #define strncasecmp _strnicmp #define strcasecmp _stricmp typedef void ThreadReturnType; - #define THREAD_RETURN(x) _endthread(); return; + #define THREAD_RETURN(x) _endthread(); return; #else typedef void* ThreadReturnType; #define THREAD_RETURN(x) return(x); diff --git a/common/useperl.h b/common/useperl.h index b20863c42..8087e4204 100644 --- a/common/useperl.h +++ b/common/useperl.h @@ -3,7 +3,7 @@ //headers from the Perl distribution -#include +#include #define WIN32IO_IS_STDIO #ifndef WIN32 @@ -43,7 +43,7 @@ extern "C" { //the perl headers dont do this for us... #endif #ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS +#undef THIS #endif diff --git a/common/worldconn.cpp b/common/worldconn.cpp index ef3922bf7..633d9d0e4 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -52,7 +52,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); _log(NET__WORLD, "Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); - + ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); SendPacket(pack); @@ -61,7 +61,7 @@ void WorldConnection::OnConnected() { void WorldConnection::Process() { _CP(WorldConnection_Process); - + //persistent connection.... if (!Connected()) { pConnected = tcpc.Connected(); @@ -71,14 +71,14 @@ void WorldConnection::Process() { else return; } - + } void WorldConnection::AsyncConnect() { const EQEmuConfig *Config=EQEmuConfig::get(); tcpc.AsyncConnect(Config->WorldIP.c_str(), Config->WorldTCPPort); } - + bool WorldConnection::Connect() { const EQEmuConfig *Config=EQEmuConfig::get(); char errbuf[TCPConnection_ErrorBufferSize]; diff --git a/common/worldconn.h b/common/worldconn.h index 3821d3c9a..c4fa4ad17 100644 --- a/common/worldconn.h +++ b/common/worldconn.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -34,20 +34,20 @@ public: virtual void Process(); bool SendPacket(ServerPacket* pack); - + uint32 GetIP() const { return tcpc.GetrIP(); } uint16 GetPort() const { return tcpc.GetrPort(); } bool Connected() const { return (pConnected && tcpc.Connected()); } - + void SetPassword(const char *password) { m_password = password; } bool Connect(); void AsyncConnect(); void Disconnect(); inline bool TryReconnect() const { return pTryReconnect; } - + protected: virtual void OnConnected(); - + std::string m_password; EmuTCPConnection tcpc; bool pTryReconnect; diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index 14257fef9..663f2e674 100644 --- a/eqlaunch/CMakeLists.txt +++ b/eqlaunch/CMakeLists.txt @@ -16,7 +16,7 @@ ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - + SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") TARGET_LINK_LIBRARIES(eqlaunch "Ws2_32.lib") ENDIF(MSVC) diff --git a/eqlaunch/ZoneLaunch.cpp b/eqlaunch/ZoneLaunch.cpp index 6b038d8bf..3e7efba77 100644 --- a/eqlaunch/ZoneLaunch.cpp +++ b/eqlaunch/ZoneLaunch.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -33,7 +33,7 @@ void ZoneLaunch::InitStartTimer() { s_startTimer.Trigger(); } -ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name, +ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name, const char *zone_name, const EQEmuConfig *config) : m_state(StateStartPending), m_world(world), @@ -68,7 +68,7 @@ void ZoneLaunch::Start() { spec->args.push_back(m_launcherName); spec->handler = this; spec->logFile = m_config->LogPrefix + m_zone + m_config->LogSuffix; - + //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { @@ -76,14 +76,14 @@ void ZoneLaunch::Start() { m_timer.Start(m_config->RestartWait); return; } - + m_startCount++; m_state = StateStarted; s_running++; m_killFails = 0; - + SendStatus(); - + _log(LAUNCHER__STATUS, "Zone %s has been started.", m_zone.c_str()); } @@ -158,15 +158,15 @@ bool ZoneLaunch::Process() { //we have to wait on the shared timer now.. break; } - + //ok, both timers say we can start. //disable our internal timer, will get started again if it is needed. m_timer.Disable(); - + //actually start up the program _log(LAUNCHER__STATUS, "Starting zone %s", m_zone.c_str()); Start(); - + //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. @@ -177,7 +177,7 @@ bool ZoneLaunch::Process() { _log(LAUNCHER__STATUS, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } - + } //else, timer still ticking, keep waiting break; case StateStarted: @@ -218,7 +218,7 @@ bool ZoneLaunch::Process() { //called when the process actually dies off... void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLauncher::Spec *spec) { s_running--; - + switch(m_state) { case StateStartPending: _log(LAUNCHER__STATUS, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); @@ -246,7 +246,7 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche _log(LAUNCHER__STATUS, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } - + SendStatus(); } diff --git a/eqlaunch/ZoneLaunch.h b/eqlaunch/ZoneLaunch.h index 9c68e7e5f..0f684af0e 100644 --- a/eqlaunch/ZoneLaunch.h +++ b/eqlaunch/ZoneLaunch.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -30,27 +30,27 @@ public: ZoneLaunch(WorldServer *world, const char *launcher_name, const char *zone_name, const EQEmuConfig *config); virtual ~ZoneLaunch(); - + void Stop(bool graceful = true); void Restart(); - + bool Process(); - + void SendStatus() const; - + const char *GetZone() const { return(m_zone.c_str()); } uint32 GetStartCount() const { return(m_startCount); } - + //should only be called during process init to setup the start timer. static void InitStartTimer(); - + protected: bool IsRunning() const { return(m_state == StateStarted || m_state == StateStopPending || m_state == StateRestartPending); } - + void Start(); - + void OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLauncher::Spec *spec); - + enum { StateStartPending, StateStarted, @@ -58,18 +58,18 @@ protected: StateStopPending, StateStopped } m_state; - + WorldServer *const m_world; const std::string m_zone; const char *const m_launcherName; const EQEmuConfig *const m_config; - + Timer m_timer; ProcLauncher::ProcRef m_ref; uint32 m_startCount; - + uint32 m_killFails; - + private: static int s_running; static Timer s_startTimer; diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 06ccd718b..4c7950025 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -48,14 +48,14 @@ int main(int argc, char *argv[]) { _log(LAUNCHER__ERROR, "You must specfify a launcher name as the first argument to this program."); return(1); } - + _log(LAUNCHER__INIT, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { _log(LAUNCHER__ERROR, "Loading server configuration failed."); return(1); } const EQEmuConfig *Config = EQEmuConfig::get(); - + /* * Setup nice signal handlers */ @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { _log(LAUNCHER__ERROR, "Could not set signal handler"); return 1; } - + /* * Add '.' to LD_LIBRARY_PATH */ @@ -86,38 +86,38 @@ int main(int argc, char *argv[]) { putenv(v); } #endif - + map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { _log(LAUNCHER__ERROR, "worldserver.Connect() FAILED! Will retry."); } - + map::iterator zone, zend; set to_remove; - + Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - + _log(LAUNCHER__INIT, "Starting main loop..."); - + // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); - + ProcLauncher *launch = ProcLauncher::get(); RunLoops = true; while(RunLoops) { //Advance the timer to our current point in time Timer::SetCurrentTime(); - + /* * Process the world connection */ world.Process(); - + /* * Let the process manager look for dead children */ launch->Process(); - + /* * Give all zones a chance to process. */ @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) { if(!zone->second->Process()) to_remove.insert(zone->first); } - + /* * Kill off any zones which have stopped */ @@ -142,13 +142,13 @@ int main(int argc, char *argv[]) { delete zone->second; zones.erase(rem); } - - + + if (InterserverTimer.Check()) { if (world.TryReconnect() && (!world.Connected())) world.AsyncConnect(); } - + /* * Take a nice nap until next cycle */ @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) { else Sleep(2000); } - + //try to be semi-nice about this... without waiting too long zone = zones.begin(); zend = zones.end(); @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) { for(; zone != zend; zone++) { delete zone->second; } - + return(0); } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 1f314bd8f..672525dbd 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -35,7 +35,7 @@ WorldServer::~WorldServer() { void WorldServer::OnConnected() { WorldConnection::OnConnected(); - + ServerPacket* pack = new ServerPacket(ServerOP_LauncherConnectInfo, sizeof(LauncherConnectInfo)); LauncherConnectInfo* sci = (LauncherConnectInfo*) pack->pBuffer; strn0cpy(sci->name, m_name, sizeof(sci->name)); @@ -43,7 +43,7 @@ void WorldServer::OnConnected() { // strcpy(sci->address, net.GetZoneAddress()); SendPacket(pack); safe_delete(pack); - + //send status for all zones... std::map::iterator cur, end; cur = m_zones.begin(); @@ -54,9 +54,9 @@ void WorldServer::OnConnected() { } void WorldServer::Process() { - + WorldConnection::Process(); - + if (!Connected()) return; @@ -83,8 +83,8 @@ void WorldServer::Process() { break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; - - + + switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { @@ -123,7 +123,7 @@ void WorldServer::Process() { //ignore this, world is still being dumb break; } - + default: { _log(LAUNCHER__NET, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; @@ -138,11 +138,11 @@ void WorldServer::Process() { void WorldServer::SendStatus(const char *short_name, uint32 start_count, bool running) { ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneStatus, sizeof(LauncherZoneStatus)); LauncherZoneStatus* it =(LauncherZoneStatus*) pack->pBuffer; - + strn0cpy(it->short_name, short_name, 32); it->start_count = start_count; it->running = running?1:0; - + SendPacket(pack); safe_delete(pack); } diff --git a/eqlaunch/worldserver.h b/eqlaunch/worldserver.h index b6d6314ad..113dc1ae4 100644 --- a/eqlaunch/worldserver.h +++ b/eqlaunch/worldserver.h @@ -32,12 +32,12 @@ public: virtual ~WorldServer(); virtual void Process(); - + void SendStatus(const char *short_name, uint32 start_count, bool running); - + private: virtual void OnConnected(); - + const char *const m_name; const EQEmuConfig *const m_config; std::map &m_zones; diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index 5ded6a0c7..96599d4b3 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -43,7 +43,7 @@ ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers}) TARGET_LINK_LIBRARIES(loginserver Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) IF(MSVC) - + SET_TARGET_PROPERTIES(loginserver PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") TARGET_LINK_LIBRARIES(loginserver "Ws2_32.lib") ENDIF(MSVC) diff --git a/loginserver/Client.cpp b/loginserver/Client.cpp index a487849e1..0ae477ff0 100644 --- a/loginserver/Client.cpp +++ b/loginserver/Client.cpp @@ -197,7 +197,7 @@ void Client::Handle_Login(const char* data, unsigned int size) #ifdef WIN32 e_buffer = server.eq_crypto->DecryptUsernamePassword(data, size, server.options.GetEncryptionMode()); - + int buffer_len = strlen(e_buffer); e_hash.assign(e_buffer, buffer_len); e_user.assign((e_buffer + buffer_len + 1), strlen(e_buffer + buffer_len + 1)); @@ -353,7 +353,7 @@ void Client::Handle_Play(const char* data) void Client::SendServerListPacket() { EQApplicationPacket *outapp = server.SM->CreateServerListPacket(this); - + if(server.options.IsDumpOutPacketsOn()) { DumpPacket(outapp); @@ -380,12 +380,12 @@ void Client::GenerateKey() int count = 0; while(count < 10) { - static const char key_selection[] = + static const char key_selection[] = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', - 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', - 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', '0', '1', '2', '3', '4', '5', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; diff --git a/loginserver/Client.h b/loginserver/Client.h index 7ca7cf9a2..b670e88c0 100644 --- a/loginserver/Client.h +++ b/loginserver/Client.h @@ -49,7 +49,7 @@ enum LoginMode }; /** - * Client class, controls a single client and it's + * Client class, controls a single client and it's * connection to the login server. */ class Client diff --git a/loginserver/ClientManager.cpp b/loginserver/ClientManager.cpp index 73791ef6b..c6ad7093f 100644 --- a/loginserver/ClientManager.cpp +++ b/loginserver/ClientManager.cpp @@ -30,7 +30,7 @@ ClientManager::ClientManager() titanium_ops = new RegularOpcodeManager; if(!titanium_ops->LoadOpcodes(server.config->GetVariable("Titanium", "opcodes").c_str())) { - server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.", + server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.", server.config->GetVariable("Titanium", "opcodes").c_str()); run_server = false; } @@ -50,7 +50,7 @@ ClientManager::ClientManager() sod_ops = new RegularOpcodeManager; if(!sod_ops->LoadOpcodes(server.config->GetVariable("SoD", "opcodes").c_str())) { - server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.", + server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.", server.config->GetVariable("SoD", "opcodes").c_str()); run_server = false; } diff --git a/loginserver/Config.cpp b/loginserver/Config.cpp index ecf544464..487a88588 100644 --- a/loginserver/Config.cpp +++ b/loginserver/Config.cpp @@ -146,7 +146,7 @@ void Config::Tokenize(FILE *input, list &tokens) { char c = fgetc(input); string lexeme; - + while(c != EOF) { if(isspace(c)) diff --git a/loginserver/Config.h b/loginserver/Config.h index 37ce9902a..c9b2b1bca 100644 --- a/loginserver/Config.h +++ b/loginserver/Config.h @@ -40,7 +40,7 @@ public: * Parses the selected file for variables, will clear current variables if selected. */ virtual void Parse(const char *file_name); - + /** * Gets a variable if it exists. */ @@ -52,7 +52,7 @@ protected: private: /** * Breaks our input up into tokens for Parse(). - * This is private because it's not intended to be overloaded by a derived class which + * This is private because it's not intended to be overloaded by a derived class which * may get it's input from other places than a C file pointer. (a http get request for example). * The programmer of a derived class would be expected to make their own Tokenize function for their own Parse(). */ diff --git a/loginserver/Database.h b/loginserver/Database.h index 08bc3b70d..71917518b 100644 --- a/loginserver/Database.h +++ b/loginserver/Database.h @@ -51,7 +51,7 @@ public: * Needed for world login procedure. * Returns true if the record was found, false otherwise. */ - virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, + virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password) { return false; } /** diff --git a/loginserver/DatabaseMySQL.cpp b/loginserver/DatabaseMySQL.cpp index df1577f3d..9294cb059 100644 --- a/loginserver/DatabaseMySQL.cpp +++ b/loginserver/DatabaseMySQL.cpp @@ -40,7 +40,7 @@ DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port, { my_bool r = 1; mysql_options(db, MYSQL_OPT_RECONNECT, &r); - if(!mysql_real_connect(db, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0)) + if(!mysql_real_connect(db, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0)) { mysql_close(db); server_log->Log(log_database, "Failed to connect to MySQL database."); @@ -73,7 +73,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u query << "SELECT LoginServerID, AccountPassword FROM " << server.options.GetAccountTable() << " WHERE AccountName = '"; query << name; query << "'"; - + if(mysql_query(db, query.str().c_str()) != 0) { server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str()); @@ -97,7 +97,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u return false; } -bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, +bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password) { if(!db) @@ -118,7 +118,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un query << " WHERE WSR.ServerShortName = '"; query << escaped_short_name; query << "'"; - + if(mysql_query(db, query.str().c_str()) != 0) { server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str()); @@ -155,7 +155,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un { if((row = mysql_fetch_row(res)) != nullptr) { - account = row[0]; + account = row[0]; password = row[1]; mysql_free_result(res); return true; diff --git a/loginserver/DatabaseMySQL.h b/loginserver/DatabaseMySQL.h index 87aa2c45b..9a1cea425 100644 --- a/loginserver/DatabaseMySQL.h +++ b/loginserver/DatabaseMySQL.h @@ -66,7 +66,7 @@ public: * Needed for world login procedure. * Returns true if the record was found, false otherwise. */ - virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, + virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password); /** diff --git a/loginserver/DatabasePostgreSQL.cpp b/loginserver/DatabasePostgreSQL.cpp index fd23ff347..f6a3c5ac4 100644 --- a/loginserver/DatabasePostgreSQL.cpp +++ b/loginserver/DatabasePostgreSQL.cpp @@ -61,7 +61,7 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo } /** - * PostgreSQL doesn't have automatic reconnection option like mysql + * PostgreSQL doesn't have automatic reconnection option like mysql * but it's easy to check and reconnect */ if(PQstatus(db) != CONNECTION_OK) @@ -100,7 +100,7 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo return false; } -bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, +bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password) { if(!db) @@ -109,7 +109,7 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam } /** - * PostgreSQL doesn't have automatic reconnection option like mysql + * PostgreSQL doesn't have automatic reconnection option like mysql * but it's easy to check and reconnect */ if(PQstatus(db) != CONNECTION_OK) @@ -147,7 +147,7 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam trusted = atoi(PQgetvalue(res, 0, 2)); list_id = atoi(PQgetvalue(res, 0, 3)); list_desc = PQgetvalue(res, 0, 4); - account = PQgetvalue(res, 0, 5); + account = PQgetvalue(res, 0, 5); password = PQgetvalue(res, 0, 6); PQclear(res); @@ -166,7 +166,7 @@ void DatabasePostgreSQL::UpdateLSAccountData(unsigned int id, string ip_address) } /** - * PostgreSQL doesn't have automatic reconnection option like mysql + * PostgreSQL doesn't have automatic reconnection option like mysql * but it's easy to check and reconnect */ if(PQstatus(db) != CONNECTION_OK) @@ -201,7 +201,7 @@ void DatabasePostgreSQL::UpdateWorldRegistration(unsigned int id, string long_na } /** - * PostgreSQL doesn't have automatic reconnection option like mysql + * PostgreSQL doesn't have automatic reconnection option like mysql * but it's easy to check and reconnect */ if(PQstatus(db) != CONNECTION_OK) diff --git a/loginserver/DatabasePostgreSQL.h b/loginserver/DatabasePostgreSQL.h index 28922f403..ef7ad30ed 100644 --- a/loginserver/DatabasePostgreSQL.h +++ b/loginserver/DatabasePostgreSQL.h @@ -66,7 +66,7 @@ public: * Needed for world login procedure. * Returns true if the record was found, false otherwise. */ - virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, + virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password); /** diff --git a/loginserver/Encryption.cpp b/loginserver/Encryption.cpp index 0a7986fc0..66498965d 100644 --- a/loginserver/Encryption.cpp +++ b/loginserver/Encryption.cpp @@ -96,15 +96,15 @@ bool Encryption::Load(const char *name) h_dll = LoadLibrary(name); #endif - if(h_dll == NULL) + if(h_dll == NULL) { return false; } - else - { - SetLastError(0); + else + { + SetLastError(0); } - + return true; } diff --git a/loginserver/ErrorLog.cpp b/loginserver/ErrorLog.cpp index 9ec6db87a..ecc5a7ba6 100644 --- a/loginserver/ErrorLog.cpp +++ b/loginserver/ErrorLog.cpp @@ -68,30 +68,30 @@ void ErrorLog::Log(eqLogType type, const char *message, ...) m_time = localtime(&m_clock); log_mutex->lock(); - printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, buffer); if(error_log) { - fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, buffer); fflush(error_log); } - + log_mutex->unlock(); delete[] buffer; } @@ -110,26 +110,26 @@ void ErrorLog::LogPacket(eqLogType type, const char *data, size_t size) m_time = localtime(&m_clock); log_mutex->lock(); - printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u:\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u:\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, (unsigned int)size); if(error_log) { - fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, (unsigned int)size); } @@ -162,7 +162,7 @@ void ErrorLog::LogPacket(eqLogType type, const char *data, size_t size) fprintf(error_log, "- "); } } - + printf("%02X ", (unsigned int)data[i]); if(error_log) { diff --git a/loginserver/LoginServer.h b/loginserver/LoginServer.h index a3fc7301f..f64cd5fae 100644 --- a/loginserver/LoginServer.h +++ b/loginserver/LoginServer.h @@ -29,7 +29,7 @@ #include "ClientManager.h" /** - * Login server struct, contains every variable for the server that needs to exist + * Login server struct, contains every variable for the server that needs to exist * outside the scope of main(). */ struct LoginServer diff --git a/loginserver/LoginStructures.h b/loginserver/LoginStructures.h index cee9a7665..01c6ab9d5 100644 --- a/loginserver/LoginStructures.h +++ b/loginserver/LoginStructures.h @@ -86,7 +86,7 @@ struct ServerListHeader_Struct { uint32 NumberOfServers; }; -struct PlayEverquestRequest_Struct +struct PlayEverquestRequest_Struct { uint16 Sequence; uint32 Unknown1; diff --git a/loginserver/Main.cpp b/loginserver/Main.cpp index 5714456d5..cc4ed579d 100644 --- a/loginserver/Main.cpp +++ b/loginserver/Main.cpp @@ -58,7 +58,7 @@ int main() server.config = new Config(); server_log->Log(log_debug, "Config System Init."); server.config->Parse("login.ini"); - + //Parse unregistered allowed option. if(server.config->GetVariable("options", "unregistered_allowed").compare("FALSE") == 0) { @@ -143,10 +143,10 @@ int main() #ifdef EQEMU_MYSQL_ENABLED server_log->Log(log_debug, "MySQL Database Init."); server.db = (Database*)new DatabaseMySQL( - server.config->GetVariable("database", "user"), - server.config->GetVariable("database", "password"), - server.config->GetVariable("database", "host"), - server.config->GetVariable("database", "port"), + server.config->GetVariable("database", "user"), + server.config->GetVariable("database", "password"), + server.config->GetVariable("database", "host"), + server.config->GetVariable("database", "port"), server.config->GetVariable("database", "db")); #endif } @@ -155,10 +155,10 @@ int main() #ifdef EQEMU_POSTGRESQL_ENABLED server_log->Log(log_debug, "PostgreSQL Database Init."); server.db = (Database*)new DatabasePostgreSQL( - server.config->GetVariable("database", "user"), - server.config->GetVariable("database", "password"), - server.config->GetVariable("database", "host"), - server.config->GetVariable("database", "port"), + server.config->GetVariable("database", "user"), + server.config->GetVariable("database", "password"), + server.config->GetVariable("database", "host"), + server.config->GetVariable("database", "port"), server.config->GetVariable("database", "db")); #endif } diff --git a/loginserver/Options.h b/loginserver/Options.h index 4f04457e3..74d1904b3 100644 --- a/loginserver/Options.h +++ b/loginserver/Options.h @@ -19,7 +19,7 @@ #define EQEMU_OPTIONS_H /** - * Collects options on one object, because having a bunch of global variables floating around is + * Collects options on one object, because having a bunch of global variables floating around is * really ugly and just a little dangerous. */ class Options @@ -28,13 +28,13 @@ public: /** * Constructor, sets the default options. */ - Options() : - allow_unregistered(true), - trace(false), - dump_in_packets(false), - dump_out_packets(false), - encryption_mode(5), - local_network("127.0.0.1"), + Options() : + allow_unregistered(true), + trace(false), + dump_in_packets(false), + dump_out_packets(false), + encryption_mode(5), + local_network("127.0.0.1"), reject_duplicate_servers(false) { } /** diff --git a/loginserver/ServerManager.cpp b/loginserver/ServerManager.cpp index c40cfd462..58aa6fd87 100644 --- a/loginserver/ServerManager.cpp +++ b/loginserver/ServerManager.cpp @@ -25,7 +25,7 @@ extern ErrorLog *server_log; extern LoginServer server; extern bool run_server; -ServerManager::ServerManager() +ServerManager::ServerManager() { char error_buffer[TCPConnection_ErrorBufferSize]; @@ -60,7 +60,7 @@ void ServerManager::Process() in_addr tmp; tmp.s_addr = tcp_c->GetrIP(); server_log->Log(log_network, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort()); - + WorldServer *cur = GetServerByAddress(tcp_c->GetrIP()); if(cur) { @@ -178,7 +178,7 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c) sl->Unknown4 = 0x00000000; sl->NumberOfServers = server_count; - unsigned char *data_ptr = outapp->pBuffer; + unsigned char *data_ptr = outapp->pBuffer; data_ptr += sizeof(ServerListHeader_Struct); iter = world_servers.begin(); @@ -280,7 +280,7 @@ void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int utwr->lsaccountid = client_account_id; (*iter)->GetConnection()->SendPacket(outapp); found = true; - + if(server.options.IsDumpInPacketsOn()) { DumpPacket(outapp); diff --git a/loginserver/WorldServer.cpp b/loginserver/WorldServer.cpp index b641161d7..8763480a3 100644 --- a/loginserver/WorldServer.cpp +++ b/loginserver/WorldServer.cpp @@ -141,11 +141,11 @@ bool WorldServer::Process() } UsertoWorldResponse_Struct *utwr = (UsertoWorldResponse_Struct*)app->pBuffer; - server_log->Log(log_client, "Trying to find client with user id of %u.", utwr->lsaccountid); + server_log->Log(log_client, "Trying to find client with user id of %u.", utwr->lsaccountid); Client *c = server.CM->GetClient(utwr->lsaccountid); if(c) { - server_log->Log(log_client, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str()); + server_log->Log(log_client, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str()); EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayEverquestResponse, sizeof(PlayEverquestResponse_Struct)); PlayEverquestResponse_Struct *per = (PlayEverquestResponse_Struct*)outapp->pBuffer; per->Sequence = c->GetPlaySequence(); @@ -180,7 +180,7 @@ bool WorldServer::Process() if(server.options.IsTraceOn()) { - server_log->Log(log_network_trace, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u", + server_log->Log(log_network_trace, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u", per->Allowed, per->Sequence, per->ServerNumber, per->Message); server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size); } @@ -371,7 +371,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) { if(s_acct_name.size() == 0 || s_acct_pass.size() == 0) { - server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.", + server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -380,7 +380,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) } else if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0) { - server_log->Log(log_world, "Server %s(%s) successfully logged in.", + server_log->Log(log_world, "Server %s(%s) successfully logged in.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -403,14 +403,14 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) } else { - server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.", long_name.c_str(), short_name.c_str()); return; } } else { - server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.", long_name.c_str(), short_name.c_str()); return; } @@ -430,7 +430,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) { if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0) { - server_log->Log(log_world, "Server %s(%s) successfully logged in.", + server_log->Log(log_world, "Server %s(%s) successfully logged in.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -461,7 +461,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) } else { - server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -471,7 +471,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) } else { - server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.", long_name.c_str(), short_name.c_str()); if(server.db->CreateWorldRegistration(long_name, short_name, s_id)) { @@ -485,7 +485,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) in_addr in; in.s_addr = connection->GetrIP(); server.db->UpdateWorldRegistration(GetRuntimeID(), long_name, string(inet_ntoa(in))); - + if(authorized) { server.CM->UpdateServerList(); @@ -503,7 +503,7 @@ void WorldServer::SendClientAuth(unsigned int ip, string account, string key, un { ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ServerLSClientAuth)); ServerLSClientAuth* slsca = (ServerLSClientAuth*)outapp->pBuffer; - + slsca->lsaccount_id = account_id; strncpy(slsca->name, account.c_str(), account.size() > 30 ? 30 : account.size()); strncpy(slsca->key, key.c_str(), 10); diff --git a/loginserver/WorldServer.h b/loginserver/WorldServer.h index f5195f8e1..8b3133965 100644 --- a/loginserver/WorldServer.h +++ b/loginserver/WorldServer.h @@ -59,7 +59,7 @@ public: * Accesses connection, it is intentional that this is not const (trust me). */ EmuTCPConnection *GetConnection() { return connection; } - + /** * Sets the connection to c. */ @@ -69,7 +69,7 @@ public: * Gets the runtime id of this server. */ unsigned int GetRuntimeID() const { return runtime_id; } - + /** * Sets the runtime id of this server. */ diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt index 4e319ddad..6af899854 100644 --- a/queryserv/CMakeLists.txt +++ b/queryserv/CMakeLists.txt @@ -22,7 +22,7 @@ ADD_DEFINITIONS(-DQSERV) TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - + SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") TARGET_LINK_LIBRARIES(queryserv "Ws2_32.lib") ENDIF(MSVC) diff --git a/queryserv/database.h b/queryserv/database.h index f38d5db98..b788e7c20 100644 --- a/queryserv/database.h +++ b/queryserv/database.h @@ -44,7 +44,7 @@ public: Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port); bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port); ~Database(); - + bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len); void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type); void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 Items); @@ -57,7 +57,7 @@ protected: void HandleMysqlError(uint32 errnum); private: void DBInitVars(); - + }; #endif diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index af44817a9..c884d45f6 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -103,7 +103,7 @@ void LFGuildManager::HandlePacket(ServerPacket *pack) pack->ReadString(Comments); uint32 Toggle = pack->ReadUInt32(); uint32 TimeZone = pack->ReadUInt32(); - + TogglePlayer(FromZoneID, FromInstanceID, From, Class, Level, AAPoints, Comments, Toggle, TimeZone); break; @@ -116,7 +116,7 @@ void LFGuildManager::HandlePacket(ServerPacket *pack) case QSG_LFGuild_UpdateGuildInfo: { char GuildName[33], Comments[257]; - + pack->ReadString(GuildName); pack->ReadString(Comments); @@ -154,8 +154,8 @@ void LFGuildManager::HandlePacket(ServerPacket *pack) default: break; } - - + + } void LFGuildManager::SendPlayerMatches(uint32 FromZoneID, uint32 FromInstanceID, char *From, uint32 FromLevel, uint32 ToLevel, uint32 MinAA, uint32 TimeZone, uint32 Classes) @@ -289,7 +289,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char worldserver->SendPacket(pack); safe_delete(pack); - + } void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char *From, char* GuildName, char *Comments, uint32 FromLevel, uint32 ToLevel, uint32 Classes, uint32 AACount, uint32 Toggle, uint32 TimeZone) @@ -336,7 +336,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char pack->WriteUInt32(TimeZone); pack->WriteUInt32(Now); pack->WriteUInt32(Toggle); - + worldserver->SendPacket(pack); safe_delete(pack); } @@ -396,7 +396,7 @@ void LFGuildManager::SendPlayerStatus(uint32 FromZoneID, uint32 FromInstanceID, pack->WriteUInt32((*it).TimeZone); pack->WriteUInt32((*it).TimePosted); pack->WriteUInt32(1); - + worldserver->SendPacket(pack); safe_delete(pack); break; diff --git a/queryserv/queryservconfig.h b/queryserv/queryservconfig.h index 61830e3da..a403d379f 100644 --- a/queryserv/queryservconfig.h +++ b/queryserv/queryservconfig.h @@ -36,7 +36,7 @@ public: // Produce a const singleton static const queryservconfig *get() { - if (_chat_config == nullptr) + if (_chat_config == nullptr) LoadConfig(); return(_chat_config); } diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index 3efd1bbbb..fae1be01f 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.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; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -58,7 +58,7 @@ void WorldServer::OnConnected() void WorldServer::Process() { WorldConnection::Process(); - + if (!Connected()) return; @@ -146,13 +146,13 @@ void WorldServer::Process() // The 'Type' field is a 'sub-opcode'. A value of 0 is used for the LFGuild packets. The next feature to be added // to queryserv would use 1, etc. // - // Obviously, any fields in the packet following the 'Type' will be unique to the particular type of packet. The + // Obviously, any fields in the packet following the 'Type' will be unique to the particular type of packet. The // 'Generic' in the name of this ServerOP code relates to the four header fields. char From[64]; pack->SetReadPosition(8); pack->ReadString(From); uint32 Type = pack->ReadUInt32(); - + switch(Type) { case QSG_LFGuild: @@ -164,7 +164,7 @@ void WorldServer::Process() default: _log(QUERYSERV__ERROR, "Received unhandled ServerOP_QueryServGeneric", Type); break; - } + } break; } diff --git a/queryserv/worldserver.h b/queryserv/worldserver.h index e579b467d..c42ca5ceb 100644 --- a/queryserv/worldserver.h +++ b/queryserv/worldserver.h @@ -27,7 +27,7 @@ public: WorldServer(); virtual ~WorldServer(); virtual void Process(); - + private: virtual void OnConnected(); }; diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp index 054434293..f6ed659d2 100644 --- a/shared_memory/items.cpp +++ b/shared_memory/items.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -27,19 +27,19 @@ void LoadItems(SharedDatabase *database) { EQEmu::IPCMutex mutex("items"); mutex.Lock(); - + int32 items = -1; uint32 max_item = 0; database->GetItemsCount(items, max_item); if(items == -1) { EQ_EXCEPT("Shared Memory", "Unable to get any items from the database."); } - + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); EQEmu::MemoryMappedFile mmf("shared/items", size); mmf.ZeroFile(); - + void *ptr = mmf.Get(); - database->LoadItems(ptr, size, items, max_item); + database->LoadItems(ptr, size, items, max_item); mutex.Unlock(); } diff --git a/shared_memory/items.h b/shared_memory/items.h index 6ef0f7f2a..c292563ec 100644 --- a/shared_memory/items.h +++ b/shared_memory/items.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/shared_memory/loot.cpp b/shared_memory/loot.cpp index 385ad04ab..ed9bc4577 100644 --- a/shared_memory/loot.cpp +++ b/shared_memory/loot.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -28,7 +28,7 @@ void LoadLoot(SharedDatabase *database) { EQEmu::IPCMutex mutex("loot"); mutex.Lock(); - + uint32 loot_table_count, loot_table_max, loot_table_entries_count; uint32 loot_drop_count, loot_drop_max, loot_drop_entries_count; database->GetLootTableInfo(loot_table_count, loot_table_max, loot_table_entries_count); @@ -49,10 +49,10 @@ void LoadLoot(SharedDatabase *database) { mmf_loot_table.ZeroFile(); mmf_loot_drop.ZeroFile(); - EQEmu::FixedMemoryVariableHashSet loot_table_hash(reinterpret_cast(mmf_loot_table.Get()), + EQEmu::FixedMemoryVariableHashSet loot_table_hash(reinterpret_cast(mmf_loot_table.Get()), loot_table_size, loot_table_max); - EQEmu::FixedMemoryVariableHashSet loot_drop_hash(reinterpret_cast(mmf_loot_drop.Get()), + EQEmu::FixedMemoryVariableHashSet loot_drop_hash(reinterpret_cast(mmf_loot_drop.Get()), loot_drop_size, loot_drop_max); database->LoadLootTables(mmf_loot_table.Get(), loot_table_max); diff --git a/shared_memory/loot.h b/shared_memory/loot.h index 3967add0d..89f470c09 100644 --- a/shared_memory/loot.h +++ b/shared_memory/loot.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index f13413d63..7e717434e 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -39,7 +39,7 @@ int main(int argc, char **argv) { LogFile->write(EQEMuLog::Error, "Unable to load configuration file."); return 0; } - + const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); @@ -47,7 +47,7 @@ int main(int argc, char **argv) { SharedDatabase database; LogFile->write(EQEMuLog::Status, "Connecting to database..."); - if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), + if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a " "database connection"); @@ -93,7 +93,7 @@ int main(int argc, char **argv) { load_loot = true; } break; - + case 's': if(strcasecmp("skill_caps", argv[i]) == 0) { load_skill_caps = true; @@ -124,7 +124,7 @@ int main(int argc, char **argv) { return 0; } } - + if(load_all || load_loot) { LogFile->write(EQEMuLog::Status, "Loading loot..."); try { diff --git a/shared_memory/npc_faction.cpp b/shared_memory/npc_faction.cpp index 6fd18ed70..5fc2d6845 100644 --- a/shared_memory/npc_faction.cpp +++ b/shared_memory/npc_faction.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -27,19 +27,19 @@ void LoadFactions(SharedDatabase *database) { EQEmu::IPCMutex mutex("faction"); mutex.Lock(); - + uint32 lists = 0; uint32 max_list = 0; database->GetFactionListInfo(lists, max_list); if(lists == 0) { EQ_EXCEPT("Shared Memory", "Unable to get any factions from the database."); } - + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(lists, max_list)); EQEmu::MemoryMappedFile mmf("shared/faction", size); mmf.ZeroFile(); - + void *ptr = mmf.Get(); - database->LoadNPCFactionLists(ptr, size, lists, max_list); + database->LoadNPCFactionLists(ptr, size, lists, max_list); mutex.Unlock(); } diff --git a/shared_memory/npc_faction.h b/shared_memory/npc_faction.h index 4ff97a91d..57313bb8e 100644 --- a/shared_memory/npc_faction.h +++ b/shared_memory/npc_faction.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/shared_memory/skill_caps.cpp b/shared_memory/skill_caps.cpp index 2c588a6ea..8cfae69fc 100644 --- a/shared_memory/skill_caps.cpp +++ b/shared_memory/skill_caps.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -28,15 +28,15 @@ void LoadSkillCaps(SharedDatabase *database) { EQEmu::IPCMutex mutex("skill_caps"); mutex.Lock(); - + uint32 class_count = PLAYER_CLASS_COUNT; uint32 skill_count = HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); EQEmu::MemoryMappedFile mmf("shared/skill_caps", size); mmf.ZeroFile(); - + void *ptr = mmf.Get(); - database->LoadSkillCaps(ptr); + database->LoadSkillCaps(ptr); mutex.Unlock(); } \ No newline at end of file diff --git a/shared_memory/skill_caps.h b/shared_memory/skill_caps.h index 044f83534..75c18bffa 100644 --- a/shared_memory/skill_caps.h +++ b/shared_memory/skill_caps.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/shared_memory/spells.cpp b/shared_memory/spells.cpp index cd5f8a0c2..635d57c29 100644 --- a/shared_memory/spells.cpp +++ b/shared_memory/spells.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/shared_memory/spells.h b/shared_memory/spells.h index 03ef75282..7959382a4 100644 --- a/shared_memory/spells.h +++ b/shared_memory/spells.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/tests/cppunit/collectoroutput.cpp b/tests/cppunit/collectoroutput.cpp index 1e2ffc204..260062504 100644 --- a/tests/cppunit/collectoroutput.cpp +++ b/tests/cppunit/collectoroutput.cpp @@ -28,7 +28,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-collectoroutput.h" @@ -46,21 +46,21 @@ namespace Test { _tests.reserve(tests); } - + /// Constructs a collector object. /// CollectorOutput::CollectorOutput() : Output(), _total_errors(0) {} - + void CollectorOutput::finished(int tests, const Time& time) { _total_tests = tests; _total_time = time; } - + void CollectorOutput::suite_start(int tests, const string& name) { @@ -70,7 +70,7 @@ namespace Test _cur_suite = &_suites.back(); } } - + void CollectorOutput::suite_end(int tests, const string&, const Time& time) { @@ -80,14 +80,14 @@ namespace Test _total_errors += _cur_suite->_errors; } } - + void CollectorOutput::test_start(const string& name) { _cur_suite->_tests.push_back(TestInfo(name)); _cur_test = &_cur_suite->_tests.back(); } - + void CollectorOutput::test_end(const string&, bool ok, const Time& time) { @@ -95,12 +95,12 @@ namespace Test ++_cur_suite->_errors; _cur_test->_time = time; } - + void CollectorOutput::assertment(const Source& s) { _cur_test->_sources.push_back(s); } - + } // namespace Test diff --git a/tests/cppunit/compileroutput.cpp b/tests/cppunit/compileroutput.cpp index 23eec3986..ef17146f4 100644 --- a/tests/cppunit/compileroutput.cpp +++ b/tests/cppunit/compileroutput.cpp @@ -50,12 +50,12 @@ namespace Test throw Test::CompilerOutput::InvalidFormat(format); pos += mod.size(); return true; - } + } return false; } - + } // anonymous namespace - + /// Constructs a compiler output handler. /// /// \param format Pre-defined compiler output format. @@ -72,10 +72,10 @@ namespace Test "%file:%line: %text", // GCC "%file(%line) : %text" // MSVC }; - + _format = table[format]; } - + /// Constructs a compiler output handler. /// /// \param format %Output format to use. @@ -89,7 +89,7 @@ namespace Test _stream(stream) { int expr(0), file(0), line(0); - + for (string::size_type pos = 0; (pos = _format.find_first_of('%', pos)) != string::npos; ) { @@ -100,34 +100,34 @@ namespace Test else throw InvalidFormat(format); } - + if (!expr && !file && !line) throw InvalidFormat(format); } - + void CompilerOutput::assertment(const Source& s) { string fmt(_format); string::size_type pos; - + fmt.reserve(fmt.size() + 128); - + if ((pos = fmt.find("%file")) != string::npos) fmt.replace(pos, 5, s.file()); - + if ((pos = fmt.find("%text")) != string::npos) fmt.replace(pos, 5, s.message()); - + if ((pos = fmt.find("%line")) != string::npos) { ostringstream ss; ss << s.line(); fmt.replace(pos, 5, ss.str()); } - + _stream << fmt << endl; } - + } // namespace Test diff --git a/tests/cppunit/cpptest-assert.h b/tests/cppunit/cpptest-assert.h index bf90dd842..0e0ceaafe 100644 --- a/tests/cppunit/cpptest-assert.h +++ b/tests/cppunit/cpptest-assert.h @@ -231,7 +231,7 @@ /// \param a First expression to test. /// \param b Second expression to test. /// \param delta Constant. -/// \param msg User message. +/// \param msg User message. /// /// \see TEST_ASSERT_DELTA(a, b, delta) /// @@ -245,7 +245,7 @@ if (!continue_after_failure()) return; \ } \ } - + /// Verify an expression and expects an exception in return. /// An assertment is issued if the exception is not thrown. /// @@ -343,7 +343,7 @@ if (!continue_after_failure()) return; \ } \ } - + /// Verify an expression and expects no exception in return. /// An assertment is issued if any exception is thrown. /// diff --git a/tests/cppunit/cpptest-collectoroutput.h b/tests/cppunit/cpptest-collectoroutput.h index cd9b65e95..c565f04cb 100644 --- a/tests/cppunit/cpptest-collectoroutput.h +++ b/tests/cppunit/cpptest-collectoroutput.h @@ -55,52 +55,52 @@ namespace Test virtual void test_end(const std::string& name, bool ok, const Time& time); virtual void assertment(const Source& s); - + protected: struct OutputSuiteInfo; struct OutputTestInfo; struct OutputErrorTestInfo; - + typedef std::list Sources; - + struct TestInfo { std::string _name; Time _time; - + bool _success : 1; Sources _sources; - + explicit TestInfo(const std::string name); }; - + typedef std::vector Tests; - + struct SuiteInfo { std::string _name; int _errors; Tests _tests; Time _time; - + SuiteInfo(const std::string& name, int tests); }; - + typedef std::list Suites; - + Suites _suites; int _total_errors; int _total_tests; Time _total_time; - + CollectorOutput(); - + private: SuiteInfo* _cur_suite; TestInfo* _cur_test; }; - + } // namespace Test - + #endif // #ifndef CPPTEST_COLLECTOROUTPUT_H diff --git a/tests/cppunit/cpptest-compileroutput.h b/tests/cppunit/cpptest-compileroutput.h index 35a6feb28..2f6cb0926 100644 --- a/tests/cppunit/cpptest-compileroutput.h +++ b/tests/cppunit/cpptest-compileroutput.h @@ -64,14 +64,14 @@ namespace Test InvalidFormat(const std::string& what) : std::logic_error(what) {} }; - + /// Pre-defined compiler output formats. /// enum Format { /// Generic compiler format, which equals: /// %%file:%%line: %%text - /// + /// Generic, /// @@ -79,34 +79,34 @@ namespace Test /// Error cpptest %%file %%line: %%text. /// BCC, - - /// GNU Compiler Collection + + /// GNU Compiler Collection /// (GCC) format, which equals: /// %%file:%%line: %%text /// GCC, - /// Microsoft Visual C++ + /// Microsoft Visual C++ /// (MSVC) format, which equals: /// %%file(%%line) : %%text /// MSVC }; - + explicit CompilerOutput(Format format = Generic, std::ostream& stream = std::cout); - + explicit CompilerOutput(const std::string& format, std::ostream& stream = std::cout); - + virtual void assertment(const Source& s); - + private: std::string _format; std::ostream& _stream; }; } // namespace Test - + #endif // #ifndef CPPTEST_COMPILEROUTPUT_H diff --git a/tests/cppunit/cpptest-htmloutput.h b/tests/cppunit/cpptest-htmloutput.h index 464683f47..1cdf096f0 100644 --- a/tests/cppunit/cpptest-htmloutput.h +++ b/tests/cppunit/cpptest-htmloutput.h @@ -44,9 +44,9 @@ namespace Test class HtmlOutput : public CollectorOutput { public: - void generate(std::ostream& os, bool incl_ok_tests = true, + void generate(std::ostream& os, bool incl_ok_tests = true, const std::string& name = ""); - + private: struct SuiteRow; struct TestRow; @@ -57,8 +57,8 @@ namespace Test friend struct TestSuiteRow; }; - -} // namespace Test - -#endif // #ifndef CPPTEST_HTMLOUTPUT_H + +} // namespace Test + +#endif // #ifndef CPPTEST_HTMLOUTPUT_H diff --git a/tests/cppunit/cpptest-output.h b/tests/cppunit/cpptest-output.h index cfadaecb1..898231bdf 100644 --- a/tests/cppunit/cpptest-output.h +++ b/tests/cppunit/cpptest-output.h @@ -41,7 +41,7 @@ namespace Test { class Source; class Time; - + /// \brief %Test suite output handler. /// /// Abstract base class for all suite output handlers. Derive from this @@ -58,7 +58,7 @@ namespace Test /// Empty destructor. /// virtual ~Output() {} - + /// Called when testing is started. /// /// \param tests Total number of tests in all suites. @@ -67,7 +67,7 @@ namespace Test { CPPTEST_UNUSED(tests); } - + /// Called when testing is finished. /// /// \param tests Total number of tests in all suites. @@ -89,7 +89,7 @@ namespace Test CPPTEST_UNUSED(tests); CPPTEST_UNUSED(name); } - + /// Called when a suite is finished. /// /// \param tests Number of tests in this suite. @@ -103,7 +103,7 @@ namespace Test CPPTEST_UNUSED(name); CPPTEST_UNUSED(time); } - + /// Called when a tests is executed. /// /// \param name Name of the test function. @@ -112,7 +112,7 @@ namespace Test { CPPTEST_UNUSED(name); } - + /// Called when a test if finished, regardless if an assertment was /// issued. /// @@ -127,7 +127,7 @@ namespace Test CPPTEST_UNUSED(ok); CPPTEST_UNUSED(time); } - + /// Called when an assertment is issued. /// /// \param s Assert point information. @@ -141,12 +141,12 @@ namespace Test /// Empty constructor. /// Output() {} - + private: Output(const Output&); Output& operator=(const Output&); }; - + } // namespace Test - + #endif // #ifndef CPPTEST_OUTPUT_H diff --git a/tests/cppunit/cpptest-source.h b/tests/cppunit/cpptest-source.h index 47140ca71..c2eb57f32 100644 --- a/tests/cppunit/cpptest-source.h +++ b/tests/cppunit/cpptest-source.h @@ -34,7 +34,7 @@ namespace Test { class Suite; - + /// \brief Assertment source information. /// /// Contains information about an assertment point. @@ -42,17 +42,17 @@ namespace Test class Source { friend class Suite; - + public: Source(); Source(const char* file, unsigned int line, const char* msg); - + const std::string& file() const; unsigned int line() const; const std::string& message() const; const std::string& suite() const; const std::string& test() const; - + private: unsigned int _line; std::string _file; @@ -60,7 +60,7 @@ namespace Test std::string _suite; std::string _test; }; - + } // namespace Test #endif // #ifndef CPPTEST_SOURCE_H diff --git a/tests/cppunit/cpptest-suite.h b/tests/cppunit/cpptest-suite.h index b42a19fa1..eb6908b7b 100644 --- a/tests/cppunit/cpptest-suite.h +++ b/tests/cppunit/cpptest-suite.h @@ -39,7 +39,7 @@ namespace Test { class Output; - + /// \brief Unit testing suite. /// /// Base class for all suites. Derive from this class to create own @@ -51,52 +51,52 @@ namespace Test /// class Suite { - public: + public: Suite(); virtual ~Suite(); - + void add(Suite* suite); - + bool run(Output& output, bool cont_after_fail = true); - + protected: /// Pointer to a test function. /// typedef void (Suite::*Func)(); - + bool continue_after_failure() const { return _continue; } - + virtual void setup() {} virtual void tear_down() {} - + void register_test(Func func, const std::string& name); void assertment(Source s); - + private: struct DoRun; struct ExecTests; struct SubSuiteTests; struct SuiteTime; struct SubSuiteTime; - + friend struct DoRun; friend struct ExecTests; friend struct SubSuiteTests; friend struct SubSuiteTime; - + struct Data { Func _func; std::string _name; Time _time; - + Data(Func func, const std::string& name) : _func(func), _name(name) {} }; - + typedef std::list Tests; typedef std::list Suites; - + std::string _name; // Suite name const std::string* _cur_test; // Current test func name Suites _suites; // External test suites @@ -105,11 +105,11 @@ namespace Test bool _result : 1; // Test result bool _success : 1; // Set if no test failed bool _continue : 1; // Continue func after failures - + void do_run(Output* os, bool cont_after_fail); int total_tests() const; Time total_time(bool recursive) const; - + // Disable // Suite(const Suite&); @@ -133,7 +133,7 @@ namespace Test /// #define TEST_ADD(func)\ register_test(static_cast(&func), #func); - + } // namespace Test #endif // #ifndef CPPTEST_SUITE_H diff --git a/tests/cppunit/cpptest-textoutput.h b/tests/cppunit/cpptest-textoutput.h index 45ed9f2fc..91b0d7c64 100644 --- a/tests/cppunit/cpptest-textoutput.h +++ b/tests/cppunit/cpptest-textoutput.h @@ -53,15 +53,15 @@ namespace Test /// Terse output mode, which only shows the number of correct tests. /// Terse, - + /// Verbose output mode, which also shows extended assert /// information for each test that failed. /// - Verbose + Verbose }; - + TextOutput(Mode mode, std::ostream& stream = std::cout); - + virtual void finished(int tests, const Time& time); virtual void suite_start(int tests, const std::string& name); virtual void suite_end(int tests, const std::string& name, @@ -69,10 +69,10 @@ namespace Test virtual void test_end(const std::string& name, bool ok, const Time& time); virtual void assertment(const Source& s); - + private: typedef std::list ErrorList; - + Mode _mode; std::ostream& _stream; ErrorList _suite_error_list; @@ -84,5 +84,5 @@ namespace Test }; } // namespace Test - + #endif // #ifndef CPPTEST_TEXTOUTPUT_H diff --git a/tests/cppunit/cpptest-time.h b/tests/cppunit/cpptest-time.h index ee1f282c9..bc7f5b78b 100644 --- a/tests/cppunit/cpptest-time.h +++ b/tests/cppunit/cpptest-time.h @@ -45,22 +45,22 @@ namespace Test public: Time(); Time(unsigned int sec, unsigned int usec); - + unsigned int seconds() const; unsigned int microseconds() const; - + static Time current(); - + friend Time operator+(const Time& t1, const Time& t2); friend Time operator-(const Time& t1, const Time& t2); - + friend std::ostream& operator<<(std::ostream& os, const Time& t); - + private: unsigned int _sec; unsigned int _usec; }; - + } // namespace Test #endif // #ifndef CPPTEST_TIME_H diff --git a/tests/cppunit/htmloutput.cpp b/tests/cppunit/htmloutput.cpp index bdf6fd6a4..8870a33fd 100644 --- a/tests/cppunit/htmloutput.cpp +++ b/tests/cppunit/htmloutput.cpp @@ -31,7 +31,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-htmloutput.h" #include "utils.h" @@ -52,7 +52,7 @@ namespace Test idx += replace.size(); } } - + string escape(string value) { @@ -63,7 +63,7 @@ namespace Test strreplace(value, '\'', "'"); return value; } - + void header(ostream& os, string name) { @@ -149,7 +149,7 @@ namespace Test "
\n" "\n"; } - + void footer(ostream& os) { @@ -162,15 +162,15 @@ namespace Test "

\n" "\n\n"; } - + void back_ref(ostream& os, const string& ref, bool prepend_newline = true) { - + os << "

Back to " << escape(ref) << "\n

\n"; } - + void sub_title(ostream& os, const string& title, int size) { @@ -186,43 +186,43 @@ namespace Test h << "h" << size; os << "<" << h.str() << ">" << escape(title) << "\n"; } - + enum ClassTableType { TableClass_Summary, TableClass_Suites, TableClass_Suite, TableClass_Result }; - + void table_header(ostream& os, ClassTableType type, const string &summary = "") { static const char* class_tabletypes[] = { "summary", "suites", "suite", "result" }; - + os << "\n"; } - + void table_footer(ostream& os) { os << "
\n"; } - + void table_tr_header(ostream& os) { os << " \n"; } - + void table_tr_footer(ostream& os) { os << " \n"; } - + enum ClassType { Title, Success, Error }; - + void table_entry(ostream& os, ClassType type, const string& s, int width = 0, const string& link = "") { static const char* class_types[] = { "title", "success", "error" }; - + os << " " << escape(s) << ""; else os << " class=\"tablecell_" << class_types[type] << "\">" << escape(s); - os << "\n"; + os << "\n"; } - + } // anonymous namespace - + // Test suite table // struct HtmlOutput::SuiteRow @@ -259,7 +259,7 @@ namespace Test table_tr_footer(_os); } }; - + // Individual tests tables, tests // struct HtmlOutput::TestRow @@ -276,7 +276,7 @@ namespace Test ti._sources.front().suite() + "_" + ti._name; ClassType type(ti._success ? Success : Error); ostringstream ss; - + table_tr_header(_os); table_entry(_os, type, ti._name, 0, link); ss.str(""), ss << ti._sources.size(); @@ -288,19 +288,19 @@ namespace Test } } }; - + // Individual tests tables, header // struct HtmlOutput::TestSuiteRow { bool _incl_ok_tests; ostream& _os; - TestSuiteRow(ostream& os, bool incl_ok_tests) + TestSuiteRow(ostream& os, bool incl_ok_tests) : _incl_ok_tests(incl_ok_tests), _os(os) {} void operator()(const SuiteInfo& si) { ostringstream ss; - + sub_title(_os, "Suite: " + si._name, 3, si._name); table_header(_os, TableClass_Suite, "Details for suite " + si._name); table_tr_header(_os); @@ -309,13 +309,13 @@ namespace Test table_entry(_os, Title, "Success", 10); table_entry(_os, Title, "Time (s)", 10); table_tr_footer(_os); - for_each(si._tests.begin(), si._tests.end(), + for_each(si._tests.begin(), si._tests.end(), TestRow(_os, _incl_ok_tests)); table_footer(_os); back_ref(_os, "top"); } }; - + // Individual tests result tables // struct HtmlOutput::TestResult @@ -325,9 +325,9 @@ namespace Test void operator()(const Source& s) { const int TitleSize = 15; - + ostringstream ss; - + table_header(_os, TableClass_Result, "Test Failure"); table_tr_header(_os); table_entry(_os, Title, "Test", TitleSize); @@ -345,7 +345,7 @@ namespace Test table_footer(_os); } }; - + // All tests result tables // struct HtmlOutput::TestResultAll @@ -357,14 +357,14 @@ namespace Test if (!ti._success) { const string& suite = ti._sources.front().suite(); - + sub_title(_os, suite + "::" + ti._name, 3, suite + "_" + ti._name); for_each(ti._sources.begin(), ti._sources.end(), TestResult(_os)); back_ref(_os, suite, false); } } }; - + // Individual tests result tables, iterator // struct HtmlOutput::SuiteTestResult @@ -376,12 +376,12 @@ namespace Test for_each(si._tests.begin(), si._tests.end(), TestResultAll(_os)); } }; - + /// Generates the HTML table. This function should only be called after /// run(), when all tests have been executed. /// /// \param os Output stream. - /// \param incl_ok_tests Set if successful tests should be shown; + /// \param incl_ok_tests Set if successful tests should be shown; /// false otherwise. /// \param name Name of generated report. /// @@ -390,9 +390,9 @@ namespace Test { ClassType type(_total_errors > 0 ? Error : Success); ostringstream ss; - + header(os, name); - + // Table: Summary // sub_title(os, "Summary", 2); @@ -415,7 +415,7 @@ namespace Test table_tr_footer(os); table_footer(os); os << "
\n\n"; - + // Table: Test suites // sub_title(os, "Test suites", 2); @@ -430,12 +430,12 @@ namespace Test for_each(_suites.begin(), _suites.end(), SuiteRow(os)); table_footer(os); os << "
\n\n"; - + // Individual tests tables // for_each(_suites.begin(), _suites.end(), TestSuiteRow(os, incl_ok_tests)); os << "
\n\n"; - + // Individual tests result tables // if(_total_errors != 0) @@ -443,11 +443,11 @@ namespace Test sub_title(os, "Test results", 2); for_each(_suites.begin(), _suites.end(), SuiteTestResult(os)); os << "
\n\n"; - } + } // EOF // footer(os); } - + } // namespace Test diff --git a/tests/cppunit/missing.cpp b/tests/cppunit/missing.cpp index 046dff7b0..6dd38d5f7 100644 --- a/tests/cppunit/missing.cpp +++ b/tests/cppunit/missing.cpp @@ -28,7 +28,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "missing.h" @@ -40,7 +40,7 @@ #include #else #include -#endif +#endif #include #include @@ -53,7 +53,7 @@ namespace Test gettimeofday(timeval* tv, void*) { assert(tv); - + #ifdef HAVE_GETTICKCOUNT long now = GetTickCount(); tv->tv_sec = now / 1000; @@ -62,10 +62,10 @@ namespace Test tv->tv_sec = time(0); tv->tv_usec = 0; #endif // #ifdef HAVE_GETTICKCOUNT - + return 0; } - + #endif // #ifndef HAVE_GETTIMEOFDAY #ifndef HAVE_ROUND @@ -74,7 +74,7 @@ namespace Test { return d > 0.0 ? floor(d + 0.5) : ceil(d - 0.5); } -#endif +#endif } // namespace Test diff --git a/tests/cppunit/missing.h b/tests/cppunit/missing.h index 78af19401..016ffb39c 100644 --- a/tests/cppunit/missing.h +++ b/tests/cppunit/missing.h @@ -31,7 +31,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif namespace Test { @@ -42,15 +42,15 @@ namespace Test long tv_sec; long tv_usec; }; - + extern int gettimeofday(timeval* tv, void*); - + #endif // #ifndef HAVE_GETTIMEOFDAY - + #ifndef HAVE_ROUND extern double round(double d); -#endif - +#endif + } // namespace Test #endif // #ifndef CPPTEST_MISSING_H diff --git a/tests/cppunit/source.cpp b/tests/cppunit/source.cpp index b1cebda53..cc4a3609e 100644 --- a/tests/cppunit/source.cpp +++ b/tests/cppunit/source.cpp @@ -36,7 +36,7 @@ namespace Test Source::Source() : _line(0) {} - + /// Constructs a source object. /// /// \param file Name of the file containing the failing function. @@ -48,15 +48,15 @@ namespace Test _file(file ? file : ""), _msg(msg ? msg : "") {} - + /// \return Name of the file containing the failing function. /// const string& - Source::file() const + Source::file() const { return _file; } - + /// \return Line where the function starts. /// unsigned int @@ -64,7 +64,7 @@ namespace Test { return _line; } - + /// \return Descriptive message. /// const string& @@ -72,7 +72,7 @@ namespace Test { return _msg; } - + /// \return Name of the suite, which the test belongs to. /// const string& diff --git a/tests/cppunit/suite.cpp b/tests/cppunit/suite.cpp index f531e6c8f..7f344d06c 100644 --- a/tests/cppunit/suite.cpp +++ b/tests/cppunit/suite.cpp @@ -34,7 +34,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-output.h" #include "cpptest-source.h" @@ -55,9 +55,9 @@ namespace Test while (first != last) delete *first++; } - + } // anonymous namespace - + /// Constructs an empty test suite. /// Suite::Suite() @@ -65,14 +65,14 @@ namespace Test _output(0), _success(true) {} - + /// Destroys this suite object. /// Suite::~Suite() { destroy_range(_suites.begin(), _suites.end()); } - + /// Starts the testing. All tests in this suite and embedded suites will /// be executed. /// @@ -90,7 +90,7 @@ namespace Test output.finished(ntests, total_time(true)); return _success; } - + /// \fn void Suite::setup() /// /// Setups a test fixture. This function is called before each test, @@ -100,7 +100,7 @@ namespace Test /// specialized behavior. /// /// \see tear_down() - + /// \fn void Suite::tear_down() /// /// Tears down a test fixture. This function is called after each test, @@ -110,7 +110,7 @@ namespace Test /// specialized behavior. /// /// \see setup() - + /// Adds a suite to this suite. Tests in added suites will be executed /// when run() of the top-level suite is called. /// @@ -121,7 +121,7 @@ namespace Test { _suites.push_back(suite); } - + /// Registers a test function. /// /// \b Note: Do not call this function directly, use the TEST_ADD(func) @@ -136,11 +136,11 @@ namespace Test { string::size_type pos = name.find_first_of(':'); assert(!name.empty() && name[pos + 1] == ':' && name[pos + 2] != '\0'); - + _name.assign(name, 0, pos); _tests.push_back(Data(func, name.substr(pos + 2))); } - + /// Issues an assertment to the output handler. /// /// Do not call this function directly, use one of the available assertment @@ -156,21 +156,21 @@ namespace Test _output->assertment(s); _result = _success = false; } - + // Functor to execute tests for the given suite. // struct Suite::ExecTests { Suite& _suite; - + ExecTests(Suite& s) : _suite(s) {} - + void operator()(Data& data) { _suite._cur_test = &data._name; _suite._result = true; // assume success, assert will set to false _suite._output->test_start(data._name); - + _suite.setup(); Time start(Time::current()); // FIXME Also feedback exception to user @@ -182,7 +182,7 @@ namespace Test } Time end(Time::current()); _suite.tear_down(); - + data._time = end - start; _suite._output->test_end(data._name, _suite._result, data._time); } @@ -194,7 +194,7 @@ namespace Test { bool _continue; Output* _output; - + DoRun(Output* output, bool cont) : _continue(cont), _output(output) {} void operator()(Suite* suite) { suite->do_run(_output, _continue); } }; @@ -206,7 +206,7 @@ namespace Test { _continue = cont_after_fail; _output = os; - + _output->suite_start(_tests.size(), _name); for_each(_tests.begin(), _tests.end(), ExecTests(*this)); _output->suite_end(_tests.size(), _name, total_time(false)); @@ -235,7 +235,7 @@ namespace Test return value + s->total_tests(); } }; - + // Counts all tests in this and all its embedded suites. // int @@ -244,7 +244,7 @@ namespace Test return accumulate(_suites.begin(), _suites.end(), _tests.size(), SubSuiteTests()); } - + // Functor to accumulate execution time for tests. // struct Suite::SuiteTime @@ -254,7 +254,7 @@ namespace Test return time + data._time; } }; - + // Functor to accumulate execution time for suites. // struct Suite::SubSuiteTime @@ -264,7 +264,7 @@ namespace Test return time + s->total_time(true); } }; - + // Counts time accumulated execution time for all tests in this and all // its embedded suites. // @@ -273,9 +273,9 @@ namespace Test { Time time = accumulate(_tests.begin(), _tests.end(), Time(), SuiteTime()); - + return !recursive ? time : accumulate(_suites.begin(), _suites.end(), time, SubSuiteTime()); } - + } // namespace Test diff --git a/tests/cppunit/textoutput.cpp b/tests/cppunit/textoutput.cpp index 792a89439..bb0846927 100644 --- a/tests/cppunit/textoutput.cpp +++ b/tests/cppunit/textoutput.cpp @@ -30,7 +30,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-textoutput.h" #include "cpptest-time.h" @@ -55,12 +55,12 @@ namespace Test << "\tFile: " << s.file() << endl << "\tLine: " << s.line() << endl << "\tMessage: " << s.message() << endl << endl; - + } }; - + } // anonymous namespace - + /// Constructs a text output handler. /// /// \param mode Output mode. @@ -71,7 +71,7 @@ namespace Test _stream(stream), _total_errors(0) {} - + void TextOutput::finished(int tests, const Time& time) { @@ -79,7 +79,7 @@ namespace Test << correct(tests, _total_errors) << "% correct" << " in " << time << " seconds" << endl; } - + void TextOutput::suite_start(int tests, const string& name) { @@ -89,13 +89,13 @@ namespace Test _suite_tests = _suite_errors = 0; _suite_total_tests = tests; _suite_error_list.clear(); - + _stream << _suite_name << ": " << "0/" << _suite_total_tests << "\r" << flush; } } - + void TextOutput::suite_end(int tests, const string& name, const Time& time) { @@ -104,15 +104,15 @@ namespace Test _stream << name << ": " << tests << "/" << tests << ", " << correct(tests, _suite_errors) << "% correct" << " in " << time << " seconds" << endl; - + if (_mode == Verbose && _suite_errors) for_each(_suite_error_list.begin(), _suite_error_list.end(), ShowSource(_stream)); - + _total_errors += _suite_errors; } } - + void TextOutput::test_end(const string&, bool ok, const Time&) { @@ -122,11 +122,11 @@ namespace Test if (!ok) ++_suite_errors; } - + void TextOutput::assertment(const Source& s) { _suite_error_list.push_back(s); } - + } // namespace Test diff --git a/tests/cppunit/time.cpp b/tests/cppunit/time.cpp index 4b7a988f5..7ba55a36b 100644 --- a/tests/cppunit/time.cpp +++ b/tests/cppunit/time.cpp @@ -28,7 +28,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "missing.h" #include "cpptest-time.h" @@ -48,16 +48,16 @@ namespace Test namespace { const unsigned int UsecPerSec = 1000000; - + } // anonymous namespace - + /// Constructs a time object with zeroed time. /// Time::Time() : _sec(0), _usec(0) {} - + /// Constructs a time object. /// /// \param sec Seconds. @@ -67,7 +67,7 @@ namespace Test : _sec(sec), _usec(usec) {} - + /// \return Seconds. /// unsigned int @@ -75,7 +75,7 @@ namespace Test { return _sec; } - + /// \return Micro-seconds. /// unsigned int @@ -83,7 +83,7 @@ namespace Test { return _usec; } - + /// \return The current time. /// Time @@ -93,7 +93,7 @@ namespace Test gettimeofday(&tv, 0); return Time(tv.tv_sec, tv.tv_usec); } - + /// \relates Time /// /// Computes the time elapsed between two time values. @@ -108,10 +108,10 @@ namespace Test { if (t2._sec > t1._sec || (t2._sec == t1._sec && t2._usec > t1._usec)) return Time(); - + unsigned int sec = t1._sec - t2._sec; unsigned int usec; - + if (t2._usec > t1._usec) { --sec; @@ -119,10 +119,10 @@ namespace Test } else usec = t1._usec - t2._usec; - + return Time(sec, usec); } - + /// \relates Time /// /// Adds two time values. @@ -137,7 +137,7 @@ namespace Test { unsigned int sec = t1._sec + t2._sec; unsigned int usec = t1._usec + t2._usec; - + if (usec > UsecPerSec) { ++sec; @@ -145,7 +145,7 @@ namespace Test } return Time(sec, usec); } - + /// \relates Time /// /// Outputs a time to an output stream. @@ -171,6 +171,6 @@ namespace Test return os; } - + } // namespace Test diff --git a/tests/cppunit/utils.cpp b/tests/cppunit/utils.cpp index ebf850239..f7e545592 100644 --- a/tests/cppunit/utils.cpp +++ b/tests/cppunit/utils.cpp @@ -29,13 +29,13 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "missing.h" #include "utils.h" namespace Test -{ +{ // Computes the procentage of correct tests. // int diff --git a/tests/cppunit/utils.h b/tests/cppunit/utils.h index 967e0afaf..c3a48e420 100644 --- a/tests/cppunit/utils.h +++ b/tests/cppunit/utils.h @@ -30,7 +30,7 @@ namespace Test { extern int correct(int tests, int errors); - + } // namespace Test #endif // #ifndef CPPTEST_UTILS_H diff --git a/tests/cppunit/winconfig.h b/tests/cppunit/winconfig.h index 6b2858a62..9546ebf5a 100644 --- a/tests/cppunit/winconfig.h +++ b/tests/cppunit/winconfig.h @@ -36,7 +36,7 @@ #if _MSC_VER == 1200 // MS Visual C++ 6.0 #pragma warning (disable: 4786) #endif - + #if _MSC_VER > 1300 // MS Visual C++ .NET 2002 and above #pragma warning (disable: 4267) #endif diff --git a/tests/fixed_memory_test.h b/tests/fixed_memory_test.h index d0463a849..89d6dad46 100644 --- a/tests/fixed_memory_test.h +++ b/tests/fixed_memory_test.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -26,7 +26,7 @@ class FixedMemoryHashTest : public Test::Suite { typedef void(FixedMemoryHashTest::*TestFunction)(void); public: - FixedMemoryHashTest() { + FixedMemoryHashTest() { size_ = EQEmu::FixedMemoryHashSet::estimated_size(72000, 190000); data_ = new uint8[size_]; memset(data_, 0, size_); @@ -43,10 +43,10 @@ public: TEST_ADD(FixedMemoryHashTest::InsertEndTest); TEST_ADD(FixedMemoryHashTest::RetrieveEndTest); } - ~FixedMemoryHashTest() { + ~FixedMemoryHashTest() { delete[] data_; } - + private: void InitTest() { EQEmu::FixedMemoryHashSet hash(data_, size_, 72000, 190000); @@ -71,7 +71,7 @@ public: strcpy(item.Name, "Iron Sword"); item.ID = 1001; hash.insert(1001, item); - + TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 1); TEST_ASSERT(hash.max_size() == 72000); @@ -84,7 +84,7 @@ public: TEST_ASSERT(hash.size() == 1); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - + Item_Struct item = hash[1001]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1001); @@ -97,7 +97,7 @@ public: strcpy(item.Name, "Steel Sword"); item.ID = 1001; hash.insert(1001, item); - + TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 1); TEST_ASSERT(hash.max_size() == 72000); @@ -110,7 +110,7 @@ public: TEST_ASSERT(hash.size() == 1); TEST_ASSERT((hash.max_size() == 72000)); TEST_ASSERT(!hash.empty()); - + Item_Struct item = hash[1001]; TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); TEST_ASSERT(item.ID == 1001); @@ -138,7 +138,7 @@ public: TEST_ASSERT(hash.size() == 2); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - + Item_Struct item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); @@ -172,7 +172,7 @@ public: TEST_ASSERT(hash.size() == 3); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - + Item_Struct item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); @@ -212,7 +212,7 @@ public: TEST_ASSERT(hash.size() == 4); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - + Item_Struct item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); diff --git a/tests/fixed_memory_variable_test.h b/tests/fixed_memory_variable_test.h index cd77d29b0..fcc04ad7f 100644 --- a/tests/fixed_memory_variable_test.h +++ b/tests/fixed_memory_variable_test.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -29,7 +29,7 @@ struct test_struct { class FixedMemoryVariableHashTest : public Test::Suite { typedef void(FixedMemoryVariableHashTest::*TestFunction)(void); public: - FixedMemoryVariableHashTest() { + FixedMemoryVariableHashTest() { size_ = 1024 + 12 + 2008; data_ = new uint8[size_]; memset(data_, 0, size_); @@ -42,10 +42,10 @@ public: TEST_ADD(FixedMemoryVariableHashTest::InsertAgainFailTest); TEST_ADD(FixedMemoryVariableHashTest::RetrieveAgainFailTest); } - ~FixedMemoryVariableHashTest() { + ~FixedMemoryVariableHashTest() { delete[] data_; } - + private: void InitTest() { EQEmu::FixedMemoryVariableHashSet hash(data_, size_, 501); @@ -65,16 +65,16 @@ public: memset(&test, 0, sizeof(test)); strcpy(test.name, "Bill D."); - hash.insert(0, reinterpret_cast(&test), sizeof(test)); + hash.insert(0, reinterpret_cast(&test), sizeof(test)); TEST_ASSERT(hash.exists(0)); TEST_ASSERT(!hash.exists(501)); } - + void RetrieveTest() { EQEmu::FixedMemoryVariableHashSet hash(data_, size_); TEST_ASSERT(hash.exists(0)); TEST_ASSERT(!hash.exists(501)); - + test_struct test = hash[0]; TEST_ASSERT(strcmp(test.name, "Bill D.") == 0); } @@ -85,7 +85,7 @@ public: memset(&test, 0, sizeof(test)); strcpy(test.name, "Jimmy P."); - hash.insert(501, reinterpret_cast(&test), sizeof(test)); + hash.insert(501, reinterpret_cast(&test), sizeof(test)); TEST_ASSERT(hash.exists(0)); TEST_ASSERT(hash.exists(501)); } @@ -94,7 +94,7 @@ public: EQEmu::FixedMemoryVariableHashSet hash(data_, size_); TEST_ASSERT(hash.exists(0)); TEST_ASSERT(hash.exists(501)); - + test_struct test = hash[501]; TEST_ASSERT(strcmp(test.name, "Jimmy P.") == 0); } @@ -119,7 +119,7 @@ public: TEST_ASSERT(hash.exists(0)); TEST_ASSERT(hash.exists(501)); TEST_ASSERT(!hash.exists(500)); - + try { test_struct test = hash[500]; TEST_ASSERT(false); diff --git a/tests/ipc_mutex_test.h b/tests/ipc_mutex_test.h index 1ecd1d11f..799fa83e4 100644 --- a/tests/ipc_mutex_test.h +++ b/tests/ipc_mutex_test.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -25,16 +25,16 @@ class IPCMutexTest : public Test::Suite { typedef void(IPCMutexTest::*TestFunction)(void); public: - IPCMutexTest() { + IPCMutexTest() { TEST_ADD(IPCMutexTest::LockMutexTest); TEST_ADD(IPCMutexTest::UnlockMutexTest); TEST_ADD(IPCMutexTest::DoubleLockMutexTest); TEST_ADD(IPCMutexTest::DoubleUnlockMutexTest); } - ~IPCMutexTest() { + ~IPCMutexTest() { } - + private: void LockMutexTest() { EQEmu::IPCMutex mutex("TestMutex1"); diff --git a/tests/main.cpp b/tests/main.cpp index b43cf2081..f3cf0e20a 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/tests/memory_mapped_file_test.h b/tests/memory_mapped_file_test.h index cccf73162..3f77353eb 100644 --- a/tests/memory_mapped_file_test.h +++ b/tests/memory_mapped_file_test.h @@ -4,13 +4,13 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -25,33 +25,33 @@ class MemoryMappedFileTest : public Test::Suite { typedef void(MemoryMappedFileTest::*TestFunction)(void); public: - MemoryMappedFileTest() { + MemoryMappedFileTest() { TEST_ADD(MemoryMappedFileTest::LoadAndZeroMMF) TEST_ADD(MemoryMappedFileTest::LoadExistingMMF) } - ~MemoryMappedFileTest() { + ~MemoryMappedFileTest() { } - private: + private: void LoadAndZeroMMF() { EQEmu::MemoryMappedFile mmf("testfile.txt", 512); mmf.ZeroFile(); TEST_ASSERT(mmf.Size() == 512); - + unsigned char *data = reinterpret_cast(mmf.Get()); TEST_ASSERT(data != nullptr); - + *reinterpret_cast(data) = 562; } - + void LoadExistingMMF() { EQEmu::MemoryMappedFile mmf("testfile.txt"); TEST_ASSERT(mmf.Size() == 512); - + unsigned char *data = reinterpret_cast(mmf.Get()); TEST_ASSERT(data != nullptr); - + uint32 val = *reinterpret_cast(data); TEST_ASSERT(val == 562); } diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 1218541a3..4493d8461 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -24,7 +24,7 @@ ADD_DEFINITIONS(-DUCS) TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - + SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib") ENDIF(MSVC) diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index 6167c7e05..c3f3ad6f0 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -28,7 +28,7 @@ extern Database database; extern uint32 ChatMessagesSent; -ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus) : +ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus) : DeleteTimer(0) { Name = inName; @@ -43,7 +43,7 @@ ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool Moderated = false; - _log(UCS__TRACE, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + _log(UCS__TRACE, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -301,7 +301,7 @@ bool ChatChannel::RemoveClient(Client *c) { return false; _log(UCS__TRACE, "Starting delete timer for empty password protected channel %s", Name.c_str()); - + DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -455,7 +455,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c) if(!c) return nullptr; if((ChannelName.length() > 0) && (isdigit(ChannelName[0]))) { - + c->GeneralChannelMessage("The channel name can not begin with a number."); return nullptr; @@ -465,7 +465,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c) string::size_type Colon = ChannelName.find_first_of(":"); - if(Colon == string::npos) + if(Colon == string::npos) NormalisedName = CapitaliseName(ChannelName); else { NormalisedName = CapitaliseName(ChannelName.substr(0, Colon)); diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 9a857c3cd..49374a7a9 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -83,8 +83,8 @@ vector ParseRecipients(string RecipientString) { // This method parses the Recipient List in the mailto command, which can look like this example: // - // "Baalinor , - // -Friends , + // "Baalinor , + // -Friends , // Guild , SOE.EQ.BTG2.luccerathe, SOE.EQ.BTG2.codsas // // First, it splits it up at commas, so it looks like this: @@ -180,7 +180,7 @@ vector ParseRecipients(string RecipientString) { break; } - RecipientList.push_back(Secret + Recips.substr(CurrentPos, + RecipientList.push_back(Secret + Recips.substr(CurrentPos, Space - CurrentPos)); CurrentPos = Space + 1; } @@ -191,9 +191,9 @@ vector ParseRecipients(string RecipientString) { } } - + (*Iterator) = Secret + (*Iterator); - + Iterator++; } @@ -212,7 +212,7 @@ vector ParseRecipients(string RecipientString) { if(LastPeriod != string::npos) { (*Iterator) = (*Iterator).substr(LastPeriod + 1); - + for(unsigned int i = 0; i < (*Iterator).length(); i++) { if(i == 0) @@ -240,7 +240,7 @@ vector ParseRecipients(string RecipientString) { static void ProcessMailTo(Client *c, string MailMessage) { _log(UCS__TRACE, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); - + vector Recipients; string::size_type FirstQuote = MailMessage.find_first_of("\"", 0); @@ -335,7 +335,7 @@ static void ProcessMailTo(Client *c, string MailMessage) { Success = false; } } - + if(Success) { // Success EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailDeliveryStatus, 10); @@ -494,7 +494,7 @@ Clientlist::Clientlist(int ChatPort) { Client::Client(EQStream *eqs) { - ClientStream = eqs; + ClientStream = eqs; CurrentMailBox = 0; @@ -571,7 +571,7 @@ void Clientlist::CheckForStaleConnections(Client *c) { _log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); - + safe_delete((*Iterator)); Iterator = ClientChatConnections.erase(Iterator); @@ -611,7 +611,7 @@ void Clientlist::Process() { _log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); - + safe_delete((*Iterator)); Iterator = ClientChatConnections.erase(Iterator); @@ -698,7 +698,7 @@ void Clientlist::Process() { case OP_Mail: { string CommandString = (const char*)app->pBuffer; - + ProcessOPMailCommand((*Iterator), CommandString); break; @@ -762,7 +762,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString) string::size_type Space = CommandString.find_first_of(" "); - if(Space != string::npos) { + if(Space != string::npos) { Command = CommandString.substr(0, Space); @@ -793,7 +793,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString) case CommandListAll: ChannelList->SendAllChannels(c); break; - + case CommandList: c->ProcessChannelList(Parameters); break; @@ -875,7 +875,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString) } case CommandSetMailForwarding: break; - + case CommandBuddy: RemoveApostrophes(Parameters); ProcessCommandBuddy(c, Parameters); @@ -924,7 +924,7 @@ void Client::SendMailBoxes() { int PacketLength = 10; string s; - + for(int i = 0; i < Count; i++) { s += GetMailPrefix() + Characters[i].Name; @@ -1028,7 +1028,7 @@ void Client::JoinChannels(string ChannelNameList) { if(NumberOfChannels == MAX_JOINED_CHANNELS) { GeneralChannelMessage("You have joined the maximum number of channels. /leave one before trying to join another."); - + break; } @@ -1238,7 +1238,7 @@ void Client::ProcessChannelList(string Input) { ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); - if(RequiredChannel) + if(RequiredChannel) RequiredChannel->SendChannelMembers(this); else GeneralChannelMessage("Channel " + Input + " not found."); @@ -1289,7 +1289,7 @@ void Client::SendChannelList() { safe_delete(outapp); } -void Client::SendChannelMessage(string Message) +void Client::SendChannelMessage(string Message) { string::size_type MessageStart = Message.find_first_of(" "); @@ -1348,11 +1348,11 @@ void Client::SendChannelMessage(string Message) } } int AllowedMessages = RuleI(Chat, MinimumMessagesPerInterval) + GetKarma(); - AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; - + AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; + if(RuleI(Chat, MinStatusToBypassAntiSpam) <= Status) AllowedMessages = 10000; - + AttemptedMessages++; if(AttemptedMessages > AllowedMessages) { @@ -1363,7 +1363,7 @@ void Client::SendChannelMessage(string Message) if(GlobalChatLimiterTimer) { char TimeLeft[256]; - sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", + sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", (GlobalChatLimiterTimer->GetRemainingTime() / 1000)); GeneralChannelMessage(TimeLeft); } @@ -1446,7 +1446,7 @@ void Client::SendChannelMessageByNumber(string Message) { } } - _log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + _log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) @@ -1463,7 +1463,7 @@ void Client::SendChannelMessageByNumber(string Message) { } } int AllowedMessages = RuleI(Chat, MinimumMessagesPerInterval) + GetKarma(); - AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; + AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; if(RuleI(Chat, MinStatusToBypassAntiSpam) <= Status) AllowedMessages = 10000; @@ -1477,7 +1477,7 @@ void Client::SendChannelMessageByNumber(string Message) { if(GlobalChatLimiterTimer) { char TimeLeft[256]; - sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", + sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", (GlobalChatLimiterTimer->GetRemainingTime() / 1000)); GeneralChannelMessage(TimeLeft); } @@ -1544,7 +1544,7 @@ void Client::ToggleAnnounce(string State) string Message = "Announcing now "; - if(Announce) + if(Announce) Message += "on"; else Message += "off"; @@ -1746,7 +1746,7 @@ void Client::SetChannelOwner(string CommandString) { void Client::OPList(string CommandString) { string::size_type ChannelStart = CommandString.find_first_not_of(" "); - + if(ChannelStart == string::npos) { string Message = "Incorrect syntax: /chat oplist "; GeneralChannelMessage(Message); @@ -1969,7 +1969,7 @@ void Client::ChannelGrantModerator(string CommandString) { } else { RequiredChannel->AddModerator(Moderator); - + if(RequiredClient) RequiredClient->GeneralChannelMessage(GetName() + " has made you a moderator of channel " + ChannelName); @@ -2056,7 +2056,7 @@ void Client::ChannelGrantVoice(string CommandString) { } else { RequiredChannel->AddVoice(Voicee); - + if(RequiredClient) RequiredClient->GeneralChannelMessage(GetName() + " has given you voice in channel " + ChannelName); @@ -2256,7 +2256,7 @@ Client *Clientlist::IsCharacterOnline(string CharacterName) { // If the mail is destined for the primary mailbox for this character, or the one they have selected // - if((MailBoxNumber == 0) || (MailBoxNumber == (*Iterator)->GetMailBoxNumber())) + if((MailBoxNumber == 0) || (MailBoxNumber == (*Iterator)->GetMailBoxNumber())) return (*Iterator); } @@ -2280,7 +2280,7 @@ void Client::SendNotification(int MailBoxNumber, string Subject, string From, in char sMessageID[100]; char Sequence[100]; - + sprintf(TimeStamp, "%i", (int)time(nullptr)); sprintf(sMessageID, "%i", MessageID); @@ -2296,8 +2296,8 @@ void Client::SendNotification(int MailBoxNumber, string Subject, string From, in VARSTRUCT_ENCODE_INTSTRING(PacketBuffer, MailBoxNumber); VARSTRUCT_ENCODE_STRING(PacketBuffer, sMessageID); VARSTRUCT_ENCODE_STRING(PacketBuffer, TimeStamp); - VARSTRUCT_ENCODE_STRING(PacketBuffer, "1"); - VARSTRUCT_ENCODE_STRING(PacketBuffer, From.c_str()); + VARSTRUCT_ENCODE_STRING(PacketBuffer, "1"); + VARSTRUCT_ENCODE_STRING(PacketBuffer, From.c_str()); VARSTRUCT_ENCODE_STRING(PacketBuffer, Subject.c_str()); _pkt(UCS__PACKETS, outapp); @@ -2314,13 +2314,13 @@ void Client::ChangeMailBox(int NewMailBox) { SetMailBox(NewMailBox); _log(UCS__TRACE, "New mailbox is %s", MailBoxName().c_str()); - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailboxChange, 2); char *buf = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_INTSTRING(buf, NewMailBox); - + _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); diff --git a/ucs/clientlist.h b/ucs/clientlist.h index f118e939c..91264a395 100644 --- a/ucs/clientlist.h +++ b/ucs/clientlist.h @@ -33,7 +33,7 @@ #define MAX_JOINED_CHANNELS 10 enum { CommandJoin = 0, CommandLeaveAll, CommandLeave, CommandListAll, CommandList, CommandSet, CommandAnnounce, CommandSetOwner, - CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick, + CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick, CommandPassword, CommandToggleInvites, CommandAFK, CommandUptime, CommandGetHeaders, CommandGetBody, CommandMailTo, CommandSetMessageStatus, CommandSelectMailBox, CommandSetMailForwarding, CommandBuddy, CommandIgnorePlayer, @@ -46,7 +46,7 @@ struct CommandEntry { typedef enum { ConnectionTypeUnknown, ConnectionTypeCombined, ConnectionTypeMail, ConnectionTypeChat } ConnectionType; -static const CommandEntry Commands[] = { +static const CommandEntry Commands[] = { { "join", CommandJoin }, { "leaveall", CommandLeaveAll }, { "leave", CommandLeave }, diff --git a/ucs/database.cpp b/ucs/database.cpp index e03339b0b..eb60b0c5c 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -161,7 +161,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) { } safe_delete_array(query); - if (mysql_num_rows(result) != 1) + if (mysql_num_rows(result) != 1) { _log(UCS__ERROR, "Bad result from query"); mysql_free_result(result); @@ -183,7 +183,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) { } safe_delete_array(query); - for(unsigned int i = 0; i < mysql_num_rows(result); i++) + for(unsigned int i = 0; i < mysql_num_rows(result); i++) { row = mysql_fetch_row(result); c->AddCharacter(atoi(row[0]), row[1], atoi(row[2])); @@ -214,7 +214,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey row = mysql_fetch_row(result); // The key is the client's IP address (expressed as 8 hex digits) and an 8 hex digit random string generated - // by world. + // by world. // char CombinedKey[17]; @@ -222,7 +222,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey sprintf(CombinedKey, "%08X%s", IPAddress, MailKey.c_str()); else sprintf(CombinedKey, "%s", MailKey.c_str()); - + _log(UCS__TRACE, "DB key is [%s], Client key is [%s]", row[0], CombinedKey); bool Valid = !strcmp(row[0], CombinedKey); @@ -407,7 +407,7 @@ void Database::SendHeaders(Client *c) { my_ulonglong NumRows = mysql_num_rows(result); int HeaderCountPacketLength = 0; - + sprintf(Buf, "%i", c->GetMailBoxNumber()); HeaderCountPacketLength += (strlen(Buf) + 1); @@ -552,7 +552,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo //printf("Database::SendMail(%s, %s, %s)\n", Recipient.c_str(), From.c_str(), Subject.c_str()); string::size_type LastPeriod = Recipient.find_last_of("."); - + if(LastPeriod == string::npos) CharacterName = Recipient; else @@ -560,7 +560,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo CharacterName[0] = toupper(CharacterName[0]); - for(unsigned int i = 1; i < CharacterName.length(); i++) + for(unsigned int i = 1; i < CharacterName.length(); i++) CharacterName[i] = tolower(CharacterName[i]); CharacterID = FindCharacter(CharacterName.c_str()); @@ -585,7 +585,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo int Now = time(nullptr); // time returns a 64 bit int on Windows at least, which vsnprintf doesn't like. - if(!RunQuery(query, MakeAnyLenString(&query, MailQuery, CharacterID, Now, From.c_str(), EscSubject, EscBody, + if(!RunQuery(query, MakeAnyLenString(&query, MailQuery, CharacterID, Now, From.c_str(), EscSubject, EscBody, RecipientsString.c_str(), 1), errbuf, 0, 0, &LastMsgID)) { _log(UCS__ERROR, "SendMail: Query %s failed with error %s", query, errbuf); @@ -610,7 +610,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo c->SendNotification(c->GetMailBoxNumber(CharacterName), Subject, FQN, LastMsgID); } - + MailMessagesSent++; return true; @@ -660,7 +660,7 @@ void Database::ExpireMail() { // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { - if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i", + if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i", time(nullptr) - RuleI(Mail, ExpireTrash)), errbuf, 0, &AffectedRows)) { _log(UCS__INIT, "Expired %i trash messages.", AffectedRows); } @@ -671,7 +671,7 @@ void Database::ExpireMail() { } // Expire Read if(RuleI(Mail, ExpireRead) >= 0) { - if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i", + if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i", time(nullptr) - RuleI(Mail, ExpireRead)), errbuf, 0, &AffectedRows)) { _log(UCS__INIT, "Expired %i read messages.", AffectedRows); } @@ -682,7 +682,7 @@ void Database::ExpireMail() { } // Expire Unread if(RuleI(Mail, ExpireUnread) >= 0) { - if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i", + if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i", time(nullptr) - RuleI(Mail, ExpireUnread)), errbuf, 0, &AffectedRows)) { _log(UCS__INIT, "Expired %i unread messages.", AffectedRows); } @@ -707,7 +707,7 @@ void Database::AddFriendOrIgnore(int CharID, int Type, string Name) { _log(UCS__TRACE, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", CharID, Type, Name.c_str()); - + safe_delete_array(query); } @@ -724,7 +724,7 @@ void Database::RemoveFriendOrIgnore(int CharID, int Type, string Name) { _log(UCS__TRACE, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", CharID, Type, Name.c_str()); - + safe_delete_array(query); } diff --git a/ucs/database.h b/ucs/database.h index ad047e928..440c9fc36 100644 --- a/ucs/database.h +++ b/ucs/database.h @@ -61,13 +61,13 @@ public: void AddFriendOrIgnore(int CharID, int Type, string Name); void RemoveFriendOrIgnore(int CharID, int Type, string Name); void GetFriendsAndIgnore(int CharID, vector &Friends, vector &Ignorees); - + protected: void HandleMysqlError(uint32 errnum); private: void DBInitVars(); - + }; #endif diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index b94a4e6ed..aeb1b2491 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -134,7 +134,7 @@ int main() { CL = new Clientlist(Config->ChatPort); ChannelList = new ChatChannelList(); - + database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { diff --git a/ucs/ucsconfig.h b/ucs/ucsconfig.h index 84fdf332d..02f1db128 100644 --- a/ucs/ucsconfig.h +++ b/ucs/ucsconfig.h @@ -36,7 +36,7 @@ public: // Produce a const singleton static const ucsconfig *get() { - if (_chat_config == nullptr) + if (_chat_config == nullptr) LoadConfig(); return(_chat_config); } diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index a8c5d7c7b..754808b6c 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.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; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -59,7 +59,7 @@ void WorldServer::OnConnected() void WorldServer::Process() { WorldConnection::Process(); - + if (!Connected()) return; @@ -118,10 +118,10 @@ void WorldServer::Process() case ServerOP_UCSMailMessage: { ServerMailMessageHeader_Struct *mail = (ServerMailMessageHeader_Struct*)pack->pBuffer; - database.SendMail(string("SOE.EQ.") + Config->ShortName + string(".") + string(mail->to), - string(mail->from), - mail->subject, - mail->message, + database.SendMail(string("SOE.EQ.") + Config->ShortName + string(".") + string(mail->to), + string(mail->from), + mail->subject, + mail->message, string()); break; } diff --git a/ucs/worldserver.h b/ucs/worldserver.h index e579b467d..c42ca5ceb 100644 --- a/ucs/worldserver.h +++ b/ucs/worldserver.h @@ -27,7 +27,7 @@ public: WorldServer(); virtual ~WorldServer(); virtual void Process(); - + private: virtual void OnConnected(); }; diff --git a/utils/EQExtractor2/EQExtractor2/ChangeLog.txt b/utils/EQExtractor2/EQExtractor2/ChangeLog.txt index 2181b9279..8fbdcc089 100644 --- a/utils/EQExtractor2/EQExtractor2/ChangeLog.txt +++ b/utils/EQExtractor2/EQExtractor2/ChangeLog.txt @@ -142,7 +142,7 @@ Derision: Redesigned the UI. Use the menu bar, or the following shortcuts: Ctrl-V View Packets Ctrl-A Dump AA Ctrl-D Show Debug Window (hidden by default. Change in Options). - Ctrl-O Set Options (these settings persist across sessions). + Ctrl-O Set Options (these settings persist across sessions). Derision: Added the ability to disable removal of redundant waypoints. Derision: Added an option to only generate SQL for spawns whose name contains a given string. @@ -153,7 +153,7 @@ Derision: Fixed crash when Debug log was closed rather than just hidden. Derision: Replaced HexDump method with a considerably faster version. ==07/14/2010== -Derision: Renamed PatchTestJune242010Decoder to PatchJuly132010Decoder. +Derision: Renamed PatchTestJune242010Decoder to PatchJuly132010Decoder. Derision: Updated patch_May12-2010.conf with current EQEmu patch_Live.conf. Updated version number to 2.0.5 ==06/26/2010== diff --git a/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs b/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs index 58537e9be..5a7d9f0db 100644 --- a/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs +++ b/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs @@ -60,9 +60,9 @@ namespace EQApplicationLayer // Put our supported patch version decoders into the list. PatchList = new List(); - + PatchList.Add(new PatchMay122010Decoder()); - + PatchList.Add(new PatchJuly132010Decoder()); PatchList.Add(new PatchTestSep012010Decoder()); @@ -92,7 +92,7 @@ namespace EQApplicationLayer PatchList.Add(new PatchJuly132012Decoder()); PatchList.Add(new PatchAugust152012Decoder()); - + PatchList.Add(new PatchDecember102012Decoder()); PatchList.Add(new PatchJanuary162013Decoder()); @@ -106,10 +106,10 @@ namespace EQApplicationLayer PatchList.Add(new PatchMarch132013Decoder()); PatchList.Add(new PatchApril152013Decoder()); - + PatchList.Add(new PatchSoD()); - } + } // This is called from the main form to tell us where the application was launched from (where to look for the .conf files) // and also gives us the LogHandler method so we can send debug messages to the main form. @@ -143,7 +143,7 @@ namespace EQApplicationLayer } public string GetDecoderVersion() - { + { // We don't need to check if PatchDecoder is null, because it is always initialised to an instance of the base // PatchSpecficDecoder class return PatchDecoder.GetVersion(); @@ -156,7 +156,7 @@ namespace EQApplicationLayer } public bool DumpPackets(string FileName, bool ShowTimeStamps) - { + { return PatchDecoder.DumpPackets(FileName, ShowTimeStamps); } @@ -187,7 +187,7 @@ namespace EQApplicationLayer else if (TempStatus > Status) Status = TempStatus; } - return Status; + return Status; } // This is called by the main form when all the packets have been processed. It prompts us to pass the packets down @@ -214,7 +214,7 @@ namespace EQApplicationLayer { return PatchDecoder.GetCaptureStartTime(); } - + public string GetZoneName() { return PatchDecoder.GetZoneName(); @@ -255,13 +255,13 @@ namespace EQApplicationLayer SQLOut("DELETE from doors where zone = '" + ZoneName + "' and doorid >= @BaseDoorID and doorid <= @BaseDoorID + " + UpperBound + " and version = " + SpawnVersion + ";"); foreach(Door d in DoorList) - { + { if ((d.OpenType == 57) || (d.OpenType == 58)) - { + { ZonePoint? zp = GetZonePointNumber(d.DoorParam); - + if (zp != null) - { + { d.DestZone = ZoneNumberToName(zp.Value.TargetZoneID); d.DestX = zp.Value.TargetX; d.DestY = zp.Value.TargetY; @@ -276,7 +276,7 @@ namespace EQApplicationLayer SQLOut(DoorQuery); } - } + } public void GenerateSpawnSQL(bool GenerateSpawns, bool GenerateGrids, bool GenerateMerchants, string ZoneName, UInt32 ZoneID, UInt32 SpawnVersion, @@ -325,18 +325,18 @@ namespace EQApplicationLayer NPCSpawnList NPCSL = new NPCSpawnList(); foreach(ZoneEntryStruct Spawn in ZoneSpawns) - { + { if (NPCType.IsMount(Spawn.SpawnName)) continue; if (!IncludeInvisibleMen && (Spawn.Race == 127)) continue; - + Spawn.Findable = (FindableEntities.IndexOf(Spawn.SpawnID) >= 0); - + if (Spawn.IsNPC != 1) continue; - + if (Spawn.PetOwnerID > 0) continue; @@ -346,9 +346,9 @@ namespace EQApplicationLayer bool ColoursInUse = false; for (int ColourSlot = 0; ColourSlot < 9; ++ColourSlot) - { + { if (((Spawn.SlotColour[ColourSlot] & 0x00ffffff) != 0) && UseNPCTypesTint) - ColoursInUse = true; + ColoursInUse = true; } if (Spawn.IsMercenary > 0) @@ -358,7 +358,7 @@ namespace EQApplicationLayer Spawn.BodyType, Spawn.HairColor, Spawn.BeardColor, Spawn.EyeColor1, Spawn.EyeColor2, Spawn.HairStyle, Spawn.Beard, Spawn.DrakkinHeritage, Spawn.DrakkinTattoo, Spawn.DrakkinDetails, Spawn.Deity, Spawn.Class, Spawn.EquipChest2, Spawn.Helm, Spawn.LastName); - + if (ExistingDBID == 0) { @@ -368,7 +368,7 @@ namespace EQApplicationLayer Spawn.Helm, Spawn.LastName, Spawn.Findable, Spawn.MeleeTexture1, Spawn.MeleeTexture2, Spawn.ArmorTintRed, Spawn.ArmorTintGreen, Spawn.ArmorTintBlue, Spawn.SlotColour); NPCTL.AddNPCType(NewNPCType); - + ExistingDBID = NPCTypeDBID++; UInt32 ArmorTintID = 0; @@ -435,17 +435,17 @@ namespace EQApplicationLayer string Spawn2EntryQuery = "INSERT INTO spawn2(`id`, `spawngroupID`, `zone`, `version`, `x`, `y`, `z`, `heading`, `respawntime`, `variance`, `pathgrid`, `_condition`, `cond_value`, `enabled`) VALUES("; Spawn2EntryQuery += "@StartingSpawn2ID + " + Spawn2ID + ", @StartingSpawnGroupID + " + SpawnGroupID + ", '" + ZoneName + "', " + SpawnVersion + ", " + Spawn.XPos + ", " + Spawn.YPos + ", " + Spawn.ZPos + ", "; Spawn2EntryQuery += Spawn.Heading + ", 640, 0, 0, 0, 1, 1);"; - + SpawnGroupID++; SpawnEntryID++; Spawn2ID++; - + if (GenerateSpawns) { SQLOut(SpawnGroupQuery); SQLOut(SpawnEntryQuery); SQLOut(Spawn2EntryQuery); - } + } } if (UpdateExistingNPCTypes) @@ -472,7 +472,7 @@ namespace EQApplicationLayer for (int ColourSlot = 0; ColourSlot < 9; ++ColourSlot) { if (((n.SlotColour[ColourSlot] & 0x00ffffff) != 0) && UseNPCTypesTint) - ColoursInUse = true; + ColoursInUse = true; } if (ColoursInUse) @@ -505,11 +505,11 @@ namespace EQApplicationLayer } if (GenerateGrids) - { + { List AllMovementUpdates = PatchDecoder.GetAllMovementUpdates(); - - foreach (PositionUpdate Update in AllMovementUpdates) - NPCSL.AddWaypoint(Update.SpawnID, Update.p, Update.HighRes); + + foreach (PositionUpdate Update in AllMovementUpdates) + NPCSL.AddWaypoint(Update.SpawnID, Update.p, Update.HighRes); SQLOut("--"); SQLOut("-- Grids"); @@ -520,24 +520,24 @@ namespace EQApplicationLayer foreach (NPCSpawn ns in NPCSL._NPCSpawnList) { if (ns.Waypoints.Count > 1) - { + { bool AllWaypointsTheSame = true; for (int WPNumber = 0; WPNumber < ns.Waypoints.Count; ++WPNumber) - { + { if (WPNumber == 0) continue; if ((ns.Waypoints[WPNumber].x != ns.Waypoints[WPNumber - 1].x) || (ns.Waypoints[WPNumber].y != ns.Waypoints[WPNumber - 1].y) || (ns.Waypoints[WPNumber].z != ns.Waypoints[WPNumber - 1].z)) { - AllWaypointsTheSame = false; + AllWaypointsTheSame = false; } } if (AllWaypointsTheSame) continue; - + int WaypointsInserted = 0; int WPNum = 1; @@ -551,10 +551,10 @@ namespace EQApplicationLayer for (int WPNumber = FirstUsableWaypoint; WPNumber < ns.Waypoints.Count; ++WPNumber) { - Position p = ns.Waypoints[WPNumber]; + Position p = ns.Waypoints[WPNumber]; if (CoalesceWaypoints) - { + { if ((WPNumber > FirstUsableWaypoint) && (WPNumber < (ns.Waypoints.Count - 2))) { Position np = ns.Waypoints[WPNumber + 1]; @@ -579,14 +579,14 @@ namespace EQApplicationLayer } } - // If this is the last waypoint, and we haven't inserted any of the previous ones, then don't bother + // If this is the last waypoint, and we haven't inserted any of the previous ones, then don't bother // with this one either. if ((WPNumber == (ns.Waypoints.Count - 1)) && (WaypointsInserted == 0)) continue; SQLOut("INSERT into grid_entries (`gridid`, `zoneid`, `number`, `x`, `y`, `z`, `heading`, `pause`) VALUES(@StartingGridID + " + GridDBID + ", " + ZoneID + ", " + (WPNum++) + ", " + p.x + ", " + p.y + ", " + p.z + ", " + p.heading + ", " + Pause + ");"); - ++WaypointsInserted; + ++WaypointsInserted; } if (WaypointsInserted > 1) { @@ -598,7 +598,7 @@ namespace EQApplicationLayer SQLOut("UPDATE spawn2 set x = " + ns.Waypoints[1].x + ", y = " + ns.Waypoints[1].y + ", z = " + ns.Waypoints[1].z + ", heading = " + ns.Waypoints[1].heading + " WHERE id = @StartingSpawn2ID + " + ns.Spawn2DBID + ";"); ++GridDBID; - } + } } } } @@ -627,7 +627,7 @@ namespace EQApplicationLayer continue; UInt32 MerchantNPCTypeID = npc.NPCTypeID; - + SQLOut("--"); SQLOut("-- " + npc.Name); SQLOut("-- "); @@ -639,7 +639,7 @@ namespace EQApplicationLayer string Insert = ""; if (mi.Quantity >= 0) - { + { if (!StartOfPlayerSoldItems) { StartOfPlayerSoldItems = true; @@ -662,7 +662,7 @@ namespace EQApplicationLayer SQLOut("UPDATE npc_types SET merchant_id = @StartingMerchantID + " + MerchantDBID + " WHERE id = @StartingNPCTypeID + " + MerchantNPCTypeID + ";"); ++MerchantDBID; - } + } } public void GenerateZonePointSQL(string ZoneName, SQLDestination SQLOut) @@ -671,13 +671,13 @@ namespace EQApplicationLayer { string Insert = String.Format("REPLACE into zone_points(`zone`, `number`, `y`, `x`, `z`, `heading`, `target_y`, `target_x`, `target_z`, `target_heading`, `zoneinst`, `target_zone_id`, `buffer`) VALUES('{0}', {1}, 0, 0, 0, 0, {2}, {3}, {4}, {5}, {6}, {7}, 0);", ZoneName, zp.Number, zp.y, zp.x, zp.z, zp.Heading, zp.Instance, zp.ZoneID); - SQLOut(Insert); + SQLOut(Insert); } } public void GenerateZonePointList() { - ZonePointList = PatchDecoder.GetZonePointList(); + ZonePointList = PatchDecoder.GetZonePointList(); } public ZonePoint? GetZonePointNumber(Int32 Number) @@ -697,7 +697,7 @@ namespace EQApplicationLayer { UInt16 ZoneID = PatchDecoder.GetZoneNumber(); - NewZoneStruct NewZone = PatchDecoder.GetZoneData(); + NewZoneStruct NewZone = PatchDecoder.GetZoneData(); SQLOut("--"); SQLOut("-- Zone Config"); @@ -725,7 +725,7 @@ namespace EQApplicationLayer public bool DumpAAs(string FileName) { return PatchDecoder.DumpAAs(FileName); - } + } public void GenerateObjectSQL(bool DoGroundSpawns, bool DoObjects, UInt32 SpawnVersion, SQLDestination SQLOut) { @@ -794,7 +794,7 @@ namespace EQApplicationLayer case "IT10802_ACTORDEF": return 16; case "IT10803_ACTORDEF": - return 15; + return 15; case "IT10865_ACTORDEF": return 15; case "IT128_ACTORDEF": diff --git a/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj b/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj index 542700b6c..7746d68c5 100644 --- a/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj +++ b/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj @@ -215,7 +215,7 @@ - diff --git a/utils/EQExtractor2/EQExtractor2/EQPacket.cs b/utils/EQExtractor2/EQExtractor2/EQPacket.cs index 775d42de9..a5c921efc 100644 --- a/utils/EQExtractor2/EQExtractor2/EQPacket.cs +++ b/utils/EQExtractor2/EQExtractor2/EQPacket.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// // This is the netcode for turning SOE protocol packets into EQ Application Packets // using System; @@ -45,20 +45,20 @@ namespace EQPacket public DateTime PacketTime; public bool Locked = false; } - + public class PacketManager { bool DEBUG = false; bool DUMPPACKETS = false; - + private void Debug(string Message) { if (DebugLogger != null) - DebugLogger(Message); + DebugLogger(Message); } public bool ErrorsInStream = false; - + const UInt32 OP_SessionRequest = 0x0001; const UInt32 OP_SessionResponse = 0x0002; const UInt32 OP_Combined = 0x0003; @@ -74,7 +74,7 @@ namespace EQPacket private int[] FragmentedPacketSize = {0, 0}; private int[] FragmentedBytesCollected = {0, 0}; private byte[][] Fragments = new byte [2][]; - + private System.Net.IPAddress ServerIP; private ushort ServerPort = 0; @@ -136,7 +136,7 @@ namespace EQPacket PacketList.Add(Packet); } - + private struct CacheEntry { public int Seq; @@ -152,7 +152,7 @@ namespace EQPacket Payload = inPayload; PacketTime = inPacketTime; SubPacket = inSubPacket; - } + } } private List Cache = new List(); @@ -212,7 +212,7 @@ namespace EQPacket int CacheElement; CacheElement = FindCacheEntry(GetExpectedSeq(PacketDirection.ServerToClient), PacketDirection.ServerToClient); - + while ( CacheElement >= 0) { if (DEBUG) @@ -267,8 +267,8 @@ namespace EQPacket ++ExpectedClientSEQ; else if (Direction == PacketDirection.ServerToClient) ++ExpectedServerSEQ; - } - + } + public void ProcessPacket(System.Net.IPAddress srcIp, System.Net.IPAddress dstIp, ushort srcPort, ushort dstPort, byte[] Payload, DateTime PacketTime, bool SubPacket, bool Cached) { byte Flags = 0x00; @@ -313,7 +313,7 @@ namespace EQPacket ServerIP = dstIp; ServerPort = dstPort; - + Log("-- Locked onto EQ Stream. Client IP " + srcIp + ":" + srcPort + " Server IP " + dstIp + ":" + dstPort); ExpectedClientSEQ = 0; @@ -321,7 +321,7 @@ namespace EQPacket ExpectedServerSEQ = 0; CryptoFlag = 0; - + break; } @@ -395,7 +395,7 @@ namespace EQPacket { if (DEBUG) Debug("0xa5"); - + Uncompressed = new byte[Payload.Length - 5]; Array.Copy(Payload, 3, Uncompressed, 0, Payload.Length - 5); @@ -436,12 +436,12 @@ namespace EQPacket AdvanceSeq(Direction); } } - + break; } else AdvanceSeq(Direction); - + bool Multi = ((Uncompressed[2] == 0x00) && (Uncompressed[3] == 0x19)); @@ -473,11 +473,11 @@ namespace EQPacket ++BufferPosition; OpCodeBytes = 3; } - + AppOpCode += (Uncompressed[BufferPosition++] * 256); - + ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, Size - OpCodeBytes, Uncompressed, BufferPosition, Direction, PacketTime); - + BufferPosition = BufferPosition + (Size - OpCodeBytes); } } @@ -494,7 +494,7 @@ namespace EQPacket OpCodeBytes = 3; } - AppOpCode += (Uncompressed[BufferPosition++] * 256); + AppOpCode += (Uncompressed[BufferPosition++] * 256); ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, Uncompressed.Length - (2 + OpCodeBytes), Uncompressed, BufferPosition, Direction, PacketTime); } @@ -539,7 +539,7 @@ namespace EQPacket { Debug("Uncompressed data."); Debug(Utils.HexDump(Uncompressed)); - } + } if (FragmentSeq[(int)Direction] == -1) { @@ -552,7 +552,7 @@ namespace EQPacket Debug("FragmentSeq is " + FragmentSeq[(int)Direction] + " Expecting " + GetExpectedSeq(Direction)); if (FragmentSeq[(int)Direction] != GetExpectedSeq(Direction)) - { + { if (FragmentSeq[(int)Direction] > GetExpectedSeq(Direction)) { if((FragmentSeq[(int)Direction] - GetExpectedSeq(Direction)) < 1000) @@ -569,7 +569,7 @@ namespace EQPacket } } FragmentSeq[(int)Direction] = -1; - + break; } else @@ -636,7 +636,7 @@ namespace EQPacket FragmentSeq[(int)Direction] = -1; } - } + } break; } else @@ -700,7 +700,7 @@ namespace EQPacket AppOpCode += (Fragments[(int)Direction][BufferPosition++] * 256); ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, Size - OpCodeBytes, Fragments[(int)Direction], BufferPosition, Direction, PacketTime); - + BufferPosition = BufferPosition + (Size - OpCodeBytes); } } @@ -721,7 +721,7 @@ namespace EQPacket byte[] NewPacket = new byte[Fragments[(int)Direction].Length - OpCodeBytes]; Array.Copy(Fragments[(int)Direction], BufferPosition, NewPacket, 0, Fragments[(int)Direction].Length - OpCodeBytes); - + ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, NewPacket.Length, NewPacket, 0, Direction, PacketTime); } if (DEBUG) @@ -730,7 +730,7 @@ namespace EQPacket FragmentSeq[(int)Direction] = -1; } } - + break; } case OP_OutOfOrderAck: @@ -750,7 +750,7 @@ namespace EQPacket Seq = Payload[3] * 256 + Payload[4]; else Seq = Payload[2] * 256 + Payload[3]; - + string DirectionString; if(Direction == PacketDirection.ClientToServer) @@ -763,7 +763,7 @@ namespace EQPacket Debug("OP_Ack, Seq " + Seq + " " + DirectionString); Debug(Utils.HexDump(Payload)); } - + break; } default: @@ -776,7 +776,7 @@ namespace EQPacket Debug(Utils.HexDump(Payload)); Debug("-------------------"); } - + int AppOpCode; byte[] NewPacket; @@ -791,7 +791,7 @@ namespace EQPacket else { // This packet has a flag byte between the first and second bytes of the opcode, and also a CRC - + Flags = Payload[1]; if (Flags == 0x5a) @@ -837,7 +837,7 @@ namespace EQPacket } if (!Cached && !CacheEmpty()) - ProcessCache(); + ProcessCache(); } public void ProcessAppPacket(System.Net.IPAddress srcIp, System.Net.IPAddress dstIp, ushort srcPort, ushort dstPort, int InOpCode, int BufferSize, byte[] Source, int Offset, PacketDirection Direction, DateTime PacketTime) @@ -854,7 +854,7 @@ namespace EQPacket PermaLocked = true; } Identified = (TempStatus == IdentificationStatus.Yes); - } + } AddPacket(app); } @@ -885,7 +885,7 @@ namespace EQPacket UncompressedSize = Payload.Length - (Offset - 1); } - + zs.Close(); zs.Dispose(); @@ -897,6 +897,6 @@ namespace EQPacket Array.Resize(ref Uncompressed, UncompressedSize); return Uncompressed; - } + } } } diff --git a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs index 6805e5df2..092ea0375 100644 --- a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs @@ -77,9 +77,9 @@ this.groupBox2.SuspendLayout(); this.MiscOptions.SuspendLayout(); this.SuspendLayout(); - // + // // groupBox1 - // + // this.groupBox1.Controls.Add(this.MerchantTextBox); this.groupBox1.Controls.Add(this.MerchantLabel); this.groupBox1.Controls.Add(this.GroundSpawnTextBox); @@ -108,9 +108,9 @@ this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Insert IDs"; - // + // // MerchantTextBox - // + // this.MerchantTextBox.Enabled = false; this.MerchantTextBox.HidePromptOnLeave = true; this.MerchantTextBox.Location = new System.Drawing.Point(107, 302); @@ -119,18 +119,18 @@ this.MerchantTextBox.PromptChar = ' '; this.MerchantTextBox.Size = new System.Drawing.Size(61, 20); this.MerchantTextBox.TabIndex = 34; - // + // // MerchantLabel - // + // this.MerchantLabel.AutoSize = true; this.MerchantLabel.Location = new System.Drawing.Point(14, 306); this.MerchantLabel.Name = "MerchantLabel"; this.MerchantLabel.Size = new System.Drawing.Size(76, 13); this.MerchantLabel.TabIndex = 33; this.MerchantLabel.Text = "Merchant Lists"; - // + // // GroundSpawnTextBox - // + // this.GroundSpawnTextBox.Enabled = false; this.GroundSpawnTextBox.HidePromptOnLeave = true; this.GroundSpawnTextBox.Location = new System.Drawing.Point(107, 274); @@ -139,18 +139,18 @@ this.GroundSpawnTextBox.PromptChar = ' '; this.GroundSpawnTextBox.Size = new System.Drawing.Size(61, 20); this.GroundSpawnTextBox.TabIndex = 32; - // + // // GroundSpawnLabel - // + // this.GroundSpawnLabel.AutoSize = true; this.GroundSpawnLabel.Location = new System.Drawing.Point(7, 278); this.GroundSpawnLabel.Name = "GroundSpawnLabel"; this.GroundSpawnLabel.Size = new System.Drawing.Size(83, 13); this.GroundSpawnLabel.TabIndex = 31; this.GroundSpawnLabel.Text = "Ground Spawns"; - // + // // ObjectTextBox - // + // this.ObjectTextBox.Enabled = false; this.ObjectTextBox.HidePromptOnLeave = true; this.ObjectTextBox.Location = new System.Drawing.Point(107, 246); @@ -159,18 +159,18 @@ this.ObjectTextBox.PromptChar = ' '; this.ObjectTextBox.Size = new System.Drawing.Size(61, 20); this.ObjectTextBox.TabIndex = 30; - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(47, 250); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(43, 13); this.label1.TabIndex = 29; this.label1.Text = "Objects"; - // + // // GridTextBox - // + // this.GridTextBox.Enabled = false; this.GridTextBox.HidePromptOnLeave = true; this.GridTextBox.Location = new System.Drawing.Point(107, 218); @@ -179,18 +179,18 @@ this.GridTextBox.PromptChar = ' '; this.GridTextBox.Size = new System.Drawing.Size(61, 20); this.GridTextBox.TabIndex = 28; - // + // // GridLabel - // + // this.GridLabel.AutoSize = true; this.GridLabel.Location = new System.Drawing.Point(59, 222); this.GridLabel.Name = "GridLabel"; this.GridLabel.Size = new System.Drawing.Size(31, 13); this.GridLabel.TabIndex = 27; this.GridLabel.Text = "Grids"; - // + // // Spawn2TextBox - // + // this.Spawn2TextBox.Enabled = false; this.Spawn2TextBox.HidePromptOnLeave = true; this.Spawn2TextBox.Location = new System.Drawing.Point(107, 190); @@ -199,18 +199,18 @@ this.Spawn2TextBox.PromptChar = ' '; this.Spawn2TextBox.Size = new System.Drawing.Size(61, 20); this.Spawn2TextBox.TabIndex = 26; - // + // // Spawn2Label - // + // this.Spawn2Label.AutoSize = true; this.Spawn2Label.Location = new System.Drawing.Point(44, 194); this.Spawn2Label.Name = "Spawn2Label"; this.Spawn2Label.Size = new System.Drawing.Size(46, 13); this.Spawn2Label.TabIndex = 25; this.Spawn2Label.Text = "Spawn2"; - // + // // SpawnEntryTextBox - // + // this.SpawnEntryTextBox.Enabled = false; this.SpawnEntryTextBox.HidePromptOnLeave = true; this.SpawnEntryTextBox.Location = new System.Drawing.Point(107, 162); @@ -219,18 +219,18 @@ this.SpawnEntryTextBox.PromptChar = ' '; this.SpawnEntryTextBox.Size = new System.Drawing.Size(61, 20); this.SpawnEntryTextBox.TabIndex = 24; - // + // // SpawnEntryLabel - // + // this.SpawnEntryLabel.AutoSize = true; this.SpawnEntryLabel.Location = new System.Drawing.Point(26, 166); this.SpawnEntryLabel.Name = "SpawnEntryLabel"; this.SpawnEntryLabel.Size = new System.Drawing.Size(64, 13); this.SpawnEntryLabel.TabIndex = 23; this.SpawnEntryLabel.Text = "SpawnEntry"; - // + // // SpawnGroupTextBox - // + // this.SpawnGroupTextBox.Enabled = false; this.SpawnGroupTextBox.HidePromptOnLeave = true; this.SpawnGroupTextBox.Location = new System.Drawing.Point(107, 134); @@ -239,18 +239,18 @@ this.SpawnGroupTextBox.PromptChar = ' '; this.SpawnGroupTextBox.Size = new System.Drawing.Size(61, 20); this.SpawnGroupTextBox.TabIndex = 22; - // + // // SpawnGroupLabel - // + // this.SpawnGroupLabel.AutoSize = true; this.SpawnGroupLabel.Location = new System.Drawing.Point(21, 138); this.SpawnGroupLabel.Name = "SpawnGroupLabel"; this.SpawnGroupLabel.Size = new System.Drawing.Size(69, 13); this.SpawnGroupLabel.TabIndex = 21; this.SpawnGroupLabel.Text = "SpawnGroup"; - // + // // NPCTypesTextBox - // + // this.NPCTypesTextBox.Enabled = false; this.NPCTypesTextBox.HidePromptOnLeave = true; this.NPCTypesTextBox.Location = new System.Drawing.Point(107, 106); @@ -259,18 +259,18 @@ this.NPCTypesTextBox.PromptChar = ' '; this.NPCTypesTextBox.Size = new System.Drawing.Size(61, 20); this.NPCTypesTextBox.TabIndex = 20; - // + // // label3 - // + // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(32, 110); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(58, 13); this.label3.TabIndex = 19; this.label3.Text = "NPCTypes"; - // + // // DoorsTextBox - // + // this.DoorsTextBox.Enabled = false; this.DoorsTextBox.HidePromptOnLeave = true; this.DoorsTextBox.Location = new System.Drawing.Point(107, 78); @@ -279,18 +279,18 @@ this.DoorsTextBox.PromptChar = ' '; this.DoorsTextBox.Size = new System.Drawing.Size(61, 20); this.DoorsTextBox.TabIndex = 18; - // + // // DoorsLabel - // + // this.DoorsLabel.AutoSize = true; this.DoorsLabel.Location = new System.Drawing.Point(55, 82); this.DoorsLabel.Name = "DoorsLabel"; this.DoorsLabel.Size = new System.Drawing.Size(35, 13); this.DoorsLabel.TabIndex = 17; this.DoorsLabel.Text = "Doors"; - // + // // VersionSelector - // + // this.VersionSelector.Enabled = false; this.VersionSelector.Location = new System.Drawing.Point(107, 50); this.VersionSelector.Maximum = new decimal(new int[] { @@ -303,27 +303,27 @@ this.VersionSelector.TabIndex = 16; this.VersionSelector.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.VersionSelector.ValueChanged += new System.EventHandler(this.VersionSelector_ValueChanged); - // + // // VersionLabel - // + // this.VersionLabel.AutoSize = true; this.VersionLabel.Location = new System.Drawing.Point(48, 54); this.VersionLabel.Name = "VersionLabel"; this.VersionLabel.Size = new System.Drawing.Size(42, 13); this.VersionLabel.TabIndex = 15; this.VersionLabel.Text = "Version"; - // + // // label4 - // + // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(44, 26); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(46, 13); this.label4.TabIndex = 14; this.label4.Text = "ZoneID:"; - // + // // ZoneIDTextBox - // + // this.ZoneIDTextBox.Enabled = false; this.ZoneIDTextBox.HidePromptOnLeave = true; this.ZoneIDTextBox.Location = new System.Drawing.Point(107, 22); @@ -333,9 +333,9 @@ this.ZoneIDTextBox.Size = new System.Drawing.Size(100, 20); this.ZoneIDTextBox.TabIndex = 13; this.ZoneIDTextBox.Validated += new System.EventHandler(this.ZoneIDTextBox_Validated); - // + // // groupBox2 - // + // this.groupBox2.Controls.Add(this.InvisibleMenCheckBox); this.groupBox2.Controls.Add(this.NPCTypesTintCheckBox); this.groupBox2.Controls.Add(this.UpdateExistingNPCTypesCheckbox); @@ -353,9 +353,9 @@ this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Include"; - // + // // NPCTypesTintCheckBox - // + // this.NPCTypesTintCheckBox.AutoSize = true; this.NPCTypesTintCheckBox.Location = new System.Drawing.Point(24, 233); this.NPCTypesTintCheckBox.Name = "NPCTypesTintCheckBox"; @@ -365,9 +365,9 @@ this.toolTip1.SetToolTip(this.NPCTypesTintCheckBox, "Uses the npc_types_tint table instead of the tint columns in the npc_types table." + ""); this.NPCTypesTintCheckBox.UseVisualStyleBackColor = true; - // + // // UpdateExistingNPCTypesCheckbox - // + // this.UpdateExistingNPCTypesCheckbox.AutoSize = true; this.UpdateExistingNPCTypesCheckbox.Location = new System.Drawing.Point(24, 210); this.UpdateExistingNPCTypesCheckbox.Name = "UpdateExistingNPCTypesCheckbox"; @@ -376,9 +376,9 @@ this.UpdateExistingNPCTypesCheckbox.Text = "Update existing NPC types"; this.UpdateExistingNPCTypesCheckbox.UseVisualStyleBackColor = true; this.UpdateExistingNPCTypesCheckbox.CheckedChanged += new System.EventHandler(this.UpdateExistingNPCTypesCheckbox_CheckedChanged); - // + // // ZonePointCheckBox - // + // this.ZonePointCheckBox.AutoSize = true; this.ZonePointCheckBox.Checked = true; this.ZonePointCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -388,9 +388,9 @@ this.ZonePointCheckBox.TabIndex = 40; this.ZonePointCheckBox.Text = "Zone Points"; this.ZonePointCheckBox.UseVisualStyleBackColor = true; - // + // // ZoneCheckBox - // + // this.ZoneCheckBox.AutoSize = true; this.ZoneCheckBox.Checked = true; this.ZoneCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -400,9 +400,9 @@ this.ZoneCheckBox.TabIndex = 39; this.ZoneCheckBox.Text = "Zone Config"; this.ZoneCheckBox.UseVisualStyleBackColor = true; - // + // // MerchantCheckBox - // + // this.MerchantCheckBox.AutoSize = true; this.MerchantCheckBox.Checked = true; this.MerchantCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -412,9 +412,9 @@ this.MerchantCheckBox.TabIndex = 38; this.MerchantCheckBox.Text = "Merchant Lists"; this.MerchantCheckBox.UseVisualStyleBackColor = true; - // + // // GroundSpawnCheckBox - // + // this.GroundSpawnCheckBox.AutoSize = true; this.GroundSpawnCheckBox.Checked = true; this.GroundSpawnCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -424,9 +424,9 @@ this.GroundSpawnCheckBox.TabIndex = 9; this.GroundSpawnCheckBox.Text = "Ground Spawns"; this.GroundSpawnCheckBox.UseVisualStyleBackColor = true; - // + // // ObjectCheckBox - // + // this.ObjectCheckBox.AutoSize = true; this.ObjectCheckBox.Checked = true; this.ObjectCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -436,9 +436,9 @@ this.ObjectCheckBox.TabIndex = 8; this.ObjectCheckBox.Text = "Objects"; this.ObjectCheckBox.UseVisualStyleBackColor = true; - // + // // GridCheckBox - // + // this.GridCheckBox.AutoSize = true; this.GridCheckBox.Checked = true; this.GridCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -448,9 +448,9 @@ this.GridCheckBox.TabIndex = 7; this.GridCheckBox.Text = "Grids"; this.GridCheckBox.UseVisualStyleBackColor = true; - // + // // SpawnCheckBox - // + // this.SpawnCheckBox.AutoSize = true; this.SpawnCheckBox.Checked = true; this.SpawnCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -461,9 +461,9 @@ this.SpawnCheckBox.Text = "Spawns"; this.SpawnCheckBox.UseVisualStyleBackColor = true; this.SpawnCheckBox.CheckedChanged += new System.EventHandler(this.SpawnCheckBox_CheckedChanged); - // + // // DoorCheckBox - // + // this.DoorCheckBox.AutoSize = true; this.DoorCheckBox.Checked = true; this.DoorCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -473,14 +473,14 @@ this.DoorCheckBox.TabIndex = 4; this.DoorCheckBox.Text = "Doors"; this.DoorCheckBox.UseVisualStyleBackColor = true; - // + // // SQLFileDialog - // + // this.SQLFileDialog.Filter = "SQL Files (*.sql)|*.sql|Text Files (*.txt)|*.txt|All files (*.*)|*.*"; this.SQLFileDialog.Title = "Generate SQL and Save As"; - // + // // GenerateSQLButton - // + // this.GenerateSQLButton.Location = new System.Drawing.Point(126, 474); this.GenerateSQLButton.Name = "GenerateSQLButton"; this.GenerateSQLButton.Size = new System.Drawing.Size(100, 27); @@ -488,9 +488,9 @@ this.GenerateSQLButton.Text = "Generate SQL"; this.GenerateSQLButton.UseVisualStyleBackColor = true; this.GenerateSQLButton.Click += new System.EventHandler(this.GenerateSQLButton_Click); - // + // // SQLCancelButton - // + // this.SQLCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.SQLCancelButton.Location = new System.Drawing.Point(305, 474); this.SQLCancelButton.Name = "SQLCancelButton"; @@ -499,9 +499,9 @@ this.SQLCancelButton.Text = "Cancel"; this.SQLCancelButton.UseVisualStyleBackColor = true; this.SQLCancelButton.Click += new System.EventHandler(this.SQLCancelButton_Click); - // + // // MiscOptions - // + // this.MiscOptions.Controls.Add(this.SpawnNameFilter); this.MiscOptions.Controls.Add(this.label2); this.MiscOptions.Controls.Add(this.CoalesceWaypoints); @@ -511,25 +511,25 @@ this.MiscOptions.TabIndex = 2; this.MiscOptions.TabStop = false; this.MiscOptions.Text = "Misc. Options"; - // + // // SpawnNameFilter - // + // this.SpawnNameFilter.Location = new System.Drawing.Point(229, 46); this.SpawnNameFilter.Name = "SpawnNameFilter"; this.SpawnNameFilter.Size = new System.Drawing.Size(209, 20); this.SpawnNameFilter.TabIndex = 5; - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(14, 49); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(209, 13); this.label2.TabIndex = 4; this.label2.Text = "Only include spawns that contain the string"; - // + // // CoalesceWaypoints - // + // this.CoalesceWaypoints.AutoSize = true; this.CoalesceWaypoints.Checked = true; this.CoalesceWaypoints.CheckState = System.Windows.Forms.CheckState.Checked; @@ -540,9 +540,9 @@ this.CoalesceWaypoints.Text = "Automatically coalesce waypoints"; this.toolTip1.SetToolTip(this.CoalesceWaypoints, "Remove redundant waypoints from generated SQL"); this.CoalesceWaypoints.UseVisualStyleBackColor = true; - // + // // InvisibleMenCheckBox - // + // this.InvisibleMenCheckBox.AutoSize = true; this.InvisibleMenCheckBox.Location = new System.Drawing.Point(24, 256); this.InvisibleMenCheckBox.Name = "InvisibleMenCheckBox"; @@ -551,9 +551,9 @@ this.InvisibleMenCheckBox.Text = "Include Invisible Men"; this.toolTip1.SetToolTip(this.InvisibleMenCheckBox, "Includes Race 127 NPCs"); this.InvisibleMenCheckBox.UseVisualStyleBackColor = true; - // + // // GenerateSQLForm - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.SQLCancelButton; diff --git a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs index d937b495f..b282bf9a7 100644 --- a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs +++ b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs @@ -96,8 +96,8 @@ namespace EQExtractor2 this.DialogResult = DialogResult.Cancel; } - + } - + } diff --git a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx index 183eb2750..5781a59db 100644 --- a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx +++ b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/InternalTypes.cs b/utils/EQExtractor2/EQExtractor2/InternalTypes.cs index 645aaea00..faa588627 100644 --- a/utils/EQExtractor2/EQExtractor2/InternalTypes.cs +++ b/utils/EQExtractor2/EQExtractor2/InternalTypes.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.Collections.Generic; @@ -21,7 +21,7 @@ namespace EQExtractor2.InternalTypes public UInt32 DropID; public string Name; public UInt16 ZoneID; - public UInt16 InstanceID; + public UInt16 InstanceID; public float Heading; public float y; public float x; @@ -64,7 +64,7 @@ namespace EQExtractor2.InternalTypes public UInt16 ZoneID; public UInt16 InstanceID; public byte FallDamage; - public float FogDensity; + public float FogDensity; } public class ZoneEntryStruct @@ -76,16 +76,16 @@ namespace EQExtractor2.InternalTypes } public string SpawnName; - public UInt32 SpawnID; + public UInt32 SpawnID; public bool Findable; public Byte Level; - public Byte IsNPC; + public Byte IsNPC; public uint Showname; public uint TargetableWithHotkey; - public uint Targetable; + public uint Targetable; public uint ShowHelm; public uint Gender; - public byte OtherData; + public byte OtherData; public string DestructableString1; public string DestructableString2; public string DestructableString3; @@ -120,21 +120,21 @@ namespace EQExtractor2.InternalTypes public UInt32 DrakkinTattoo; public UInt32 DrakkinDetails; public UInt32 Deity; - public byte Class; - public byte EquipChest2; + public byte Class; + public byte EquipChest2; public byte Helm; public string LastName; public UInt32 PetOwnerID; public float YPos; - public float Heading; - public float XPos; - public float ZPos; + public float Heading; + public float XPos; + public float ZPos; public UInt32[] SlotColour; public byte ArmorTintRed; public byte ArmorTintGreen; - public byte ArmorTintBlue; + public byte ArmorTintBlue; public UInt32 MeleeTexture1; - public UInt32 MeleeTexture2; + public UInt32 MeleeTexture2; public UInt32[] Equipment; public string Title; public string Suffix; @@ -383,7 +383,7 @@ namespace EQExtractor2.InternalTypes public UInt16 Instance; public float x; public float y; - public float z; + public float z; public float TargetX; public float TargetY; public float TargetZ; @@ -575,7 +575,7 @@ namespace EQExtractor2.InternalTypes public Position p; - public bool HighRes; + public bool HighRes; } public class ExplorerSpawnRecord @@ -632,7 +632,7 @@ namespace EQExtractor2.InternalTypes public float DestY; public float DestZ; public float DestHeading; - + } class MerchantManager { diff --git a/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs b/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs index b1531ee72..be5c03559 100644 --- a/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs @@ -30,9 +30,9 @@ { this.ConsoleWindow = new System.Windows.Forms.ListBox(); this.SuspendLayout(); - // + // // ConsoleWindow - // + // this.ConsoleWindow.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); @@ -44,9 +44,9 @@ this.ConsoleWindow.Name = "ConsoleWindow"; this.ConsoleWindow.Size = new System.Drawing.Size(938, 326); this.ConsoleWindow.TabIndex = 35; - // + // // LogForm - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(962, 355); diff --git a/utils/EQExtractor2/EQExtractor2/LogForm.cs b/utils/EQExtractor2/EQExtractor2/LogForm.cs index c836aa1af..9a0cde667 100644 --- a/utils/EQExtractor2/EQExtractor2/LogForm.cs +++ b/utils/EQExtractor2/EQExtractor2/LogForm.cs @@ -21,6 +21,6 @@ namespace EQExtractor2 e.Cancel = true; this.Hide(); } - + } } diff --git a/utils/EQExtractor2/EQExtractor2/LogForm.resx b/utils/EQExtractor2/EQExtractor2/LogForm.resx index 1af7de150..8b2ff64a1 100644 --- a/utils/EQExtractor2/EQExtractor2/LogForm.resx +++ b/utils/EQExtractor2/EQExtractor2/LogForm.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs b/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs index 21b980190..a862a3119 100644 --- a/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs +++ b/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; @@ -124,8 +124,8 @@ namespace EQExtractor2.OpCodes public void ResetCounts() { - foreach (OpCode oc in OpCodeList) - oc.Count = 0; + foreach (OpCode oc in OpCodeList) + oc.Count = 0; } public void RegisterExplorer(string Name, ExplorerMethod Explorer) @@ -137,7 +137,7 @@ namespace EQExtractor2.OpCodes oc.Explorer = Explorer; return; } - } + } } public void UnRegisterExplorer(string Name) diff --git a/utils/EQExtractor2/EQExtractor2/PacketDotNet.dll b/utils/EQExtractor2/EQExtractor2/PacketDotNet.dll index 560b03feeb7c309222b903e2534961cd9f0154d9..4f1a6c42fc3d0e5be377ad60c60675879b50b32d 100644 GIT binary patch delta 18 acmZoT!utO(>jv(Y$sg+^HmkJUxeEYS2nl`w delta 20 ccmex=n6=>u>jv%?M$X9}>m)WSx7@i40AYg(hX4Qo diff --git a/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs index 9ae389832..153a3304f 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs @@ -14,8 +14,8 @@ namespace EQExtractor2.Patches public PatchApril152013Decoder() { Version = "EQ Client Build Date April 15 2013."; - - PatchConfFileName = "patch_April15-2013.conf"; + + PatchConfFileName = "patch_April15-2013.conf"; SupportsSQLGeneration = true; } @@ -204,7 +204,7 @@ namespace EQExtractor2.Patches UInt32 Position4 = Buffer.ReadUInt32(); UInt32 Position5 = Buffer.ReadUInt32(); - + NewSpawn.YPos = Utils.EQ19ToFloat((Int32)((Position1 >> 12) & 0x7FFFF)); NewSpawn.ZPos = Utils.EQ19ToFloat((Int32)(Position2) & 0x7FFFF); diff --git a/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs index df72a7ed1..d291093fa 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs @@ -13,7 +13,7 @@ namespace EQExtractor2.Patches public PatchAug042011Decoder() { Version = "EQ Client Build Date August 04 2011."; - + ExpectedPPLength = 28496; PPZoneIDOffset = 21164; diff --git a/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs index 9351f0663..d05902add 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs @@ -17,7 +17,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = 33904; PPZoneIDOffset = 26572; - + PatchConfFileName = "patch_August15-2012.conf"; } @@ -28,10 +28,10 @@ namespace EQExtractor2.Patches Item NewItem = new Item(); Buffer.SetPosition(30); - NewItem.MerchantSlot = Buffer.ReadByte(); - NewItem.Price = Buffer.ReadUInt32(); + NewItem.MerchantSlot = Buffer.ReadByte(); + NewItem.Price = Buffer.ReadUInt32(); Buffer.SkipBytes(5); - NewItem.Quantity = Buffer.ReadInt32(); + NewItem.Quantity = Buffer.ReadInt32(); Buffer.SetPosition(109); // 109 NewItem.Name = Buffer.ReadString(true); diff --git a/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs index 97b109900..416e3abef 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs @@ -15,7 +15,7 @@ namespace EQExtractor2.Patches Version = "EQ Client Build Date December 7 2010."; PatchConfFileName = "patch_Dec7-2010.conf"; - + } override public IdentificationStatus Identify(int OpCode, int Size, PacketDirection Direction) { @@ -31,7 +31,7 @@ namespace EQExtractor2.Patches public override void RegisterExplorers() { - //OpManager.RegisterExplorer("OP_ClientUpdate", ExploreClientUpdate); + //OpManager.RegisterExplorer("OP_ClientUpdate", ExploreClientUpdate); } public void ExploreClientUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) @@ -42,7 +42,7 @@ namespace EQExtractor2.Patches float y = Buffer.ReadSingle(); Buffer.SkipBytes(12); float z = Buffer.ReadSingle(); - + Buffer.SkipBytes(4); UInt32 Temp = Buffer.ReadUInt32(); Temp = Temp & 0x3FFFFF; diff --git a/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs index 4b9c29479..f6b43f709 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs @@ -18,7 +18,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = -1; PPZoneIDOffset = -1; - + PatchConfFileName = "patch_Dec10-2012.conf"; PacketsToMatch = new PacketToMatch[] { @@ -31,7 +31,7 @@ namespace EQExtractor2.Patches } override public IdentificationStatus Identify(int OpCode, int Size, PacketDirection Direction) - { + { if ((OpCode == OpManager.OpCodeNameToNumber(PacketsToMatch[WaitingForPacket].OPCodeName)) && (Direction == PacketsToMatch[WaitingForPacket].Direction)) { @@ -42,7 +42,7 @@ namespace EQExtractor2.Patches return IdentificationStatus.Yes; WaitingForPacket++; - + return IdentificationStatus.Tentative; } @@ -119,8 +119,8 @@ namespace EQExtractor2.Patches ByteStream Buffer = new ByteStream(PlayerProfilePacket[0]); - Buffer.SkipBytes(24); - + Buffer.SkipBytes(24); + UInt32 BindCount = Buffer.ReadUInt32(); for (int i = 0; i < BindCount; ++i) @@ -129,7 +129,7 @@ namespace EQExtractor2.Patches } Buffer.SkipBytes(8); // Deity, intoxication - UInt32 SpellRefreshCount = Buffer.ReadUInt32(); + UInt32 SpellRefreshCount = Buffer.ReadUInt32(); for (int i = 0; i < SpellRefreshCount; ++i) { @@ -137,20 +137,20 @@ namespace EQExtractor2.Patches } UInt32 EquipmentCount = Buffer.ReadUInt32(); - + for (int i = 0; i < EquipmentCount; ++i) { Buffer.SkipBytes(20); } - UInt32 SomethingCount = Buffer.ReadUInt32(); + UInt32 SomethingCount = Buffer.ReadUInt32(); for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(20); } - SomethingCount = Buffer.ReadUInt32(); + SomethingCount = Buffer.ReadUInt32(); for (int i = 0; i < SomethingCount; ++i) { @@ -158,7 +158,7 @@ namespace EQExtractor2.Patches } SomethingCount = Buffer.ReadUInt32(); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); @@ -169,25 +169,25 @@ namespace EQExtractor2.Patches UInt32 Points = Buffer.ReadUInt32(); UInt32 Mana = Buffer.ReadUInt32(); UInt32 CurHP = Buffer.ReadUInt32(); - + Buffer.SkipBytes(28); Buffer.SkipBytes(28); UInt32 AACount = Buffer.ReadUInt32(); - + for (int i = 0; i < AACount; ++i) { Buffer.SkipBytes(12); } SomethingCount = Buffer.ReadUInt32(); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); } SomethingCount = Buffer.ReadUInt32(); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); @@ -305,7 +305,7 @@ namespace EQExtractor2.Patches UInt16 ZoneID = Buffer.ReadUInt16(); return ZoneID; - + } override public List GetSpawns() @@ -335,7 +335,7 @@ namespace EQExtractor2.Patches UInt32 Bitfield = Buffer.ReadUInt32(); NewSpawn.Gender = (Bitfield & 3); - + Byte OtherData = Buffer.ReadByte(); Buffer.SkipBytes(8); // Skip 8 unknown bytes @@ -367,7 +367,7 @@ namespace EQExtractor2.Patches NewSpawn.BodyType = Buffer.ReadUInt32(); else NewSpawn.BodyType = 0; - + for (int j = 1; j < NewSpawn.PropCount; ++j) Buffer.SkipBytes(4); @@ -399,9 +399,9 @@ namespace EQExtractor2.Patches NewSpawn.WalkSpeed = Buffer.ReadSingle(); NewSpawn.RunSpeed = Buffer.ReadSingle(); - + NewSpawn.Race = Buffer.ReadUInt32(); - + Buffer.SkipBytes(1); // Skip Holding NewSpawn.Deity = Buffer.ReadUInt32(); @@ -411,9 +411,9 @@ namespace EQExtractor2.Patches NewSpawn.Class = Buffer.ReadByte(); Buffer.SkipBytes(4); // Skip PVP, Standstate, Light, Flymode - + NewSpawn.LastName = Buffer.ReadString(true); - + Buffer.SkipBytes(6); NewSpawn.PetOwnerID = Buffer.ReadUInt32(); @@ -421,7 +421,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(25); NewSpawn.MeleeTexture1 = 0; - NewSpawn.MeleeTexture2 = 0; + NewSpawn.MeleeTexture2 = 0; if ( (NewSpawn.IsNPC == 0) || NPCType.IsPlayableRace(NewSpawn.Race)) { @@ -501,7 +501,7 @@ namespace EQExtractor2.Patches NewSpawn.Heading = Utils.EQ19ToFloat((Int32)(Position5) & 0x7FFFF); - + if ((OtherData & 16) > 0) @@ -626,7 +626,7 @@ namespace EQExtractor2.Patches DecodeItemPacket(OutputStream, Buffer, Direction); } - + } @@ -669,7 +669,7 @@ namespace EQExtractor2.Patches String Desc = Buffer.ReadString(false); - + OutputStream.WriteLine("Duration: {0}, Unk4: {1:X}, StartTime: {2:X}", Duration, Unk4, StartTime); OutputStream.WriteLine("Desc: {0}", Desc); @@ -765,7 +765,7 @@ namespace EQExtractor2.Patches } OutputStream.WriteLine(""); //OutputStream.WriteLine("Offset is now: {0}", Buffer.GetPosition()); - + } } @@ -803,7 +803,7 @@ namespace EQExtractor2.Patches //float DeltaHeading = Utils.EQ19ToFloat((int)(Word & 0x3FF)); } - + } @@ -843,11 +843,11 @@ namespace EQExtractor2.Patches OutputStream.WriteLine(""); UInt32 BindCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: BindCount = {1}", Buffer.GetPosition() - 4, BindCount); - + for (int i = 0; i < BindCount; ++i) { OutputStream.WriteLine("{0, -5}: Bind: {1} Zone: {2} XYZ: {3},{4},{5} Heading: {6}", - Buffer.GetPosition(), i, Buffer.ReadUInt32(), Buffer.ReadSingle(), Buffer.ReadSingle(),Buffer.ReadSingle(),Buffer.ReadSingle()); + Buffer.GetPosition(), i, Buffer.ReadUInt32(), Buffer.ReadSingle(), Buffer.ReadSingle(),Buffer.ReadSingle(),Buffer.ReadSingle()); } OutputStream.WriteLine(""); @@ -858,10 +858,10 @@ namespace EQExtractor2.Patches //Buffer.SkipBytes(8); // Deity, intoxication UInt32 UnknownCount = Buffer.ReadUInt32(); - + OutputStream.WriteLine("{0, -5}: Unknown Count = {1}", Buffer.GetPosition() - 4, UnknownCount); - + for (int i = 0; i < UnknownCount; ++i) { @@ -872,7 +872,7 @@ namespace EQExtractor2.Patches UInt32 EquipmentCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: EquipmentCount = {1}", Buffer.GetPosition() - 4, EquipmentCount); - + for (int i = 0; i < EquipmentCount; ++i) { OutputStream.Write("{0, -5}: Equip: {1} Values: ", Buffer.GetPosition(), i); @@ -901,7 +901,7 @@ namespace EQExtractor2.Patches UInt32 TintCount = Buffer.ReadUInt32(); - OutputStream.WriteLine("{0, -5}: TintCount = {1}", Buffer.GetPosition() - 4, TintCount); + OutputStream.WriteLine("{0, -5}: TintCount = {1}", Buffer.GetPosition() - 4, TintCount); for (int i = 0; i < TintCount; ++i) { @@ -976,8 +976,8 @@ namespace EQExtractor2.Patches UInt32 AACount = Buffer.ReadUInt32(); - OutputStream.WriteLine("{0, -5}: AA Count = {1}", Buffer.GetPosition() - 4, AACount); - + OutputStream.WriteLine("{0, -5}: AA Count = {1}", Buffer.GetPosition() - 4, AACount); + for (int i = 0; i < AACount; ++i) { @@ -988,25 +988,25 @@ namespace EQExtractor2.Patches UInt32 SkillCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Skill Count = {1}", Buffer.GetPosition() - 4, SkillCount); - + for (int i = 0; i < SkillCount; ++i) { Buffer.SkipBytes(4); } - + UInt32 SomethingCount = Buffer.ReadUInt32(); - OutputStream.WriteLine("{0, -5}: Something Count = {1}", Buffer.GetPosition() - 4, SomethingCount); - + OutputStream.WriteLine("{0, -5}: Something Count = {1}", Buffer.GetPosition() - 4, SomethingCount); + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); } - + UInt32 DisciplineCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Discipline Count = {1}", Buffer.GetPosition() - 4, DisciplineCount); - + for (int i = 0; i < DisciplineCount; ++i) { Buffer.SkipBytes(4); @@ -1014,12 +1014,12 @@ namespace EQExtractor2.Patches UInt32 TimeStampCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: TimeStamp Count = {1}", Buffer.GetPosition() - 4, TimeStampCount); - + for (int i = 0; i < TimeStampCount; ++i) { Buffer.SkipBytes(4); } - + UInt32 RecastCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Recast Count = {1}", Buffer.GetPosition() - 4, RecastCount); @@ -1037,11 +1037,11 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); } - + UInt32 SpellBookSlots = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: SpellBookSlot Count = {1}", Buffer.GetPosition() - 4, SpellBookSlots); - + for (int i = 0; i < SpellBookSlots; ++i) { Buffer.SkipBytes(4); @@ -1050,7 +1050,7 @@ namespace EQExtractor2.Patches UInt32 SpellMemSlots = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Spell Mem Count = {1}", Buffer.GetPosition() - 4, SpellMemSlots); - + for (int i = 0; i < SpellMemSlots; ++i) { Buffer.SkipBytes(4); @@ -1059,18 +1059,18 @@ namespace EQExtractor2.Patches SomethingCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Unknown Count = {1}", Buffer.GetPosition() - 4, SomethingCount); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); } OutputStream.WriteLine("{0, -5}: Unknown = {1}", Buffer.GetPosition(), Buffer.ReadByte()); - + UInt32 BuffCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Buff Count = {1}", Buffer.GetPosition() - 4, BuffCount); - + for (int i = 0; i < BuffCount; ++i) { Buffer.ReadByte(); @@ -1104,7 +1104,7 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: Unknown = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Thirst? = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Hunger? = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); - + //Buffer.SkipBytes(20); OutputStream.WriteLine("{0, -5}: AA Spent = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); @@ -1118,14 +1118,14 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: AA Spent Special = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: AA Unspent = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown", Buffer.GetPosition(), Buffer.ReadUInt16()); - + //Buffer.SkipBytes(30); UInt32 BandolierCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Bandolier Count = {1}", Buffer.GetPosition() - 4, BandolierCount); - + for (int i = 0; i < BandolierCount; ++i) { Buffer.ReadString(false); @@ -1146,11 +1146,11 @@ namespace EQExtractor2.Patches UInt32 PotionCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Potion Count = {1}", Buffer.GetPosition() - 4, PotionCount); - + for (int i = 0; i < PotionCount; ++i) { Buffer.ReadString(false); - Buffer.SkipBytes(8); + Buffer.SkipBytes(8); } OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadInt32()); @@ -1186,7 +1186,7 @@ namespace EQExtractor2.Patches int CurrentPosition = Buffer.GetPosition(); OutputStream.WriteLine("{0, -5}: Name: {1}", Buffer.GetPosition(), Buffer.ReadString(false)); - + Buffer.SetPosition(CurrentPosition + (int)NameLength); UInt32 LastNameLength = Buffer.ReadUInt32(); @@ -1209,10 +1209,10 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: Language Count = {1}", Buffer.GetPosition() - 4, LanguageCount); for (int i = 0; i < LanguageCount; ++i) - { + { Buffer.SkipBytes(1); } - + OutputStream.WriteLine("{0, -5}: Zone ID {1}", Buffer.GetPosition(), Buffer.ReadUInt16()); OutputStream.WriteLine("{0, -5}: Zone Instance {1}", Buffer.GetPosition(), Buffer.ReadUInt16()); OutputStream.WriteLine("{0, -5}: Y,X,Z {1},{2},{3} Heading: {4}", @@ -1341,7 +1341,7 @@ namespace EQExtractor2.Patches for(int i = 0; i < Unknown6; ++i) OutputStream.WriteLine("{0, -5}: Unknown LDON? {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); - + OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); @@ -1358,7 +1358,7 @@ namespace EQExtractor2.Patches // Air remaining ? OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); - // Next 7 could be PVP stats, + // Next 7 could be PVP stats, OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); @@ -1426,16 +1426,16 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: Showhelm? {1}", Buffer.GetPosition(), Buffer.ReadByte()); OutputStream.WriteLine("{0, -5}: RestTimer? {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); - + OutputStream.WriteLine("Skipping 1028 bytes starting at offset {0}", Buffer.GetPosition()); Buffer.SkipBytes(1028); - + OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("Pointer is {0} bytes from end.", Buffer.Length() - Buffer.GetPosition()); - + } @@ -1490,12 +1490,12 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("Properties = {0}, Offset now {1}", Properties, Buffer.GetPosition()); UInt32 BodyType = 0; - + if(Properties > 0) BodyType = Buffer.ReadUInt32(); OutputStream.WriteLine("Bodytype = {0}", BodyType); - + if (Properties != 1) OutputStream.WriteLine("XXXX Properties is {0}", Properties); @@ -1552,7 +1552,7 @@ namespace EQExtractor2.Patches { UInt32 Equip3 = Buffer.ReadUInt32(); - UInt32 Equipx = Buffer.ReadUInt32(); + UInt32 Equipx = Buffer.ReadUInt32(); UInt32 Equip2 = Buffer.ReadUInt32(); @@ -1560,13 +1560,13 @@ namespace EQExtractor2.Patches UInt32 Equip0 = Buffer.ReadUInt32(); - OutputStream.WriteLine("Equip slot {0}: 0,1,2,x,3 is {1}, {2}, {3}, {4}, {5}", i, + OutputStream.WriteLine("Equip slot {0}: 0,1,2,x,3 is {1}, {2}, {3}, {4}, {5}", i, Equip0, Equip1, Equip2, Equipx, Equip3); } - - + + } else @@ -1635,7 +1635,7 @@ namespace EQExtractor2.Patches if (Buffer.Length() != Buffer.GetPosition()) OutputStream.WriteLine("PARSE ERROR"); - + diff --git a/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs index 02c1e4430..5b4054726 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs @@ -44,7 +44,7 @@ namespace EQExtractor2.Patches ByteStream Buffer = new ByteStream(PacketBuffer); Item NewItem = new Item(); - + Buffer.SetPosition(30); NewItem.MerchantSlot = Buffer.ReadByte(); // 13 NewItem.Price = Buffer.ReadUInt32(); // 14 diff --git a/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs index 2464e6f2d..9226e5b19 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs @@ -14,10 +14,10 @@ namespace EQExtractor2.Patches public PatchFebruary112013Decoder() { Version = "EQ Client Build Date February 11 2013."; - + PatchConfFileName = "patch_Feb11-2013.conf"; - PacketsToMatch = new PacketToMatch[] { + PacketsToMatch = new PacketToMatch[] { new PacketToMatch { OPCodeName = "OP_ZoneEntry", Direction = PacketDirection.ClientToServer, RequiredSize = 76, VersionMatched = false }, new PacketToMatch { OPCodeName = "OP_PlayerProfile", Direction = PacketDirection.ServerToClient, RequiredSize = -1, VersionMatched = true }, }; @@ -691,7 +691,7 @@ namespace EQExtractor2.Patches // Air remaining ? OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); - // Next 7 could be PVP stats, + // Next 7 could be PVP stats, OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); diff --git a/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs b/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs index 5457c0ba2..c714041b5 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs @@ -36,7 +36,7 @@ namespace EQExtractor2.Patches { return Version; } - + virtual public bool UnsupportedVersion() { return ExpectedPPLength == 0; @@ -70,7 +70,7 @@ namespace EQExtractor2.Patches { return 0; } - + virtual public MerchantManager GetMerchantData(NPCSpawnList NPCSL) { return null; @@ -128,7 +128,7 @@ namespace EQExtractor2.Patches virtual public PositionUpdate Decode_OP_NPCMoveUpdate(byte[] UpdatePacket) { - PositionUpdate PosUpdate = new PositionUpdate(); + PositionUpdate PosUpdate = new PositionUpdate(); return PosUpdate; } @@ -165,12 +165,12 @@ namespace EQExtractor2.Patches { return ""; } - + virtual public bool DumpAAs(string FileName) { return false; } - + public void GivePackets(PacketManager pm) { Packets = pm; @@ -281,7 +281,7 @@ namespace EQExtractor2.Patches return ""; } - + protected PacketManager Packets; public OpCodeManager OpManager; diff --git a/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs index f43df3233..589ce30fd 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs @@ -14,8 +14,8 @@ namespace EQExtractor2.Patches public PatchJanuary162013Decoder() { Version = "EQ Client Build Date January 16 2013."; - - PatchConfFileName = "patch_Jan16-2013.conf"; + + PatchConfFileName = "patch_Jan16-2013.conf"; } override public List GetSpawns() @@ -240,7 +240,7 @@ namespace EQExtractor2.Patches { //OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); //OpManager.RegisterExplorer("OP_NPCMoveUpdate", ExploreNPCMoveUpdate); - //OpManager.RegisterExplorer("OP_MobUpdate", ExploreMobUpdate); + //OpManager.RegisterExplorer("OP_MobUpdate", ExploreMobUpdate); } public void ExploreNPCMoveUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) diff --git a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs index dcc8eafe6..acfefceb3 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; using System.Collections.Generic; @@ -45,7 +45,7 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("Item: {0} at Slot: {1}", Name, Slot); } - + public void ExploreCastSpell(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) { @@ -138,6 +138,6 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("\r\nBuffer position at end is {0}", Buffer.GetPosition()); OutputStream.WriteLine(""); } - + } } diff --git a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs index bd037eca7..67b6ec412 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs @@ -17,8 +17,8 @@ namespace EQExtractor2.Patches ExpectedPPLength = 33784; PPZoneIDOffset = 26452; - + PatchConfFileName = "patch_July13-2012.conf"; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs index 98f5b0e75..090fde73b 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs @@ -13,8 +13,8 @@ namespace EQExtractor2.Patches public PatchJune252012Decoder() { Version = "EQ Client Build Date June 25 2012."; - + PatchConfFileName = "patch_June25-2012.conf"; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs index 00c65a5b7..e98c2003e 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs @@ -22,7 +22,7 @@ namespace EQExtractor2.Patches } public override void RegisterExplorers() - { + { //OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); } @@ -32,7 +32,7 @@ namespace EQExtractor2.Patches return; string SpawnName = Buffer.ReadString(true); - + UInt32 SpawnID = Buffer.ReadUInt32(); byte Level = Buffer.ReadByte(); @@ -102,7 +102,7 @@ namespace EQExtractor2.Patches Buffer.ReadByte(); - + } OutputStream.WriteLine("Size starts at offset {0}", Buffer.GetPosition()); @@ -372,7 +372,7 @@ namespace EQExtractor2.Patches NewSpawn.XPos = Utils.EQ19ToFloat((Int32)(Position4 >> 12) & 0x7FFFF); NewSpawn.ZPos = Utils.EQ19ToFloat((Int32)(Position5 & 0x7FFFF)); - + NewSpawn.MeleeTexture1 = 0; NewSpawn.MeleeTexture2 = 0; diff --git a/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs index a4bac3b81..d70572b2b 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs @@ -14,12 +14,12 @@ namespace EQExtractor2.Patches public PatchMarch132013Decoder() { Version = "EQ Client Build Date March 13 2013."; - - PatchConfFileName = "patch_Mar13-2013.conf"; + + PatchConfFileName = "patch_Mar13-2013.conf"; SupportsSQLGeneration = true; } - + override public List GetDoors() { List DoorList = new List(); diff --git a/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs index 2ec152125..c189749e9 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs @@ -18,7 +18,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = 28536; - PPZoneIDOffset = 21204; - } + PPZoneIDOffset = 21204; + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs index d31c6d172..20e4253a3 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; @@ -26,14 +26,14 @@ namespace EQExtractor2.Patches public PatchMay122010Decoder() { Version = "EQ Client Build Date May 12 2010. (Valid up to and including Build Date June 8 2010)"; - + PatchConfFileName = "patch_May12-2010.conf"; - + ExpectedPPLength = 26632; - + PPZoneIDOffset = 19396; } - + override public bool Init(string ConfDirectory, ref string ErrorMessage) { OpManager = new OpCodeManager(); @@ -94,7 +94,7 @@ namespace EQExtractor2.Patches List PlayerProfilePacket = GetPacketsOfType("OP_PlayerProfile", PacketDirection.ServerToClient); if (PlayerProfilePacket.Count == 0) - { + { return 0; } else @@ -107,7 +107,7 @@ namespace EQExtractor2.Patches return BitConverter.ToUInt16(PlayerProfilePacket[0], PPZoneIDOffset); } - + override public List GetDoors() { List DoorList = new List(); @@ -159,7 +159,7 @@ namespace EQExtractor2.Patches DoorParam, DestZone, 0, 0, 0, 0); DoorList.Add(NewDoor); - + } return DoorList; } @@ -221,7 +221,7 @@ namespace EQExtractor2.Patches { ByteStream Buffer = new ByteStream(PacketBuffer); - Item NewItem = new Item(); + Item NewItem = new Item(); NewItem.StackSize = Buffer.ReadUInt32(); Buffer.SkipBytes(4); @@ -233,7 +233,7 @@ namespace EQExtractor2.Patches NewItem.Name = Buffer.ReadString(true); NewItem.Lore = Buffer.ReadString(true); NewItem.IDFile = Buffer.ReadString(true); - NewItem.ID = Buffer.ReadUInt32(); + NewItem.ID = Buffer.ReadUInt32(); return NewItem; } @@ -245,7 +245,7 @@ namespace EQExtractor2.Patches List ZonePointPackets = GetPacketsOfType("OP_SendZonepoints", PacketDirection.ServerToClient); if (ZonePointPackets.Count < 1) - { + { return ZonePointList; } @@ -257,7 +257,7 @@ namespace EQExtractor2.Patches if (Entries == 0) return ZonePointList; - + float x, y, z, Heading; UInt32 Number; @@ -284,14 +284,14 @@ namespace EQExtractor2.Patches ZoneID = Buffer.ReadUInt16(); Instance = Buffer.ReadUInt16(); - + Buffer.SkipBytes(4); // Skip the last UInt32 ZonePoint NewZonePoint = new ZonePoint(Number, ZoneID, Instance, x, y, z, x, y, z, Heading, ZoneID); - ZonePointList.Add(NewZonePoint); + ZonePointList.Add(NewZonePoint); } - + return ZonePointList; } @@ -300,7 +300,7 @@ namespace EQExtractor2.Patches NewZoneStruct NewZone = new NewZoneStruct(); List ZonePackets = GetPacketsOfType("OP_NewZone", PacketDirection.ServerToClient); - + if (ZonePackets.Count < 1) return NewZone; @@ -316,7 +316,7 @@ namespace EQExtractor2.Patches NewZone.LongName = Buffer.ReadFixedLengthString(278, true); - NewZone.Type = Buffer.ReadByte(); + NewZone.Type = Buffer.ReadByte(); NewZone.FogRed = Buffer.ReadBytes(4); @@ -325,7 +325,7 @@ namespace EQExtractor2.Patches NewZone.FogBlue = Buffer.ReadBytes(4); Buffer.SkipBytes(1); // Unknown - + for (int i = 0; i < 4; ++i) NewZone.FogMinClip[i] = Buffer.ReadSingle(); @@ -379,7 +379,7 @@ namespace EQExtractor2.Patches NewZone.FogDensity = Buffer.ReadSingle(); // Everything else after this point in the packet is unknown. - + return NewZone; } @@ -433,7 +433,7 @@ namespace EQExtractor2.Patches // Destructable Objects. Not handled yet // //SQLOut(String.Format("-- OBJECT FOUND SpawnID {0}", SpawnID.ToString("x"))); - + NewSpawn.DestructableString1 = Buffer.ReadString(false); NewSpawn.DestructableString2 = Buffer.ReadString(false); @@ -524,7 +524,7 @@ namespace EQExtractor2.Patches NewSpawn.EquipChest2 = Buffer.ReadByte(); bool UseWorn = (NewSpawn.EquipChest2 == 255); - + Buffer.SkipBytes(2); // 2 Unknown bytes; NewSpawn.Helm = Buffer.ReadByte(); @@ -554,7 +554,7 @@ namespace EQExtractor2.Patches NewSpawn.XPos = Utils.EQ19ToFloat((Int32)(Position4 >> 12) & 0x7FFFF); NewSpawn.ZPos = Utils.EQ19ToFloat((Int32)(Position5 & 0x7FFFF)); - + for (int ColourSlot = 0; ColourSlot < 9; ++ColourSlot) NewSpawn.SlotColour[ColourSlot] = Buffer.ReadUInt32(); @@ -636,9 +636,9 @@ namespace EQExtractor2.Patches List UpdatePackets = GetPacketsOfType("OP_NPCMoveUpdate", PacketDirection.ServerToClient); - foreach (byte[] UpdatePacket in UpdatePackets) + foreach (byte[] UpdatePacket in UpdatePackets) Updates.Add(Decode_OP_NPCMoveUpdate(UpdatePacket)); - + return Updates; } @@ -671,9 +671,9 @@ namespace EQExtractor2.Patches List UpdatePackets = GetPacketsOfType("OP_MobUpdate", PacketDirection.ServerToClient); - foreach (byte[] MobUpdatePacket in UpdatePackets) + foreach (byte[] MobUpdatePacket in UpdatePackets) Updates.Add(Decode_OP_MobUpdate(MobUpdatePacket)); - + return Updates; } @@ -754,7 +754,7 @@ namespace EQExtractor2.Patches List PacketList = Packets.PacketList; UInt32 OP_ClientUpdate = OpManager.OpCodeNameToNumber("OP_ClientUpdate"); - + foreach (EQApplicationPacket UpdatePacket in PacketList) { if ((UpdatePacket.OpCode != OP_ClientUpdate) || (UpdatePacket.Direction != PacketDirection.ClientToServer)) @@ -779,7 +779,7 @@ namespace EQExtractor2.Patches Updates.Add(PosUpdate); - } + } return Updates; } @@ -828,7 +828,7 @@ namespace EQExtractor2.Patches List FindableSpawnList = new List(); List FindablePackets = GetPacketsOfType("OP_SendFindableNPCs", PacketDirection.ServerToClient); - + if (FindablePackets.Count < 1) return FindableSpawnList; @@ -837,7 +837,7 @@ namespace EQExtractor2.Patches if (BitConverter.ToUInt32(Packet, 0) == 0) FindableSpawnList.Add(BitConverter.ToUInt32(Packet, 4)); } - + return FindableSpawnList; } @@ -864,7 +864,7 @@ namespace EQExtractor2.Patches //OpManager.RegisterExplorer("OP_HPUpdate", ExploreHPUpdate); //OpManager.RegisterExplorer("OP_Animation", ExploreAnimation); //OpManager.RegisterExplorer("OP_CharInventory", ExploreCharInventoryPacket); - + } public void ExploreZoneEntry(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) @@ -910,7 +910,7 @@ namespace EQExtractor2.Patches if ((OtherData & 1) > 0) { // Destructable Objects. - + DestructableString1 = Buffer.ReadString(false); DestructableString2 = Buffer.ReadString(false); @@ -956,9 +956,9 @@ namespace EQExtractor2.Patches DestructableUnk9, DestructableByte); } - Buffer.SkipBytes(17); + Buffer.SkipBytes(17); - byte PropCount = Buffer.ReadByte(); + byte PropCount = Buffer.ReadByte(); if (PropCount >= 1) { @@ -991,8 +991,8 @@ namespace EQExtractor2.Patches { UInt32 CurrentHP = Buffer.ReadUInt32(); Int32 MaxHP = Buffer.ReadInt32(); - UInt16 SpawnID = Buffer.ReadUInt16(); - + UInt16 SpawnID = Buffer.ReadUInt16(); + string SpawnName = FindExplorerSpawn(SpawnID); OutputStream.WriteLine("Spawn {0} {1} Current HP: {2} Max HP: {3}", SpawnID, SpawnName, CurrentHP, MaxHP); @@ -1001,7 +1001,7 @@ namespace EQExtractor2.Patches } public void ExploreAnimation(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) - { + { UInt16 SpawnID = Buffer.ReadUInt16(); byte Action = Buffer.ReadByte(); byte Value = Buffer.ReadByte(); @@ -1324,7 +1324,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // clickunk7 Buffer.SkipBytes(30); // Proc Effect Struct Buffer.ReadString(true); // Proc Name - Buffer.SkipBytes(4); // unknown5 + Buffer.SkipBytes(4); // unknown5 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name Buffer.SkipBytes(4); // unknown6 @@ -1336,7 +1336,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name - Buffer.SkipBytes(4); // unknown6 + Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(103); // Item Quaternary Body Struct - 4 (we want to read the SubLength field at the end) //UInt32 SubLengths = Buffer.ReadUInt32(); diff --git a/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs index 97f0ac2ac..852eabefc 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs @@ -18,7 +18,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = 28536; - PPZoneIDOffset = 21204; + PPZoneIDOffset = 21204; } override public PositionUpdate Decode_OP_NPCMoveUpdate(byte[] UpdatePacket) @@ -42,7 +42,7 @@ namespace EQExtractor2.Patches PosUpdate.p.heading = (float)bs.readInt(12) / (float)(1 << 3); PosUpdate.HighRes = true; - + return PosUpdate; } @@ -245,20 +245,20 @@ namespace EQExtractor2.Patches //base.RegisterExplorers(); //OpManager.RegisterExplorer("OP_SpawnDoor", ExploreSpawnDoor); - + } public void ExploreSpawnDoor(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) - { + { uint DoorCount = Buffer.Length() / 96; OutputStream.WriteLine("Door Count: {0}", DoorCount); - + for (int d = 0; d < DoorCount; ++d) { string DoorName = Buffer.ReadFixedLengthString(32, false); - + float YPos = Buffer.ReadSingle(); float XPos = Buffer.ReadSingle(); @@ -288,9 +288,9 @@ namespace EQExtractor2.Patches // Skip past the trailing unknowns in the door struct, moving to the next door in the packet. - Buffer.SkipBytes(28); + Buffer.SkipBytes(28); } - + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs index 280db1333..63049ecd9 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs @@ -13,10 +13,10 @@ namespace EQExtractor2.Patches public PatchMay242011Decoder() { Version = "EQ Client Build Date May 24 2011."; - + ExpectedPPLength = 28856; - PPZoneIDOffset = 21524; - } + PPZoneIDOffset = 21524; + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs index 01218b638..c7e0df132 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs @@ -274,7 +274,7 @@ namespace EQExtractor2.Patches //OpManager.RegisterExplorer("OP_NPCMoveUpdate", ExploreNPCMoveUpdate); //OpManager.RegisterExplorer("OP_MobUpdate", ExploreMobUpdate); - + } public void ExploreNPCMoveUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) @@ -365,7 +365,7 @@ namespace EQExtractor2.Patches UInt32 Cost = Buffer.ReadUInt32(); UInt32 Seq = Buffer.ReadUInt32(); UInt32 CurrentLevel = Buffer.ReadUInt32(); - + UInt32 PreReqSkillCount = Buffer.ReadUInt32(); UInt32 [] PreReqSkills = new UInt32[PreReqSkillCount]; @@ -416,7 +416,7 @@ namespace EQExtractor2.Patches OutputFile.Write("{0} ", PreReqMinPoints[i]); OutputFile.WriteLine(""); - + OutputFile.WriteLine(" Type:\t\t" + Type); OutputFile.WriteLine(" SpellID:\t" + SpellID); OutputFile.WriteLine(" Unknown057:\t" + Unknown057); diff --git a/utils/EQExtractor2/EQExtractor2/PatchSoD.cs b/utils/EQExtractor2/EQExtractor2/PatchSoD.cs index 70c06c4f1..c1bdc2e1c 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchSoD.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchSoD.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// // // IMPORTANT NOTE: This decoder for SoD was developed purely as a cursory test of the multi-patch support and is not guaranteed // to be 100% correct. @@ -721,7 +721,7 @@ namespace EQExtractor2.Patches GroundSpawn.Name = Buffer.ReadFixedLengthString(16, false); - Buffer.SkipBytes(20); + Buffer.SkipBytes(20); GroundSpawn.ObjectType = Buffer.ReadUInt32(); @@ -760,11 +760,11 @@ namespace EQExtractor2.Patches public override void RegisterExplorers() { - OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); + OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); //OpManager.RegisterExplorer("OP_RespawnWindow", ExploreRespawnWindow); //OpManager.RegisterExplorer("OP_ZonePlayerToBind", ExploreZonePlayerToBind); //OpManager.RegisterExplorer("OP_RequestClientZoneChange", ExploreRequestClientZoneChange); - //OpManager.RegisterExplorer("OP_DeleteSpawn", ExploreDeleteSpawn); + //OpManager.RegisterExplorer("OP_DeleteSpawn", ExploreDeleteSpawn); OpManager.RegisterExplorer("OP_HPUpdate", ExploreHPUpdate); } diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs index b2a7cd486..7eaf07b7d 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; using System.Collections.Generic; @@ -25,15 +25,15 @@ namespace EQExtractor2.Patches { if((OpCode == OpManager.OpCodeNameToNumber("OP_ZoneEntry")) && (Direction == PacketDirection.ClientToServer)) return IdentificationStatus.Yes; - + return IdentificationStatus.No; - } + } override public Item DecodeItemPacket(byte[] PacketBuffer) { ByteStream Buffer = new ByteStream(PacketBuffer); - Item NewItem = new Item(); + Item NewItem = new Item(); NewItem.StackSize = Buffer.ReadUInt32(); // 00 Buffer.SkipBytes(4); @@ -55,12 +55,12 @@ namespace EQExtractor2.Patches public override void RegisterExplorers() { base.RegisterExplorers(); - + //OpManager.RegisterExplorer("OP_CharInventory", ExploreCharInventoryPacket); //OpManager.RegisterExplorer("OP_ItemPacket", ExploreItemPacket); //OpManager.RegisterExplorer("OP_MercenaryPurchaseWindow", ExploreMercenaryPurchaseWindow); } - + public void ExploreCharInventoryPacket(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) { UInt32 ItemCount = Buffer.ReadUInt32(); @@ -69,7 +69,7 @@ namespace EQExtractor2.Patches for (int i = 0; i < ItemCount; ++i) { - ExploreSubItem(OutputStream, ref Buffer); + ExploreSubItem(OutputStream, ref Buffer); } OutputStream.WriteLine(""); @@ -85,7 +85,7 @@ namespace EQExtractor2.Patches } void ExploreSubItem(StreamWriter OutputStream, ref ByteStream Buffer) - { + { Buffer.SkipBytes(8); byte Area = Buffer.ReadByte(); @@ -118,14 +118,14 @@ namespace EQExtractor2.Patches break; case 8: AreaName = "Merchant"; - break; + break; } OutputStream.WriteLine("Area: {0} {1} Main Slot {2,2} Sub Slot {3,3} Name {4}", Area, AreaName.PadRight(20), MainSlot, SubSlot, Name); Buffer.ReadString(true); // Lore Buffer.ReadString(true); // IDFile - + //Buffer.SkipBytes(236); // Item Body Struct UInt32 ID = Buffer.ReadUInt32(); @@ -229,7 +229,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // clickunk7 Buffer.SkipBytes(30); // Proc Effect Struct Buffer.ReadString(true); // Proc Name - Buffer.SkipBytes(4); // unknown5 + Buffer.SkipBytes(4); // unknown5 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name Buffer.SkipBytes(4); // unknown6 @@ -241,15 +241,15 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name - Buffer.SkipBytes(4); // unknown6 + Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(103); // Item Quaternary Body Struct - 4 (we want to read the SubLength field at the end) UInt32 SubLengths = Buffer.ReadUInt32(); - + for (int i = 0; i < SubLengths; ++i) { Buffer.SkipBytes(4); - ExploreSubItem(OutputStream, ref Buffer); + ExploreSubItem(OutputStream, ref Buffer); } } @@ -291,7 +291,7 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown3); UInt32 Unknown4 = Buffer.ReadUInt32(); OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown4); - + byte Unknown5 = Buffer.ReadByte(); //OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint8, Buffer, {0}); // Unknown", Unknown5); @@ -303,7 +303,7 @@ namespace EQExtractor2.Patches //OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown8); UInt32 StanceCount = Buffer.ReadUInt32(); - + OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Number of Stances for this Merc", StanceCount); UInt32 Unknown10 = Buffer.ReadUInt32(); @@ -311,8 +311,8 @@ namespace EQExtractor2.Patches byte Unknown11 = Buffer.ReadByte(); //OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint8, Buffer, {0}); // Unknown", Unknown11); - - + + //OutputStream.WriteLine(" Offset: {5} Unknown1: {0} DBStrings: {1} {2} Purchase: {3} Upkeep: {4}\r\n", Unknown1, DBStringID1, DBStringID2, // PurchaseCost, UpkeepCost, Offset); //OutputStream.WriteLine(" Unknowns: {0} {1} {2} {3} {4} {5} {6} {7} {8}\r\n", @@ -336,6 +336,6 @@ namespace EQExtractor2.Patches OutputStream.WriteLine(""); } - + } } diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs index 6c5230501..2f53e1363 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs @@ -314,7 +314,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // clickunk7 Buffer.SkipBytes(30); // Proc Effect Struct Buffer.ReadString(true); // Proc Name - Buffer.SkipBytes(4); // unknown5 + Buffer.SkipBytes(4); // unknown5 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name Buffer.SkipBytes(4); // unknown6 @@ -326,15 +326,15 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name - Buffer.SkipBytes(4); // unknown6 + Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(103); // Item Quaternary Body Struct - 4 (we want to read the SubLength field at the end) - + Buffer.SkipBytes(57); // HoT OutputStream.WriteLine(" Reading sublengths from offset {0}", Buffer.GetPosition()); UInt32 SubLengths = Buffer.ReadUInt32(); - + for (int i = 0; i < SubLengths; ++i) { diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs index c705bccd4..1298dd5e4 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs @@ -14,10 +14,10 @@ namespace EQExtractor2.Patches public PatchTestServerFebruary52013Decoder() { Version = "EQ Client Build Date Test Server February 5 2013."; - + PatchConfFileName = "patch_TestServer-Feb5-2013.conf"; SupportsSQLGeneration = false; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs index 41f6a3889..21be591cc 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs @@ -14,10 +14,10 @@ namespace EQExtractor2.Patches public PatchTestServerJanuary162013Decoder() { Version = "EQ Client Build Date Test Server January 16 2013."; - + PatchConfFileName = "patch_TestServer-Jan16-2013.conf"; SupportsSQLGeneration = false; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs b/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs index 879069892..202a873e5 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs +++ b/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("EQExtractor2")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] diff --git a/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs b/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs index e67b74c43..b78b32960 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs @@ -10,8 +10,8 @@ namespace EQExtractor2.Properties { using System; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -23,15 +23,15 @@ namespace EQExtractor2.Properties { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { - + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// @@ -45,7 +45,7 @@ namespace EQExtractor2.Properties { return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. diff --git a/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx b/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx index af7dbebba..9c90483af 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx +++ b/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs b/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs index 27d78fb48..37d6d4781 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs @@ -9,20 +9,20 @@ //------------------------------------------------------------------------------ namespace EQExtractor2.Properties { - - + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - + public static Settings Default { get { return defaultInstance; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("notepad.exe")] @@ -34,7 +34,7 @@ namespace EQExtractor2.Properties { this["TextFileViewer"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -46,7 +46,7 @@ namespace EQExtractor2.Properties { this["ShowDebugWindowOnStartup"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] diff --git a/utils/EQExtractor2/EQExtractor2/SharpPcap.dll b/utils/EQExtractor2/EQExtractor2/SharpPcap.dll index 38b783bf27c9a0e2bbf3cd766473dfed7055257e..e53fa0198ab85a66fd95aaf758de7bfaec66b3da 100644 GIT binary patch delta 14 WcmZoz!}NbO(}o#(n`i2!rvm^p^#+*$ delta 16 YcmeyrnyFz8(}o#(j0&4)=%uFv06x?Pxc~qF diff --git a/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs b/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs index 372cb8fcd..3d5581f79 100644 --- a/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs @@ -39,27 +39,27 @@ this.EQPacketDebugFilename = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(107, 13); this.label1.TabIndex = 0; this.label1.Text = "Packet Dump Viewer"; - // + // // PacketDumpViewerProgram - // + // this.PacketDumpViewerProgram.Location = new System.Drawing.Point(125, 6); this.PacketDumpViewerProgram.Name = "PacketDumpViewerProgram"; this.PacketDumpViewerProgram.Size = new System.Drawing.Size(390, 20); this.PacketDumpViewerProgram.TabIndex = 1; this.toolTip1.SetToolTip(this.PacketDumpViewerProgram, "If not using notepad/wordpad include the full path, e.g. C:\\Program Files (x86)\\N" + "otepad++\\notepad++.exe"); - // + // // ShowDebugWindowOnStartup - // + // this.ShowDebugWindowOnStartup.AutoSize = true; this.ShowDebugWindowOnStartup.Location = new System.Drawing.Point(15, 61); this.ShowDebugWindowOnStartup.Name = "ShowDebugWindowOnStartup"; @@ -67,9 +67,9 @@ this.ShowDebugWindowOnStartup.TabIndex = 2; this.ShowDebugWindowOnStartup.Text = "Show Debug Window On Startup"; this.ShowDebugWindowOnStartup.UseVisualStyleBackColor = true; - // + // // ShowTimeStamps - // + // this.ShowTimeStamps.AutoSize = true; this.ShowTimeStamps.Location = new System.Drawing.Point(15, 84); this.ShowTimeStamps.Name = "ShowTimeStamps"; @@ -77,9 +77,9 @@ this.ShowTimeStamps.TabIndex = 3; this.ShowTimeStamps.Text = "Include Time Stamps In Packet Dump"; this.ShowTimeStamps.UseVisualStyleBackColor = true; - // + // // OptionsOKButton - // + // this.OptionsOKButton.Location = new System.Drawing.Point(125, 122); this.OptionsOKButton.Name = "OptionsOKButton"; this.OptionsOKButton.Size = new System.Drawing.Size(75, 23); @@ -87,9 +87,9 @@ this.OptionsOKButton.Text = "OK"; this.OptionsOKButton.UseVisualStyleBackColor = true; this.OptionsOKButton.Click += new System.EventHandler(this.OptionsOKButton_Click); - // + // // OptionsCancelButton - // + // this.OptionsCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.OptionsCancelButton.Location = new System.Drawing.Point(332, 122); this.OptionsCancelButton.Name = "OptionsCancelButton"; @@ -98,17 +98,17 @@ this.OptionsCancelButton.Text = "Cancel"; this.OptionsCancelButton.UseVisualStyleBackColor = true; this.OptionsCancelButton.Click += new System.EventHandler(this.OptionsCancelButton_Click); - // + // // EQPacketDebugFilename - // + // this.EQPacketDebugFilename.Location = new System.Drawing.Point(125, 32); this.EQPacketDebugFilename.Name = "EQPacketDebugFilename"; this.EQPacketDebugFilename.Size = new System.Drawing.Size(390, 20); this.EQPacketDebugFilename.TabIndex = 7; this.toolTip1.SetToolTip(this.EQPacketDebugFilename, "Output file for low level netcode debugging"); - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 35); this.label2.Name = "label2"; @@ -116,9 +116,9 @@ this.label2.TabIndex = 6; this.label2.Text = "Netcode Debug"; this.toolTip1.SetToolTip(this.label2, "Output file for low level netcode debugging"); - // + // // UserOptions - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.OptionsCancelButton; diff --git a/utils/EQExtractor2/EQExtractor2/UserOptions.resx b/utils/EQExtractor2/EQExtractor2/UserOptions.resx index df8339b68..dcfd08d0f 100644 --- a/utils/EQExtractor2/EQExtractor2/UserOptions.resx +++ b/utils/EQExtractor2/EQExtractor2/UserOptions.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/Utils.cs b/utils/EQExtractor2/EQExtractor2/Utils.cs index 3aeb28028..62a69ccc5 100644 --- a/utils/EQExtractor2/EQExtractor2/Utils.cs +++ b/utils/EQExtractor2/EQExtractor2/Utils.cs @@ -4,7 +4,7 @@ // // ShowEQ Distributed under GPL // http://www.sourceforge.net/projects/seq -// +// // Copyright 2004 Zaphod (dohpaz@users.sourceforge.net). // // ----------------------------------------------------------- @@ -13,7 +13,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; @@ -21,7 +21,7 @@ using System.Text; namespace MyUtils { - public class ByteStream + public class ByteStream { public ByteStream(byte[] NewBuffer) { @@ -93,7 +93,7 @@ namespace MyUtils return Slice; } - + public void SkipBytes(int Count) { BufferPointer += Count; @@ -149,7 +149,7 @@ namespace MyUtils int BufferPointer; } - + class BitStream { public BitStream(byte[] Data, UInt32 Length) @@ -182,7 +182,7 @@ namespace MyUtils { // Lead partial is a byte. So just put it in the middle. leadPartialBitCount = 0; - } + } if (leadPartialBitCount > bitCount) { @@ -216,7 +216,7 @@ namespace MyUtils Out = (Out << 8) | m_data[currentByte]; currentByte++; } - + // And the end. if (tailPartialBitCount > 0) { @@ -292,7 +292,7 @@ namespace MyUtils { StringBuilder CleanName = new StringBuilder(); - foreach(char c in Name) + foreach(char c in Name) if(!Char.IsDigit(c)) CleanName.Append(c); @@ -300,15 +300,15 @@ namespace MyUtils } public static float EQ19ToFloat(Int32 EQ19Value) - { + { if ((EQ19Value & 0x40000) > 0) EQ19Value = -(0x7FFFF - EQ19Value + 1); return (float)EQ19Value / (float)(1 << 3); } - + } - + } diff --git a/utils/EQExtractor2/EQExtractor2/log4net.dll b/utils/EQExtractor2/EQExtractor2/log4net.dll index 1bac5d9a06373a3722dd84407608bc1982d8a3f7..b184be52eafb3723794eb99f63f508ceebe00ed1 100644 GIT binary patch delta 62 zcmZqp!1v=l--cD9n^%kW?A>f}*tm_mon+1, mTime->tm_mday, mTime->tm_year%100, mTime->tm_hour, mTime->tm_min, mTime->tm_sec, buffer); } @@ -65,7 +65,7 @@ void EQEmuErrorLog::Log(unsigned int mOutputType, const char *msg, ...) fprintf(mErrorLogSQL, "%s;\n\n", buffer); } } - + if(buffer) delete[] buffer; } \ No newline at end of file diff --git a/utils/TaskMaster/ErrorLog.h b/utils/TaskMaster/ErrorLog.h index 2d1ada0c4..615c7a44d 100644 --- a/utils/TaskMaster/ErrorLog.h +++ b/utils/TaskMaster/ErrorLog.h @@ -13,12 +13,12 @@ enum{ }; //log file output -#define LOG_FILE_NAME "debug.txt" +#define LOG_FILE_NAME "debug.txt" #define SQL_LOG_FILE_NAME "sql_log.sql" //max single log length //same as a client:message() max len -#define MAX_LOG_LEN 4096 +#define MAX_LOG_LEN 4096 //much simplified logging function, similar to the one used on the server (Tho much simpler) class EQEmuErrorLog { diff --git a/utils/TaskMaster/activities.cpp b/utils/TaskMaster/activities.cpp index fac68536b..4f2d211f4 100644 --- a/utils/TaskMaster/activities.cpp +++ b/utils/TaskMaster/activities.cpp @@ -5,7 +5,7 @@ #include "utility.h" #include "base.h" #include "ErrorLog.h" - + using namespace std; void MainFrame::ActivitiesListBoxSimpleSelect(wxCommandEvent& event) @@ -129,7 +129,7 @@ void MainFrame::NewActivity(wxCommandEvent& event) char * mActQuery = 0; MakeAnyLenString(&mActQuery, "INSERT INTO `activities` (`taskid`,`activityid`,`step`,`activitytype`,`text1`,`text2`,`text3`,`goalid`,`goalmethod`,`goalcount`,`delivertonpc`,`zoneid`,`optional`) VALUES (%u,%u,%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u)", newAct.id, newAct.activityId, newAct.step, newAct.activityType, newAct.text1, newAct.text2, newAct.text3, newAct.goalid, newAct.goalmethod, newAct.goalcount, newAct.deliverToNpc, newAct.zoneid, newAct.optional ); - + mErrorLog->Log(eqEmuLogSQL, "%s", mActQuery); if (mysql_query(mMysql, mActQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); @@ -161,7 +161,7 @@ void MainFrame::DeleteActivity(wxCommandEvent& event) eqtask_activity_id *selAct = (eqtask_activity_id*)ActivitiesSelectionList->GetClientData(ActivitiesSelectionList->GetSelection()); unsigned int aid = selAct->activityid; - unsigned int tid = selAct->id; + unsigned int tid = selAct->id; if(selAct) { diff --git a/utils/TaskMaster/base.cpp b/utils/TaskMaster/base.cpp index af119a961..b9b118962 100644 --- a/utils/TaskMaster/base.cpp +++ b/utils/TaskMaster/base.cpp @@ -113,7 +113,7 @@ MainFrame::MainFrame(const wxString& title, BoxSizer1 = new wxBoxSizer(wxHORIZONTAL); mErrorLog->Log(eqEmuLogBoth, "Creating Item List Box."); - ItemSelectionList = new wxListBox(this, LIST_Click, wxDefaultPosition, wxSize( -1,-1 ), 0, NULL, 0); + ItemSelectionList = new wxListBox(this, LIST_Click, wxDefaultPosition, wxSize( -1,-1 ), 0, NULL, 0); mErrorLog->Log(eqEmuLogBoth, "Adding Item List Box to Sizer."); BoxSizer1->Add(ItemSelectionList, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5); @@ -228,7 +228,7 @@ MainFrame::MainFrame(const wxString& title, mActText1 = new wxTextCtrl(MainPanel2, -1, wxT(""), wxPoint(185,0), wxSize(180,20), wxTE_DONTWRAP); mActText1->SetMaxLength(64); mActText1->Disable(); - + mActText2Label = new wxStaticText(MainPanel2, -1, "Text 2:", wxPoint(105,22), wxDefaultSize); mActText2 = new wxTextCtrl(MainPanel2, -1, wxT(""), wxPoint(185,20), wxSize(180,20), wxTE_DONTWRAP); mActText2->SetMaxLength(64); @@ -392,7 +392,7 @@ MainFrame::MainFrame(const wxString& title, mErrorLog->Log(eqEmuLogBoth, "Adding Notebook to Sizer."); BoxSizer1->Add(MainNotebookBack, 1, wxALIGN_TOP|wxEXPAND, 5); - + mErrorLog->Log(eqEmuLogBoth, "Setting Frame Sizer."); this->SetSizer(BoxSizer1); mErrorLog->Log(eqEmuLogBoth, "Calculating Frame Layout."); @@ -444,22 +444,22 @@ void MainFrame::Connect(wxCommandEvent& WXUNUSED(event)) mErrorLog->Log(eqEmuLogBoth, "Failed to load tasks, exiting."); Close(TRUE); return; - } + } if(!LoadGoals()){ mysql_close(mMysql); mErrorLog->Log(eqEmuLogBoth, "Failed to load goals, exiting."); Close(TRUE); return; - } + } if(!LoadActivities()){ mysql_close(mMysql); mErrorLog->Log(eqEmuLogBoth, "Failed to load activities, exiting."); Close(TRUE); return; - } - + } + if(!LoadItems()){ mysql_close(mMysql); mErrorLog->Log(eqEmuLogBoth, "Failed to load items, exiting."); @@ -510,7 +510,7 @@ void MainFrame::ListBoxDoubleClick(wxCommandEvent& event) Iter = taskList.begin(); Iter += openedIndex; eqtask mTask = *Iter; - + wxString mStr; mStr.Printf("%s", mTask.title); mTaskName->Clear(); diff --git a/utils/TaskMaster/base.h b/utils/TaskMaster/base.h index 58bb1100b..c6365088c 100644 --- a/utils/TaskMaster/base.h +++ b/utils/TaskMaster/base.h @@ -223,7 +223,7 @@ public: enum { - TEXT_Main = wxID_HIGHEST + 1, + TEXT_Main = wxID_HIGHEST + 1, MENU_Connect, MENU_Quit, MENU_NewTask, @@ -252,4 +252,4 @@ enum LIST_Click_Proximity, }; -#endif \ No newline at end of file +#endif \ No newline at end of file diff --git a/utils/TaskMaster/base_utility.cpp b/utils/TaskMaster/base_utility.cpp index 181419b0e..96dcf9e3a 100644 --- a/utils/TaskMaster/base_utility.cpp +++ b/utils/TaskMaster/base_utility.cpp @@ -12,7 +12,7 @@ using namespace std; bool MainFrame::GetDatabaseSettings(){ FILE *mFile = NULL; mFile = fopen("db.txt", "r"); - + //very little error checking //we don't make sure the values in the file are valid //or all there just that the file exists so: @@ -81,7 +81,7 @@ bool MainFrame::LoadItems(){ itemsLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Items", itemsLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for item load."); @@ -143,7 +143,7 @@ bool MainFrame::LoadZones() zonesLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Zones", zonesLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for zone load."); @@ -181,7 +181,7 @@ bool MainFrame::LoadTasks() wxString str; str.Printf("%d:%s", newT.id, newT.title); ItemSelectionList->Append(str); - + if(newT.id > highestIndex) highestIndex = newT.id; @@ -200,7 +200,7 @@ bool MainFrame::LoadTasks() tasksLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Tasks", tasksLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for task load."); @@ -232,7 +232,7 @@ bool MainFrame::LoadGoals() goalsLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Goals", goalsLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for goal load."); @@ -276,7 +276,7 @@ bool MainFrame::LoadActivities() activitiesLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Activities", activitiesLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for activity load."); @@ -315,7 +315,7 @@ bool MainFrame::LoadProximity() proximitiesLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Proximities", proximitiesLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for proximity load."); diff --git a/utils/TaskMaster/goals.cpp b/utils/TaskMaster/goals.cpp index 2f78d6529..64c35e419 100644 --- a/utils/TaskMaster/goals.cpp +++ b/utils/TaskMaster/goals.cpp @@ -67,7 +67,7 @@ void MainFrame::PopulateGoalValues(unsigned int goalid) if((*Iter).id == goalid){ int *i = new int; *i = (*Iter).value; - + wxString curStr; curStr.Clear(); curStr.Printf("%u", (*Iter).value); @@ -333,7 +333,7 @@ void MainFrame::ChangeGoalValue(wxCommandEvent& event) mErrorLog->Log(eqEmuLogBoth, "Modify goal value failed, goal values not active"); return; } - + if(GoalsValuesList->GetSelection() == wxNOT_FOUND) { mErrorLog->Log(eqEmuLogBoth, "Modify goal value failed, no selection found"); diff --git a/utils/TaskMaster/proximity.cpp b/utils/TaskMaster/proximity.cpp index f4491b1e2..0ed3820d9 100644 --- a/utils/TaskMaster/proximity.cpp +++ b/utils/TaskMaster/proximity.cpp @@ -32,7 +32,7 @@ void MainFrame::PopulateProximity() prox->exploreid = eqt.exploreid; prox->zoneid = eqt.zoneid; - + wxString zoneName; zoneName.Printf("Unknown Zone"); vector::iterator ZoneIter; @@ -115,7 +115,7 @@ void MainFrame::NewProximity(wxCommandEvent& event) mErrorLog->Log(eqEmuLogBoth, "New proximity failed, not connected to db"); return; } - + int newID = wxGetNumberFromUser("", "Explore ID:", "Explore ID", 0, 0, 9999999); int newZoneID = wxGetNumberFromUser("", "Zone ID:", "Zone ID", 0, 0, 9999999); @@ -280,7 +280,7 @@ void MainFrame::SaveProximity(wxCommandEvent& event) inStr.Clear(); inStr = mProxMinx->GetValue(); - toSave.minx = atof(inStr.mb_str()); + toSave.minx = atof(inStr.mb_str()); inStr.Clear(); inStr = mProxMaxx->GetValue(); @@ -368,9 +368,9 @@ void MainFrame::SaveProximity(wxCommandEvent& event) if(canUpdate){ char * mQuery = 0; - MakeAnyLenString(&mQuery, "UPDATE proximities SET minx=%.4f, maxx=%.4f, miny=%.4f, maxy=%.4f, minz=%.4f, maxz=%.4f) WHERE zoneid=%u AND exploreid=%u", + MakeAnyLenString(&mQuery, "UPDATE proximities SET minx=%.4f, maxx=%.4f, miny=%.4f, maxy=%.4f, minz=%.4f, maxz=%.4f) WHERE zoneid=%u AND exploreid=%u", toSave.minx, toSave.maxx, toSave.miny, toSave.maxy, toSave.minz, toSave.maxz, toSave.zoneid, toSave.exploreid); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); @@ -389,7 +389,7 @@ void MainFrame::SaveProximity(wxCommandEvent& event) MakeAnyLenString(&mQuery, "INSERT INTO `proximities` (`zoneid`,`exploreid`,`minx`,`maxx`,`miny`,`maxy`,`minz`,`maxz`) VALUES (%u,%u,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f)" , toSave.zoneid, toSave.exploreid, toSave.minx, toSave.maxx, toSave.miny, toSave.maxy, toSave.minz, toSave.maxz); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); diff --git a/utils/TaskMaster/tasks.cpp b/utils/TaskMaster/tasks.cpp index 4929ad26a..48aa44080 100644 --- a/utils/TaskMaster/tasks.cpp +++ b/utils/TaskMaster/tasks.cpp @@ -250,7 +250,7 @@ void MainFrame::SaveTask(wxCommandEvent& event) getStr = mRewardXP->GetValue(); ourTask.xpreward = atoi(getStr.mb_str()); getStr.Clear(); - + int * i = (int*)mStartZone->GetClientData(mStartZone->GetSelection()); ourTask.startzone = *i; @@ -261,7 +261,7 @@ void MainFrame::SaveTask(wxCommandEvent& event) char * mQuery = 0; MakeAnyLenString(&mQuery, "UPDATE tasks SET duration=%u, title='%s', description='%s', reward='%s', rewardid=%u, cashreward=%u, xpreward=%i, rewardmethod=%u, startzone=%u, minlevel=%u, maxlevel=%u, repeatable=%u WHERE id=%u", ourTask.duration, MakeStringSQLSafe(ourTask.title).mb_str(), MakeStringSQLSafe(ourTask.desc).mb_str(), MakeStringSQLSafe(ourTask.reward).mb_str(), ourTask.rewardid, ourTask.cashreward, ourTask.xpreward, ourTask.rewardmethod, ourTask.startzone, ourTask.level_min, ourTask.level_max, ourTask.repeatable, ourTask.id); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); @@ -278,7 +278,7 @@ void MainFrame::SaveTask(wxCommandEvent& event) MakeAnyLenString(&mQuery, "INSERT INTO `tasks` (`id`,`duration`,`title`,`description`,`reward`,`rewardid`,`cashreward`,`xpreward`,`rewardmethod`,`startzone`, `minlevel`, `maxlevel`) VALUES (%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u,%u)", ourTask.id, ourTask.duration, MakeStringSQLSafe(ourTask.title).mb_str(), MakeStringSQLSafe(ourTask.desc).mb_str(), MakeStringSQLSafe(ourTask.reward).mb_str(), ourTask.rewardid, ourTask.cashreward, ourTask.xpreward, ourTask.rewardmethod, ourTask.startzone, ourTask.level_min, ourTask.level_max); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); diff --git a/utils/azone2/CMakeLists.txt b/utils/azone2/CMakeLists.txt index e6576fd90..3567df948 100644 --- a/utils/azone2/CMakeLists.txt +++ b/utils/azone2/CMakeLists.txt @@ -106,14 +106,14 @@ IF(MSVC) SET(glmodelviewer_sources GLModelViewer.cpp ) - + SET(glmodelviewer_headers GLModelViewer.h ) - + ADD_EXECUTABLE(glmodelviewer WIN32 ${glmodelviewer_sources} ${glmodelviewer_headers}) TARGET_LINK_LIBRARIES(glmodelviewer azone_common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} "opengl32.lib" "GLU32.lib" "Ws2_32.lib") SET_TARGET_PROPERTIES(glmodelviewer PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - + SET(EXECUTABLE_OUTPUT_PATH ../../Bin) ENDIF(MSVC) diff --git a/utils/azone2/GLModelViewer.cpp b/utils/azone2/GLModelViewer.cpp index 4c44d5257..7ce2c0b70 100644 --- a/utils/azone2/GLModelViewer.cpp +++ b/utils/azone2/GLModelViewer.cpp @@ -30,7 +30,7 @@ typedef struct _vertex{ float x; float y; float z; - + }VERTEX; void DrawEQModel(FileLoader *fileloader, int modnum); @@ -43,10 +43,10 @@ HGLRC hRC=NULL; HWND hWnd=NULL; HINSTANCE hInstance; -bool keys[256]; +bool keys[256]; char ch; bool active=true; -GLuint base; +GLuint base; int modelnum = 1; // The Number of the model we are currently displaying. float angle = 0; // used to rotate the model. Updated by a timer @@ -62,72 +62,72 @@ GLvoid BuildFont(GLvoid) font = CreateFont(-24, 0, 0, 0, FW_BOLD, false, false, false, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, - FF_DONTCARE|DEFAULT_PITCH, "Courier New"); + FF_DONTCARE|DEFAULT_PITCH, "Courier New"); - oldfont = (HFONT)SelectObject(hDC, font); - wglUseFontBitmaps(hDC, 32, 96, base); - SelectObject(hDC, oldfont); - DeleteObject(font); + oldfont = (HFONT)SelectObject(hDC, font); + wglUseFontBitmaps(hDC, 32, 96, base); + SelectObject(hDC, oldfont); + DeleteObject(font); } -GLvoid KillFont(GLvoid) +GLvoid KillFont(GLvoid) { - glDeleteLists(base, 96); + glDeleteLists(base, 96); } GLvoid glPrint(const char *fmt, ...) { char text[256]; - va_list ap; + va_list ap; - if (fmt == NULL) return; + if (fmt == NULL) return; - va_start(ap, fmt); - vsprintf(text, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(text, fmt, ap); + va_end(ap); - glPushAttrib(GL_LIST_BIT); - glListBase(base - 32); + glPushAttrib(GL_LIST_BIT); + glListBase(base - 32); glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); - glPopAttrib(); + glPopAttrib(); } GLvoid ReSizeGLScene(GLsizei width, GLsizei height) { - if (height==0)height=1; + if (height==0)height=1; - glViewport(0,0,width,height); + glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + glLoadIdentity(); gluPerspective(60.0f,(GLfloat)width/(GLfloat)height,0.1f,12000.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); } -int InitGL(GLvoid) +int InitGL(GLvoid) { - glShadeModel(GL_SMOOTH); + glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.5f); - glClearDepth(1.0f); + glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); BuildFont(); - return true; + return true; } -int DrawGLScene(char *ZoneFileName) +int DrawGLScene(char *ZoneFileName) { char textBuffer[100]; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glLoadIdentity(); + glLoadIdentity(); if(mfileloader->model_data.models[modelnum]) DrawEQModel(mfileloader, modelnum); glLoadIdentity(); - glTranslatef(0.0f,0.0f,-1.2f); + glTranslatef(0.0f,0.0f,-1.2f); glColor3f(100.0f,0.0f,0.0f); glRasterPos2f(-1.15f,0.56f); @@ -139,17 +139,17 @@ int DrawGLScene(char *ZoneFileName) else sprintf(textBuffer," %s: Model Number %4d. Not Viewable (probably zone mesh).", ZoneFileName, modelnum); - glPrint(textBuffer); + glPrint(textBuffer); sprintf(textBuffer," Use the + and - keys to cycle through models."); glRasterPos2f(-1.15f,0.50f); - glPrint(textBuffer); + glPrint(textBuffer); - - return true; + + return true; } GLvoid KillGLWindow(GLvoid) { - if (hRC) { + if (hRC) { if (!wglMakeCurrent(NULL,NULL)) { MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } @@ -157,107 +157,107 @@ GLvoid KillGLWindow(GLvoid) { if (!wglDeleteContext(hRC)) { MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } - hRC=NULL; + hRC=NULL; } if (hDC && !ReleaseDC(hWnd,hDC)) { MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); - hDC=NULL; + hDC=NULL; } if (hWnd && !DestroyWindow(hWnd)) { MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); - hWnd=NULL; + hWnd=NULL; } if (!UnregisterClass("OpenGL",hInstance)) { MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); - hInstance=NULL; + hInstance=NULL; } KillFont(); } - + BOOL CreateGLWindow(char* title, int width, int height, int bits) { GLuint PixelFormat; - WNDCLASS wc; + WNDCLASS wc; DWORD dwExStyle; DWORD dwStyle; RECT WindowRect; WindowRect.left=(long)0; - WindowRect.right=(long)width; - WindowRect.top=(long)0; - WindowRect.bottom=(long)height; + WindowRect.right=(long)width; + WindowRect.top=(long)0; + WindowRect.bottom=(long)height; - hInstance = GetModuleHandle(NULL); + hInstance = GetModuleHandle(NULL); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wc.lpfnWndProc = (WNDPROC) WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; + wc.lpfnWndProc = (WNDPROC) WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); + wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; wc.lpszClassName = "OpenGL"; if (!RegisterClass(&wc)) { MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } - + dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; - dwStyle=WS_OVERLAPPEDWINDOW; + dwStyle=WS_OVERLAPPEDWINDOW; AdjustWindowRectEx(&WindowRect, dwStyle, false, dwExStyle); if (!(hWnd=CreateWindowEx(dwExStyle, "OpenGL", title, dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, 0, 0, WindowRect.right-WindowRect.left, WindowRect.bottom-WindowRect.top, NULL, NULL, hInstance, NULL))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } static PIXELFORMATDESCRIPTOR pfd= { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, bits, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, - 0, 0, 0, 0 + 0, 0, 0, 0 }; - + if (!(hDC=GetDC(hWnd))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } if(!SetPixelFormat(hDC,PixelFormat,&pfd)) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } if (!(hRC=wglCreateContext(hDC))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } if(!wglMakeCurrent(hDC,hRC)) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } ShowWindow(hWnd,SW_SHOW); - SetForegroundWindow(hWnd); - SetFocus(hWnd); + SetForegroundWindow(hWnd); + SetFocus(hWnd); ReSizeGLScene(width, height); if (!InitGL()) { @@ -268,17 +268,17 @@ BOOL CreateGLWindow(char* title, int width, int height, int bits) { SetTimer(hWnd, 1, 50, (TIMERPROC) NULL); - return true; + return true; } LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { - case WM_ACTIVATE: - if (!HIWORD(wParam)) active=true; + case WM_ACTIVATE: + if (!HIWORD(wParam)) active=true; else active=false; - - return 0; + + return 0; case WM_SYSCOMMAND: switch (wParam) { case SC_SCREENSAVE: @@ -288,19 +288,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { break; case WM_CLOSE: PostQuitMessage(0); - return 0; + return 0; case WM_KEYDOWN: keys[wParam] = true; - return 0; + return 0; case WM_CHAR: ch = wParam; return 0; - case WM_KEYUP: - keys[wParam] = false; - return 0; - case WM_SIZE: - ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); - return 0; + case WM_KEYUP: + keys[wParam] = false; + return 0; + case WM_SIZE: + ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); + return 0; case WM_TIMER: angle = angle + 1; if(angle>359) angle = 0; @@ -327,7 +327,7 @@ void ScaleVertex(VERTEX &v, float XScale, float YScale, float ZScale) { void DrawEQModel(FileLoader *fileloader, int modnum) { - + Polygon *poly; Vertex *verts[3]; VERTEX v1, v2, v3; @@ -363,16 +363,16 @@ void DrawEQModel(FileLoader *fileloader, int modnum) { if(maxz-minz>maxDimension) maxDimension = maxz-minz; // Hack for very small models (e.g. spoons) - if(maxDimension>1) - glTranslatef(-1.5f,0.0f,-(maxDimension*2)); + if(maxDimension>1) + glTranslatef(-1.5f,0.0f,-(maxDimension*2)); else - glTranslatef(-1.5f,0.0f,-10); + glTranslatef(-1.5f,0.0f,-10); // angle is updated by a timer every 50ms. glRotatef(angle, 1, 0, 0); glRotatef(angle, 0, 1, 0); glRotatef(angle, 0, 0, 1); - + glBegin(GL_TRIANGLES); for(int i = 0; i < model->poly_count; ++i) { @@ -398,23 +398,23 @@ void DrawEQModel(FileLoader *fileloader, int modnum) { ScaleVertex(v2, 10, 10, 10); ScaleVertex(v3, 10, 10, 10); } - + // Assign a kind of random colour to each polygon //glColor3b((i%50)+50,(i*5)%200,(i*10)%200); float col = (float)(100 + ((i*10) % 150)) /250 * 1.0f; glColor3f(col, col, col); - + glVertex3f(v1.x, v1.z, v1.y); glVertex3f(v2.x, v2.z, v2.y); glVertex3f(v3.x, v3.z, v3.y); - + } glEnd(); } bool ProcessZoneFile(const char *shortname) { - + char bufs[96]; Archive *archive; @@ -427,7 +427,7 @@ bool ProcessZoneFile(const char *shortname) { archive = new PFSLoader(); fff = fopen(bufs, "rb"); - if(fff != NULL) + if(fff != NULL) FileType = S3D; else { sprintf(bufs, "%s.eqg", shortname); @@ -443,15 +443,15 @@ bool ProcessZoneFile(const char *shortname) { if(archive->Open(fff) == 0) { MessageBox(NULL,"Unable to open container file","ERROR",MB_OK|MB_ICONEXCLAMATION); - + return(false); } switch(FileType) { - case S3D: + case S3D: mfileloader = new WLDLoader(); if(mfileloader->Open(NULL, (char *) shortname, archive) == 0) { - + MessageBox(NULL,"Error reading WLD from container file","ERROR",MB_OK|MB_ICONEXCLAMATION); return(false); } @@ -485,11 +485,11 @@ bool ProcessZoneFile(const char *shortname) { int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL done=false; - FILE *fp; + FILE *fp; - for(int i=0;i<256;i++) + for(int i=0;i<256;i++) keys[i] = false; - + char* buf = (char *) new char[strlen(lpCmdLine) + 1] ; char *pTmp = buf; @@ -501,48 +501,48 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } strcpy(buf,lpCmdLine); - + if(!ProcessZoneFile(buf)) return 0; - + if (!CreateGLWindow("EQ Model Viewer",1280,768,16)) - return 0; - + return 0; + while(!done) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { - if (msg.message==WM_QUIT) - done=true; + if (msg.message==WM_QUIT) + done=true; else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { - if ((active && !DrawGLScene(buf)) || keys[VK_ESCAPE]) - done=true; + if ((active && !DrawGLScene(buf)) || keys[VK_ESCAPE]) + done=true; else - SwapBuffers(hDC); + SwapBuffers(hDC); // Use + and - to cycle through the models - if (toupper(ch)=='+') { - if(modelnum+1 < mfileloader->model_data.model_count) + if (toupper(ch)=='+') { + if(modelnum+1 < mfileloader->model_data.model_count) modelnum++; else modelnum=0; angle = 0; } - if (toupper(ch)=='-') { + if (toupper(ch)=='-') { if(modelnum>0) modelnum--; else modelnum = mfileloader->model_data.model_count - 1; - angle = 0; + angle = 0; } ch = 0; } } KillGLWindow(); - return (msg.wParam); + return (msg.wParam); } diff --git a/utils/azone2/awater.cpp b/utils/azone2/awater.cpp index ee15a02da..940c27596 100644 --- a/utils/azone2/awater.cpp +++ b/utils/azone2/awater.cpp @@ -10,22 +10,22 @@ Father Nitwit's Zone to map conversion program. Copyright (C) 2004 Father Nitwit (eqemu@8ass.com) - + This thing uses code from freaku, so whatever license that comes under is relavent, if you care. - + the rest of it is GPL, even though I hate the GPL. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -76,7 +76,7 @@ long BSPCountNodes(BSP_Node *tree, long node_number); int main(int argc, char *argv[]) { long DefaultRegionType=RegionTypeWater; - + if((argc < 2) || (argc > 3) || #ifndef WIN32 @@ -90,9 +90,9 @@ int main(int argc, char *argv[]) { printf("\nIf -dl is omitted, untagged special regions will be marked as water\n"); return(1); } - + char bufm[250]; - + if(argc==3) DefaultRegionType=RegionTypeLava; sprintf(bufm, "%s.wtr", argv[argc-1]); @@ -110,15 +110,15 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { char bufs[96]; Archive *archive; WLDLoader *fileloader; - long WaterOrLavaCount = 0; - + long WaterOrLavaCount = 0; + //TODO: clean up a LOT of memory that the freaku code does not - + sprintf(bufs, "%s.s3d", shortname); archive = new PFSLoader(); - + FILE *s3df = fopen(bufs, "rb"); if(s3df == nullptr) { // One day we may try EQG, but not today. @@ -131,8 +131,8 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { } printf("Loading %s...\n", bufs); - fileloader = new WLDLoader(); - + fileloader = new WLDLoader(); + if(fileloader->Open(nullptr, (char *) shortname, archive) == 0) { printf("Error reading WLD from %s\n", bufs); return(false); @@ -152,7 +152,7 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { case RegionTypeUnsupported: { printf("Unsupported\n"); break; } case RegionTypeUntagged: { printf("Untagged. We will set it to "); - if(DefaultRegionType==RegionTypeWater) { + if(DefaultRegionType==RegionTypeWater) { printf("Water\n"); } else printf("Lava\n"); data29->region_type = DefaultRegionType; @@ -172,7 +172,7 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { } - + if(tree==nullptr) { printf("No BSP Tree. Bailing out\n"); return(false); @@ -184,12 +184,12 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { // Now we mark each leaf in the BSP tree that is in a 'special area' with what type the area is // Water, Lava, Zoneline etc - + for(int i=0; ifragcount; i++) { if(fileloader->frags[i]->type == 0x29) { data29 = (struct_Data29 *) fileloader->frags[i]->frag; for(long j=0; jregion_count; j++) { - BSPMarkRegion(tree, 1,data29->region_array[j]+1, data29->region_type); + BSPMarkRegion(tree, 1,data29->region_array[j]+1, data29->region_type); } } } @@ -268,7 +268,7 @@ long BSPCountNodes(BSP_Node *tree, long node_number) { return(NodesInRightBranch + NodesInLeftBranch + 1); } - + long BSPFindRegion(BSP_Node *tree, long node_number, long region) { //printf("Find Region %ld in node %ld\n", region, node_number); @@ -281,7 +281,7 @@ long BSPFindRegion(BSP_Node *tree, long node_number, long region) { if(tree[node_number-1].region==region) return node_number; } - + long retnode ; if(tree[node_number-1].left!=0) { retnode = BSPFindRegion(tree, tree[node_number-1].left, region); @@ -303,15 +303,15 @@ long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z) { printf("BSP Find Node, currently in Node %ld\n", node_number); // Are we at a leaf - + if((tree[node_number-1].left==0)&& (tree[node_number-1].right==0)) { return tree[node_number-1].region; } - + // No, so determine which side of the split plane we are on // - + distance = (x * tree[node_number-1].normal[0]) + (y * tree[node_number-1].normal[1]) + (z * tree[node_number-1].normal[2]) + @@ -341,7 +341,7 @@ long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z) { } - + long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_type) { //printf("Find Region %ld in node %ld\n", region, node_number); if(node_number<1) { @@ -369,7 +369,7 @@ long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_typ return 0; } - + diff --git a/utils/azone2/azone.h b/utils/azone2/azone.h index 641676194..3021b118a 100644 --- a/utils/azone2/azone.h +++ b/utils/azone2/azone.h @@ -38,7 +38,7 @@ using namespace std; unsigned shorts are adequate because, worst case even in a zone that is 6000x6000 with a small node size of 30x30, there are only 40000 nodes. - + quadrent definitions: quad 1 (nodes[0]): x>=0, y>=0 @@ -48,7 +48,7 @@ using namespace std; x<0, y<0 quad 4 (nodes[3]): x>=0, y<0 - + */ #define MAX_POLY_VTX 24 //arbitrary, im too lazy to figure it out //cut a triangle at most 6 times.... @@ -65,12 +65,12 @@ public: GPoint(); GPoint(VERTEX &v); GPoint(float x, float y, float z); - + inline void operator()(float nx, float ny, float nz) { x = nx; y = ny; z = nz; } - + GPoint cross(const GPoint &them) const; float dot3(const GPoint &them) const; - + float x; float y; float z; @@ -83,13 +83,13 @@ public: GVector(); GVector(const GPoint &them); GVector(float x, float y, float z, float w = 1.0f); - + inline void operator()(float nx, float ny, float nz, float nw) { x = nx; y = ny; z = nz; W = nw; } float dot4(const GVector &them) const; float dot4(const GPoint &them) const; void normalize(); float length(); - + float W; }; @@ -104,7 +104,7 @@ class QTBuilder { public: QTBuilder(); ~QTBuilder(); - + bool build(const char *shortname); bool build_eqg(const char *shortname); void AddPlaceable(FileLoader *fileloader, char *ZoneFileName, bool ListPlaceable=false); @@ -113,28 +113,28 @@ public: void ScaleVertex(VERTEX &v, float XScale, float YScale, float ZScale); void TranslateVertex(VERTEX &v, float XOffset, float YOffset, float ZOffset); bool writeMap(const char *file); - + bool FaceInNode(const QTNode *q, const FACE *f); protected: - + void AddFace(VERTEX &v1, VERTEX &v2, VERTEX &v3); - + int ClipPolygon(POLYGON *poly, GVector *plane); - + //dynamic during load // vector _VertexList; vector _FaceList; - + //static once loaded // unsigned long vertexCount; unsigned long faceCount; // VERTEX * vertexBlock; FACE * faceBlock; - + VERTEX tempvtx[MAX_POLY_VTX]; - + QTNode *_root; - + static void NormalizeN(FACE *p); #ifdef COUNT_MACTHES @@ -151,28 +151,28 @@ class QTNode { public: QTNode(QTBuilder *builder, float Tminx, float Tmaxx, float Tminy, float Tmaxy); ~QTNode(); - + void clearNodes(); - + void doSplit(); void divideYourself(int depth); - + void buildVertexes(); // bool writeFile(FILE *out); - + unsigned long countNodes() const; unsigned long countFacelists() const; - + void fillBlocks(nodeHeader *heads, unsigned long *flist, unsigned long &hindex, unsigned long &findex); - + float minx; float miny; float maxx; float maxy; unsigned long nfaces; vector faces; - + /* quadrent definitions: quad 1 (node1): @@ -190,7 +190,7 @@ public: QTNode *node4; GPoint v[8]; bool final; - + protected: QTBuilder *builder; }; diff --git a/utils/azone2/dat.cpp b/utils/azone2/dat.cpp index 0dad16ffa..c89bd4d11 100644 --- a/utils/azone2/dat.cpp +++ b/utils/azone2/dat.cpp @@ -98,14 +98,14 @@ string GetToken(uchar *&Buffer, int &Position) ++Position; } ++Position; - //printf("Returning %s\n", Token.c_str()); + //printf("Returning %s\n", Token.c_str()); return Token; } int AddModelName(Content_3D *C3D, string ModelName) { vector::iterator Iterator; - + for(unsigned int i = 0; i < C3D->ModelNames.size(); ++i) { #ifndef WIN32 @@ -116,8 +116,8 @@ int AddModelName(Content_3D *C3D, string ModelName) return i; } - - + + C3D->ModelNames.push_back(ModelName); return C3D->ModelNames.size() - 1; @@ -171,7 +171,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { if(filename != zone_name) delete[] filename; - + buf_start = buffer; //TODO: Find out what these three unknowns are @@ -341,10 +341,10 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { this->model_data.zone_model = new Zone_Model; zm = this->model_data.zone_model; - + zm->vert_count = QuadCount * TileCount * 4; zm->poly_count = QuadCount * 2 * TileCount; - + zm->verts = new Vertex *[zm->vert_count]; zm->polys = new Polygon *[zm->poly_count]; @@ -360,7 +360,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { for(int TileNumber = 0; TileNumber < TileCount; ++TileNumber) { - + int TileLNG = VARSTRUCT_DECODE_TYPE(uint32, buffer); int TileLAT = VARSTRUCT_DECODE_TYPE(uint32, buffer); int TileUNK = VARSTRUCT_DECODE_TYPE(uint32, buffer); @@ -449,7 +449,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { int LayerCount = VARSTRUCT_DECODE_TYPE(uint32, buffer); VARSTRUCT_DECODE_STRING(s, buffer); - + int OverlayCount = 0; for(int Layer = 1; Layer < LayerCount; ++Layer) @@ -462,10 +462,10 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { { uint8 Byte = VARSTRUCT_DECODE_TYPE(uint8, buffer); } - + ++OverlayCount; - } + } int Count1 = VARSTRUCT_DECODE_TYPE(uint32, buffer); #ifdef DEBUGDAT @@ -517,7 +517,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { printf("Model: %s LOC: %8.3f, %8.3f, %8.3f, ROT: %8.3f, %8.3f, %8.3f\n", ModelName, x, y, z, RotX, RotY, RotZ); #endif ObjectGroupEntry NewObjectGroup; - + NewObjectGroup.FromTOG = false; NewObjectGroup.y = y; @@ -534,18 +534,18 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { // of another tile, which means based on the data for the tile we are processing, we should be unable to // calculate the Z value for that object. // - // By hand editing an .EQG, it was discovered that what the client appears to do is calculate the Z value + // By hand editing an .EQG, it was discovered that what the client appears to do is calculate the Z value // for these objects by adjusting the x/y offsets by +/- (QuadsPerTile * UnitsPerVert) until the offsets // are within this tiles boundaries and using the corresponding height values. // - // For example, if a model has an offset of -157.5, -157.5 and QPT * UPV = 160, then the height value used + // For example, if a model has an offset of -157.5, -157.5 and QPT * UPV = 160, then the height value used // would be the height at +2.5, +2.5 in this tile. // // This doesn't make a great deal of sense, but it is how the EQ graphics engine appears to do things. // // These 'Adjusted' x/y offsets are used only for determing the ground Z for the object. The actual placement // of the object relative to the terrain uses the unadjusted offsets. - // + // // For the record, as of SoF, this applies to the following zones and objects: // // arcstone: Model translations adjusted from -14.000, 219.000 to 146.000, 59.000 @@ -737,7 +737,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float ZAdjust = VARSTRUCT_DECODE_TYPE(float, buffer); #ifdef DEBUGDAT - printf("ZAdjust %8.3f\n", ZAdjust); + printf("ZAdjust %8.3f\n", ZAdjust); #endif char TogFileName[255]; @@ -764,7 +764,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { NewObjectGroup.TileY = TileXStart; NewObjectGroup.TileZ = 0; - + NewObjectGroup.RotX = RotX; NewObjectGroup.RotY = RotY; NewObjectGroup.RotZ = RotZ; @@ -821,7 +821,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { NewObjectGroup.SubObjects.push_back(model_data.PlaceableList.size()-1); } if(Token == "*END_OBJECTGROUP") - { + { #ifdef DEBUGDAT printf("Pushing back new ObjectGroup\n"); printf(" Position : %8.3f, %8.3f, %8.3f\n", NewObjectGroup.x, NewObjectGroup.y, NewObjectGroup.z); @@ -867,7 +867,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float QuadVertex2X = QuadVertex1X + (QuadsPerTile * UnitsPerVertX); float QuadVertex2Y = QuadVertex1Y; float QuadVertex2Z = QuadVertex1Z; - + float QuadVertex3X = QuadVertex2X; float QuadVertex3Y = QuadVertex1Y + (QuadsPerTile * UnitsPerVertY); float QuadVertex3Z = QuadVertex1Z; @@ -875,7 +875,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float QuadVertex4X = QuadVertex1X; float QuadVertex4Y = QuadVertex3Y; float QuadVertex4Z = QuadVertex1Z; - + ++VertexNumber; @@ -903,7 +903,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { zm->polys[PolyNumber]->v1 = VertexNumber; zm->polys[PolyNumber]->v2 = VertexNumber - 3; zm->polys[PolyNumber]->v3 = VertexNumber - 2; - zm->polys[PolyNumber]->tex = -1; + zm->polys[PolyNumber]->tex = -1; } else { @@ -915,7 +915,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { { if((Quad % QuadsPerTile) == 0) ++RowNumber; - + // Other common values for this Byte are 0x80, 0x82. Setting them all to zero has no obvious visual // effect. if(Bytes[Quad] & 0x01) // Indicates Quad should not be included because an object will overlay it. @@ -924,47 +924,47 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float QuadVertex1X = TileXStart + (RowNumber * UnitsPerVertX); float QuadVertex1Y = TileYStart + (Quad % QuadsPerTile) * UnitsPerVertY; float QuadVertex1Z = Floats[Quad + RowNumber]; - + float QuadVertex2X = QuadVertex1X + UnitsPerVertX; float QuadVertex2Y = QuadVertex1Y; float QuadVertex2Z = Floats[Quad + RowNumber + QuadsPerTile + 1]; - + float QuadVertex3X = QuadVertex1X + UnitsPerVertX; float QuadVertex3Y = QuadVertex1Y + UnitsPerVertY; float QuadVertex3Z = Floats[Quad + RowNumber + QuadsPerTile + 2]; - + float QuadVertex4X = QuadVertex1X; float QuadVertex4Y = QuadVertex1Y + UnitsPerVertY; float QuadVertex4Z = Floats[Quad + RowNumber + 1]; - + ++VertexNumber; - + zm->verts[VertexNumber++] = new Vertex(QuadVertex1Y, QuadVertex1X, QuadVertex1Z); - + zm->verts[VertexNumber++] = new Vertex(QuadVertex2Y, QuadVertex2X, QuadVertex2Z); - + zm->verts[VertexNumber++] = new Vertex(QuadVertex3Y, QuadVertex3X, QuadVertex3Z); - + zm->verts[VertexNumber] = new Vertex(QuadVertex4Y, QuadVertex4X, QuadVertex4Z); - + PolyNumber++; - + zm->polys[PolyNumber] = new Polygon; - + zm->polys[PolyNumber]->v1 = VertexNumber; zm->polys[PolyNumber]->v2 = VertexNumber - 2; zm->polys[PolyNumber]->v3 = VertexNumber - 1; zm->polys[PolyNumber]->tex = -1; - + PolyNumber++; - + zm->polys[PolyNumber] = new Polygon; - + zm->polys[PolyNumber]->v1 = VertexNumber; zm->polys[PolyNumber]->v2 = VertexNumber - 3; zm->polys[PolyNumber]->v3 = VertexNumber - 2; - zm->polys[PolyNumber]->tex = -1; - + zm->polys[PolyNumber]->tex = -1; + } } zm->vert_count = VertexNumber + 1; @@ -995,7 +995,7 @@ int DATLoader::Close() { for(i = 0; i < zm->poly_count; ++i) delete zm->polys[i]; - + delete[] zm->verts; delete[] zm->polys; diff --git a/utils/azone2/listobj.cpp b/utils/azone2/listobj.cpp index 687355e69..f69e5b7de 100644 --- a/utils/azone2/listobj.cpp +++ b/utils/azone2/listobj.cpp @@ -1,18 +1,18 @@ /* - List Placeable Objects in an S3D or EQG. + List Placeable Objects in an S3D or EQG. By Derision, based on OpenEQ File Loaders by Daeken et al. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which are required to give you total support for your newly bought product; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -48,29 +48,29 @@ enum EQFileType { S3D, EQG, UNKNOWN }; int main(int argc, char *argv[]) { printf("LISTOBJ: List Placeable Objects in .S3D or .EQG zone files.\n"); - + if(argc != 2) { printf("Usage: %s (zone short name)\n", argv[0]); return(1); } - + return(ProcessZoneFile(argv[1])); } bool ProcessZoneFile(const char *shortname) { - + char bufs[96]; Archive *archive; FileLoader *fileloader; Zone_Model *zm; FILE *fff; EQFileType FileType = UNKNOWN; - + sprintf(bufs, "%s.s3d", shortname); archive = new PFSLoader(); fff = fopen(bufs, "rb"); - if(fff != nullptr) + if(fff != nullptr) FileType = S3D; else { sprintf(bufs, "%s.eqg", shortname); @@ -92,7 +92,7 @@ bool ProcessZoneFile(const char *shortname) { bool V4Zone = false; switch(FileType) { - case S3D: + case S3D: fileloader = new WLDLoader(); if(fileloader->Open(nullptr, (char *) shortname, archive) == 0) { printf("Error reading WLD from %s\n", bufs); @@ -118,7 +118,7 @@ bool ProcessZoneFile(const char *shortname) { zm = fileloader->model_data.zone_model; - + if(!V4Zone) ListPlaceable(fileloader, bufs); else @@ -137,11 +137,11 @@ void ListPlaceable(FileLoader *fileloader, char *ZoneFileName) { fileloader->model_data.placeable[i]->x, fileloader->model_data.placeable[i]->z, fileloader->model_data.placeable[i]->model, - fileloader->model_data.models[fileloader->model_data.placeable[i]->model]->name); + fileloader->model_data.models[fileloader->model_data.placeable[i]->model]->name); } } - + void ListPlaceableV4(FileLoader *fileloader, char *ZoneFileName) { @@ -175,7 +175,7 @@ void ListPlaceableV4(FileLoader *fileloader, char *ZoneFileName) list::iterator ModelIterator; ModelIterator = (*Iterator).SubObjects.begin(); - + while(ModelIterator != (*Iterator).SubObjects.end()) { int SubModel = (*ModelIterator); diff --git a/utils/azone2/pfs.cpp b/utils/azone2/pfs.cpp index c58816d5e..05cd8d31e 100644 --- a/utils/azone2/pfs.cpp +++ b/utils/azone2/pfs.cpp @@ -46,12 +46,12 @@ inline void decompress(char *p, char *p2, int len, int uLen) { d_stream.zalloc = (alloc_func)0; d_stream.zfree = (free_func)0; d_stream.opaque = (voidpf)0; - + d_stream.next_in = (Bytef *) p; d_stream.avail_in = len; d_stream.next_out = (Bytef *) p2; d_stream.avail_out = uLen; - + inflateInit(&d_stream); status = inflate(&d_stream, Z_NO_FLUSH); inflateEnd(&d_stream); @@ -107,7 +107,7 @@ int PFSLoader::Open(FILE *fp) fseek(fp, s3d_header.offset, SEEK_SET); fread(&s3d_dir_header, sizeof(struct_directory_header), 1, fp); - + this->count = s3d_dir_header.count - 1; this->filenames = new char *[s3d_dir_header.count]; this->files = new uint32[s3d_dir_header.count - 1]; @@ -206,7 +206,7 @@ const char *PFSLoader::FindExtension(const char *ext) { int i; int elen = strlen(ext); - + for(i = 0; i < this->count; ++i) { int flen = strlen(this->filenames[i]); if(flen <= elen) @@ -234,7 +234,7 @@ int PFSLoader::GetFile(char *name, uchar **buf, int *len) { fread(&s3d_dir, sizeof(struct_directory), 1, this->fp); fseek(this->fp, s3d_dir.offset, SEEK_SET); *buf = new uchar[s3d_dir.size]; - + inf = 0; while(inf < (int)s3d_dir.size) { fread(&s3d_data, sizeof(struct_data_block), 1, this->fp); diff --git a/utils/azone2/ter.cpp b/utils/azone2/ter.cpp index c2e021e4f..bc5dd4f07 100644 --- a/utils/azone2/ter.cpp +++ b/utils/azone2/ter.cpp @@ -105,17 +105,17 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { this->model_data.zone_model = new Zone_Model; zm = this->model_data.zone_model; - + zm->vert_count = thdr->vert_count; zm->poly_count = thdr->tri_count; - + zm->verts = new Vertex *[zm->vert_count]; zm->polys = new Polygon *[zm->poly_count]; this->model_data.plac_count = 0; this->model_data.model_count = 0; - - buffer = ter_orig + thdr->list_len + sizeof(ter_header); + + buffer = ter_orig + thdr->list_len + sizeof(ter_header); if(thdr->magic[3] == 'M') buffer = buffer + 4; #ifdef DEBUGTER printf("Starting offset is %8X\n", buffer-ter_orig); @@ -158,7 +158,7 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { } - + j = 0; for(i = 0; i < (unsigned int)zm->poly_count; ++i) { ttri = (ter_triangle *) buffer; @@ -167,7 +167,7 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { continue; } zm->polys[j] = new Polygon; -/* +/* zm->polys[j]->v1 = ttri->v1; zm->polys[j]->v2 = ttri->v2; zm->polys[j]->v3 = ttri->v3; @@ -201,15 +201,15 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { #endif zm->polys[j]->tex = ttri->group; } - + ++j; buffer += sizeof(ter_triangle); } - + zm->poly_count = j; - + zm->tex_count = 0; - + delete[] mlist; delete [] ter_orig; diff --git a/utils/azone2/wld.cpp b/utils/azone2/wld.cpp index 0fddac191..45471738c 100644 --- a/utils/azone2/wld.cpp +++ b/utils/azone2/wld.cpp @@ -150,11 +150,11 @@ FRAG_CONSTRUCTOR(Data21) { } - + } FRAG_CONSTRUCTOR(Data22) { - + int pos; uchar *data6area ; @@ -190,7 +190,7 @@ FRAG_CONSTRUCTOR(Data22) { Frag36Ref = *((long *) (data6area+20)); //printf("Frag 36 reference?: %ld\n", *((long *) (data6area+20))); } - + @@ -198,7 +198,7 @@ FRAG_CONSTRUCTOR(Data22) { } FRAG_CONSTRUCTOR(Data29) { - + long a,flags, numregions, lenstr; struct_Data29 *data29 = (struct_Data29 *) malloc(sizeof(struct_Data29)); @@ -213,7 +213,7 @@ FRAG_CONSTRUCTOR(Data29) { else if(!strncmp((char *) &wld->sHash[-frag_name], "VWA", 3)) data29->region_type = 7; // VWater ? this->frag = (void *) data29; - + flags = *buf; numregions = *((long *)(buf+4)); data29->region_count = numregions ; @@ -277,7 +277,7 @@ FRAG_CONSTRUCTOR(Data30) { this->frag = (void *) tex; return; } - + tex = (Texture *) wld->frags[ref - 1]->frag; if(data->params1 & (1 << 1) || data->params1 & (1 << 2) || data->params1 & (1 << 3) || data->params1 & (1 << 4)) @@ -313,7 +313,7 @@ FRAG_CONSTRUCTOR(Data36) { VertexNormal *vn; Vert *v; - + TexRef *tr; @@ -393,7 +393,7 @@ FRAG_CONSTRUCTOR(Data36) { for(i = 0; i < header->normalsCount; ++i) { - + if(ivertexCount) { vn = (VertexNormal *) buf; vert = model->verts[i]; @@ -419,7 +419,7 @@ FRAG_CONSTRUCTOR(Data36) { // in the WLD loader in the stock azone, and has the effect of screwing up the normals, // Changed to keep things consistent with prior versions. poly->v1 = p->v1; - poly->v2 = p->v2; + poly->v2 = p->v2; poly->v3 = p->v3; #ifdef DEBUGWLD2 printf("Frag36: Polygon: %5d Vertices: %5d, %5d, %5d\n", i, poly->v1, poly->v2, poly->v3); @@ -502,7 +502,7 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { return 0; buffer += sizeof(struct_wld_header); - + this->sHash = buffer; decode(this->sHash, header->stringHashSize); buffer += header->stringHashSize; @@ -535,7 +535,7 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { case 0x30: FRAGMENT(Data30); break; case 0x31: FRAGMENT(Data31); break; case 0x36: FRAGMENT(Data36); break; - + default: this->frags[i] = new Fragment; break; } @@ -545,7 +545,7 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { buffer += frag->size - 4; } - + if(!strcmp(&zone_name[strlen(zone_name) - 4], "_obj")) { @@ -585,12 +585,12 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { } - + zm->verts = new Vertex *[zm->vert_count]; zm->polys = new Polygon *[zm->poly_count]; - + vc = pc = 0; - + for(i = 0; i < this->fragcount; ++i) { if(this->frags[i]->type != 0x36) continue; @@ -714,7 +714,7 @@ int WLDLoader::Close() { for(j = 0; j < zm->tex_count; ++j) delete zm->tex[j]; delete[] zm->tex; - + delete[] zm->verts; delete[] zm->polys; } diff --git a/utils/azone2/wld.hpp b/utils/azone2/wld.hpp index b6760ea8a..4665be754 100644 --- a/utils/azone2/wld.hpp +++ b/utils/azone2/wld.hpp @@ -33,7 +33,7 @@ class WLDLoader : public FileLoader { public: WLDLoader(); ~WLDLoader(); - + virtual int Open(char *base_path, char *zone_name, Archive *archive); virtual int Close(); diff --git a/utils/azone2/zon.cpp b/utils/azone2/zon.cpp index 82e5812b4..efa275cf7 100644 --- a/utils/azone2/zon.cpp +++ b/utils/azone2/zon.cpp @@ -154,7 +154,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { // Derision: 23/06/08 // dranikcatacombsa.eqg has a couple of model names with a left parenthesis where there should // be an underscore. E.g. OBP_DZ_Lbanner0)_00.MOD instead of OBP_DZ_Lbanner0__00.MOD - // This is the only zone I have seen this in, but is the reason for the follow code to replace + // This is the only zone I have seen this in, but is the reason for the follow code to replace // the parenthesis with an underscore. // for(unsigned int i=0; ilist_len + hdr->NumberOfModels * 4; this->model_data.plac_count = hdr->obj_count - 1; @@ -187,8 +187,8 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { #ifdef DEBUGPLAC printf(" Placeable count is %d\n", this->model_data.plac_count); #endif - this->model_data.placeable = new Placeable *[this->model_data.plac_count]; - + this->model_data.placeable = new Placeable *[this->model_data.plac_count]; + plac = (zon_placeable *) buffer; base[0] = plac->x; base[1] = plac->y; @@ -250,7 +250,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { long UnknownSize = *((long *)(buffer)); buffer = buffer + 4 + (UnknownSize * 4); } - + } @@ -272,7 +272,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { } // printf("Attempting to open MOD file %s\n", model_names[j]); fflush(stdout); if(model_loaders[j].Open(nullptr, model_names[j], archive)) { - + this->model_data.models[j] = new Model; this->model_data.models[j]->vert_count = model_loaders[j].model_data.zone_model->vert_count; this->model_data.models[j]->poly_count = model_loaders[j].model_data.zone_model->poly_count; @@ -282,10 +282,10 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { this->model_data.models[j]->tex = model_loaders[j].model_data.zone_model->tex; this->model_data.models[j]->name = new char[strlen(model_names[j])+1]; strcpy(this->model_data.models[j]->name, model_names[j]); - + tex_tmp = 1; // I think this is looking to see if the placeable model textures already exist in the zone model. - // + // for(i = 0; i < this->model_data.models[j]->tex_count; ++i) { tex_tmp = 1; // Derision for(k = 0; k < this->model_data.zone_model->tex_count; ++k) { @@ -310,7 +310,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { continue; } for(l = 0; l < this->model_data.models[k]->tex_count; ++l) { - if(this->model_data.models[k]->tex[l]->filenames[0] == this->model_data.models[j]->tex[i]->filenames[0] || + if(this->model_data.models[k]->tex[l]->filenames[0] == this->model_data.models[j]->tex[i]->filenames[0] || (this->model_data.models[k]->tex[l]->filenames[0] && this->model_data.models[j]->tex[i]->filenames[0] && !strcmp(this->model_data.models[k]->tex[l]->filenames[0], this->model_data.models[j]->tex[i]->filenames[0]))) { diff --git a/utils/azone2/zon.hpp b/utils/azone2/zon.hpp index 876bdfc4e..f7198ffa7 100644 --- a/utils/azone2/zon.hpp +++ b/utils/azone2/zon.hpp @@ -35,7 +35,7 @@ class ZonLoader : public FileLoader { public: ZonLoader(); ~ZonLoader(); - + virtual int Open(char *base_path, char *zone_name, Archive *archive); virtual int Close(); diff --git a/utils/azone2/zonv4.cpp b/utils/azone2/zonv4.cpp index 40abc53d3..c2e0b32af 100644 --- a/utils/azone2/zonv4.cpp +++ b/utils/azone2/zonv4.cpp @@ -26,7 +26,7 @@ Zonv4Loader::~Zonv4Loader() int Zonv4Loader::Open(char *base_path, char *zone_name, Archive *archive) { - + uchar *buffer; int position; int buf_len; diff --git a/utils/azone2/zonv4.hpp b/utils/azone2/zonv4.hpp index c97b3bbd5..cbfd4ef18 100644 --- a/utils/azone2/zonv4.hpp +++ b/utils/azone2/zonv4.hpp @@ -31,7 +31,7 @@ class Zonv4Loader : public FileLoader { public: Zonv4Loader(); ~Zonv4Loader(); - + virtual int Open(char *base_path, char *zone_name, Archive *archive); virtual int Close(); diff --git a/utils/defaults/eqemu_config.xml.full b/utils/defaults/eqemu_config.xml.full index 859dafa33..9f1de78cd 100644 --- a/utils/defaults/eqemu_config.xml.full +++ b/utils/defaults/eqemu_config.xml.full @@ -25,7 +25,7 @@ some long random string - + diff --git a/utils/defaults/mime.types b/utils/defaults/mime.types index e0ef69119..9cf771941 100644 --- a/utils/defaults/mime.types +++ b/utils/defaults/mime.types @@ -3,24 +3,24 @@ # http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/extension-map.html # for more details -application/postscript ai eps ps -application/rtf rtf -application/x-tex tex -application/x-texinfo texinfo texi -application/x-troff t tr roff -audio/basic au snd +application/postscript ai eps ps +application/rtf rtf +application/x-tex tex +application/x-texinfo texinfo texi +application/x-troff t tr roff +audio/basic au snd audio/x-aiff aif aiff aifc -audio/x-wav wav -image/gif gif -image/ief ief +audio/x-wav wav +image/gif gif +image/ief ief image/jpeg jpeg jpg jpe -image/tiff tiff tif -image/x-xwindowdump xwd -text/html html +image/tiff tiff tif +image/x-xwindowdump xwd +text/html html text/plain txt c cc h -video/mpeg mpeg mpg mpe -video/quicktime qt mov -video/x-msvideo avi +video/mpeg mpeg mpg mpe +video/quicktime qt mov +video/x-msvideo avi video/x-sgi-movie movie text/css css image/png png diff --git a/utils/defaults/plugins/check_handin.pl b/utils/defaults/plugins/check_handin.pl index 57da2fd73..13cad9b91 100644 --- a/utils/defaults/plugins/check_handin.pl +++ b/utils/defaults/plugins/check_handin.pl @@ -34,7 +34,7 @@ sub check_mq_handin { return 1; } -sub return_items { +sub return_items { my $hashref = plugin::var('$itemcount'); my $client = plugin::val('$client'); my $items_returned = 0; @@ -45,7 +45,7 @@ sub return_items { 2 => [ plugin::val('$item3'), plugin::val('$item3_charges'), plugin::val('$item3_attuned') ], 3 => [ plugin::val('$item4'), plugin::val('$item4_charges'), plugin::val('$item4_attuned') ], ); - + foreach my $k (keys(%{$hashref})) { next if($k == 0); diff --git a/utils/defaults/templates/TreeMenu.css b/utils/defaults/templates/TreeMenu.css index 974be6379..b5c3055f8 100644 --- a/utils/defaults/templates/TreeMenu.css +++ b/utils/defaults/templates/TreeMenu.css @@ -28,17 +28,17 @@ font-style: normal; } -/* Since all menu items are links, the following can be equally important - * to your menu appearance. +/* Since all menu items are links, the following can be equally important + * to your menu appearance. * The main thing you may want to change are the A:link and A:visited colors. */ -*.tmenu0text A:link,*.tmenu1text A:link,*.tmenu2text A:link,*.tmenu3text A:link +*.tmenu0text A:link,*.tmenu1text A:link,*.tmenu2text A:link,*.tmenu3text A:link { text-decoration:none; color:#505080 } -*.tmenu0text A:visited,*.tmenu1text A:visited,*.tmenu2text A:visited,*.tmenu3text A:visited +*.tmenu0text A:visited,*.tmenu1text A:visited,*.tmenu2text A:visited,*.tmenu3text A:visited { text-decoration:none; color:#505080 } -*.tmenu0text A:active,*.tmenu1text A:active,*.tmenu2text A:active,*.tmenu3text A:active +*.tmenu0text A:active,*.tmenu1text A:active,*.tmenu2text A:active,*.tmenu3text A:active { text-decoration:none; color:#805050 } -*.tmenu0text A:hover,*.tmenu1text A:hover,*.tmenu2text A:hover,*.tmenu3text A:hover +*.tmenu0text A:hover,*.tmenu1text A:hover,*.tmenu2text A:hover,*.tmenu3text A:hover { text-decoration:underline; color:#FF0000 } @@ -51,7 +51,7 @@ } /* .tmenuSelected is used with linkSelectKey to highlight selected items */ -.tmenuSelected { +.tmenuSelected { background-color: yellow; } *.tmenuSelected A:link { text-decoration:none; color:#2020ff } diff --git a/utils/defaults/templates/TreeMenu.js b/utils/defaults/templates/TreeMenu.js index 90171c157..3f29ff5d0 100644 --- a/utils/defaults/templates/TreeMenu.js +++ b/utils/defaults/templates/TreeMenu.js @@ -12,7 +12,7 @@ // | notice, this list of conditions and the following disclaimer. | // | o Redistributions in binary form must reproduce the above copyright | // | notice, this list of conditions and the following disclaimer in the | -// | documentation and/or other materials provided with the distribution.| +// | documentation and/or other materials provided with the distribution.| // | o The names of the authors may not be used to endorse or promote | // | products derived from this software without specific prior written | // | permission. | @@ -51,7 +51,7 @@ this.imgWidth = 20; this.imgHeight = 20; this.n = new Array(); - + this.branches = new Array(); this.branchStatus = new Array(); this.layerRelations = new Array(); @@ -79,10 +79,10 @@ newNode.lineImageWidth = this.imgWidth; newNode.lineImageHeight = this.imgHeight; this.n[newIndex] = newNode; - + return this.n[newIndex]; } - + TreeMenu.prototype.SetImageSize = function(w, h) { this.imgWidth = w; this.imgHeight = h; @@ -96,15 +96,15 @@ var plustop = new Image; plustop.src = this.iconpath + '/plustop.gif'; var plusbottom = new Image; plusbottom.src = this.iconpath + '/plusbottom.gif'; var plus = new Image; plus.src = this.iconpath + '/plus.gif'; - + var minustop = new Image; minustop.src = this.iconpath + '/minustop.gif'; var minusbottom = new Image; minusbottom.src = this.iconpath + '/minusbottom.gif'; var minus = new Image; minus.src = this.iconpath + '/minus.gif'; - + var branchtop = new Image; branchtop.src = this.iconpath + '/branchtop.gif'; var branchbottom = new Image; branchbottom.src = this.iconpath + '/branchbottom.gif'; var branch = new Image; branch.src = this.iconpath + '/branch.gif'; - + var linebottom = new Image; linebottom.src = this.iconpath + '/linebottom.gif'; var line = new Image; line.src = this.iconpath + '/line.gif'; } @@ -122,7 +122,7 @@ var modifier = ''; var layerID = ''; var parentLayerID = ''; - + /** * Parse any optional arguments */ @@ -132,19 +132,19 @@ var expanded = arguments[3] ? arguments[3] : false; var visibility = arguments[4] ? arguments[4] : 'inline'; var parentLayerID = arguments[5] ? arguments[5] : null; - + var currentlevel = level.length; - + for (var i=0; i', this.iconpath, nodes[i].icon, nodes[i].iconImageWidth, nodes[i].iconImageHeight) : ''; - - + + /** * Build the html to write to the document * IMPORTANT: @@ -210,14 +210,14 @@ var imgTag = this.stringFormat('', this.iconpath, gifname, modifier, layerID, onMDown, nodes[i].lineImageWidth, nodes[i].lineImageHeight); var linkStart = nodes[i].link ? this.stringFormat('', nodes[i].link, this.linkTarget) : ''; var linkEnd = nodes[i].link ? '' : ''; - + // cc 2002-11-12 All these are additions var selectedStart = nodes[i].selected ? "" : ''; var selectedEnd = nodes[i].selected ? '' : ''; var nobrStart = this.brOK ? '' : ''; var nobrEnd = this.brOK ? '' : ''; - + // cc 2002-11-12 modified output = this.stringFormat('{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}
', layerTag, @@ -229,7 +229,7 @@ nodes[i].title, linkEnd, selectedEnd, nobrEnd); - + /** * Write out the HTML. Uses document.write for speed over layers and * innerHTML. This however means no dynamic adding/removing nodes on @@ -249,15 +249,15 @@ */ if (parentLayerID == null && nodes.length == 1) { var newPrepend = ''; - + } else if (i < (nodes.length - 1)) { // cc 2002-11-12 Both lines, added image size parameters. var newPrepend = prepend + this.stringFormat('', this.iconpath, nodes[i].lineImageWidth, nodes[i].lineImageHeight); - + } else { var newPrepend = prepend + this.stringFormat('', this.iconpath, nodes[i].lineImageWidth, nodes[i].lineImageHeight); } - + this.drawMenu(nodes[i].n, level, newPrepend, @@ -276,26 +276,26 @@ { var currentDisplay = this.getLayer(layerID).style.display; var newDisplay = (this.branchStatus[layerID] && currentDisplay == 'inline') ? 'none' : 'inline' - + for (var i=0; iquery($q); - if ($res2) { + if ($res2) { my $row5=$res2->fetch_row_hash; print <<"CHAR"; @@ -95,7 +95,7 @@ CHAR print "Account Name query error."; } } - print ""; + print ""; } else { print "IP Address query error."; } @@ -104,9 +104,9 @@ CHAR my $acctE = $EQDB->escape_string($acct); my $q; $q="select id,charname,sharedplat,status,revoked from account where name='$acctE'"; - + my $res=$EQDB->query($q); - if ($res) { + if ($res) { my $row=$res->fetch_row_hash; print <<"HTML"; @@ -139,17 +139,17 @@ HTML CHAR } - print "
$row2->{zonename} delete, - move acct, + move acct, move zone
"; + print ""; } else { print "Char query error."; } - + $q="SELECT ip,count FROM account_ip WHERE accid=$row->{id}"; my $res3=$EQDB->query($q); if($res3) { @@ -166,7 +166,7 @@ HTML $row3->{ip} $row3->{count} - + CHAR } print ""; @@ -185,7 +185,7 @@ HTML } else { print "Query error."; } - + print "Actions: ban/unban, set status, set world password, delete chars, move chars, delete account and chars"; } diff --git a/utils/defaults/templates/accounts.html b/utils/defaults/templates/accounts.html index 7166e0d91..e89e4e276 100644 --- a/utils/defaults/templates/accounts.html +++ b/utils/defaults/templates/accounts.html @@ -18,7 +18,7 @@ $type = $request->get("type", ""); ?>
Account Search:
- > Account Name   + > Account Name   > Character Name
@@ -41,8 +41,8 @@ if ($query) { } my $res=$EQDB->query($q); - if ($res) { - + if ($res) { + print "\n"; print "\t\n"; if ($type eq "char") { diff --git a/utils/defaults/templates/bugs.html b/utils/defaults/templates/bugs.html index 063bd6d10..7ceb7db64 100644 --- a/utils/defaults/templates/bugs.html +++ b/utils/defaults/templates/bugs.html @@ -12,7 +12,7 @@ my $id = $request->get("id", "0"); $EQW->ResolveBug($id); } - + $offset = $request->get("offset", "0"); $count = $EQW->CountBugs(); @bugs = $EQW->ListBugs($offset); diff --git a/utils/defaults/templates/commands.html b/utils/defaults/templates/commands.html index 441434e91..abfef6636 100644 --- a/utils/defaults/templates/commands.html +++ b/utils/defaults/templates/commands.html @@ -37,7 +37,7 @@ if (defined($gets->{"update.x"})) { my $i=0; $q="select * from commands order by command"; my $res=$EQDB->query($q); - if ($res) { + if ($res) { print "
\n"; printf "\t\t\n"; printf "\t\t\n"; diff --git a/utils/defaults/templates/guild.html b/utils/defaults/templates/guild.html index 53423433f..c420837b5 100644 --- a/utils/defaults/templates/guild.html +++ b/utils/defaults/templates/guild.html @@ -14,7 +14,7 @@ my $gid = $request->getInt("id", 0); if($gid > 0) { my $act = $request->get("action", ""); - + #note: delete action should be done on the actions.html page, so we can redirect elsewhere. if($act eq "makeleader") { my $char = $request->getInt("char", 0); @@ -39,9 +39,9 @@ if($gid > 0) { print "Invalid char in remove member.
"; } } - - - + + + my $q = "SELECT g.id,g.name,g.leader,g.motd,g.motd_setter,g.tribute,c.name AS lname FROM guilds AS g LEFT JOIN character_ AS c ON g.leader=c.id WHERE g.id=$gid"; my $res=$EQDB->query($q); my $row; @@ -61,7 +61,7 @@ HTML ."LEFT JOIN character_ AS c ON g.char_id=c.id " ."LEFT JOIN guild_ranks AS gr ON g.rank=gr.rank AND g.guild_id=gr.guild_id " ."WHERE g.guild_id=$gid"; - + my $res2 = $EQDB->query($q); if($res2) { print <<"HTML"; @@ -93,7 +93,7 @@ HTML CHAR diff --git a/utils/defaults/templates/guilds.html b/utils/defaults/templates/guilds.html index a2392553e..d04606eed 100644 --- a/utils/defaults/templates/guilds.html +++ b/utils/defaults/templates/guilds.html @@ -11,7 +11,7 @@

Guild List



diff --git a/utils/defaults/templates/launcher.html b/utils/defaults/templates/launcher.html index ba6cf48e5..baa8408f6 100644 --- a/utils/defaults/templates/launcher.html +++ b/utils/defaults/templates/launcher.html @@ -114,9 +114,9 @@ if($act eq "Boot") { ?>
@@ -153,7 +153,7 @@ if($act eq "Boot") { ListZones(); - + for my $zone (sort @zones) { my $z = $config->GetZoneDetails($zone); if(!$z) { @@ -161,7 +161,7 @@ if($act eq "Boot") { } elsif($z->{error}) { $zone->{name} = "ERROR: $z->{error}"; } - + print "\n"; print "\t"; if($z->{up}) { diff --git a/utils/defaults/templates/launchers.html b/utils/defaults/templates/launchers.html index 69d6b5fa0..997b51c9f 100644 --- a/utils/defaults/templates/launchers.html +++ b/utils/defaults/templates/launchers.html @@ -9,7 +9,7 @@ ListLaunchers(); - + ?>

Launchers

@@ -51,7 +51,7 @@ print "You have ".($#list+1)." launchers. (@list)"; Add Launcher: Name: -Dynamic Count: +Dynamic Count: diff --git a/utils/defaults/templates/main.css b/utils/defaults/templates/main.css index 1549282c2..8d7db8811 100644 --- a/utils/defaults/templates/main.css +++ b/utils/defaults/templates/main.css @@ -45,26 +45,26 @@ table { border-collapse:collapse; } th { - margin:2px; + margin:2px; padding: 2px; border:1px solid #2b6874; - background-color:#2b6874; - color:#dddddd; + background-color:#2b6874; + color:#dddddd; font-weight:bold; } td { - margin:2px; + margin:2px; padding: 2px; - border:1px solid #2b6874; - background-color:#12282F; - color:#aaaaaa; + border:1px solid #2b6874; + background-color:#12282F; + color:#aaaaaa; } .headtbl { border: 0px; - margin: 0px; - padding: 0px; + margin: 0px; + padding: 0px; background-color: #091315; } diff --git a/utils/defaults/templates/rule.html b/utils/defaults/templates/rule.html index da72cc324..8738d021a 100644 --- a/utils/defaults/templates/rule.html +++ b/utils/defaults/templates/rule.html @@ -25,11 +25,11 @@ print "\t\n"; print "\t\t\n"; print "\t\t\n"; - + my $q2 = "SELECT COUNT(ruleset_id) AS num_rules FROM rule_values WHERE ruleset_id = '$row->{ruleset_id}'"; my $res2 = $EQDB->query($q2); my $row2 = $res2->fetch_row_hash; - + print "\t\t\n"; #print "\t\t\n"; print "\t\n"; diff --git a/utils/defaults/templates/rules.html b/utils/defaults/templates/rules.html index 20ea10565..7a81935c3 100644 --- a/utils/defaults/templates/rules.html +++ b/utils/defaults/templates/rules.html @@ -35,14 +35,14 @@ if ($ruleset_id !~ m/^[0-9]+$/) {$ruleset_id = 1;} #this should default any non-numeric values (particularly blank ones), also making it free from injections my $rule_type = $request->get("rule_type", "All"); #not safe from injection as-is if ($rule_type !~ m/^\w+$/i) {$rule_type = "All";} #this should make it safe from injection, but may cause issues if we start using non-alphanumeric characters in the first part of the rule_name - + #now, we'll put together a list of the rule categories that we can filter by print "
\n\t"; - + if ($rule_type eq "All") {print "";} print "All"; if ($rule_type eq "All") {print "";} - + my $q = "SELECT DISTINCT(SUBSTRING(rule_name, 1, LOCATE(':', rule_name) - 1)) AS rule_type FROM rule_values WHERE ruleset_id = '$ruleset_id' ORDER BY rule_type ASC"; my $res = $EQDB->query($q); if ($res) { @@ -73,7 +73,7 @@ #print "\t\t
\n"; #print "\t\t\n"; #print "\t\n"; - + #lastly, output any matching rules my $w2 = "WHERE ruleset_id = '$ruleset_id'"; if ($rule_type ne "All") { diff --git a/utils/defaults/templates/top.html b/utils/defaults/templates/top.html index b744adba7..6a062c8bf 100644 --- a/utils/defaults/templates/top.html +++ b/utils/defaults/templates/top.html @@ -9,7 +9,7 @@
CommandAccess$tline/$row2->{total_tribute} $row2->{public_note} - Remove - + Remove - Make Leader
$z->{name}
{ruleset_id}\">$row->{name}{ruleset_id}\">$row->{ruleset_id}$row2->{num_rules}
- + diff --git a/utils/defaults/templates/variables.html b/utils/defaults/templates/variables.html index a5f59f83e..06a3df246 100644 --- a/utils/defaults/templates/variables.html +++ b/utils/defaults/templates/variables.html @@ -36,7 +36,7 @@ if (defined($gets->{"update.x"})) { my $i=0; $q="select * from variables order by varname"; my $res=$EQDB->query($q); - if ($res) { + if ($res) { print "
\n"; printf "\t\t\n"; printf "\t\t\n"; diff --git a/utils/defaults/updated_templates/actions/bug_action.html b/utils/defaults/updated_templates/actions/bug_action.html index 8cfea78f1..9dcd1e492 100644 --- a/utils/defaults/updated_templates/actions/bug_action.html +++ b/utils/defaults/updated_templates/actions/bug_action.html @@ -1,7 +1,7 @@ get("action", "none"); my $bug_id = $request->get("bug_id", "-1"); - + if($action eq "resolve") { if($bug_id != -1) { $EQW->ResolveBug($bug_id); diff --git a/utils/defaults/updated_templates/actions/console_action.html b/utils/defaults/updated_templates/actions/console_action.html index 6213b6d0f..4a41b6164 100644 --- a/utils/defaults/updated_templates/actions/console_action.html +++ b/utils/defaults/updated_templates/actions/console_action.html @@ -17,7 +17,7 @@ print "}"; return; } - + print "{"; print "\"status\" : 1,"; print "\"message\" : \"\""; diff --git a/utils/defaults/updated_templates/actions/launcher_action.html b/utils/defaults/updated_templates/actions/launcher_action.html index b4a925d9b..87698c561 100644 --- a/utils/defaults/updated_templates/actions/launcher_action.html +++ b/utils/defaults/updated_templates/actions/launcher_action.html @@ -7,8 +7,8 @@ print "\"message\" : \"Missing launcher name in Remove action\""; print "}"; return; - } - + } + if($action eq "add") { my $dynamic_count = $request->get("dynamic_count", "0"); if($dynamic_count < 0 || $dynamic_count > 254) { @@ -40,7 +40,7 @@ print "}"; return; } - + if($port < 0 || $port > 65535) { print "{"; print "\"status\" : 0, "; @@ -48,14 +48,14 @@ print "}"; return; } - + if(!$config->BootStaticZone($zone, $port)) { print "{"; print "\"status\" : 0, "; print "\"message\" : \"Failed to boot '$zone' on launcher $launcher_name with port $port. Invalid zone?\""; print "}"; return; - } + } } elsif($action eq "change_dynamic_count") { my $dynamic_count = $request->get("dynamic_count", "0"); $config->SetDynamicCount($dynamic_count); @@ -73,7 +73,7 @@ print "\"status\" : 0, "; print "\"message\" : \"Failed to remove '$zone' on launcher $launcher_name. Invalid zone?\""; print "}"; - return; + return; } } } elsif($action eq "reboot_all") { @@ -98,7 +98,7 @@ return; } else { $config->RestartZone($zone); - } + } } elsif($action eq "start_zone") { my $zone = $request->get("zone", "none"); if($zone eq "none" || $zone eq "") { @@ -122,7 +122,7 @@ $config->StopZone($zone); } } - + print "{"; print "\"status\" : 1"; print "}"; diff --git a/utils/defaults/updated_templates/actions/world_action.html b/utils/defaults/updated_templates/actions/world_action.html index 6d50b239b..acdd15890 100644 --- a/utils/defaults/updated_templates/actions/world_action.html +++ b/utils/defaults/updated_templates/actions/world_action.html @@ -7,7 +7,7 @@ } elsif($act eq "lsreconnect") { $EQW->LSReconnect(); } - + print "{"; if($EQW->LSConnected()) { print "\"connected\" : \"1\","; diff --git a/utils/defaults/updated_templates/actions/zone_action.html b/utils/defaults/updated_templates/actions/zone_action.html index 5813cfb2f..7a520a15e 100644 --- a/utils/defaults/updated_templates/actions/zone_action.html +++ b/utils/defaults/updated_templates/actions/zone_action.html @@ -9,7 +9,7 @@ } elsif($act eq "killall") { } elsif($act eq "restartall") { } - + print "{"; print "\"status\" : 1"; print "}"; diff --git a/utils/defaults/updated_templates/bugs.html b/utils/defaults/updated_templates/bugs.html index 5f2dc9703..aa1866c9b 100644 --- a/utils/defaults/updated_templates/bugs.html +++ b/utils/defaults/updated_templates/bugs.html @@ -10,13 +10,13 @@ function GetStatusIdx() { return idx++; } - + var offset = 0; function StatusTic() { $.getJSON("data/bug_data.html?offset="+offset+"&idx="+GetStatusIdx(), function(data) { var elm = document.getElementById("open_bugs_count"); - + var cur_offset = offset / 50; var sep = (data.total_bug_count / 50); var app = ""; @@ -31,7 +31,7 @@ } } elm.innerHTML = app; - + $("#bug_table").empty(); var app_html = ""; app_html += ""; @@ -41,7 +41,7 @@ app_html += ""; app_html += ""; $("#bug_table").append(app_html); - for(var i = 0; i < data.bug_count; i++) { + for(var i = 0; i < data.bug_count; i++) { app_html = ""; var mod = i % 2; if(mod == 1) { @@ -49,7 +49,7 @@ } else { app_html += ""; } - + var bug_text = data.bugs[i].bug; bug_text = bug_text.replace("\r", ""); bug_text = bug_text.replace("\n", "
"); @@ -59,16 +59,16 @@ app_html += ""; app_html += ""; app_html += ""; - $("#bug_table").append(app_html); + $("#bug_table").append(app_html); } }); } - + function OpenBugs(off) { offset = off; StatusTic(); } - + function ResolveBug(id) { $.getJSON("actions/bug_action.html?action=resolve&bug_id="+id+"&idx="+GetStatusIdx(), function(data) { @@ -76,11 +76,11 @@ alert(data.message); return; } - + StatusTic(); }); } - + $(document).ready(function() { setInterval("StatusTic()", 15000); }); @@ -103,7 +103,7 @@ for(my $i = 0; $i < $sep; ++$i) { my $cur = 50 * $i; my $name = $i + 1; - + if($i == $cur_offset) { print "$name "; } @@ -128,13 +128,13 @@ if(!$bug) { next; } - + if($i % 2 == 1) { print ""; } else { print ""; } - + my $bug_val = $bug->{bug}; $bug_val =~ s/\r//g; $bug_val =~ s/\n/
/g; diff --git a/utils/defaults/updated_templates/bugview.html b/utils/defaults/updated_templates/bugview.html index b41ee29c9..3dcac45ee 100644 --- a/utils/defaults/updated_templates/bugview.html +++ b/utils/defaults/updated_templates/bugview.html @@ -10,13 +10,13 @@ function GetStatusIdx() { return idx++; } - + var offset = 0; function StatusTic() { $.getJSON("data/bug_data.html?offset="+offset+"&idx="+GetStatusIdx(), function(data) { var elm = document.getElementById("open_bugs_count"); - + var cur_offset = offset / 50; var sep = (data.total_bug_count / 50); var app = ""; @@ -31,7 +31,7 @@ } } elm.innerHTML = app; - + $("#bug_table").empty(); var app_html = ""; app_html += ""; @@ -40,7 +40,7 @@ app_html += ""; app_html += ""; $("#bug_table").append(app_html); - for(var i = 0; i < data.bug_count; i++) { + for(var i = 0; i < data.bug_count; i++) { app_html = ""; var mod = i % 2; if(mod == 1) { @@ -48,7 +48,7 @@ } else { app_html += ""; } - + var bug_text = data.bugs[i].bug; bug_text = bug_text.replace("\r", ""); bug_text = bug_text.replace("\n", "
"); @@ -57,16 +57,16 @@ app_html += ""; app_html += ""; app_html += ""; - $("#bug_table").append(app_html); + $("#bug_table").append(app_html); } }); } - + function OpenBugs(off) { offset = off; StatusTic(); } - + $(document).ready(function() { setInterval("StatusTic()", 6000); }); @@ -89,7 +89,7 @@ for(my $i = 0; $i < $sep; ++$i) { my $cur = 50 * $i; my $name = $i + 1; - + if($i == $cur_offset) { print "$name "; } @@ -113,13 +113,13 @@ if(!$bug) { next; } - + if($i % 2 == 1) { print ""; } else { print ""; } - + my $bug_val = $bug->{bug}; $bug_val =~ s/\r//g; $bug_val =~ s/\n/
/g; diff --git a/utils/defaults/updated_templates/console.html b/utils/defaults/updated_templates/console.html index e0bb46256..b1a31490e 100644 --- a/utils/defaults/updated_templates/console.html +++ b/utils/defaults/updated_templates/console.html @@ -8,38 +8,38 @@ diff --git a/utils/defaults/updated_templates/data/bug_data.html b/utils/defaults/updated_templates/data/bug_data.html index 52cb5a4a9..100ce2717 100644 --- a/utils/defaults/updated_templates/data/bug_data.html +++ b/utils/defaults/updated_templates/data/bug_data.html @@ -4,14 +4,14 @@ my $bug_count = @bugs; my $total_bug_count = $EQW->CountBugs(); print "{"; - print "\"total_bug_count\" : $total_bug_count,"; + print "\"total_bug_count\" : $total_bug_count,"; print "\"bug_count\" : $bug_count,"; print "\"bugs\" : "; print "["; my $i = 0; for my $bugkey (@bugs) { my $bug = $EQW->GetBugDetails($bugkey); - + my $bug_val = $bug->{bug}; $bug_val =~ s/\\/\\\\/g; $bug_val =~ s/\//\\\//g; @@ -32,7 +32,7 @@ print "\"x\" : \"$bug->{x}\","; print "\"y\" : \"$bug->{y}\","; print "\"z\" : \"$bug->{z}\""; - + print "}"; if($i != $bug_count - 1) { print ","; diff --git a/utils/defaults/updated_templates/data/console_data.html b/utils/defaults/updated_templates/data/console_data.html index 99a3271ff..a96973603 100644 --- a/utils/defaults/updated_templates/data/console_data.html +++ b/utils/defaults/updated_templates/data/console_data.html @@ -4,7 +4,7 @@ print "\"message_count\" : $message_count,"; print "\"messages\" : "; print "["; - for(my $i = 0; $i < $message_count; $i++) + for(my $i = 0; $i < $message_count; $i++) { print "{"; my $msg = $EQW->GetConsoleMessage($i); @@ -19,7 +19,7 @@ $message =~ s/\x0C/\\b/g; $message =~ s/[\x00-\x1F]/\./g; $message =~ s/[\x7F-\xFF]/\./g; - + print "\"message\" : \"$message\""; print "}"; if($i != $message_count - 1) { diff --git a/utils/defaults/updated_templates/data/launcher_data.html b/utils/defaults/updated_templates/data/launcher_data.html index 9ce4d548b..2ead600e4 100644 --- a/utils/defaults/updated_templates/data/launcher_data.html +++ b/utils/defaults/updated_templates/data/launcher_data.html @@ -2,7 +2,7 @@ $launcher_name = $request->get("launcher", "none"); if($launcher_name eq "none") { - @launchers = sort $EQW->ListLaunchers(); + @launchers = sort $EQW->ListLaunchers(); my $launcher_count = @launchers; print "{"; print "\"launcher_count\" : $launcher_count,"; @@ -22,14 +22,14 @@ } print "\"connected\" : ". $conn; print "}"; - + if($i != $launcher_count - 1) { print ","; } $i++; } - print "]"; + print "]"; print "}"; } else { my $l = $EQW->GetLauncher($lname); @@ -56,13 +56,13 @@ print "\"starts\" : $z->{starts},"; print "\"port\" : $z->{port}"; print "}"; - + if($i != $zone_count - 1) { print ", "; } $i++; } - + print "]"; print "}"; } diff --git a/utils/defaults/updated_templates/data/player_data.html b/utils/defaults/updated_templates/data/player_data.html index 9220792c4..17e72b40f 100644 --- a/utils/defaults/updated_templates/data/player_data.html +++ b/utils/defaults/updated_templates/data/player_data.html @@ -7,11 +7,11 @@ print "\"player_count\" : $player_count,"; print "\"players\" : "; print "["; - + my $i = 0; for my $player (@players) { my $pd = $EQW->GetPlayerDetails($player); - + print "{"; print "\"character\" : \"$pd->{character}\","; print "\"account\" : \"$pd->{account}\","; @@ -29,13 +29,13 @@ print "\"status\" : \"$pd->{status}\","; print "\"client_version\" : \"$pd->{client_version}\""; print "}"; - + if($i != $player_count - 1) { print ","; } $i++; } - + print "]"; print "}"; diff --git a/utils/defaults/updated_templates/data/world_status.html b/utils/defaults/updated_templates/data/world_status.html index 47551445c..e31a2bc3b 100644 --- a/utils/defaults/updated_templates/data/world_status.html +++ b/utils/defaults/updated_templates/data/world_status.html @@ -1,4 +1,4 @@ -LSConnected()) { print "\"connected\" : \"1\","; diff --git a/utils/defaults/updated_templates/data/zone_data.html b/utils/defaults/updated_templates/data/zone_data.html index 11b27ed29..3ccfdd07d 100644 --- a/utils/defaults/updated_templates/data/zone_data.html +++ b/utils/defaults/updated_templates/data/zone_data.html @@ -19,9 +19,9 @@ for(my $i = 0; $i < $zone_count; $i++) { print "\"long_name\" : \"$zone->{long_name}\","; print "\"port\" : $zone->{port},"; print "\"player_count\" : $zone->{player_count},"; - print "\"instance_id\" : $zone->{instance_id}"; + print "\"instance_id\" : $zone->{instance_id}"; print "}"; - + if($i != $zone_count - 1) { print ","; } diff --git a/utils/defaults/updated_templates/images/loading.gif b/utils/defaults/updated_templates/images/loading.gif index d0bce1542342e912da81a2c260562df172f30d73..cd5899c6cdf7759b5e541db19bc7ca888b7cf44f 100644 GIT binary patch delta 35 qcmZ3;I+Jxm)0B=ML^Z)<= diff --git a/utils/defaults/updated_templates/index.html b/utils/defaults/updated_templates/index.html index 619674448..a21b40d6e 100644 --- a/utils/defaults/updated_templates/index.html +++ b/utils/defaults/updated_templates/index.html @@ -8,34 +8,34 @@ "; } else { $locked_str = "World is NOT locked. Lock World.
"; } - + print "
"; print "$locked_str"; - print "
"; + print ""; ?> diff --git a/utils/defaults/updated_templates/launcher.html b/utils/defaults/updated_templates/launcher.html index 0cc2c3121..ff6b25a3f 100644 --- a/utils/defaults/updated_templates/launcher.html +++ b/utils/defaults/updated_templates/launcher.html @@ -13,7 +13,7 @@ function GetStatusIdx() { return idx++; } - + function StatusTic() { $.getJSON("data/launcher_data.html?launcher="++"&idx="+GetStatusIdx(), function(data) { @@ -57,23 +57,23 @@ } app_html += ""; app_html += "
"; - $("#launcher_table").append(app_html); + $("#launcher_table").append(app_html); } - }); + }); } - + function ShowAddLauncher() { $("#add_launcher_link").hide(); $("#min_add_launcher_link").show(); $("#add_launcher_table").fadeIn("slow"); } - + function HideAddLauncher() { $("#add_launcher_link").show(); $("#min_add_launcher_link").hide(); $("#add_launcher_table").fadeOut("slow"); } - + function BootZone() { var elm = document.getElementById("short_name_field"); var bzone = elm.value; @@ -81,23 +81,23 @@ elm = document.getElementById("port_field"); var bport = elm.value; elm.value = "0"; - + elm = document.getElementById("boot_button_img"); elm.style.display = "inline"; - + elm = document.getElementById("boot_button"); elm.className = "styled_button_disabled"; $('#boot_button').unbind('click'); - + $.getJSON("actions/launcher_action.html?action=boot&launcher_name="++"&zone="+bzone+"&port="+bport+"&idx="+GetStatusIdx(), function(data) { $('#boot_button').bind('click', BootZone); elm = document.getElementById("boot_button"); elm.className = "styled_button"; - + elm = document.getElementById("boot_button_img"); elm.style.display = "none"; - + if(data.status == 0) { alert(data.message); } else { @@ -105,38 +105,38 @@ } }); } - + function ChangeDynamicCount() { var elm = document.getElementById("dynamic_count_field"); var dcount = elm.value; - + elm = document.getElementById("dynamic_count_button_img"); elm.style.display = "inline"; - + elm = document.getElementById("dynamic_count_button"); elm.className = "styled_button_disabled"; $('#dynamic_count_button').unbind('click'); - + $.getJSON("actions/launcher_action.html?action=change_dynamic_count&launcher_name="++"&dynamic_count="+dcount+"&idx="+GetStatusIdx(), function(data) { $('#dynamic_count_button').bind('click', ChangeDynamicCount); elm = document.getElementById("dynamic_count_button"); elm.className = "styled_button"; - + elm = document.getElementById("dynamic_count_button_img"); elm.style.display = "none"; - + if(data.status == 0) { alert(data.message); } else { StatusTic(); } - }); + }); } - + function RemoveZone(zone_name) { $.getJSON("actions/launcher_action.html?action=remove_zone&launcher_name="++"&zone="+zone_name+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -144,10 +144,10 @@ } }); } - + function RebootAll() { $.getJSON("actions/launcher_action.html?action=reboot_all&launcher_name="++"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -155,10 +155,10 @@ } }); } - + function StopAll() { $.getJSON("actions/launcher_action.html?action=stop_all&launcher_name="++"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -166,10 +166,10 @@ } }); } - + function StartAll() { $.getJSON("actions/launcher_action.html?action=start_all&launcher_name="++"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -177,21 +177,21 @@ } }); } - + function RestartZone(zone) { $.getJSON("actions/launcher_action.html?action=restart_zone&launcher_name="++"&zone="+zone+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { StatusTic(); } - }); + }); } - + function StartZone(zone) { $.getJSON("actions/launcher_action.html?action=start_zone&launcher_name="++"&zone="+zone+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -199,10 +199,10 @@ } }); } - + function StopZone(zone) { $.getJSON("actions/launcher_action.html?action=stop_zone&launcher_name="++"&zone="+zone+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -210,14 +210,14 @@ } }); } - + $(document).ready(function() { setInterval("StatusTic()", 4000); $('#boot_button').bind('click', BootZone); $('#dynamic_count_button').bind('click', ChangeDynamicCount); }); --> - +
@@ -230,8 +230,8 @@ } ?>
@@ -255,7 +255,7 @@
VariableDescription
ActionsDescripton
"+data.bugs[i].target+""+bug_text+"
ReporterDescripton
"+data.bugs[i].target+""+bug_text+"
- + @@ -266,7 +266,7 @@ ListZones(); - + for my $zone (sort @zones) { my $z = $config->GetZoneDetails($zone); if(!$z) { @@ -274,7 +274,7 @@ } elsif($z->{error}) { $zone->{name} = "ERROR: $z->{error}"; } - + print "\n"; print "\t"; if($z->{up}) { @@ -307,7 +307,7 @@ print "\n"; } ?> -
Zone Name
$z->{name}
+