From f1a25da06522dc96348e70c25a595615e8b7b07a Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 14 Feb 2015 16:36:30 -0500 Subject: [PATCH 1/8] Pre-purposed clean-up --- common/clientversions.h | 45 +++++++--- common/database_conversions.cpp | 34 ++++--- common/eq_dictionary.cpp | 144 ++++++++++++++++++------------ common/eq_dictionary.h | 16 ++-- common/eq_packet_structs.h | 95 ++++++++++++-------- common/patches/rof.cpp | 18 ++-- common/patches/rof2.cpp | 18 ++-- common/patches/rof2_structs.h | 119 +++++++++++++++--------- common/patches/rof_structs.h | 119 +++++++++++++++--------- common/patches/sod.cpp | 14 +-- common/patches/sod_structs.h | 89 +++++++++++------- common/patches/sof.cpp | 14 +-- common/patches/sof_structs.h | 89 +++++++++++------- common/patches/titanium.cpp | 14 +-- common/patches/titanium_structs.h | 89 +++++++++++------- common/patches/uf.cpp | 14 +-- common/patches/uf_structs.h | 89 +++++++++++------- zone/client_packet.cpp | 27 +++--- zone/inventory.cpp | 84 ++++++++--------- zone/zonedb.cpp | 32 ++++--- 20 files changed, 697 insertions(+), 466 deletions(-) diff --git a/common/clientversions.h b/common/clientversions.h index d0b5f7c41..040e5dc12 100644 --- a/common/clientversions.h +++ b/common/clientversions.h @@ -1,3 +1,24 @@ +/* +EQEMu: Everquest Server Emulator + +Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net) + +This program is free software; 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 + +*/ + #ifndef CLIENTVERSIONS_H #define CLIENTVERSIONS_H @@ -46,29 +67,29 @@ static const char* ClientVersionName(ClientVersion version) switch (version) { case ClientVersion::Unknown: - return "ClientVersion::Unknown"; + return "Unknown"; case ClientVersion::Client62: - return "ClientVersion::Client62"; + return "Client62"; case ClientVersion::Titanium: - return "ClientVersion::Titanium"; + return "Titanium"; case ClientVersion::SoF: - return "ClientVersion::SoF"; + return "SoF"; case ClientVersion::SoD: - return "ClientVersion::SoD"; + return "SoD"; case ClientVersion::UF: - return "ClientVersion::UF"; + return "UF"; case ClientVersion::RoF: - return "ClientVersion::RoF"; + return "RoF"; case ClientVersion::RoF2: - return "ClientVersion::RoF2"; + return "RoF2"; case ClientVersion::MobNPC: - return "ClientVersion::MobNPC"; + return "MobNPC"; case ClientVersion::MobMerc: - return "ClientVersion::MobMerc"; + return "MobMerc"; case ClientVersion::MobBot: - return "ClientVersion::MobBot"; + return "MobBot"; case ClientVersion::MobPet: - return "ClientVersion::MobPet"; + return "MobPet"; default: return " Invalid ClientVersion"; }; diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index 8a938e8b5..7d49522a3 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -157,18 +157,26 @@ namespace Convert { /*84*/ uint32 Points; /*88*/ } PVPStatsEntry_Struct; + struct BandolierItem_Struct { - uint32 item_id; - uint32 icon; - char item_name[64]; + uint32 ID; + uint32 Icon; + char Name[64]; }; struct Bandolier_Struct { - char name[32]; - Convert::BandolierItem_Struct items[EmuConstants::BANDOLIER_SIZE]; + char Name[32]; + Convert::BandolierItem_Struct Items[EmuConstants::BANDOLIER_SIZE]; + }; + + struct PotionBeltItem_Struct { + uint32 ID; + uint32 Icon; + char Name[64]; }; struct PotionBelt_Struct { - Convert::BandolierItem_Struct items[EmuConstants::POTION_BELT_SIZE]; + Convert::PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_SIZE]; }; + struct SuspendedMinion_Struct { /*000*/ uint16 SpellID; @@ -1431,14 +1439,14 @@ bool Database::CheckDatabaseConvertPPDeblob(){ /* Run Bandolier Convert */ first_entry = 0; rquery = ""; for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){ - if (strlen(pp->bandoliers[i].name) < 32) { + if (strlen(pp->bandoliers[i].Name) < 32) { for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++){ - if (pp->bandoliers[i].items[si].item_id > 0){ + if (pp->bandoliers[i].Items[si].ID > 0){ if (first_entry != 1) { - rquery = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%i, %u, %i, %u, %u, '%s')", character_id, i, si, pp->bandoliers[i].items[si].item_id, pp->bandoliers[i].items[si].icon, pp->bandoliers[i].name); + rquery = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%i, %u, %i, %u, %u, '%s')", character_id, i, si, pp->bandoliers[i].Items[si].ID, pp->bandoliers[i].Items[si].Icon, pp->bandoliers[i].Name); first_entry = 1; } - rquery = rquery + StringFormat(", (%i, %u, %i, %u, %u, '%s')", character_id, i, si, pp->bandoliers[i].items[si].item_id, pp->bandoliers[i].items[si].icon, pp->bandoliers[i].name); + rquery = rquery + StringFormat(", (%i, %u, %i, %u, %u, '%s')", character_id, i, si, pp->bandoliers[i].Items[si].ID, pp->bandoliers[i].Items[si].Icon, pp->bandoliers[i].Name); } } } @@ -1447,12 +1455,12 @@ bool Database::CheckDatabaseConvertPPDeblob(){ /* Run Potion Belt Convert */ first_entry = 0; rquery = ""; for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){ - if (pp->potionbelt.items[i].item_id > 0){ + if (pp->potionbelt.Items[i].ID > 0){ if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%i, %u, %u, %u)", character_id, i, pp->potionbelt.items[i].item_id, pp->potionbelt.items[i].icon); + rquery = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%i, %u, %u, %u)", character_id, i, pp->potionbelt.Items[i].ID, pp->potionbelt.Items[i].Icon); first_entry = 1; } - rquery = rquery + StringFormat(", (%i, %u, %u, %u)", character_id, i, pp->potionbelt.items[i].item_id, pp->potionbelt.items[i].icon); + rquery = rquery + StringFormat(", (%i, %u, %u, %u)", character_id, i, pp->potionbelt.Items[i].ID, pp->potionbelt.Items[i].Icon); } } diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index ed3253260..026d84a31 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -1,7 +1,7 @@ /* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net) +Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,8 +25,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // class EmuConstants // -uint16 EmuConstants::InventoryMapSize(int16 indexMap) { - switch (indexMap) { +uint16 EmuConstants::InventoryMapSize(int16 indexMap) +{ + switch (indexMap) + { case MapPossessions: return MAP_POSSESSIONS_SIZE; case MapBank: @@ -83,7 +85,8 @@ uint16 EmuConstants::InventoryMapSize(int16 indexMap) { } /* -std::string EmuConstants::InventoryLocationName(Location_Struct location) { +std::string EmuConstants::InventoryLocationName(Location_Struct location) +{ // not ready for implementation... std::string ret_str; StringFormat(ret_str, "%s, %s, %s, %s", InventoryMapName(location.map), InventoryMainName(location.main), InventorySubName(location.sub), InventoryAugName(location.aug)); @@ -91,8 +94,10 @@ std::string EmuConstants::InventoryLocationName(Location_Struct location) { } */ -std::string EmuConstants::InventoryMapName(int16 indexMap) { - switch (indexMap) { +std::string EmuConstants::InventoryMapName(int16 indexMap) +{ + switch (indexMap) + { case INVALID_INDEX: return "Invalid Map"; case MapPossessions: @@ -100,7 +105,7 @@ std::string EmuConstants::InventoryMapName(int16 indexMap) { case MapBank: return "Bank"; case MapSharedBank: - return "Shared Bank"; + return "SharedBank"; case MapTrade: return "Trade"; case MapWorld: @@ -110,9 +115,9 @@ std::string EmuConstants::InventoryMapName(int16 indexMap) { case MapTribute: return "Tribute"; case MapTrophyTribute: - return "Trophy Tribute"; + return "TrophyTribute"; case MapGuildTribute: - return "Guild Tribute"; + return "GuildTribute"; case MapMerchant: return "Merchant"; case MapDeleted: @@ -124,23 +129,23 @@ std::string EmuConstants::InventoryMapName(int16 indexMap) { case MapInspect: return "Inspect"; case MapRealEstate: - return "Real Estate"; + return "RealEstate"; case MapViewMODPC: - return "View MOD PC"; + return "ViewMODPC"; case MapViewMODBank: - return "View MOD Bank"; + return "ViewMODBank"; case MapViewMODSharedBank: - return "View MOD Shared Bank"; + return "ViewMODSharedBank"; case MapViewMODLimbo: - return "View MOD Limbo"; + return "ViewMODLimbo"; case MapAltStorage: - return "Alt Storage"; + return "AltStorage"; case MapArchived: return "Archived"; case MapMail: return "Mail"; case MapGuildTrophyTribute: - return "Guild Trophy Tribute"; + return "GuildTrophyTribute"; case MapKrono: return "Krono"; case MapOther: @@ -150,20 +155,22 @@ std::string EmuConstants::InventoryMapName(int16 indexMap) { } } -std::string EmuConstants::InventoryMainName(int16 indexMain) { - switch (indexMain) { +std::string EmuConstants::InventoryMainName(int16 indexMain) +{ + switch (indexMain) + { case INVALID_INDEX: return "Invalid Main"; case MainCharm: return "Charm"; case MainEar1: - return "Ear 1"; + return "Ear1"; case MainHead: return "Head"; case MainFace: return "Face"; case MainEar2: - return "Ear 2"; + return "Ear2"; case MainNeck: return "Neck"; case MainShoulders: @@ -173,9 +180,9 @@ std::string EmuConstants::InventoryMainName(int16 indexMain) { case MainBack: return "Back"; case MainWrist1: - return "Wrist 1"; + return "Wrist1"; case MainWrist2: - return "Wrist 2"; + return "Wrist2"; case MainRange: return "Range"; case MainHands: @@ -185,9 +192,9 @@ std::string EmuConstants::InventoryMainName(int16 indexMain) { case MainSecondary: return "Secondary"; case MainFinger1: - return "Finger 1"; + return "Finger1"; case MainFinger2: - return "Finger 2"; + return "Finger2"; case MainChest: return "Chest"; case MainLegs: @@ -197,30 +204,30 @@ std::string EmuConstants::InventoryMainName(int16 indexMain) { case MainWaist: return "Waist"; case MainPowerSource: - return "Power Source"; + return "PowerSource"; case MainAmmo: return "Ammo"; case MainGeneral1: - return "General 1"; + return "General1"; case MainGeneral2: - return "General 2"; + return "General2"; case MainGeneral3: - return "General 3"; + return "General3"; case MainGeneral4: - return "General 4"; + return "General4"; case MainGeneral5: - return "General 5"; + return "General5"; case MainGeneral6: - return "General 6"; + return "General6"; case MainGeneral7: - return "General 7"; + return "General7"; case MainGeneral8: - return "General 8"; + return "General8"; /* case MainGeneral9: - return "General 9"; + return "General9"; case MainGeneral10: - return "General 10"; + return "General10"; */ case MainCursor: return "Cursor"; @@ -229,7 +236,8 @@ std::string EmuConstants::InventoryMainName(int16 indexMain) { } } -std::string EmuConstants::InventorySubName(int16 indexSub) { +std::string EmuConstants::InventorySubName(int16 indexSub) +{ if (indexSub == INVALID_INDEX) return "Invalid Sub"; @@ -237,12 +245,13 @@ std::string EmuConstants::InventorySubName(int16 indexSub) { return "Unknown Sub"; std::string ret_str; - ret_str = StringFormat("Container %i", (indexSub + 1)); // zero-based index..but, count starts at one + ret_str = StringFormat("Container%i", (indexSub + 1)); // zero-based index..but, count starts at one return ret_str; } -std::string EmuConstants::InventoryAugName(int16 indexAug) { +std::string EmuConstants::InventoryAugName(int16 indexAug) +{ if (indexAug == INVALID_INDEX) return "Invalid Aug"; @@ -250,7 +259,7 @@ std::string EmuConstants::InventoryAugName(int16 indexAug) { return "Unknown Aug"; std::string ret_str; - ret_str = StringFormat("Augment %i", (indexAug + 1)); // zero-based index..but, count starts at one + ret_str = StringFormat("Augment%i", (indexAug + 1)); // zero-based index..but, count starts at one return ret_str; } @@ -260,14 +269,16 @@ std::string EmuConstants::InventoryAugName(int16 indexAug) { // class EQLimits // // client validation -bool EQLimits::IsValidPCClientVersion(ClientVersion clientVersion) { +bool EQLimits::IsValidPCClientVersion(ClientVersion clientVersion) +{ if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT) return true; return false; } -ClientVersion EQLimits::ValidatePCClientVersion(ClientVersion clientVersion) { +ClientVersion EQLimits::ValidatePCClientVersion(ClientVersion clientVersion) +{ if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT) return clientVersion; @@ -275,14 +286,16 @@ ClientVersion EQLimits::ValidatePCClientVersion(ClientVersion clientVersion) { } // npc validation -bool EQLimits::IsValidNPCClientVersion(ClientVersion clientVersion) { +bool EQLimits::IsValidNPCClientVersion(ClientVersion clientVersion) +{ if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT) return true; return false; } -ClientVersion EQLimits::ValidateNPCClientVersion(ClientVersion clientVersion) { +ClientVersion EQLimits::ValidateNPCClientVersion(ClientVersion clientVersion) +{ if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT) return clientVersion; @@ -290,14 +303,16 @@ ClientVersion EQLimits::ValidateNPCClientVersion(ClientVersion clientVersion) { } // mob validation -bool EQLimits::IsValidMobClientVersion(ClientVersion clientVersion) { +bool EQLimits::IsValidMobClientVersion(ClientVersion clientVersion) +{ if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT) return true; return false; } -ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion) { +ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion) +{ if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT) return clientVersion; @@ -305,7 +320,8 @@ ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion) { } // inventory -uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) { +uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) +{ // not all maps will have an instantiated container..some are references for queue generators (i.e., bazaar, mail, etc...) // a zero '0' indicates a needed value..otherwise, change to '_NOTUSED' for a null value so indices requiring research can be identified // ALL of these values need to be verified before pushing to live @@ -704,7 +720,8 @@ uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) { return NOT_USED; } -uint64 EQLimits::PossessionsBitmask(ClientVersion clientVersion) { +uint64 EQLimits::PossessionsBitmask(ClientVersion clientVersion) +{ // these are for the new inventory system (RoF)..not the current (Ti) one... // 0x0000000000200000 is SlotPowerSource (SoF+) // 0x0000000080000000 is SlotGeneral9 (RoF+) @@ -730,7 +747,8 @@ uint64 EQLimits::PossessionsBitmask(ClientVersion clientVersion) { //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint64 EQLimits::EquipmentBitmask(ClientVersion clientVersion) { +uint64 EQLimits::EquipmentBitmask(ClientVersion clientVersion) +{ static const uint64 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ 0x00000000005FFFFF, @@ -751,7 +769,8 @@ uint64 EQLimits::EquipmentBitmask(ClientVersion clientVersion) { //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint64 EQLimits::GeneralBitmask(ClientVersion clientVersion) { +uint64 EQLimits::GeneralBitmask(ClientVersion clientVersion) +{ static const uint64 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ 0x000000007F800000, @@ -772,7 +791,8 @@ uint64 EQLimits::GeneralBitmask(ClientVersion clientVersion) { //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint64 EQLimits::CursorBitmask(ClientVersion clientVersion) { +uint64 EQLimits::CursorBitmask(ClientVersion clientVersion) +{ static const uint64 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ 0x0000000200000000, @@ -793,7 +813,8 @@ uint64 EQLimits::CursorBitmask(ClientVersion clientVersion) { //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion) { +bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion) +{ static const bool local[CLIENT_VERSION_COUNT] = { /*Unknown*/ false, /*62*/ false, @@ -814,7 +835,8 @@ bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion) { //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion) { +bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion) +{ static const bool local[CLIENT_VERSION_COUNT] = { /*Unknown*/ false, /*62*/ false, @@ -835,7 +857,8 @@ bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion) { } // items -uint16 EQLimits::ItemCommonSize(ClientVersion clientVersion) { +uint16 EQLimits::ItemCommonSize(ClientVersion clientVersion) +{ static const uint16 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::ITEM_COMMON_SIZE, @@ -855,7 +878,8 @@ uint16 EQLimits::ItemCommonSize(ClientVersion clientVersion) { return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint16 EQLimits::ItemContainerSize(ClientVersion clientVersion) { +uint16 EQLimits::ItemContainerSize(ClientVersion clientVersion) +{ static const uint16 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::ITEM_CONTAINER_SIZE, @@ -875,7 +899,8 @@ uint16 EQLimits::ItemContainerSize(ClientVersion clientVersion) { return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -bool EQLimits::CoinHasWeight(ClientVersion clientVersion) { +bool EQLimits::CoinHasWeight(ClientVersion clientVersion) +{ static const bool local[CLIENT_VERSION_COUNT] = { /*Unknown*/ true, /*62*/ true, @@ -895,7 +920,8 @@ bool EQLimits::CoinHasWeight(ClientVersion clientVersion) { return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) { +uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) +{ static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::BANDOLIERS_COUNT, @@ -915,7 +941,8 @@ uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) { return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint32 EQLimits::BandolierSize(ClientVersion clientVersion) { +uint32 EQLimits::BandolierSize(ClientVersion clientVersion) +{ static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::BANDOLIER_SIZE, @@ -935,7 +962,8 @@ uint32 EQLimits::BandolierSize(ClientVersion clientVersion) { return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint32 EQLimits::PotionBeltSize(ClientVersion clientVersion) { +uint32 EQLimits::PotionBeltSize(ClientVersion clientVersion) +{ static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::POTION_BELT_SIZE, diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index d1337856e..151397dd4 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -1,7 +1,7 @@ /* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net) +Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //using namespace RoF2::maps; // server inventory maps enumeration (code and database sync'd to reference) //using namespace RoF::slots; // server possessions slots enumeration (code and database sync'd to reference) -class EmuConstants { +class EmuConstants +{ // an immutable value is required to initialize arrays, etc... use this class as a repository for those public: // database @@ -140,23 +141,16 @@ public: static const uint16 ITEM_COMMON_SIZE = RoF::consts::ITEM_COMMON_SIZE; static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE; - // player profile - //static const uint32 CLASS_BITMASK = 0; // needs value - //static const uint32 RACE_BITMASK = 0; // needs value - // BANDOLIERS_COUNT sets maximum limit..active limit will need to be handled by the appropriate AA static const uint32 BANDOLIERS_COUNT = Titanium::consts::BANDOLIERS_COUNT; // count = number of bandolier instances static const uint32 BANDOLIER_SIZE = Titanium::consts::BANDOLIER_SIZE; // size = number of equipment slots in bandolier instance static const uint32 POTION_BELT_SIZE = Titanium::consts::POTION_BELT_SIZE; static const size_t TEXT_LINK_BODY_LENGTH = 56; - - // legacy-related functions - //static int ServerToPerlSlot(int slot); // encode - //static int PerlToServerSlot(int slot); // decode }; -class EQLimits { +class EQLimits +{ // values should default to a non-beneficial value..unless value conflicts with intended operation // // EmuConstants may be used as references..but, not every reference needs to be in EmuConstants (i.e., AllowsEmptyBagInBag(), CoinHasWeight(), etc...) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index cd30cf3d1..9d49a3080 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -15,6 +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 */ + #ifndef EQ_PACKET_STRUCTS_H #define EQ_PACKET_STRUCTS_H @@ -756,29 +757,46 @@ struct Tribute_Struct { uint32 tier; }; -//len = 72 -struct BandolierItem_Struct { - uint32 item_id; - uint32 icon; - char item_name[64]; -}; - -//len = 320 -enum { //bandolier item positions - bandolierMainHand = 0, - bandolierOffHand, +// Bandolier item positions +enum +{ + bandolierPrimary = 0, + bandolierSecondary, bandolierRange, bandolierAmmo }; -struct Bandolier_Struct { - char name[32]; - BandolierItem_Struct items[EmuConstants::BANDOLIER_SIZE]; -}; -struct PotionBelt_Struct { - BandolierItem_Struct items[EmuConstants::POTION_BELT_SIZE]; + +//len = 72 +struct BandolierItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; }; -struct MovePotionToBelt_Struct { +//len = 320 +struct Bandolier_Struct +{ + char Name[32]; + BandolierItem_Struct Items[EmuConstants::BANDOLIER_SIZE]; +}; + +//len = 72 +struct PotionBeltItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; +}; + +//len = 288 +struct PotionBelt_Struct +{ + PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_SIZE]; +}; + +struct MovePotionToBelt_Struct +{ uint32 Action; uint32 SlotNumber; uint32 ItemID; @@ -4106,30 +4124,35 @@ struct DynamicWall_Struct { /*80*/ }; -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 +// Bandolier actions +enum +{ + bandolierCreate = 0, + bandolierRemove, + bandolierSet }; -struct BandolierCreate_Struct { -/*00*/ uint32 action; //0 for create -/*04*/ uint8 number; -/*05*/ char name[32]; -/*37*/ uint16 unknown37; //seen 0x93FD -/*39*/ uint8 unknown39; //0 +struct BandolierCreate_Struct +{ +/*00*/ uint32 Action; //0 for create +/*04*/ uint8 Number; +/*05*/ char Name[32]; +/*37*/ uint16 Unknown37; //seen 0x93FD +/*39*/ uint8 Unknown39; //0 }; -struct BandolierDelete_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierDelete_Struct +{ +/*00*/ uint32 Action; +/*04*/ uint8 Number; +/*05*/ uint8 Unknown05[35]; }; -struct BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierSet_Struct +{ +/*00*/ uint32 Action; +/*04*/ uint8 Number; +/*05*/ uint8 Unknown05[35]; }; struct Arrow_Struct { diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index cb95bfdb1..42b588ec3 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2290,15 +2290,15 @@ namespace RoF for (uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) { - outapp->WriteString(emu->bandoliers[r].name); + outapp->WriteString(emu->bandoliers[r].Name); for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) { - outapp->WriteString(emu->bandoliers[r].items[j].item_name); - outapp->WriteUInt32(emu->bandoliers[r].items[j].item_id); - if (emu->bandoliers[r].items[j].icon) + outapp->WriteString(emu->bandoliers[r].Items[j].Name); + outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); + if (emu->bandoliers[r].Items[j].Icon) { - outapp->WriteSInt32(emu->bandoliers[r].items[j].icon); + outapp->WriteSInt32(emu->bandoliers[r].Items[j].Icon); } else { @@ -2324,11 +2324,11 @@ namespace RoF for (uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++) { - outapp->WriteString(emu->potionbelt.items[r].item_name); - outapp->WriteUInt32(emu->potionbelt.items[r].item_id); - if (emu->potionbelt.items[r].icon) + outapp->WriteString(emu->potionbelt.Items[r].Name); + outapp->WriteUInt32(emu->potionbelt.Items[r].ID); + if (emu->potionbelt.Items[r].Icon) { - outapp->WriteSInt32(emu->potionbelt.items[r].icon); + outapp->WriteSInt32(emu->potionbelt.Items[r].Icon); } else { diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 5cab22a60..4aec12ba1 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2364,15 +2364,15 @@ namespace RoF2 for (uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) { - outapp->WriteString(emu->bandoliers[r].name); + outapp->WriteString(emu->bandoliers[r].Name); for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) { - outapp->WriteString(emu->bandoliers[r].items[j].item_name); - outapp->WriteUInt32(emu->bandoliers[r].items[j].item_id); - if (emu->bandoliers[r].items[j].icon) + outapp->WriteString(emu->bandoliers[r].Items[j].Name); + outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); + if (emu->bandoliers[r].Items[j].Icon) { - outapp->WriteSInt32(emu->bandoliers[r].items[j].icon); + outapp->WriteSInt32(emu->bandoliers[r].Items[j].Icon); } else { @@ -2398,11 +2398,11 @@ namespace RoF2 for (uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++) { - outapp->WriteString(emu->potionbelt.items[r].item_name); - outapp->WriteUInt32(emu->potionbelt.items[r].item_id); - if (emu->potionbelt.items[r].icon) + outapp->WriteString(emu->potionbelt.Items[r].Name); + outapp->WriteUInt32(emu->potionbelt.Items[r].ID); + if (emu->potionbelt.Items[r].Icon) { - outapp->WriteSInt32(emu->potionbelt.items[r].icon); + outapp->WriteSInt32(emu->potionbelt.Items[r].Icon); } else { diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index e4e11ae8b..092d12d76 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -896,38 +896,66 @@ struct Tribute_Struct { uint32 tier; }; -struct BandolierItem_Struct { - char item_name[1]; // Variable Length - uint32 item_id; - uint32 icon; -}; - -//len = 72 -struct BandolierItem_Struct_Old { - uint32 item_id; - uint32 icon; - char item_name[64]; -}; - -//len = 320 -enum { //bandolier item positions - bandolierMainHand = 0, - bandolierOffHand, +// Bandolier item positions +enum +{ + bandolierPrimary = 0, + bandolierSecondary, bandolierRange, bandolierAmmo }; -struct Bandolier_Struct { - char name[1]; // Variable Length - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; + +struct BandolierItem_Struct +{ + char Name[1]; // Variable Length + uint32 ID; + uint32 Icon; }; -struct Bandolier_Struct_Old { - char name[32]; - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; +//len = 72 +struct BandolierItem_Struct_Old +{ + uint32 ID; + uint32 Icon; + char Name[64]; }; -struct PotionBelt_Struct { - BandolierItem_Struct items[MAX_POTIONS_IN_BELT]; +//len = 320 +struct Bandolier_Struct +{ + char Name[1]; // Variable Length + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +struct Bandolier_Struct_Old +{ + char Name[32]; + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +struct PotionBeltItem_Struct +{ + char Name[1]; // Variable Length + uint32 ID; + uint32 Icon; +}; + +//len = 72 +struct PotionBeltItem_Struct_Old +{ + uint32 ID; + uint32 Icon; + char Name[64]; +}; + +struct PotionBelt_Struct +{ + PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; +}; + +struct PotionBelt_Struct_Old +{ + PotionBeltItem_Struct_Old Items[MAX_POTIONS_IN_BELT]; }; struct GroupLeadershipAA_Struct { @@ -4109,30 +4137,35 @@ struct DynamicWall_Struct { /*80*/ }; -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 +// Bandolier actions +enum +{ + bandolierCreate = 0, + bandolierRemove, + bandolierSet }; -struct BandolierCreate_Struct { -/*00*/ uint32 action; //0 for create -/*04*/ uint8 number; -/*05*/ char name[32]; -/*37*/ uint16 unknown37; //seen 0x93FD -/*39*/ uint8 unknown39; //0 +struct BandolierCreate_Struct +{ + /*00*/ uint32 Action; //0 for create + /*04*/ uint8 Number; + /*05*/ char Name[32]; + /*37*/ uint16 Unknown37; //seen 0x93FD + /*39*/ uint8 Unknown39; //0 }; -struct BandolierDelete_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierDelete_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; -struct BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierSet_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; struct Arrow_Struct { diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 417ff2e64..770dd250f 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -880,38 +880,66 @@ struct Tribute_Struct { uint32 tier; }; -struct BandolierItem_Struct { - char item_name[1]; // Variable Length - uint32 item_id; - uint32 icon; -}; - -//len = 72 -struct BandolierItem_Struct_Old { - uint32 item_id; - uint32 icon; - char item_name[64]; -}; - -//len = 320 -enum { //bandolier item positions - bandolierMainHand = 0, - bandolierOffHand, +// Bandolier item positions +enum +{ + bandolierPrimary = 0, + bandolierSecondary, bandolierRange, bandolierAmmo }; -struct Bandolier_Struct { - char name[1]; // Variable Length - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; + +struct BandolierItem_Struct +{ + char Name[1]; // Variable Length + uint32 ID; + uint32 Icon; }; -struct Bandolier_Struct_Old { - char name[32]; - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; +//len = 72 +struct BandolierItem_Struct_Old +{ + uint32 ID; + uint32 Icon; + char Name[64]; }; -struct PotionBelt_Struct { - BandolierItem_Struct items[MAX_POTIONS_IN_BELT]; +//len = 320 +struct Bandolier_Struct +{ + char Name[1]; // Variable Length + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +struct Bandolier_Struct_Old +{ + char Name[32]; + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +struct PotionBeltItem_Struct +{ + char Name[1]; // Variable Length + uint32 ID; + uint32 Icon; +}; + +//len = 72 +struct PotionBeltItem_Struct_Old +{ + uint32 ID; + uint32 Icon; + char Name[64]; +}; + +struct PotionBelt_Struct +{ + PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; +}; + +struct PotionBelt_Struct_Old +{ + PotionBeltItem_Struct_Old Items[MAX_POTIONS_IN_BELT]; }; struct GroupLeadershipAA_Struct { @@ -4113,30 +4141,35 @@ struct DynamicWall_Struct { /*80*/ }; -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 +// Bandolier actions +enum +{ + bandolierCreate = 0, + bandolierRemove, + bandolierSet }; -struct BandolierCreate_Struct { -/*00*/ uint32 action; //0 for create -/*04*/ uint8 number; -/*05*/ char name[32]; -/*37*/ uint16 unknown37; //seen 0x93FD -/*39*/ uint8 unknown39; //0 +struct BandolierCreate_Struct +{ + /*00*/ uint32 Action; //0 for create + /*04*/ uint8 Number; + /*05*/ char Name[32]; + /*37*/ uint16 Unknown37; //seen 0x93FD + /*39*/ uint8 Unknown39; //0 }; -struct BandolierDelete_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierDelete_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; -struct BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierSet_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; struct Arrow_Struct { diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 488f51e87..c2a6eeaaa 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1610,19 +1610,19 @@ namespace SoD //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for (r = 0; r < 4; r++) { - OUT_str(bandoliers[r].name); + OUT_str(bandoliers[r].Name); uint32 k; for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { - OUT(bandoliers[r].items[k].item_id); - OUT(bandoliers[r].items[k].icon); - OUT_str(bandoliers[r].items[k].item_name); + OUT(bandoliers[r].Items[k].ID); + OUT(bandoliers[r].Items[k].Icon); + OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { - OUT(potionbelt.items[r].item_id); - OUT(potionbelt.items[r].icon); - OUT_str(potionbelt.items[r].item_name); + OUT(potionbelt.Items[r].ID); + OUT(potionbelt.Items[r].Icon); + OUT_str(potionbelt.Items[r].Name); } // OUT(unknown12852[8]); // OUT(unknown12864[76]); diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 810c59b1e..18f17ce62 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -686,26 +686,42 @@ struct Tribute_Struct { uint32 tier; }; -//len = 72 -struct BandolierItem_Struct { - uint32 item_id; - uint32 icon; - char item_name[64]; -}; - -//len = 320 -enum { //bandolier item positions - bandolierMainHand = 0, - bandolierOffHand, +// Bandolier item positions +enum +{ + bandolierPrimary = 0, + bandolierSecondary, bandolierRange, bandolierAmmo }; -struct Bandolier_Struct { - char name[32]; - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; + +//len = 72 +struct BandolierItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; }; -struct PotionBelt_Struct { - BandolierItem_Struct items[MAX_POTIONS_IN_BELT]; + +//len = 320 +struct Bandolier_Struct +{ + char Name[32]; + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +//len = 72 +struct PotionBeltItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; +}; + +//len = 288 +struct PotionBelt_Struct +{ + PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -3686,30 +3702,35 @@ struct DynamicWall_Struct { /*80*/ }; -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 +// Bandolier actions +enum +{ + bandolierCreate = 0, + bandolierRemove, + bandolierSet }; -struct BandolierCreate_Struct { -/*00*/ uint32 action; //0 for create -/*04*/ uint8 number; -/*05*/ char name[32]; -/*37*/ uint16 unknown37; //seen 0x93FD -/*39*/ uint8 unknown39; //0 +struct BandolierCreate_Struct +{ + /*00*/ uint32 Action; //0 for create + /*04*/ uint8 Number; + /*05*/ char Name[32]; + /*37*/ uint16 Unknown37; //seen 0x93FD + /*39*/ uint8 Unknown39; //0 }; -struct BandolierDelete_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierDelete_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; -struct BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierSet_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; struct Arrow_Struct { diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index ab956a28d..cf19582b0 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1268,19 +1268,19 @@ namespace SoF //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for (r = 0; r < 4; r++) { - OUT_str(bandoliers[r].name); + OUT_str(bandoliers[r].Name); uint32 k; for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { - OUT(bandoliers[r].items[k].item_id); - OUT(bandoliers[r].items[k].icon); - OUT_str(bandoliers[r].items[k].item_name); + OUT(bandoliers[r].Items[k].ID); + OUT(bandoliers[r].Items[k].Icon); + OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { - OUT(potionbelt.items[r].item_id); - OUT(potionbelt.items[r].icon); - OUT_str(potionbelt.items[r].item_name); + OUT(potionbelt.Items[r].ID); + OUT(potionbelt.Items[r].Icon); + OUT_str(potionbelt.Items[r].Name); } // OUT(unknown12852[8]); // OUT(unknown12864[76]); diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 32b275716..33773e91e 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -663,26 +663,42 @@ struct Tribute_Struct { uint32 tier; }; -//len = 72 -struct BandolierItem_Struct { - uint32 item_id; - uint32 icon; - char item_name[64]; -}; - -//len = 320 -enum { //bandolier item positions - bandolierMainHand = 0, - bandolierOffHand, +// Bandolier item positions +enum +{ + bandolierPrimary = 0, + bandolierSecondary, bandolierRange, bandolierAmmo }; -struct Bandolier_Struct { - char name[32]; - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; + +//len = 72 +struct BandolierItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; }; -struct PotionBelt_Struct { - BandolierItem_Struct items[MAX_POTIONS_IN_BELT]; + +//len = 320 +struct Bandolier_Struct +{ + char Name[32]; + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +//len = 72 +struct PotionBeltItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; +}; + +//len = 288 +struct PotionBelt_Struct +{ + PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -3548,30 +3564,35 @@ struct DynamicWall_Struct { /*80*/ }; -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 +// Bandolier actions +enum +{ + bandolierCreate = 0, + bandolierRemove, + bandolierSet }; -struct BandolierCreate_Struct { -/*00*/ uint32 action; //0 for create -/*04*/ uint8 number; -/*05*/ char name[32]; -/*37*/ uint16 unknown37; //seen 0x93FD -/*39*/ uint8 unknown39; //0 +struct BandolierCreate_Struct +{ + /*00*/ uint32 Action; //0 for create + /*04*/ uint8 Number; + /*05*/ char Name[32]; + /*37*/ uint16 Unknown37; //seen 0x93FD + /*39*/ uint8 Unknown39; //0 }; -struct BandolierDelete_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierDelete_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; -struct BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierSet_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; struct Arrow_Struct { diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 3be2d7d70..7528a378d 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -924,19 +924,19 @@ namespace Titanium OUT(aapoints); // OUT(unknown06160[4]); for (r = 0; r < structs::MAX_PLAYER_BANDOLIER; r++) { - OUT_str(bandoliers[r].name); + OUT_str(bandoliers[r].Name); uint32 k; for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { - OUT(bandoliers[r].items[k].item_id); - OUT(bandoliers[r].items[k].icon); - OUT_str(bandoliers[r].items[k].item_name); + OUT(bandoliers[r].Items[k].ID); + OUT(bandoliers[r].Items[k].Icon); + OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); for (r = 0; r < structs::MAX_PLAYER_BANDOLIER_ITEMS; r++) { - OUT(potionbelt.items[r].item_id); - OUT(potionbelt.items[r].icon); - OUT_str(potionbelt.items[r].item_name); + OUT(potionbelt.Items[r].ID); + OUT(potionbelt.Items[r].Icon); + OUT_str(potionbelt.Items[r].Name); } // OUT(unknown12852[8]); // OUT(unknown12864[76]); diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 19d82d6af..8286d125c 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -594,26 +594,42 @@ struct Tribute_Struct { uint32 tier; }; -//len = 72 -struct BandolierItem_Struct { - uint32 item_id; - uint32 icon; - char item_name[64]; -}; - -//len = 320 -enum { //bandolier item positions - bandolierMainHand = 0, - bandolierOffHand, +// Bandolier item positions +enum +{ + bandolierPrimary = 0, + bandolierSecondary, bandolierRange, bandolierAmmo }; -struct Bandolier_Struct { - char name[32]; - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; + +//len = 72 +struct BandolierItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; }; -struct PotionBelt_Struct { - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; + +//len = 320 +struct Bandolier_Struct +{ + char Name[32]; + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +//len = 72 +struct PotionBeltItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; +}; + +//len = 288 +struct PotionBelt_Struct +{ + PotionBeltItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -3030,30 +3046,35 @@ struct DynamicWall_Struct { /*80*/ }; -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 +// Bandolier actions +enum +{ + bandolierCreate = 0, + bandolierRemove, + bandolierSet }; -struct BandolierCreate_Struct { -/*00*/ uint32 action; //0 for create -/*04*/ uint8 number; -/*05*/ char name[32]; -/*37*/ uint16 unknown37; //seen 0x93FD -/*39*/ uint8 unknown39; //0 +struct BandolierCreate_Struct +{ + /*00*/ uint32 Action; //0 for create + /*04*/ uint8 Number; + /*05*/ char Name[32]; + /*37*/ uint16 Unknown37; //seen 0x93FD + /*39*/ uint8 Unknown39; //0 }; -struct BandolierDelete_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierDelete_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; -struct BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierSet_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; struct Arrow_Struct { diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 11fdb3c7b..334a6dc88 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1872,19 +1872,19 @@ namespace UF //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for (r = 0; r < 4; r++) { - OUT_str(bandoliers[r].name); + OUT_str(bandoliers[r].Name); uint32 k; for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { - OUT(bandoliers[r].items[k].item_id); - OUT(bandoliers[r].items[k].icon); - OUT_str(bandoliers[r].items[k].item_name); + OUT(bandoliers[r].Items[k].ID); + OUT(bandoliers[r].Items[k].Icon); + OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { - OUT(potionbelt.items[r].item_id); - OUT(potionbelt.items[r].icon); - OUT_str(potionbelt.items[r].item_name); + OUT(potionbelt.Items[r].ID); + OUT(potionbelt.Items[r].Icon); + OUT_str(potionbelt.Items[r].Name); } // OUT(unknown12852[8]); // OUT(unknown12864[76]); diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index fb4d00de3..762419a67 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -732,26 +732,42 @@ struct Tribute_Struct { uint32 tier; }; -//len = 72 -struct BandolierItem_Struct { - uint32 item_id; - uint32 icon; - char item_name[64]; -}; - -//len = 320 -enum { //bandolier item positions - bandolierMainHand = 0, - bandolierOffHand, +// Bandolier item positions +enum +{ + bandolierPrimary = 0, + bandolierSecondary, bandolierRange, bandolierAmmo }; -struct Bandolier_Struct { - char name[32]; - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; + +//len = 72 +struct BandolierItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; }; -struct PotionBelt_Struct { - BandolierItem_Struct items[MAX_POTIONS_IN_BELT]; + +//len = 320 +struct Bandolier_Struct +{ + char Name[32]; + BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; +}; + +//len = 72 +struct PotionBeltItem_Struct +{ + uint32 ID; + uint32 Icon; + char Name[64]; +}; + +//len = 288 +struct PotionBelt_Struct +{ + PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -3758,30 +3774,35 @@ struct DynamicWall_Struct { /*80*/ }; -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 +// Bandolier actions +enum +{ + bandolierCreate = 0, + bandolierRemove, + bandolierSet }; -struct BandolierCreate_Struct { -/*00*/ uint32 action; //0 for create -/*04*/ uint8 number; -/*05*/ char name[32]; -/*37*/ uint16 unknown37; //seen 0x93FD -/*39*/ uint8 unknown39; //0 +struct BandolierCreate_Struct +{ + /*00*/ uint32 Action; //0 for create + /*04*/ uint8 Number; + /*05*/ char Name[32]; + /*37*/ uint16 Unknown37; //seen 0x93FD + /*39*/ uint8 Unknown39; //0 }; -struct BandolierDelete_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierDelete_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; -struct BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; +struct BandolierSet_Struct +{ + /*00*/ uint32 Action; + /*04*/ uint8 Number; + /*05*/ uint8 Unknown05[35]; }; // Not 100% sure on this struct. Live as of 1/1/11 is different than UF. Seems to work 'OK' diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2d60b444e..97b927352 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3183,19 +3183,20 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - switch (bs->action) { - case BandolierCreate: + switch (bs->Action) + { + case bandolierCreate: CreateBandolier(app); break; - case BandolierRemove: + case bandolierRemove: RemoveBandolier(app); break; - case BandolierSet: + case bandolierSet: SetBandolier(app); break; default: - Log.Out(Logs::General, Logs::None, "Uknown Bandolier action %i", bs->action); - + Log.Out(Logs::General, Logs::None, "Uknown Bandolier action %i", bs->Action); + break; } } @@ -10442,16 +10443,16 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) if (mptbs->Action == 0) { const Item_Struct *BaseItem = database.GetItem(mptbs->ItemID); if (BaseItem) { - m_pp.potionbelt.items[mptbs->SlotNumber].item_id = BaseItem->ID; - m_pp.potionbelt.items[mptbs->SlotNumber].icon = BaseItem->Icon; - strn0cpy(m_pp.potionbelt.items[mptbs->SlotNumber].item_name, BaseItem->Name, sizeof(BaseItem->Name)); - database.SaveCharacterPotionBelt(this->CharacterID(), mptbs->SlotNumber, m_pp.potionbelt.items[mptbs->SlotNumber].item_id, m_pp.potionbelt.items[mptbs->SlotNumber].icon); + m_pp.potionbelt.Items[mptbs->SlotNumber].ID = BaseItem->ID; + m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = BaseItem->Icon; + strn0cpy(m_pp.potionbelt.Items[mptbs->SlotNumber].Name, BaseItem->Name, sizeof(BaseItem->Name)); + database.SaveCharacterPotionBelt(this->CharacterID(), mptbs->SlotNumber, m_pp.potionbelt.Items[mptbs->SlotNumber].ID, m_pp.potionbelt.Items[mptbs->SlotNumber].Icon); } } else { - m_pp.potionbelt.items[mptbs->SlotNumber].item_id = 0; - m_pp.potionbelt.items[mptbs->SlotNumber].icon = 0; - strncpy(m_pp.potionbelt.items[mptbs->SlotNumber].item_name, "\0", 1); + m_pp.potionbelt.Items[mptbs->SlotNumber].ID = 0; + m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = 0; + strncpy(m_pp.potionbelt.Items[mptbs->SlotNumber].Name, "\0", 1); } } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 69f1de882..7f2fa0173 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2476,97 +2476,99 @@ EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const ItemInst* ins return outapp; } -static int16 BandolierSlotToWeaponSlot(int BandolierSlot) { - - switch(BandolierSlot) { - case bandolierMainHand: - return MainPrimary; - case bandolierOffHand: - return MainSecondary; - case bandolierRange: - return MainRange; - default: - return MainAmmo; +static int16 BandolierSlotToWeaponSlot(int BandolierSlot) +{ + switch (BandolierSlot) + { + case bandolierPrimary: + return MainPrimary; + case bandolierSecondary: + return MainSecondary; + case bandolierRange: + return MainRange; + default: + return MainAmmo; } } -void Client::CreateBandolier(const EQApplicationPacket *app) { - +void Client::CreateBandolier(const EQApplicationPacket *app) +{ // Store bandolier set with the number and name passed by the client, along with the items that are currently // in the players weapon slots. BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name); - strcpy(m_pp.bandoliers[bs->number].name, bs->name); + Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->Number, bs->Name); + strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name); const ItemInst* InvItem = nullptr; const Item_Struct *BaseItem = nullptr; - int16 WeaponSlot; + int16 WeaponSlot = 0; - for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) { + for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) { WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot); InvItem = GetInv()[WeaponSlot]; if(InvItem) { BaseItem = InvItem->GetItem(); Log.Out(Logs::Detail, Logs::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot); - m_pp.bandoliers[bs->number].items[BandolierSlot].item_id = BaseItem->ID; - m_pp.bandoliers[bs->number].items[BandolierSlot].icon = BaseItem->Icon; - database.SaveCharacterBandolier(this->CharacterID(), bs->number, BandolierSlot, m_pp.bandoliers[bs->number].items[BandolierSlot].item_id, m_pp.bandoliers[bs->number].items[BandolierSlot].icon, bs->name); + m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = BaseItem->ID; + m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = BaseItem->Icon; + database.SaveCharacterBandolier(this->CharacterID(), bs->Number, BandolierSlot, m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID, m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon, bs->Name); } else { Log.Out(Logs::Detail, Logs::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot); - m_pp.bandoliers[bs->number].items[BandolierSlot].item_id = 0; - m_pp.bandoliers[bs->number].items[BandolierSlot].icon = 0; + m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = 0; + m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = 0; } } } -void Client::RemoveBandolier(const EQApplicationPacket *app) { +void Client::RemoveBandolier(const EQApplicationPacket *app) +{ BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer; - Log.Out(Logs::Detail, Logs::Inventory, "Char: %s removing set", GetName(), bds->number); - memset(m_pp.bandoliers[bds->number].name, 0, 32); - for(int i = bandolierMainHand; i <= bandolierAmmo; i++) { - m_pp.bandoliers[bds->number].items[i].item_id = 0; - m_pp.bandoliers[bds->number].items[i].icon = 0; + Log.Out(Logs::Detail, Logs::Inventory, "Char: %s removing set", GetName(), bds->Number); + memset(m_pp.bandoliers[bds->Number].Name, 0, 32); + for(int i = bandolierPrimary; i <= bandolierAmmo; i++) { + m_pp.bandoliers[bds->Number].Items[i].ID = 0; + m_pp.bandoliers[bds->Number].Items[i].Icon = 0; } - database.DeleteCharacterBandolier(this->CharacterID(), bds->number); + database.DeleteCharacterBandolier(this->CharacterID(), bds->Number); } -void Client::SetBandolier(const EQApplicationPacket *app) { - +void Client::SetBandolier(const EQApplicationPacket *app) +{ // Swap the weapons in the given bandolier set into the character's weapon slots and return // any items currently in the weapon slots to inventory. BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer; - Log.Out(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->number); - int16 slot; - int16 WeaponSlot; + Log.Out(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->Number); + int16 slot = 0; + int16 WeaponSlot = 0; ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory // First we pull the items for this bandolier set out of their inventory, this makes space to put the // currently equipped items back. - for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) { + for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) { // If this bandolier set has an item in this position - if(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id) { + if(m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID) { WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot); // Check if the player has the item specified in the bandolier set on them. // - slot = m_inv.HasItem(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id, 1, + slot = m_inv.HasItem(m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID, 1, invWhereWorn|invWherePersonal); // removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here if (slot == INVALID_INDEX) { if (m_inv.GetItem(MainCursor)) { - if (m_inv.GetItem(MainCursor)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id && + if (m_inv.GetItem(MainCursor)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && m_inv.GetItem(MainCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches Inventory::_HasItem conditional check slot = MainCursor; } else if (m_inv.GetItem(MainCursor)->GetItem()->ItemClass == 1) { for(int16 CursorBagSlot = EmuConstants::CURSOR_BAG_BEGIN; CursorBagSlot <= EmuConstants::CURSOR_BAG_END; CursorBagSlot++) { if (m_inv.GetItem(CursorBagSlot)) { - if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id && + if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && m_inv.GetItem(CursorBagSlot)->GetCharges() >= 1) { // ditto slot = CursorBagSlot; break; @@ -2630,14 +2632,14 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // Now we move the required weapons into the character weapon slots, and return any items we are replacing // back to inventory. // - for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) { + for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) { // Find the inventory slot corresponding to this bandolier slot WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot); // if there is an item in this Bandolier slot ? - if(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id) { + if(m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID) { // if the player has this item in their inventory, and it is not already where it needs to be if(BandolierItems[BandolierSlot]) { // Pull the item that we are going to replace diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index b99024c5c..8a95de0f4 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1175,20 +1175,21 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile return true; } -bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp){ +bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp) +{ std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT 16", character_id); auto results = database.QueryDatabase(query); int i = 0; int r = 0; int si = 0; for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++) for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++) - pp->bandoliers[i].items[si].icon = 0; + pp->bandoliers[i].Items[si].Icon = 0; for (auto row = results.begin(); row != results.end(); ++row) { r = 0; i = atoi(row[r]); /* Bandolier ID */ r++; si = atoi(row[r]); /* Bandolier Slot */ r++; - pp->bandoliers[i].items[si].item_id = atoi(row[r]); r++; - pp->bandoliers[i].items[si].icon = atoi(row[r]); r++; - strcpy(pp->bandoliers[i].name, row[r]); r++; + pp->bandoliers[i].Items[si].ID = atoi(row[r]); r++; + pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++; + strcpy(pp->bandoliers[i].Name, row[r]); r++; si++; } return true; @@ -1213,13 +1214,14 @@ bool ZoneDatabase::LoadCharacterTribute(uint32 character_id, PlayerProfile_Struc return true; } -bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp){ +bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp) +{ std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT 4", character_id); auto results = database.QueryDatabase(query); int i = 0; for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){ - pp->potionbelt.items[i].icon = 0; - pp->potionbelt.items[i].item_id = 0; - strncpy(pp->potionbelt.items[i].item_name, "\0", 1); + pp->potionbelt.Items[i].Icon = 0; + pp->potionbelt.Items[i].ID = 0; + strncpy(pp->potionbelt.Items[i].Name, "\0", 1); } for (auto row = results.begin(); row != results.end(); ++row) { @@ -1230,9 +1232,9 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc if(!item) continue; - pp->potionbelt.items[i].item_id = item_id; - pp->potionbelt.items[i].icon = atoi(row[2]); - strncpy(pp->potionbelt.items[i].item_name, item->Name, 64); + pp->potionbelt.Items[i].ID = item_id; + pp->potionbelt.Items[i].Icon = atoi(row[2]); + strncpy(pp->potionbelt.Items[i].Name, item->Name, 64); } return true; @@ -1326,7 +1328,8 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc return true; } -bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_id, uint8 bandolier_slot, uint32 item_id, uint32 icon, const char* bandolier_name){ +bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_id, uint8 bandolier_slot, uint32 item_id, uint32 icon, const char* bandolier_name) +{ char bandolier_name_esc[64]; DoEscapeString(bandolier_name_esc, bandolier_name, strlen(bandolier_name)); std::string query = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%u, %u, %u, %u, %u,'%s')", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name_esc); @@ -1335,7 +1338,8 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i return true; } -bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon) { +bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon) +{ std::string query = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%u, %u, %u, %u)", character_id, potion_id, item_id, icon); auto results = QueryDatabase(query); return true; From 5a3b10a11c3c2ee4fdcc8d0c02e0bb33096e5f2d Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 14 Feb 2015 18:10:50 -0500 Subject: [PATCH 2/8] Constant name re-alignments prior to extended bandolier/potion belt activation --- common/database_conversions.cpp | 15 ++++++----- common/eq_dictionary.cpp | 42 ++++++++++++++--------------- common/eq_dictionary.h | 12 +++++---- common/eq_packet_structs.h | 6 ++--- common/patches/rof.cpp | 16 +++++------ common/patches/rof2.cpp | 16 +++++------ common/patches/rof2_constants.h | 7 ++--- common/patches/rof2_structs.h | 15 ++++------- common/patches/rof_constants.h | 7 ++--- common/patches/rof_structs.h | 15 ++++------- common/patches/sod.cpp | 4 +-- common/patches/sod_constants.h | 7 ++--- common/patches/sod_structs.h | 9 +++---- common/patches/sof.cpp | 4 +-- common/patches/sof_constants.h | 7 ++--- common/patches/sof_structs.h | 9 +++---- common/patches/titanium.cpp | 6 ++--- common/patches/titanium_constants.h | 7 ++--- common/patches/titanium_structs.h | 8 +++--- common/patches/uf.cpp | 4 +-- common/patches/uf_constants.h | 7 ++--- common/patches/uf_structs.h | 9 +++---- zone/zonedb.cpp | 6 ++--- 23 files changed, 114 insertions(+), 124 deletions(-) diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index 7d49522a3..f6c43687f 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -158,6 +158,8 @@ namespace Convert { /*88*/ } PVPStatsEntry_Struct; + static const size_t BANDOLIERS_SIZE = 4; + static const size_t BANDOLIER_ITEM_COUNT = 4; struct BandolierItem_Struct { uint32 ID; uint32 Icon; @@ -165,16 +167,17 @@ namespace Convert { }; struct Bandolier_Struct { char Name[32]; - Convert::BandolierItem_Struct Items[EmuConstants::BANDOLIER_SIZE]; + Convert::BandolierItem_Struct Items[Convert::BANDOLIER_ITEM_COUNT]; }; + static const size_t POTION_BELT_ITEM_COUNT = 4; struct PotionBeltItem_Struct { uint32 ID; uint32 Icon; char Name[64]; }; struct PotionBelt_Struct { - Convert::PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_SIZE]; + Convert::PotionBeltItem_Struct Items[Convert::POTION_BELT_ITEM_COUNT]; }; struct SuspendedMinion_Struct @@ -354,7 +357,7 @@ namespace Convert { /*12800*/ uint32 expAA; /*12804*/ uint32 aapoints; //avaliable, unspent /*12808*/ uint8 unknown12844[36]; - /*12844*/ Convert::Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT]; + /*12844*/ Convert::Bandolier_Struct bandoliers[Convert::BANDOLIERS_SIZE]; /*14124*/ uint8 unknown14160[4506]; /*18630*/ Convert::SuspendedMinion_Struct SuspendedMinion; // No longer in use /*19240*/ uint32 timeentitledonaccount; @@ -1438,9 +1441,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Bandolier Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){ + for (i = 0; i < Convert::BANDOLIERS_SIZE; i++){ if (strlen(pp->bandoliers[i].Name) < 32) { - for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++){ + for (int si = 0; si < Convert::BANDOLIER_ITEM_COUNT; si++){ if (pp->bandoliers[i].Items[si].ID > 0){ if (first_entry != 1) { rquery = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%i, %u, %i, %u, %u, '%s')", character_id, i, si, pp->bandoliers[i].Items[si].ID, pp->bandoliers[i].Items[si].Icon, pp->bandoliers[i].Name); @@ -1454,7 +1457,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Potion Belt Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){ + for (i = 0; i < Convert::POTION_BELT_ITEM_COUNT; i++){ if (pp->potionbelt.Items[i].ID > 0){ if (first_entry != 1){ rquery = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%i, %u, %u, %u)", character_id, i, pp->potionbelt.Items[i].ID, pp->potionbelt.Items[i].Icon); diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index 026d84a31..a87ae569a 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -924,13 +924,13 @@ uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) { static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::BANDOLIERS_COUNT, -/*Titanium*/ EmuConstants::BANDOLIERS_COUNT, -/*SoF*/ EmuConstants::BANDOLIERS_COUNT, -/*SoD*/ EmuConstants::BANDOLIERS_COUNT, -/*Underfoot*/ EmuConstants::BANDOLIERS_COUNT, -/*RoF*/ EmuConstants::BANDOLIERS_COUNT, -/*RoF2*/ EmuConstants::BANDOLIERS_COUNT, +/*62*/ NOT_USED, +/*Titanium*/ EmuConstants::BANDOLIERS_SIZE, +/*SoF*/ EmuConstants::BANDOLIERS_SIZE, +/*SoD*/ EmuConstants::BANDOLIERS_SIZE, +/*Underfoot*/ EmuConstants::BANDOLIERS_SIZE, +/*RoF*/ EmuConstants::BANDOLIERS_SIZE, +/*RoF2*/ EmuConstants::BANDOLIERS_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -945,13 +945,13 @@ uint32 EQLimits::BandolierSize(ClientVersion clientVersion) { static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::BANDOLIER_SIZE, -/*Titanium*/ EmuConstants::BANDOLIER_SIZE, -/*SoF*/ EmuConstants::BANDOLIER_SIZE, -/*SoD*/ EmuConstants::BANDOLIER_SIZE, -/*Underfoot*/ EmuConstants::BANDOLIER_SIZE, -/*RoF*/ EmuConstants::BANDOLIER_SIZE, -/*RoF2*/ EmuConstants::BANDOLIER_SIZE, +/*62*/ NOT_USED, +/*Titanium*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*SoF*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*SoD*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*Underfoot*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*RoF*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*RoF2*/ EmuConstants::BANDOLIER_ITEM_COUNT, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -966,13 +966,13 @@ uint32 EQLimits::PotionBeltSize(ClientVersion clientVersion) { static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::POTION_BELT_SIZE, -/*Titanium*/ EmuConstants::POTION_BELT_SIZE, -/*SoF*/ EmuConstants::POTION_BELT_SIZE, -/*SoD*/ EmuConstants::POTION_BELT_SIZE, -/*Underfoot*/ EmuConstants::POTION_BELT_SIZE, -/*RoF*/ EmuConstants::POTION_BELT_SIZE, -/*RoF2*/ EmuConstants::POTION_BELT_SIZE, +/*62*/ NOT_USED, +/*Titanium*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*SoF*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*SoD*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*Underfoot*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*RoF*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*RoF2*/ EmuConstants::POTION_BELT_ITEM_COUNT, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 151397dd4..501fd52cf 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -141,12 +141,14 @@ public: static const uint16 ITEM_COMMON_SIZE = RoF::consts::ITEM_COMMON_SIZE; static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE; - // BANDOLIERS_COUNT sets maximum limit..active limit will need to be handled by the appropriate AA - static const uint32 BANDOLIERS_COUNT = Titanium::consts::BANDOLIERS_COUNT; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = Titanium::consts::BANDOLIER_SIZE; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = Titanium::consts::POTION_BELT_SIZE; + // BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?) + static const size_t BANDOLIERS_SIZE = Titanium::consts::BANDOLIERS_SIZE; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = Titanium::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance - static const size_t TEXT_LINK_BODY_LENGTH = 56; + // POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?) + static const size_t POTION_BELT_ITEM_COUNT = Titanium::consts::POTION_BELT_ITEM_COUNT; + + static const size_t TEXT_LINK_BODY_LENGTH = RoF2::consts::TEXT_LINK_BODY_LENGTH; }; class EQLimits diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 9d49a3080..17fe7e913 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -778,7 +778,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[EmuConstants::BANDOLIER_SIZE]; + BandolierItem_Struct Items[EmuConstants::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -792,7 +792,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_SIZE]; + PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_ITEM_COUNT]; }; struct MovePotionToBelt_Struct @@ -1121,7 +1121,7 @@ struct PlayerProfile_Struct /*12800*/ uint32 expAA; /*12804*/ uint32 aapoints; //avaliable, unspent /*12808*/ uint8 unknown12844[36]; -/*12844*/ Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT]; +/*12844*/ Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_SIZE]; /*14124*/ uint8 unknown14160[4506]; /*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use /*19240*/ uint32 timeentitledonaccount; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 42b588ec3..86382e7b5 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2286,13 +2286,13 @@ namespace RoF outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(structs::MAX_PLAYER_BANDOLIER); + outapp->WriteUInt32(consts::BANDOLIERS_SIZE); - for (uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); @@ -2308,11 +2308,11 @@ namespace RoF } } - for (uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < consts::BANDOLIERS_SIZE - EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(""); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(""); outapp->WriteUInt32(0); @@ -2320,9 +2320,9 @@ namespace RoF } } - outapp->WriteUInt32(structs::MAX_POTIONS_IN_BELT); + outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); - for (uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); @@ -2336,7 +2336,7 @@ namespace RoF } } - for (uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < consts::POTION_BELT_ITEM_COUNT - EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(""); outapp->WriteUInt32(0); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 4aec12ba1..ba06c2742 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2360,13 +2360,13 @@ namespace RoF2 outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(structs::MAX_PLAYER_BANDOLIER); + outapp->WriteUInt32(consts::BANDOLIERS_SIZE); - for (uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); @@ -2382,11 +2382,11 @@ namespace RoF2 } } - for (uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < consts::BANDOLIERS_SIZE - EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(""); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(""); outapp->WriteUInt32(0); @@ -2394,9 +2394,9 @@ namespace RoF2 } } - outapp->WriteUInt32(structs::MAX_POTIONS_IN_BELT); + outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); - for (uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); @@ -2410,7 +2410,7 @@ namespace RoF2 } } - for (uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < consts::POTION_BELT_ITEM_COUNT - EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(""); outapp->WriteUInt32(0); diff --git a/common/patches/rof2_constants.h b/common/patches/rof2_constants.h index ca59511a1..867574670 100644 --- a/common/patches/rof2_constants.h +++ b/common/patches/rof2_constants.h @@ -178,9 +178,10 @@ namespace RoF2 { static const uint16 ITEM_COMMON_SIZE = 6; static const uint16 ITEM_CONTAINER_SIZE = 255; // 255; (server max will be 255..unsure what actual client is - test) - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 56; } diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 092d12d76..94f8bf4e7 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -97,11 +97,6 @@ static const uint32 MAX_PLAYER_TRIBUTES = 5; static const uint32 MAX_TRIBUTE_TIERS = 10; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; - -static const uint32 MAX_POTIONS_IN_BELT = 5; - 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); @@ -924,13 +919,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct PotionBeltItem_Struct @@ -950,12 +945,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct_Old Items[consts::POTION_BELT_ITEM_COUNT]; }; struct GroupLeadershipAA_Struct { @@ -1165,7 +1160,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*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 +/*12959*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/rof_constants.h b/common/patches/rof_constants.h index 92c019bad..4fbf21d47 100644 --- a/common/patches/rof_constants.h +++ b/common/patches/rof_constants.h @@ -177,9 +177,10 @@ namespace RoF { static const uint16 ITEM_COMMON_SIZE = 6; static const uint16 ITEM_CONTAINER_SIZE = 255; // 255; (server max will be 255..unsure what actual client is - test) - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 55; } diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 770dd250f..05cc5a346 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -97,11 +97,6 @@ static const uint32 MAX_PLAYER_TRIBUTES = 5; static const uint32 MAX_TRIBUTE_TIERS = 10; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; - -static const uint32 MAX_POTIONS_IN_BELT = 5; - 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); @@ -908,13 +903,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct PotionBeltItem_Struct @@ -934,12 +929,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct_Old Items[consts::POTION_BELT_ITEM_COUNT]; }; struct GroupLeadershipAA_Struct { @@ -1149,7 +1144,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*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 +/*12959*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index c2a6eeaaa..81cb49f1a 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1612,14 +1612,14 @@ namespace SoD for (r = 0; r < 4; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/sod_constants.h b/common/patches/sod_constants.h index 7731d1d1f..6b587b7c4 100644 --- a/common/patches/sod_constants.h +++ b/common/patches/sod_constants.h @@ -174,9 +174,10 @@ namespace SoD { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 50; } diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 18f17ce62..f929ec744 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -676,9 +676,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; -static const uint32 MAX_POTIONS_IN_BELT = 5; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { @@ -707,7 +704,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -721,7 +718,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -941,7 +938,7 @@ struct PlayerProfile_Struct /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index cf19582b0..01b6abb55 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1270,14 +1270,14 @@ namespace SoF for (r = 0; r < 4; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/sof_constants.h b/common/patches/sof_constants.h index b20e57196..f5376cd13 100644 --- a/common/patches/sof_constants.h +++ b/common/patches/sof_constants.h @@ -174,9 +174,10 @@ namespace SoF { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 50; } diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 33773e91e..1510ded59 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -653,9 +653,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; -static const uint32 MAX_POTIONS_IN_BELT = 5; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { @@ -684,7 +681,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -698,7 +695,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -917,7 +914,7 @@ struct PlayerProfile_Struct //23576 Octets /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 7528a378d..b242a48b7 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -923,17 +923,17 @@ namespace Titanium OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - for (r = 0; r < structs::MAX_PLAYER_BANDOLIER; r++) { + for (r = 0; r < consts::BANDOLIERS_SIZE; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_PLAYER_BANDOLIER_ITEMS; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/titanium_constants.h b/common/patches/titanium_constants.h index 15338e220..61da2ba59 100644 --- a/common/patches/titanium_constants.h +++ b/common/patches/titanium_constants.h @@ -173,9 +173,10 @@ namespace Titanium { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 4; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 4; + static const size_t BANDOLIERS_SIZE = 4; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 4; static const size_t TEXT_LINK_BODY_LENGTH = 45; } diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 8286d125c..9a165a33d 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -586,8 +586,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 4; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { uint32 tribute; @@ -615,7 +613,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -629,7 +627,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -833,7 +831,7 @@ struct PlayerProfile_Struct /*06152*/ uint32 aapoints_spent; // Number of spent AA points /*06156*/ uint32 aapoints; // Unspent AA points /*06160*/ uint8 unknown06160[4]; -/*06164*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // bandolier contents +/*06164*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // bandolier contents /*07444*/ uint8 unknown07444[5120]; /*12564*/ PotionBelt_Struct potionbelt; // potion belt /*12852*/ uint8 unknown12852[8]; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 334a6dc88..5827c652c 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1874,14 +1874,14 @@ namespace UF for (r = 0; r < 4; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/uf_constants.h b/common/patches/uf_constants.h index 70b89df18..fc14af63f 100644 --- a/common/patches/uf_constants.h +++ b/common/patches/uf_constants.h @@ -174,9 +174,10 @@ namespace UF { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 50; } diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 762419a67..f33ab7b4c 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -722,9 +722,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; -static const uint32 MAX_POTIONS_IN_BELT = 5; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { @@ -753,7 +750,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -767,7 +764,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -990,7 +987,7 @@ struct PlayerProfile_Struct /*11236*/ uint32 aapoints_spent; // Number of spent AA points /*11240*/ uint32 aapoints; // Unspent AA points /*11244*/ uint8 unknown11244[4]; -/*11248*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [6400] bandolier contents +/*11248*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents /*17648*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*18008*/ uint8 unknown18008[8]; /*18016*/ uint32 available_slots; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8a95de0f4..d409e270a 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1179,8 +1179,8 @@ bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Str { std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT 16", character_id); auto results = database.QueryDatabase(query); int i = 0; int r = 0; int si = 0; - for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++) - for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++) + for (i = 0; i < EmuConstants::BANDOLIERS_SIZE; i++) + for (int si = 0; si < EmuConstants::BANDOLIER_ITEM_COUNT; si++) pp->bandoliers[i].Items[si].Icon = 0; for (auto row = results.begin(); row != results.end(); ++row) { @@ -1218,7 +1218,7 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc { std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT 4", character_id); auto results = database.QueryDatabase(query); int i = 0; - for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){ + for (i = 0; i < EmuConstants::POTION_BELT_ITEM_COUNT; i++){ pp->potionbelt.Items[i].Icon = 0; pp->potionbelt.Items[i].ID = 0; strncpy(pp->potionbelt.Items[i].Name, "\0", 1); From dedbb3f6c8546e9920940d4b5e79bdb784355dbf Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 14 Feb 2015 20:52:20 -0500 Subject: [PATCH 3/8] Implemented higher bandolier and potion belt counts --- changelog.txt | 1 + common/eq_dictionary.cpp | 63 ------------------------------- common/eq_dictionary.h | 11 ++---- common/patches/rof.cpp | 39 ++++++++----------- common/patches/rof2.cpp | 75 ++++++++++++++++--------------------- common/patches/sod.cpp | 32 +++++++++++++--- common/patches/sof.cpp | 32 +++++++++++++--- common/patches/titanium.cpp | 30 +++++++++++++-- common/patches/uf.cpp | 32 +++++++++++++--- zone/client_packet.cpp | 5 +-- zone/zonedb.cpp | 47 ++++++++++++++--------- 11 files changed, 188 insertions(+), 179 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6d50f235e..c04647bbc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ demonstar55: (RoF2) Send the bard focus effects, note custom servers will need t == 02/14/2015 == Trevius: (RoF2) Bazaar is now partially functional. RoF2 clients can start/end trader mode and other clients can purchase from them. No other functionality yet. +Uleat: Implemented higher bandolier and potion belt counts for clients that support it..you will still need to activate them through the proper aa's, etc... == 02/12/2015 == Akkadius: Implement zone based gravity, required SQL DB change diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index a87ae569a..a6a0d806d 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -919,66 +919,3 @@ bool EQLimits::CoinHasWeight(ClientVersion clientVersion) return local[static_cast(ValidateMobClientVersion(clientVersion))]; } - -uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) -{ - static const uint32 local[CLIENT_VERSION_COUNT] = { -/*Unknown*/ NOT_USED, -/*62*/ NOT_USED, -/*Titanium*/ EmuConstants::BANDOLIERS_SIZE, -/*SoF*/ EmuConstants::BANDOLIERS_SIZE, -/*SoD*/ EmuConstants::BANDOLIERS_SIZE, -/*Underfoot*/ EmuConstants::BANDOLIERS_SIZE, -/*RoF*/ EmuConstants::BANDOLIERS_SIZE, -/*RoF2*/ EmuConstants::BANDOLIERS_SIZE, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED - }; - - return local[static_cast(ValidateMobClientVersion(clientVersion))]; -} - -uint32 EQLimits::BandolierSize(ClientVersion clientVersion) -{ - static const uint32 local[CLIENT_VERSION_COUNT] = { -/*Unknown*/ NOT_USED, -/*62*/ NOT_USED, -/*Titanium*/ EmuConstants::BANDOLIER_ITEM_COUNT, -/*SoF*/ EmuConstants::BANDOLIER_ITEM_COUNT, -/*SoD*/ EmuConstants::BANDOLIER_ITEM_COUNT, -/*Underfoot*/ EmuConstants::BANDOLIER_ITEM_COUNT, -/*RoF*/ EmuConstants::BANDOLIER_ITEM_COUNT, -/*RoF2*/ EmuConstants::BANDOLIER_ITEM_COUNT, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED - }; - - return local[static_cast(ValidateMobClientVersion(clientVersion))]; -} - -uint32 EQLimits::PotionBeltSize(ClientVersion clientVersion) -{ - static const uint32 local[CLIENT_VERSION_COUNT] = { -/*Unknown*/ NOT_USED, -/*62*/ NOT_USED, -/*Titanium*/ EmuConstants::POTION_BELT_ITEM_COUNT, -/*SoF*/ EmuConstants::POTION_BELT_ITEM_COUNT, -/*SoD*/ EmuConstants::POTION_BELT_ITEM_COUNT, -/*Underfoot*/ EmuConstants::POTION_BELT_ITEM_COUNT, -/*RoF*/ EmuConstants::POTION_BELT_ITEM_COUNT, -/*RoF2*/ EmuConstants::POTION_BELT_ITEM_COUNT, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED - }; - - return local[static_cast(ValidateMobClientVersion(clientVersion))]; -} diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 501fd52cf..16586f356 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -142,11 +142,11 @@ public: static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE; // BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?) - static const size_t BANDOLIERS_SIZE = Titanium::consts::BANDOLIERS_SIZE; // number of bandolier instances - static const size_t BANDOLIER_ITEM_COUNT = Titanium::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance + static const size_t BANDOLIERS_SIZE = RoF2::consts::BANDOLIERS_SIZE; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = RoF2::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance // POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?) - static const size_t POTION_BELT_ITEM_COUNT = Titanium::consts::POTION_BELT_ITEM_COUNT; + static const size_t POTION_BELT_ITEM_COUNT = RoF2::consts::POTION_BELT_ITEM_COUNT; static const size_t TEXT_LINK_BODY_LENGTH = RoF2::consts::TEXT_LINK_BODY_LENGTH; }; @@ -186,11 +186,6 @@ public: // player profile static bool CoinHasWeight(ClientVersion clientVersion); - - static uint32 BandoliersCount(ClientVersion clientVersion); - static uint32 BandolierSize(ClientVersion clientVersion); - - static uint32 PotionBeltSize(ClientVersion clientVersion); }; #endif /* EQ_DICTIONARY_H */ diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 86382e7b5..ed943db97 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2288,32 +2288,25 @@ namespace RoF outapp->WriteUInt32(consts::BANDOLIERS_SIZE); - for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE; r++) - { + // Copy bandoliers where server and client indexes converge + for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { outapp->WriteString(emu->bandoliers[r].Name); - - for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) - { + for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); - if (emu->bandoliers[r].Items[j].Icon) - { + if (emu->bandoliers[r].Items[j].Icon) { outapp->WriteSInt32(emu->bandoliers[r].Items[j].Icon); } - else - { + else { // If no icon, it must send -1 or Treasure Chest Icon (836) is displayed outapp->WriteSInt32(-1); } } } - - for (uint32 r = 0; r < consts::BANDOLIERS_SIZE - EmuConstants::BANDOLIERS_SIZE; r++) - { + // Nullify bandoliers where server and client indexes diverge, with a client bias + for (uint32 r = EmuConstants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { outapp->WriteString(""); - - for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) - { + for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); @@ -2322,22 +2315,20 @@ namespace RoF outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); - for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT; r++) - { + // Copy potion belt where server and client indexes converge + for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); - if (emu->potionbelt.Items[r].Icon) - { + if (emu->potionbelt.Items[r].Icon) { outapp->WriteSInt32(emu->potionbelt.Items[r].Icon); } - else - { + else { + // If no icon, it must send -1 or Treasure Chest Icon (836) is displayed outapp->WriteSInt32(-1); } } - - for (uint32 r = 0; r < consts::POTION_BELT_ITEM_COUNT - EmuConstants::POTION_BELT_ITEM_COUNT; r++) - { + // Nullify potion belt where server and client indexes diverge, with a client bias + for (uint32 r = EmuConstants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index ba06c2742..e6f4775ac 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2362,56 +2362,47 @@ namespace RoF2 outapp->WriteUInt32(consts::BANDOLIERS_SIZE); - for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE; r++) - { + // Copy bandoliers where server and client indexes converge + for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { outapp->WriteString(emu->bandoliers[r].Name); - - for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) - { + for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); - if (emu->bandoliers[r].Items[j].Icon) - { + if (emu->bandoliers[r].Items[j].Icon) { outapp->WriteSInt32(emu->bandoliers[r].Items[j].Icon); - } - else - { - // If no icon, it must send -1 or Treasure Chest Icon (836) is displayed - outapp->WriteSInt32(-1); - } - } - } - - for (uint32 r = 0; r < consts::BANDOLIERS_SIZE - EmuConstants::BANDOLIERS_SIZE; r++) - { - outapp->WriteString(""); - - for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) - { - outapp->WriteString(""); - outapp->WriteUInt32(0); - outapp->WriteSInt32(-1); - } - } - + } + else { + // If no icon, it must send -1 or Treasure Chest Icon (836) is displayed + outapp->WriteSInt32(-1); + } + } + } + // Nullify bandoliers where server and client indexes diverge, with a client bias + for (uint32 r = EmuConstants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + outapp->WriteString(""); + for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true + outapp->WriteString(""); + outapp->WriteUInt32(0); + outapp->WriteSInt32(-1); + } + } + outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); - - for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT; r++) - { + + // Copy potion belt where server and client indexes converge + for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); - if (emu->potionbelt.Items[r].Icon) - { + if (emu->potionbelt.Items[r].Icon) { outapp->WriteSInt32(emu->potionbelt.Items[r].Icon); - } - else - { - outapp->WriteSInt32(-1); - } - } - - for (uint32 r = 0; r < consts::POTION_BELT_ITEM_COUNT - EmuConstants::POTION_BELT_ITEM_COUNT; r++) - { + } + else { + // If no icon, it must send -1 or Treasure Chest Icon (836) is displayed + outapp->WriteSInt32(-1); + } + } + // Nullify potion belt where server and client indexes diverge, with a client bias + for (uint32 r = EmuConstants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 81cb49f1a..b1ae218ed 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1606,26 +1606,46 @@ namespace SoD OUT(endurance); OUT(aapoints_spent); OUT(aapoints); + // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep - //only supports 4.. - for (r = 0; r < 4; r++) { + + // Copy bandoliers where server and client indexes converge + for (r = 0; r < EmuConstants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - uint32 k; - for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } + // Nullify bandoliers where server and client indexes diverge, with a client bias + for (r = EmuConstants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + eq->bandoliers[r].Name[0] = '\0'; + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + eq->bandoliers[r].Items[k].ID = 0; + eq->bandoliers[r].Items[k].Icon = 0; + eq->bandoliers[r].Items[k].Name[0] = '\0'; + } + } + // OUT(unknown07444[5120]); - for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { + + // Copy potion belt where server and client indexes converge + for (r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } + // Nullify potion belt where server and client indexes diverge, with a client bias + for (r = EmuConstants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + eq->potionbelt.Items[r].ID = 0; + eq->potionbelt.Items[r].Icon = 0; + eq->potionbelt.Items[r].Name[0] = '\0'; + } + // OUT(unknown12852[8]); // OUT(unknown12864[76]); + OUT_str(name); OUT_str(last_name); OUT(guild_id); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 01b6abb55..4ba534ac7 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1264,26 +1264,46 @@ namespace SoF OUT(endurance); OUT(aapoints_spent); OUT(aapoints); + // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep - //only supports 4.. - for (r = 0; r < 4; r++) { + + // Copy bandoliers where server and client indexes converge + for (r = 0; r < EmuConstants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - uint32 k; - for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } + // Nullify bandoliers where server and client indexes diverge, with a client bias + for (r = EmuConstants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + eq->bandoliers[r].Name[0] = '\0'; + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + eq->bandoliers[r].Items[k].ID = 0; + eq->bandoliers[r].Items[k].Icon = 0; + eq->bandoliers[r].Items[k].Name[0] = '\0'; + } + } + // OUT(unknown07444[5120]); - for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { + + // Copy potion belt where server and client indexes converge + for (r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } + // Nullify potion belt where server and client indexes diverge, with a client bias + for (r = EmuConstants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + eq->potionbelt.Items[r].ID = 0; + eq->potionbelt.Items[r].Icon = 0; + eq->potionbelt.Items[r].Name[0] = '\0'; + } + // OUT(unknown12852[8]); // OUT(unknown12864[76]); + OUT_str(name); OUT_str(last_name); OUT(guild_id); diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index b242a48b7..d048f0e5d 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -922,24 +922,46 @@ namespace Titanium OUT(endurance); OUT(aapoints_spent); OUT(aapoints); + // OUT(unknown06160[4]); - for (r = 0; r < consts::BANDOLIERS_SIZE; r++) { + + // Copy bandoliers where server and client indexes converge + for (r = 0; r < EmuConstants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - uint32 k; - for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } + // Nullify bandoliers where server and client indexes diverge, with a client bias + for (r = EmuConstants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + eq->bandoliers[r].Name[0] = '\0'; + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + eq->bandoliers[r].Items[k].ID = 0; + eq->bandoliers[r].Items[k].Icon = 0; + eq->bandoliers[r].Items[k].Name[0] = '\0'; + } + } + // OUT(unknown07444[5120]); - for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { + + // Copy potion belt where server and client indexes converge + for (r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } + // Nullify potion belt where server and client indexes diverge, with a client bias + for (r = EmuConstants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + eq->potionbelt.Items[r].ID = 0; + eq->potionbelt.Items[r].Icon = 0; + eq->potionbelt.Items[r].Name[0] = '\0'; + } + // OUT(unknown12852[8]); // OUT(unknown12864[76]); + OUT_str(name); OUT_str(last_name); OUT(guild_id); diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 5827c652c..991b35aa4 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1868,26 +1868,46 @@ namespace UF OUT(endurance); OUT(aapoints_spent); OUT(aapoints); + // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep - //only supports 4.. - for (r = 0; r < 4; r++) { + + // Copy bandoliers where server and client indexes converge + for (r = 0; r < EmuConstants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - uint32 k; - for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } + // Nullify bandoliers where server and client indexes diverge, with a client bias + for (r = EmuConstants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + eq->bandoliers[r].Name[0] = '\0'; + for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + eq->bandoliers[r].Items[k].ID = 0; + eq->bandoliers[r].Items[k].Icon = 0; + eq->bandoliers[r].Items[k].Name[0] = '\0'; + } + } + // OUT(unknown07444[5120]); - for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { + + // Copy potion belt where server and client indexes converge + for (r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } + // Nullify potion belt where server and client indexes diverge, with a client bias + for (r = EmuConstants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + eq->potionbelt.Items[r].ID = 0; + eq->potionbelt.Items[r].Icon = 0; + eq->potionbelt.Items[r].Name[0] = '\0'; + } + // OUT(unknown12852[8]); // OUT(unknown12864[76]); + OUT_str(name); OUT_str(last_name); OUT(guild_id); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 97b927352..3fa28c891 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3171,7 +3171,6 @@ void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) { - // Although there are three different structs for OP_Bandolier, they are all the same size. // if (app->size != sizeof(BandolierCreate_Struct)) { @@ -3195,7 +3194,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - Log.Out(Logs::General, Logs::None, "Uknown Bandolier action %i", bs->Action); + Log.Out(Logs::General, Logs::None, "Unknown Bandolier action %i", bs->Action); break; } } @@ -10452,7 +10451,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) else { m_pp.potionbelt.Items[mptbs->SlotNumber].ID = 0; m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = 0; - strncpy(m_pp.potionbelt.Items[mptbs->SlotNumber].Name, "\0", 1); + m_pp.potionbelt.Items[mptbs->SlotNumber].Name[0] = '\0'; } } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index d409e270a..d9e564e29 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1177,20 +1177,37 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp) { - std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT 16", character_id); + std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT %u", + character_id, EmuConstants::BANDOLIERS_SIZE); auto results = database.QueryDatabase(query); int i = 0; int r = 0; int si = 0; - for (i = 0; i < EmuConstants::BANDOLIERS_SIZE; i++) - for (int si = 0; si < EmuConstants::BANDOLIER_ITEM_COUNT; si++) + for (i = 0; i < EmuConstants::BANDOLIERS_SIZE; i++) { + pp->bandoliers[i].Name[0] = '\0'; + for (int si = 0; si < EmuConstants::BANDOLIER_ITEM_COUNT; si++) { + pp->bandoliers[i].Items[si].ID = 0; pp->bandoliers[i].Items[si].Icon = 0; + pp->bandoliers[i].Items[si].Name[0] = '\0'; + } + } for (auto row = results.begin(); row != results.end(); ++row) { r = 0; i = atoi(row[r]); /* Bandolier ID */ r++; si = atoi(row[r]); /* Bandolier Slot */ r++; - pp->bandoliers[i].Items[si].ID = atoi(row[r]); r++; - pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++; + + const Item_Struct* item_data = database.GetItem(atoi(row[r])); + if (item_data) { + pp->bandoliers[i].Items[si].ID = item_data->ID; r++; + pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++; // Must use db value in case an Ornamentation is assigned + strncpy(pp->bandoliers[i].Items[si].Name, item_data->Name, 64); + } + else { + pp->bandoliers[i].Items[si].ID = 0; r++; + pp->bandoliers[i].Items[si].Icon = 0; r++; + pp->bandoliers[i].Items[si].Name[0] = '\0'; + } strcpy(pp->bandoliers[i].Name, row[r]); r++; - si++; + + si++; // What is this for!? } return true; } @@ -1216,25 +1233,21 @@ bool ZoneDatabase::LoadCharacterTribute(uint32 character_id, PlayerProfile_Struc bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp) { - std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT 4", character_id); + std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT %u", + character_id, EmuConstants::POTION_BELT_ITEM_COUNT); auto results = database.QueryDatabase(query); int i = 0; for (i = 0; i < EmuConstants::POTION_BELT_ITEM_COUNT; i++){ pp->potionbelt.Items[i].Icon = 0; pp->potionbelt.Items[i].ID = 0; - strncpy(pp->potionbelt.Items[i].Name, "\0", 1); + pp->potionbelt.Items[i].Name[0] = '\0'; } for (auto row = results.begin(); row != results.end(); ++row) { - i = atoi(row[0]); /* Potion belt slot number */ - uint32 item_id = atoi(row[1]); - const Item_Struct *item = database.GetItem(item_id); - - if(!item) - continue; - - pp->potionbelt.Items[i].ID = item_id; + const Item_Struct *item_data = database.GetItem(atoi(row[1])); + if (item_data == nullptr) { continue; } + pp->potionbelt.Items[i].ID = item_data->ID; pp->potionbelt.Items[i].Icon = atoi(row[2]); - strncpy(pp->potionbelt.Items[i].Name, item->Name, 64); + strncpy(pp->potionbelt.Items[i].Name, item_data->Name, 64); } return true; From 20249cec67999e2787686e6af8a228cb5fbc7336 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 14 Feb 2015 21:36:54 -0500 Subject: [PATCH 4/8] Pre-purposed prep-work --- common/clientversions.h | 55 +++++++++++++++++++++++++++++++++++++++++ world/client.cpp | 32 ++++++++++++------------ world/client.h | 3 ++- world/worlddb.cpp | 13 ++++------ zone/client.cpp | 4 +-- zone/client.h | 6 ++--- zone/client_packet.cpp | 5 ++-- zone/client_process.cpp | 2 +- 8 files changed, 86 insertions(+), 34 deletions(-) diff --git a/common/clientversions.h b/common/clientversions.h index 040e5dc12..675429eab 100644 --- a/common/clientversions.h +++ b/common/clientversions.h @@ -95,4 +95,59 @@ static const char* ClientVersionName(ClientVersion version) }; } +static uint32 ClientBitFromVersion(ClientVersion clientVersion) +{ + switch (clientVersion) + { + case ClientVersion::Unknown: + case ClientVersion::Client62: + return 0; + case ClientVersion::Titanium: + case ClientVersion::SoF: + case ClientVersion::SoD: + case ClientVersion::UF: + case ClientVersion::RoF: + case ClientVersion::RoF2: + case ClientVersion::MobNPC: + case ClientVersion::MobMerc: + case ClientVersion::MobBot: + case ClientVersion::MobPet: + return ((uint32)1 << (static_cast(clientVersion) - 1)); + default: + return 0; + } +} + +static ClientVersion ClientVersionFromBit(uint32 clientVersionBit) +{ + switch (clientVersionBit) + { + case (uint32)static_cast(ClientVersion::Unknown): + case ((uint32)1 << (static_cast(ClientVersion::Client62) - 1)): + return ClientVersion::Unknown; + case ((uint32)1 << (static_cast(ClientVersion::Titanium) - 1)): + return ClientVersion::Titanium; + case ((uint32)1 << (static_cast(ClientVersion::SoF) - 1)): + return ClientVersion::SoF; + case ((uint32)1 << (static_cast(ClientVersion::SoD) - 1)): + return ClientVersion::SoD; + case ((uint32)1 << (static_cast(ClientVersion::UF) - 1)): + return ClientVersion::UF; + case ((uint32)1 << (static_cast(ClientVersion::RoF) - 1)): + return ClientVersion::RoF; + case ((uint32)1 << (static_cast(ClientVersion::RoF2) - 1)): + return ClientVersion::RoF2; + case ((uint32)1 << (static_cast(ClientVersion::MobNPC) - 1)): + return ClientVersion::MobNPC; + case ((uint32)1 << (static_cast(ClientVersion::MobMerc) - 1)): + return ClientVersion::MobMerc; + case ((uint32)1 << (static_cast(ClientVersion::MobBot) - 1)): + return ClientVersion::MobBot; + case ((uint32)1 << (static_cast(ClientVersion::MobPet) - 1)): + return ClientVersion::MobPet; + default: + return ClientVersion::Unknown; + } +} + #endif /* CLIENTVERSIONS_H */ diff --git a/world/client.cpp b/world/client.cpp index ace58ffea..f26328e12 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -86,11 +86,11 @@ Client::Client(EQStreamInterface* ieqs) charid = 0; pwaitingforbootup = 0; StartInTutorial = false; - ClientVersionBit = 0; - numclients++; - if (eqs->GetClientVersion() != ClientVersion::Unknown) - ClientVersionBit = 1 << (static_cast(eqs->GetClientVersion()) - 1); + m_ClientVersion = eqs->GetClientVersion(); + m_ClientVersionBit = ClientBitFromVersion(m_ClientVersion); + + numclients++; } Client::~Client() { @@ -161,7 +161,7 @@ void Client::SendCharInfo() { cle->SetOnline(CLE_Status_CharSelect); } - if (ClientVersionBit & BIT_RoFAndLater) + if (m_ClientVersionBit & BIT_RoFAndLater) { // Can make max char per account into a rule - New to VoA SendMaxCharCreate(10); @@ -176,7 +176,7 @@ void Client::SendCharInfo() { auto outapp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct)); CharacterSelect_Struct* cs = (CharacterSelect_Struct*)outapp->pBuffer; - database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit); + database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit); QueuePacket(outapp); safe_delete(outapp); @@ -671,7 +671,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { } else { - if(ClientVersionBit & BIT_TitaniumAndEarlier) + if (m_ClientVersionBit & BIT_TitaniumAndEarlier) StartInTutorial = true; SendCharInfo(); } @@ -719,7 +719,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if(!pZoning && ew->return_home && !ew->tutorial) { auto cs = new CharacterSelect_Struct; memset(cs, 0, sizeof(CharacterSelect_Struct)); - database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit); + database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit); bool home_enabled = false; for(int x = 0; x < 10; ++x) @@ -749,7 +749,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if(!pZoning && (RuleB(World, EnableTutorialButton) && (ew->tutorial || StartInTutorial))) { auto cs = new CharacterSelect_Struct; memset(cs, 0, sizeof(CharacterSelect_Struct)); - database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit); + database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit); bool tutorial_enabled = false; for(int x = 0; x < 10; ++x) @@ -846,9 +846,9 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { char ConnectionType; - if(ClientVersionBit & BIT_UFAndLater) + if (m_ClientVersionBit & BIT_UFAndLater) ConnectionType = 'U'; - else if(ClientVersionBit & BIT_SoFAndLater) + else if (m_ClientVersionBit & BIT_SoFAndLater) ConnectionType = 'S'; else ConnectionType = 'C'; @@ -872,7 +872,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { outapp2 = new EQApplicationPacket(OP_SetChatServer2); - if(ClientVersionBit & BIT_TitaniumAndEarlier) + if (m_ClientVersionBit & BIT_TitaniumAndEarlier) ConnectionType = 'M'; sprintf(buffer,"%s,%i,%s.%s,%c%08X", @@ -906,7 +906,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) { bool Client::HandleZoneChangePacket(const EQApplicationPacket *app) { // HoT sends this to world while zoning and wants it echoed back. - if(ClientVersionBit & BIT_RoFAndLater) + if (m_ClientVersionBit & BIT_RoFAndLater) { QueuePacket(app); } @@ -1370,7 +1370,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) Log.Out(Logs::Detail, Logs::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); /* Validate the char creation struct */ - if (ClientVersionBit & BIT_SoFAndLater) { + if (m_ClientVersionBit & BIT_SoFAndLater) { if (!CheckCharCreateInfoSoF(cc)) { Log.Out(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; @@ -1438,7 +1438,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.pvp = database.GetServerType() == 1 ? 1 : 0; /* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */ - if (ClientVersionBit & BIT_SoFAndLater) { + if (m_ClientVersionBit & BIT_SoFAndLater) { Log.Out(Logs::Detail, Logs::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); if (RuleI(World, SoFStartZoneID) > 0) { pp.zone_id = RuleI(World, SoFStartZoneID); @@ -1454,7 +1454,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) } } /* use normal starting zone logic to either get defaults, or if startzone was set, load that from the db table.*/ - bool ValidStartZone = database.GetStartZone(&pp, cc, ClientVersionBit & BIT_TitaniumAndEarlier); + bool ValidStartZone = database.GetStartZone(&pp, cc, m_ClientVersionBit & BIT_TitaniumAndEarlier); if (!ValidStartZone){ return false; diff --git a/world/client.h b/world/client.h index c6b67f91d..ea1df42ba 100644 --- a/world/client.h +++ b/world/client.h @@ -84,7 +84,8 @@ private: uint32 pwaitingforbootup; bool StartInTutorial; - uint32 ClientVersionBit; + ClientVersion m_ClientVersion; + uint32 m_ClientVersionBit; bool OPCharCreate(char *name, CharCreate_Struct *cc); void SetClassStartingSkills( PlayerProfile_Struct *pp ); diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 223ae89d6..3409a1e17 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -33,8 +33,9 @@ extern std::vector character_create_race_class_combos; // the current stuff is at the bottom of this function -void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) { - Inventory *inv; +void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) +{ + Inventory *inv = nullptr; uint8 has_home = 0; uint8 has_bind = 0; @@ -74,7 +75,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* "character_data " "WHERE `account_id` = %i ORDER BY `name` LIMIT 10 ", account_id); auto results = database.QueryDatabase(cquery); int char_num = 0; - for (auto row = results.begin(); row != results.end(); ++row) { + for (auto row = results.begin(); row != results.end() && char_num < 10; ++row, ++char_num) { PlayerProfile_Struct pp; memset(&pp, 0, sizeof(PlayerProfile_Struct)); @@ -167,6 +168,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* } /* Load Inventory */ + // If we ensure that the material data is updated appropriately, we can do away with inventory loads inv = new Inventory; if (GetInventory(account_id, cs->name[char_num], inv)) { @@ -237,11 +239,6 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* } safe_delete(inv); - - if (++char_num > 10) - { - break; - } } return; diff --git a/zone/client.cpp b/zone/client.cpp index 63a9b5073..816b21e15 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -250,7 +250,7 @@ Client::Client(EQStreamInterface* ieqs) AttemptedMessages = 0; TotalKarma = 0; m_ClientVersion = ClientVersion::Unknown; - ClientVersionBit = 0; + m_ClientVersionBit = 0; AggroCount = 0; RestRegenHP = 0; RestRegenMana = 0; @@ -7468,7 +7468,7 @@ void Client::SendClearMercInfo() void Client::DuplicateLoreMessage(uint32 ItemID) { - if(!(ClientVersionBit & BIT_RoFAndLater)) + if (!(m_ClientVersionBit & BIT_RoFAndLater)) { Message_StringID(0, PICK_LORE); return; diff --git a/zone/client.h b/zone/client.h index f2325ccca..e49f39805 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1022,7 +1022,7 @@ public: inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); } inline const ClientVersion GetClientVersion() const { return m_ClientVersion; } - inline const uint32 GetClientVersionBit() const { return ClientVersionBit; } + inline const uint32 GetClientVersionBit() const { return m_ClientVersionBit; } inline void SetClientVersion(ClientVersion in) { m_ClientVersion = in; } /** Adventure Stuff **/ @@ -1140,7 +1140,7 @@ public: void HandleLFGuildResponse(ServerPacket *pack); void SendLFGuildStatus(); void SendGuildLFGuildStatus(); - inline bool XTargettingAvailable() const { return ((ClientVersionBit & BIT_UFAndLater) && RuleB(Character, EnableXTargetting)); } + inline bool XTargettingAvailable() const { return ((m_ClientVersionBit & BIT_UFAndLater) && RuleB(Character, EnableXTargetting)); } inline uint8 GetMaxXTargets() const { return MaxXTargets; } void SetMaxXTargets(uint8 NewMax); bool IsXTarget(const Mob *m) const; @@ -1517,7 +1517,7 @@ private: uint32 AttemptedMessages; ClientVersion m_ClientVersion; - uint32 ClientVersionBit; + uint32 m_ClientVersionBit; int XPRate; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 3fa28c891..1b866073b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1191,8 +1191,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) conn_state = ReceivedZoneEntry; SetClientVersion(Connection()->GetClientVersion()); - if (m_ClientVersion != ClientVersion::Unknown) - ClientVersionBit = 1 << (static_cast(m_ClientVersion) - 1); + m_ClientVersionBit = ClientBitFromVersion(Connection()->GetClientVersion()); bool siv = m_inv.SetInventoryVersion(m_ClientVersion); Log.Out(Logs::General, Logs::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), ClientVersionName(m_ClientVersion), m_ClientVersion); @@ -1736,7 +1735,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) safe_delete(outapp); } - if (ClientVersionBit & BIT_UFAndLater) { + if (m_ClientVersionBit & BIT_UFAndLater) { outapp = new EQApplicationPacket(OP_XTargetResponse, 8); outapp->WriteUInt32(GetMaxXTargets()); outapp->WriteUInt32(0); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 3f9d0ee3a..4f228ba8a 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -968,7 +968,7 @@ void Client::BulkSendInventoryItems() void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { const Item_Struct* handyitem = nullptr; uint32 numItemSlots = 80; //The max number of items passed in the transaction. - if (ClientVersionBit & BIT_RoFAndLater) { // RoF+ can send 200 items + if (m_ClientVersionBit & BIT_RoFAndLater) { // RoF+ can send 200 items numItemSlots = 200; } const Item_Struct *item; From 53a1faa36feb5a6e9253c79d6877fcee17488530 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 14 Feb 2015 22:57:47 -0500 Subject: [PATCH 5/8] Constant name and eqdictionary entry addition prior to per-client version limit activation --- common/eq_dictionary.cpp | 22 ++++++++++++++++++++++ common/eq_dictionary.h | 6 ++++++ common/patches/rof2_constants.h | 2 ++ common/patches/rof_constants.h | 2 ++ common/patches/sod_constants.h | 2 ++ common/patches/sof_constants.h | 2 ++ common/patches/titanium_constants.h | 2 ++ common/patches/uf_constants.h | 2 ++ 8 files changed, 40 insertions(+) diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index a6a0d806d..9bc602aa1 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -319,6 +319,28 @@ ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion) return ClientVersion::Unknown; } +// database +size_t EQLimits::CharacterCreationLimit(ClientVersion clientVersion) +{ + static const size_t local[CLIENT_VERSION_COUNT] = { +/*Unknown*/ NOT_USED, +/*Client62*/ NOT_USED, +/*Titanium*/ Titanium::consts::CHARACTER_CREATION_LIMIT, +/*SoF*/ SoF::consts::CHARACTER_CREATION_LIMIT, +/*SoD*/ SoD::consts::CHARACTER_CREATION_LIMIT, +/*UF*/ UF::consts::CHARACTER_CREATION_LIMIT, +/*RoF*/ RoF::consts::CHARACTER_CREATION_LIMIT, +/*RoF2*/ RoF2::consts::CHARACTER_CREATION_LIMIT, + +/*MobNPC*/ NOT_USED, +/*MobMerc*/ NOT_USED, +/*MobBot*/ NOT_USED, +/*MobPet*/ NOT_USED + }; + + return local[static_cast(ValidateMobClientVersion(clientVersion))]; +} + // inventory uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) { diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 16586f356..84da53f63 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -49,6 +49,9 @@ public: // database static const ClientVersion CHARACTER_CREATION_CLIENT = ClientVersion::RoF2; // adjust according to starting item placement and target client + // This value should be at least 8 or Titanium will have issues (tested at 6) + static const size_t CHARACTER_CREATION_LIMIT = RoF2::consts::CHARACTER_CREATION_LIMIT; + // inventory static uint16 InventoryMapSize(int16 indexMap); //static std::string InventoryLocationName(Location_Struct location); @@ -170,6 +173,9 @@ public: static bool IsValidMobClientVersion(ClientVersion clientVersion); static ClientVersion ValidateMobClientVersion(ClientVersion clientVersion); + // database + static size_t CharacterCreationLimit(ClientVersion clientVersion); + // inventory static uint16 InventoryMapSize(int16 indexMap, ClientVersion clientVersion); static uint64 PossessionsBitmask(ClientVersion clientVersion); diff --git a/common/patches/rof2_constants.h b/common/patches/rof2_constants.h index 867574670..750a6fb3e 100644 --- a/common/patches/rof2_constants.h +++ b/common/patches/rof2_constants.h @@ -103,6 +103,8 @@ namespace RoF2 { } namespace consts { + static const size_t CHARACTER_CREATION_LIMIT = 10; + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; static const uint16 MAP_SHARED_BANK_SIZE = 2; diff --git a/common/patches/rof_constants.h b/common/patches/rof_constants.h index 4fbf21d47..86367b3d9 100644 --- a/common/patches/rof_constants.h +++ b/common/patches/rof_constants.h @@ -102,6 +102,8 @@ namespace RoF { } namespace consts { + static const size_t CHARACTER_CREATION_LIMIT = 10; + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; static const uint16 MAP_SHARED_BANK_SIZE = 2; diff --git a/common/patches/sod_constants.h b/common/patches/sod_constants.h index 6b587b7c4..5fdb89578 100644 --- a/common/patches/sod_constants.h +++ b/common/patches/sod_constants.h @@ -101,6 +101,8 @@ namespace SoD { } namespace consts { + static const size_t CHARACTER_CREATION_LIMIT = 10; + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; static const uint16 MAP_SHARED_BANK_SIZE = 2; diff --git a/common/patches/sof_constants.h b/common/patches/sof_constants.h index f5376cd13..4729eb436 100644 --- a/common/patches/sof_constants.h +++ b/common/patches/sof_constants.h @@ -101,6 +101,8 @@ namespace SoF { } namespace consts { + static const size_t CHARACTER_CREATION_LIMIT = 10; + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; static const uint16 MAP_SHARED_BANK_SIZE = 2; diff --git a/common/patches/titanium_constants.h b/common/patches/titanium_constants.h index 61da2ba59..c93de7666 100644 --- a/common/patches/titanium_constants.h +++ b/common/patches/titanium_constants.h @@ -100,6 +100,8 @@ namespace Titanium { } namespace consts { + static const size_t CHARACTER_CREATION_LIMIT = 8; + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 16; static const uint16 MAP_SHARED_BANK_SIZE = 2; diff --git a/common/patches/uf_constants.h b/common/patches/uf_constants.h index fc14af63f..3320fee76 100644 --- a/common/patches/uf_constants.h +++ b/common/patches/uf_constants.h @@ -101,6 +101,8 @@ namespace UF { } namespace consts { + static const size_t CHARACTER_CREATION_LIMIT = 10; + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; static const uint16 MAP_SHARED_BANK_SIZE = 2; From e4be4d6895a4f6db0748e8e36d3271b2ad76badf Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 15 Feb 2015 10:30:43 -0500 Subject: [PATCH 6/8] Pre-purposed clean-up --- common/eq_packet_structs.h | 119 ++++++++++++--------------- common/patches/rof.cpp | 104 +++++++++++------------ common/patches/rof2.cpp | 104 +++++++++++------------ common/patches/rof2_structs.h | 131 ++++++++++++++--------------- common/patches/rof_structs.h | 132 +++++++++++++++--------------- common/patches/sod.cpp | 92 ++++++++++----------- common/patches/sod_structs.h | 103 +++++++++++------------ common/patches/sof.cpp | 90 ++++++++++---------- common/patches/sof_structs.h | 100 +++++++++++----------- common/patches/titanium.cpp | 58 ++++++------- common/patches/titanium_structs.h | 69 ++++++++-------- common/patches/uf.cpp | 92 ++++++++++----------- common/patches/uf_structs.h | 102 ++++++++++++----------- world/client.cpp | 8 +- world/worlddb.cpp | 82 +++++++++---------- zone/bot.cpp | 22 ++--- zone/client.cpp | 6 +- zone/client_packet.cpp | 4 +- zone/command.cpp | 2 +- zone/corpse.cpp | 22 ++--- zone/inventory.cpp | 22 ++--- zone/mob.cpp | 18 ++-- zone/zonedb.cpp | 50 +++++------ 23 files changed, 762 insertions(+), 770 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 17fe7e913..0f1b63136 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -124,83 +124,66 @@ struct LDoNTrapTemplate /////////////////////////////////////////////////////////////////////////////// -/* -** Color_Struct -** Size: 4 bytes -** Used for convenience -** Merth: Gave struct a name so gcc 2.96 would compile -** -*/ +// All clients translate the character select information to some degree + struct Color_Struct { - union - { - struct - { - uint8 blue; - uint8 green; - uint8 red; - uint8 use_tint; // if there's a tint this is FF - } rgb; - uint32 color; + union { + struct { + uint8 Blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint this is FF + } RGB; + uint32 Color; }; }; -/* -* Visible equiptment. -* Size: 20 Octets -*/ -struct EquipStruct { - /*00*/ uint32 material; - /*04*/ uint32 unknown1; - /*08*/ uint32 elitematerial; - /*12*/ uint32 heroforgemodel; - /*16*/ uint32 material2; // Same as material? - /*20*/ +struct EquipStruct +{ + uint32 Material; + uint32 Unknown1; + uint32 EliteMaterial; + uint32 HeroForgeModel; + uint32 Material2; // Same as material? }; -struct CharSelectEquip { - uint32 material; - uint32 unknown1; - uint32 elitematerial; - uint32 heroforgemodel; - uint32 material2; - Color_Struct color; +struct CharSelectEquip +{ + uint32 Material; + uint32 Unknown1; + uint32 EliteMaterial; + uint32 HeroForgeModel; + uint32 Material2; + Color_Struct Color; }; -/* -** Character Selection Struct -** Length: 1704 Bytes -** -*/ -struct CharacterSelect_Struct { -/*0000*/ uint32 race[10]; // Characters Race -/*0040*/ //Color_Struct cs_colors[10][9]; // Characters Equipment Colors -/*0400*/ uint8 beardcolor[10]; // Characters beard Color -/*0410*/ uint8 hairstyle[10]; // Characters hair style -/*0420*/ //uint32 equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be) -/*0000*/ CharSelectEquip equip[10][9]; -/*0780*/ uint32 secondary[10]; // Characters secondary IDFile number -/*0820*/ uint32 drakkin_heritage[10]; // added for SoF -/*0860*/ uint32 drakkin_tattoo[10]; // added for SoF -/*0900*/ uint32 drakkin_details[10]; // added for SoF -/*0940*/ uint32 deity[10]; // Characters Deity -/*0980*/ uint8 gohome[10]; // 1=Go Home available, 0=not -/*0990*/ uint8 tutorial[10]; // 1=Tutorial available, 0=not -/*1000*/ uint8 beard[10]; // Characters Beard Type -/*1010*/ uint8 unknown902[10]; // 10x ff -/*1020*/ uint32 primary[10]; // Characters primary IDFile number -/*1060*/ uint8 haircolor[10]; // Characters Hair Color -/*1070*/ uint8 unknown0962[2]; // 2x 00 -/*1072*/ uint32 zone[10]; // Characters Current Zone -/*1112*/ uint8 class_[10]; // Characters Classes -/*1022*/ uint8 face[10]; // Characters Face Type -/*1032*/ char name[10][64]; // Characters Names -/*1672*/ uint8 gender[10]; // Characters Gender -/*1682*/ uint8 eyecolor1[10]; // Characters Eye Color -/*1692*/ uint8 eyecolor2[10]; // Characters Eye 2 Color -/*1702*/ uint8 level[10]; // Characters Levels -/*1712*/ +struct CharacterSelect_Struct +{ + uint32 Race[10]; // Characters Race + uint8 BeardColor[10]; // Characters beard Color + uint8 HairStyle[10]; // Characters hair style + CharSelectEquip Equip[10][9]; + uint32 Secondary[10]; // Characters secondary IDFile number + uint32 DrakkinHeritage[10]; // added for SoF + uint32 DrakkinTattoo[10]; // added for SoF + uint32 DrakkinDetails[10]; // added for SoF + uint32 Deity[10]; // Characters Deity + uint8 GoHome[10]; // 1=Go Home available, 0=not + uint8 Tutorial[10]; // 1=Tutorial available, 0=not + uint8 Beard[10]; // Characters Beard Type + uint8 Unknown902[10]; // 10x ff + uint32 Primary[10]; // Characters primary IDFile number + uint8 HairColor[10]; // Characters Hair Color + uint8 Unknown0962[2]; // 2x 00 + uint32 Zone[10]; // Characters Current Zone + uint8 Class_[10]; // Characters Classes + uint8 Face[10]; // Characters Face Type + char Name[10][64]; // Characters Names + uint8 Gender[10]; // Characters Gender + uint8 EyeColor1[10]; // Characters Eye Color + uint8 EyeColor2[10]; // Characters Eye 2 Color + uint8 Level[10]; // Characters Levels }; /* diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index ed943db97..6e89f7d39 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2043,7 +2043,7 @@ namespace RoF for (int r = 0; r < 7; r++) { - outapp->WriteUInt32(emu->item_tint[r].color); + outapp->WriteUInt32(emu->item_tint[r].Color); } // Write zeroes for extra two tint values outapp->WriteUInt32(0); @@ -2053,7 +2053,7 @@ namespace RoF for (int r = 0; r < 7; r++) { - outapp->WriteUInt32(emu->item_tint[r].color); + outapp->WriteUInt32(emu->item_tint[r].Color); } // Write zeroes for extra two tint values outapp->WriteUInt32(0); @@ -2906,11 +2906,11 @@ namespace RoF int char_count; int namelen = 0; for (char_count = 0; char_count < 10; char_count++) { - if (emu->name[char_count][0] == '\0') + if (emu->Name[char_count][0] == '\0') break; - if (strcmp(emu->name[char_count], "") == 0) + if (strcmp(emu->Name[char_count], "") == 0) break; - namelen += strlen(emu->name[char_count]); + namelen += strlen(emu->Name[char_count]); } int total_length = sizeof(structs::CharacterSelect_Struct) @@ -2922,58 +2922,58 @@ namespace RoF //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->CharCount = char_count; //eq->total_chars = 10; - unsigned char *bufptr = (unsigned char *)eq->entries; + unsigned char *bufptr = (unsigned char *)eq->Entries; int r; for (r = 0; r < char_count; r++) { { //pre-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - memcpy(eq2->name, emu->name[r], strlen(emu->name[r]) + 1); + memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); } //adjust for name. - bufptr += strlen(emu->name[r]); + bufptr += strlen(emu->Name[r]); { //post-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->class_ = emu->class_[r]; - eq2->race = emu->race[r]; - eq2->level = emu->level[r]; - eq2->class_2 = emu->class_[r]; - eq2->race2 = emu->race[r]; - eq2->zone = emu->zone[r]; - eq2->instance = 0; - eq2->gender = emu->gender[r]; - eq2->face = emu->face[r]; + eq2->Class_ = emu->Class_[r]; + eq2->Race = emu->Race[r]; + eq2->Level = emu->Level[r]; + eq2->Class_2 = emu->Class_[r]; + eq2->Race2 = emu->Race[r]; + eq2->Zone = emu->Zone[r]; + eq2->Instance = 0; + eq2->Gender = emu->Gender[r]; + eq2->Face = emu->Face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].material = emu->equip[r][k].material; - eq2->equip[k].unknown1 = emu->equip[r][k].unknown1; - eq2->equip[k].elitematerial = emu->equip[r][k].elitematerial; - eq2->equip[k].heroforgemodel = emu->equip[r][k].heroforgemodel; - eq2->equip[k].material2 = emu->equip[r][k].material2; - eq2->equip[k].color.color = emu->equip[r][k].color.color; + eq2->Equip[k].Material = emu->Equip[r][k].Material; + eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; + eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; + eq2->Equip[k].HeroForgeModel = emu->Equip[r][k].HeroForgeModel; + eq2->Equip[k].Material2 = emu->Equip[r][k].Material2; + eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; } - eq2->u15 = 0xff; - eq2->u19 = 0xFF; - eq2->drakkin_tattoo = emu->drakkin_tattoo[r]; - eq2->drakkin_details = emu->drakkin_details[r]; - eq2->deity = emu->deity[r]; - eq2->primary = emu->primary[r]; - eq2->secondary = emu->secondary[r]; - eq2->haircolor = emu->haircolor[r]; - eq2->beardcolor = emu->beardcolor[r]; - eq2->eyecolor1 = emu->eyecolor1[r]; - eq2->eyecolor2 = emu->eyecolor2[r]; - eq2->hairstyle = emu->hairstyle[r]; - eq2->beard = emu->beard[r]; - eq2->char_enabled = 1; - eq2->tutorial = emu->tutorial[r]; - eq2->drakkin_heritage = emu->drakkin_heritage[r]; - eq2->unknown1 = 0; - eq2->gohome = emu->gohome[r]; + eq2->Unknown15 = 0xFF; + eq2->Uknown19 = 0xFF; + eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; + eq2->DrakkinDetails = emu->DrakkinDetails[r]; + eq2->Deity = emu->Deity[r]; + eq2->Primary = emu->Primary[r]; + eq2->Secondary = emu->Secondary[r]; + eq2->HairColor = emu->HairColor[r]; + eq2->BeardColor = emu->BeardColor[r]; + eq2->EyeColor1 = emu->EyeColor1[r]; + eq2->EyeColor2 = emu->EyeColor2[r]; + eq2->HairStyle = emu->HairStyle[r]; + eq2->Beard = emu->Beard[r]; + eq2->CharEnabled = 1; + eq2->Tutorial = emu->Tutorial[r]; + eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; + eq2->Unknown1 = 0; + eq2->GoHome = emu->GoHome[r]; eq2->LastLogin = 1212696584; - eq2->unknown2 = 0; + eq2->Unknown2 = 0; } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } @@ -3639,7 +3639,7 @@ namespace RoF OUT(elite_material); OUT(hero_forge_model); OUT(unknown18); - OUT(color.color); + OUT(color.Color); OUT(wear_slot_id); FINISH_ENCODE(); @@ -3950,18 +3950,18 @@ namespace RoF for (k = 0; k < 9; ++k) { { - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].color); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color); } } structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].material = emu->equipment[k].material; - Equipment[k].unknown1 = emu->equipment[k].unknown1; - Equipment[k].elitematerial = emu->equipment[k].elitematerial; - Equipment[k].heroforgemodel = emu->equipment[k].heroforgemodel; - Equipment[k].material2 = emu->equipment[k].material2; + Equipment[k].Material = emu->equipment[k].Material; + Equipment[k].Unknown1 = emu->equipment[k].Unknown1; + Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial; + Equipment[k].HeroForgeModel = emu->equipment[k].HeroForgeModel; + Equipment[k].Material2 = emu->equipment[k].Material2; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -3974,13 +3974,13 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index e6f4775ac..0215911e6 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2118,7 +2118,7 @@ namespace RoF2 for (int r = 0; r < 7; r++) { - outapp->WriteUInt32(emu->item_tint[r].color); + outapp->WriteUInt32(emu->item_tint[r].Color); } // Write zeroes for extra two tint values outapp->WriteUInt32(0); @@ -2128,7 +2128,7 @@ namespace RoF2 for (int r = 0; r < 7; r++) { - outapp->WriteUInt32(emu->item_tint[r].color); + outapp->WriteUInt32(emu->item_tint[r].Color); } // Write zeroes for extra two tint values outapp->WriteUInt32(0); @@ -2990,11 +2990,11 @@ namespace RoF2 int char_count; int namelen = 0; for (char_count = 0; char_count < 10; char_count++) { - if (emu->name[char_count][0] == '\0') + if (emu->Name[char_count][0] == '\0') break; - if (strcmp(emu->name[char_count], "") == 0) + if (strcmp(emu->Name[char_count], "") == 0) break; - namelen += strlen(emu->name[char_count]); + namelen += strlen(emu->Name[char_count]); } int total_length = sizeof(structs::CharacterSelect_Struct) @@ -3006,58 +3006,58 @@ namespace RoF2 //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->CharCount = char_count; //eq->total_chars = 10; - unsigned char *bufptr = (unsigned char *)eq->entries; + unsigned char *bufptr = (unsigned char *)eq->Entries; int r; for (r = 0; r < char_count; r++) { { //pre-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - memcpy(eq2->name, emu->name[r], strlen(emu->name[r]) + 1); + memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); } //adjust for name. - bufptr += strlen(emu->name[r]); + bufptr += strlen(emu->Name[r]); { //post-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->class_ = emu->class_[r]; - eq2->race = emu->race[r]; - eq2->level = emu->level[r]; - eq2->class_2 = emu->class_[r]; - eq2->race2 = emu->race[r]; - eq2->zone = emu->zone[r]; - eq2->instance = 0; - eq2->gender = emu->gender[r]; - eq2->face = emu->face[r]; + eq2->Class_ = emu->Class_[r]; + eq2->Race = emu->Race[r]; + eq2->Level = emu->Level[r]; + eq2->Class_2 = emu->Class_[r]; + eq2->Race2 = emu->Race[r]; + eq2->Zone = emu->Zone[r]; + eq2->Instance = 0; + eq2->Gender = emu->Gender[r]; + eq2->Face = emu->Face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].material = emu->equip[r][k].material; - eq2->equip[k].unknown1 = emu->equip[r][k].unknown1; - eq2->equip[k].elitematerial = emu->equip[r][k].elitematerial; - eq2->equip[k].heroforgemodel = emu->equip[r][k].heroforgemodel; - eq2->equip[k].material2 = emu->equip[r][k].material2; - eq2->equip[k].color.color = emu->equip[r][k].color.color; + eq2->Equip[k].Material = emu->Equip[r][k].Material; + eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; + eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; + eq2->Equip[k].HeroForgeModel = emu->Equip[r][k].HeroForgeModel; + eq2->Equip[k].Material2 = emu->Equip[r][k].Material2; + eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; } - eq2->u15 = 0xff; - eq2->u19 = 0xFF; - eq2->drakkin_tattoo = emu->drakkin_tattoo[r]; - eq2->drakkin_details = emu->drakkin_details[r]; - eq2->deity = emu->deity[r]; - eq2->primary = emu->primary[r]; - eq2->secondary = emu->secondary[r]; - eq2->haircolor = emu->haircolor[r]; - eq2->beardcolor = emu->beardcolor[r]; - eq2->eyecolor1 = emu->eyecolor1[r]; - eq2->eyecolor2 = emu->eyecolor2[r]; - eq2->hairstyle = emu->hairstyle[r]; - eq2->beard = emu->beard[r]; - eq2->char_enabled = 1; - eq2->tutorial = emu->tutorial[r]; - eq2->drakkin_heritage = emu->drakkin_heritage[r]; - eq2->unknown1 = 0; - eq2->gohome = emu->gohome[r]; + eq2->Unknown15 = 0xFF; + eq2->Unknown19 = 0xFF; + eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; + eq2->DrakkinDetails = emu->DrakkinDetails[r]; + eq2->Deity = emu->Deity[r]; + eq2->Primary = emu->Primary[r]; + eq2->Secondary = emu->Secondary[r]; + eq2->HairColor = emu->HairColor[r]; + eq2->BeardColor = emu->BeardColor[r]; + eq2->EyeColor1 = emu->EyeColor1[r]; + eq2->EyeColor2 = emu->EyeColor2[r]; + eq2->HairStyle = emu->HairStyle[r]; + eq2->Beard = emu->Beard[r]; + eq2->CharEnabled = 1; + eq2->Tutorial = emu->Tutorial[r]; + eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; + eq2->Unknown1 = 0; + eq2->GoHome = emu->GoHome[r]; eq2->LastLogin = 1212696584; - eq2->unknown2 = 0; + eq2->Unknown2 = 0; } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } @@ -3763,7 +3763,7 @@ namespace RoF2 OUT(elite_material); OUT(hero_forge_model); OUT(unknown18); - OUT(color.color); + OUT(color.Color); OUT(wear_slot_id); FINISH_ENCODE(); @@ -4078,18 +4078,18 @@ namespace RoF2 for (k = 0; k < 9; ++k) { { - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].color); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color); } } structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].material = emu->equipment[k].material; - Equipment[k].unknown1 = emu->equipment[k].unknown1; - Equipment[k].elitematerial = emu->equipment[k].elitematerial; - Equipment[k].heroforgemodel = emu->equipment[k].heroforgemodel; - Equipment[k].material2 = emu->equipment[k].material2; + Equipment[k].Material = emu->equipment[k].Material; + Equipment[k].Unknown1 = emu->equipment[k].Unknown1; + Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial; + Equipment[k].HeroForgeModel = emu->equipment[k].HeroForgeModel; + Equipment[k].Material2 = emu->equipment[k].Material2; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -4102,13 +4102,13 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 94f8bf4e7..7f8fc6978 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -142,84 +142,87 @@ struct AdventureInfo { */ struct Color_Struct { - union - { - struct - { - uint8 blue; - uint8 green; - uint8 red; - uint8 use_tint; // if there's a tint this is FF - } rgb; - uint32 color; + union { + struct { + uint8 Blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint this is FF + } RGB; + uint32 Color; }; }; -/* -* Visible equiptment. -* Size: 20 Octets -*/ -struct EquipStruct { - /*00*/ uint32 material; - /*04*/ uint32 unknown1; - /*08*/ uint32 elitematerial; - /*12*/ uint32 heroforgemodel; - /*16*/ uint32 material2; // Same as material? - /*20*/ +struct CharSelectEquip +{ + uint32 Material; + uint32 Unknown1; + uint32 EliteMaterial; + uint32 HeroForgeModel; + uint32 Material2; + Color_Struct Color; }; -struct CharSelectEquip { - uint32 material; - uint32 unknown1; - uint32 elitematerial; - uint32 heroforgemodel; - uint32 material2; - Color_Struct color; -}; - -struct CharacterSelectEntry_Struct { -/*0000*/ char name[1]; // Name null terminated -/*0000*/ uint8 class_; -/*0000*/ uint32 race; -/*0000*/ uint8 level; -/*0000*/ uint8 class_2; -/*0000*/ uint32 race2; -/*0000*/ uint16 zone; -/*0000*/ uint16 instance; -/*0000*/ uint8 gender; -/*0000*/ uint8 face; -/*0000*/ CharSelectEquip equip[9]; -/*0000*/ uint8 u15; // Seen FF -/*0000*/ uint8 u19; // Seen FF -/*0000*/ uint32 drakkin_tattoo; -/*0000*/ uint32 drakkin_details; -/*0000*/ uint32 deity; -/*0000*/ uint32 primary; -/*0000*/ uint32 secondary; -/*0000*/ uint8 haircolor; -/*0000*/ uint8 beardcolor; -/*0000*/ uint8 eyecolor1; -/*0000*/ uint8 eyecolor2; -/*0000*/ uint8 hairstyle; -/*0000*/ uint8 beard; -/*0000*/ uint8 char_enabled; -/*0000*/ uint8 tutorial; // Seen 1 for new char or 0 for existing -/*0000*/ uint32 drakkin_heritage; -/*0000*/ uint8 unknown1; // Seen 0 -/*0000*/ uint8 gohome; // Seen 0 for new char and 1 for existing +struct CharacterSelectEntry_Struct +{ +/*0000*/ char Name[1]; // Name null terminated +/*0000*/ uint8 Class_; +/*0000*/ uint32 Race; +/*0000*/ uint8 Level; +/*0000*/ uint8 Class_2; +/*0000*/ uint32 Race2; +/*0000*/ uint16 Zone; +/*0000*/ uint16 Instance; +/*0000*/ uint8 Gender; +/*0000*/ uint8 Face; +/*0000*/ CharSelectEquip Equip[9]; +/*0000*/ uint8 Unknown15; // Seen FF +/*0000*/ uint8 Unknown19; // Seen FF +/*0000*/ uint32 DrakkinTattoo; +/*0000*/ uint32 DrakkinDetails; +/*0000*/ uint32 Deity; +/*0000*/ uint32 Primary; +/*0000*/ uint32 Secondary; +/*0000*/ uint8 HairColor; +/*0000*/ uint8 BeardColor; +/*0000*/ uint8 EyeColor1; +/*0000*/ uint8 EyeColor2; +/*0000*/ uint8 HairStyle; +/*0000*/ uint8 Beard; +/*0000*/ uint8 CharEnabled; +/*0000*/ uint8 Tutorial; // Seen 1 for new char or 0 for existing +/*0000*/ uint32 DrakkinHeritage; +/*0000*/ uint8 Unknown1; // Seen 0 +/*0000*/ uint8 GoHome; // Seen 0 for new char and 1 for existing /*0000*/ uint32 LastLogin; -/*0000*/ uint8 unknown2; // Seen 0 +/*0000*/ uint8 Unknown2; // Seen 0 }; /* ** Character Selection Struct ** */ -struct CharacterSelect_Struct { -/*000*/ uint32 char_count; //number of chars in this packet -/*004*/ CharacterSelectEntry_Struct entries[0]; +struct CharacterSelect_Struct +{ +/*000*/ uint32 CharCount; //number of chars in this packet +/*004*/ CharacterSelectEntry_Struct Entries[0]; }; +/* +* Visible equiptment. +* Size: 20 Octets +*/ +struct EquipStruct +{ + /*00*/ uint32 Material; + /*04*/ uint32 Unknown1; + /*08*/ uint32 EliteMaterial; + /*12*/ uint32 HeroForgeModel; + /*16*/ uint32 Material2; // Same as material? + /*20*/ +}; + + struct Membership_Entry_Struct { /*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300 diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 05cc5a346..a1260fe72 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -142,71 +142,87 @@ struct AdventureInfo { */ struct Color_Struct { - union - { - struct - { - uint8 blue; - uint8 green; - uint8 red; - uint8 use_tint; // if there's a tint this is FF - } rgb; - uint32 color; + union { + struct { + uint8 Blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint this is FF + } RGB; + uint32 Color; }; }; -struct CharSelectEquip { - uint32 material; - uint32 unknown1; - uint32 elitematerial; - uint32 heroforgemodel; - uint32 material2; - Color_Struct color; +struct CharSelectEquip +{ + uint32 Material; + uint32 Unknown1; + uint32 EliteMaterial; + uint32 HeroForgeModel; + uint32 Material2; + Color_Struct Color; }; -struct CharacterSelectEntry_Struct { -/*0000*/ char name[1]; // Name null terminated -/*0000*/ uint8 class_; -/*0000*/ uint32 race; -/*0000*/ uint8 level; -/*0000*/ uint8 class_2; -/*0000*/ uint32 race2; -/*0000*/ uint16 zone; -/*0000*/ uint16 instance; -/*0000*/ uint8 gender; -/*0000*/ uint8 face; -/*0000*/ CharSelectEquip equip[9]; -/*0000*/ uint8 u15; // Seen FF -/*0000*/ uint8 u19; // Seen FF -/*0000*/ uint32 drakkin_tattoo; -/*0000*/ uint32 drakkin_details; -/*0000*/ uint32 deity; -/*0000*/ uint32 primary; -/*0000*/ uint32 secondary; -/*0000*/ uint8 haircolor; -/*0000*/ uint8 beardcolor; -/*0000*/ uint8 eyecolor1; -/*0000*/ uint8 eyecolor2; -/*0000*/ uint8 hairstyle; -/*0000*/ uint8 beard; -/*0000*/ uint8 char_enabled; -/*0000*/ uint8 tutorial; // Seen 1 for new char or 0 for existing -/*0000*/ uint32 drakkin_heritage; -/*0000*/ uint8 unknown1; // Seen 0 -/*0000*/ uint8 gohome; // Seen 0 for new char and 1 for existing +struct CharacterSelectEntry_Struct +{ +/*0000*/ char Name[1]; // Name null terminated +/*0000*/ uint8 Class_; +/*0000*/ uint32 Race; +/*0000*/ uint8 Level; +/*0000*/ uint8 Class_2; +/*0000*/ uint32 Race2; +/*0000*/ uint16 Zone; +/*0000*/ uint16 Instance; +/*0000*/ uint8 Gender; +/*0000*/ uint8 Face; +/*0000*/ CharSelectEquip Equip[9]; +/*0000*/ uint8 Unknown15; // Seen FF +/*0000*/ uint8 Uknown19; // Seen FF +/*0000*/ uint32 DrakkinTattoo; +/*0000*/ uint32 DrakkinDetails; +/*0000*/ uint32 Deity; +/*0000*/ uint32 Primary; +/*0000*/ uint32 Secondary; +/*0000*/ uint8 HairColor; +/*0000*/ uint8 BeardColor; +/*0000*/ uint8 EyeColor1; +/*0000*/ uint8 EyeColor2; +/*0000*/ uint8 HairStyle; +/*0000*/ uint8 Beard; +/*0000*/ uint8 CharEnabled; +/*0000*/ uint8 Tutorial; // Seen 1 for new char or 0 for existing +/*0000*/ uint32 DrakkinHeritage; +/*0000*/ uint8 Unknown1; // Seen 0 +/*0000*/ uint8 GoHome; // Seen 0 for new char and 1 for existing /*0000*/ uint32 LastLogin; -/*0000*/ uint8 unknown2; // Seen 0 +/*0000*/ uint8 Unknown2; // Seen 0 }; /* ** Character Selection Struct ** */ -struct CharacterSelect_Struct { -/*000*/ uint32 char_count; //number of chars in this packet -/*004*/ CharacterSelectEntry_Struct entries[0]; +struct CharacterSelect_Struct +{ +/*000*/ uint32 CharCount; //number of chars in this packet +/*004*/ CharacterSelectEntry_Struct Entries[0]; }; +/* +* Visible equiptment. +* Size: 20 Octets +*/ +struct EquipStruct +{ + /*00*/ uint32 Material; + /*04*/ uint32 Unknown1; + /*08*/ uint32 EliteMaterial; + /*12*/ uint32 HeroForgeModel; + /*16*/ uint32 Material2; // Same as material? + /*20*/ +}; + + struct Membership_Entry_Struct { /*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300 @@ -247,20 +263,6 @@ struct Membership_Struct }; -/* -* Visible equiptment. -* Size: 20 Octets -*/ -struct EquipStruct { -/*00*/ uint32 material; -/*04*/ uint32 unknown1; -/*08*/ uint32 elitematerial; -/*12*/ uint32 heroforgemodel; -/*16*/ uint32 material2; // Same as material? -/*20*/ -}; - - /* ** Generic Spawn Struct ** Length: 897 Octets diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index b1ae218ed..c2ac79d7d 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1542,13 +1542,13 @@ namespace SoD OUT(beard); // OUT(unknown00178[10]); for (r = 0; r < 9; r++) { - eq->equipment[r].material = emu->item_material[r]; - eq->equipment[r].unknown1 = 0; - eq->equipment[r].elitematerial = 0; + eq->equipment[r].Material = emu->item_material[r]; + eq->equipment[r].Unknown1 = 0; + eq->equipment[r].EliteMaterial = 0; //eq->colors[r].color = emu->colors[r].color; } for (r = 0; r < 7; r++) { - OUT(item_tint[r].color); + OUT(item_tint[r].Color); } // OUT(unknown00224[48]); //NOTE: new client supports 300 AAs, our internal rep/PP @@ -1920,11 +1920,11 @@ namespace SoD int char_count; int namelen = 0; for (char_count = 0; char_count < 10; char_count++) { - if (emu->name[char_count][0] == '\0') + if (emu->Name[char_count][0] == '\0') break; - if (strcmp(emu->name[char_count], "") == 0) + if (strcmp(emu->Name[char_count], "") == 0) break; - namelen += strlen(emu->name[char_count]); + namelen += strlen(emu->Name[char_count]); } int total_length = sizeof(structs::CharacterSelect_Struct) @@ -1936,49 +1936,49 @@ namespace SoD //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; + eq->CharCount = char_count; + eq->TotalChars = 10; - unsigned char *bufptr = (unsigned char *)eq->entries; + unsigned char *bufptr = (unsigned char *)eq->Entries; int r; for (r = 0; r < char_count; r++) { { //pre-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->level = emu->level[r]; - eq2->hairstyle = emu->hairstyle[r]; - eq2->gender = emu->gender[r]; - memcpy(eq2->name, emu->name[r], strlen(emu->name[r]) + 1); + eq2->Level = emu->Level[r]; + eq2->HairStyle = emu->HairStyle[r]; + eq2->Gender = emu->Gender[r]; + memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); } //adjust for name. - bufptr += strlen(emu->name[r]); + bufptr += strlen(emu->Name[r]); { //post-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->beard = emu->beard[r]; - eq2->haircolor = emu->haircolor[r]; - eq2->face = emu->face[r]; + eq2->Beard = emu->Beard[r]; + eq2->HairColor = emu->HairColor[r]; + eq2->Face = emu->Face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].material = emu->equip[r][k].material; - eq2->equip[k].unknown1 = emu->equip[r][k].unknown1; - eq2->equip[k].elitematerial = emu->equip[r][k].elitematerial; - eq2->equip[k].color.color = emu->equip[r][k].color.color; + eq2->Equip[k].Material = emu->Equip[r][k].Material; + eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; + eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; + eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; } - eq2->primary = emu->primary[r]; - eq2->secondary = emu->secondary[r]; - eq2->tutorial = emu->tutorial[r]; // was u15 - eq2->u15 = 0xff; - eq2->deity = emu->deity[r]; - eq2->zone = emu->zone[r]; - eq2->u19 = 0xFF; - eq2->race = emu->race[r]; - eq2->gohome = emu->gohome[r]; - eq2->class_ = emu->class_[r]; - eq2->eyecolor1 = emu->eyecolor1[r]; - eq2->beardcolor = emu->beardcolor[r]; - eq2->eyecolor2 = emu->eyecolor2[r]; - eq2->drakkin_heritage = emu->drakkin_heritage[r]; - eq2->drakkin_tattoo = emu->drakkin_tattoo[r]; - eq2->drakkin_details = emu->drakkin_details[r]; + eq2->Primary = emu->Primary[r]; + eq2->Secondary = emu->Secondary[r]; + eq2->Tutorial = emu->Tutorial[r]; // was u15 + eq2->Unknown15 = 0xFF; + eq2->Deity = emu->Deity[r]; + eq2->Zone = emu->Zone[r]; + eq2->Unknown19 = 0xFF; + eq2->Race = emu->Race[r]; + eq2->GoHome = emu->GoHome[r]; + eq2->Class_ = emu->Class_[r]; + eq2->EyeColor1 = emu->EyeColor1[r]; + eq2->BeardColor = emu->BeardColor[r]; + eq2->EyeColor2 = emu->EyeColor2[r]; + eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; + eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; + eq2->DrakkinDetails = emu->DrakkinDetails[r]; } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } @@ -2375,7 +2375,7 @@ namespace SoD OUT(material); OUT(unknown06); OUT(elite_material); - OUT(color.color); + OUT(color.Color); OUT(wear_slot_id); FINISH_ENCODE(); @@ -2743,7 +2743,7 @@ namespace SoD for (k = 0; k < 9; ++k) { { - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].color); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color); } } } @@ -2753,11 +2753,11 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); } @@ -2768,9 +2768,9 @@ namespace SoD structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].material = emu->equipment[k].material; - Equipment[k].unknown1 = emu->equipment[k].unknown1; - Equipment[k].elitematerial = emu->equipment[k].elitematerial; + Equipment[k].Material = emu->equipment[k].Material; + Equipment[k].Unknown1 = emu->equipment[k].Unknown1; + Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -3485,7 +3485,7 @@ namespace SoD IN(material); IN(unknown06); IN(elite_material); - IN(color.color); + IN(color.Color); IN(wear_slot_id); emu->hero_forge_model = 0; emu->unknown18 = 0; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index f929ec744..f18e3d2f6 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -103,54 +103,53 @@ struct AdventureInfo { */ struct Color_Struct { - union - { - struct - { - uint8 blue; - uint8 green; - uint8 red; - uint8 use_tint; // if there's a tint this is FF - } rgb; - uint32 color; + union { + struct { + uint8 Blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint this is FF + } RGB; + uint32 Color; }; }; -struct CharSelectEquip { - //totally guessed; - uint32 material; - uint32 unknown1; - uint32 elitematerial; - Color_Struct color; +struct CharSelectEquip +{ + uint32 Material; + uint32 Unknown1; + uint32 EliteMaterial; + Color_Struct Color; }; -struct CharacterSelectEntry_Struct { -/*0000*/ uint8 level; // -/*0000*/ uint8 hairstyle; // -/*0002*/ uint8 gender; // -/*0003*/ char name[1]; //variable length, edi+0 -/*0000*/ uint8 beard; // -/*0001*/ uint8 haircolor; // -/*0000*/ uint8 face; // -/*0000*/ CharSelectEquip equip[9]; -/*0000*/ uint32 primary; // -/*0000*/ uint32 secondary; // -/*0000*/ uint8 u15; // 0xff -/*0000*/ uint32 deity; // -/*0000*/ uint16 zone; // -/*0000*/ uint16 instance; -/*0000*/ uint8 gohome; // -/*0000*/ uint8 u19; // 0xff -/*0000*/ uint32 race; // -/*0000*/ uint8 tutorial; // -/*0000*/ uint8 class_; // -/*0000*/ uint8 eyecolor1; // -/*0000*/ uint8 beardcolor; // -/*0000*/ uint8 eyecolor2; // -/*0000*/ uint32 drakkin_heritage; // Drakkin Heritage -/*0000*/ uint32 drakkin_tattoo; // Drakkin Tattoo -/*0000*/ uint32 drakkin_details; // Drakkin Details (Facial Spikes) -/*0000*/ uint8 unknown; // New field to SoD +struct CharacterSelectEntry_Struct +{ +/*0000*/ uint8 Level; // +/*0000*/ uint8 HairStyle; // +/*0002*/ uint8 Gender; // +/*0003*/ char Name[1]; // variable length, edi+0 +/*0000*/ uint8 Beard; // +/*0001*/ uint8 HairColor; // +/*0000*/ uint8 Face; // +/*0000*/ CharSelectEquip Equip[9]; +/*0000*/ uint32 Primary; // +/*0000*/ uint32 Secondary; // +/*0000*/ uint8 Unknown15; // 0xff +/*0000*/ uint32 Deity; // +/*0000*/ uint16 Zone; // +/*0000*/ uint16 Instance; +/*0000*/ uint8 GoHome; // +/*0000*/ uint8 Unknown19; // 0xff +/*0000*/ uint32 Race; // +/*0000*/ uint8 Tutorial; // +/*0000*/ uint8 Class_; // +/*0000*/ uint8 EyeColor1; // +/*0000*/ uint8 BeardColor; // +/*0000*/ uint8 EyeColor2; // +/*0000*/ uint32 DrakkinHeritage; // Drakkin Heritage +/*0000*/ uint32 DrakkinTattoo; // Drakkin Tattoo +/*0000*/ uint32 DrakkinDetails; // Drakkin Details (Facial Spikes) +/*0000*/ uint8 Unknown; // New field to SoD }; @@ -158,20 +157,22 @@ struct CharacterSelectEntry_Struct { ** Character Selection Struct ** */ -struct CharacterSelect_Struct { -/*0000*/ uint32 char_count; //number of chars in this packet -/*0004*/ uint32 total_chars; //total number of chars allowed? -/*0008*/ CharacterSelectEntry_Struct entries[0]; +struct CharacterSelect_Struct +{ +/*0000*/ uint32 CharCount; //number of chars in this packet +/*0004*/ uint32 TotalChars; //total number of chars allowed? +/*0008*/ CharacterSelectEntry_Struct Entries[0]; }; /* * Visible equiptment. * Size: 12 Octets */ -struct EquipStruct { -/*00*/ uint32 material; -/*04*/ uint32 unknown1; -/*08*/ uint32 elitematerial; +struct EquipStruct +{ +/*00*/ uint32 Material; +/*04*/ uint32 Unknown1; +/*08*/ uint32 EliteMaterial; /*12*/ }; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 4ba534ac7..5220a0a6e 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1200,13 +1200,13 @@ namespace SoF OUT(beard); // OUT(unknown00178[10]); for (r = 0; r < 9; r++) { - eq->equipment[r].material = emu->item_material[r]; - eq->equipment[r].unknown1 = 0; - eq->equipment[r].elitematerial = 0; + eq->equipment[r].Material = emu->item_material[r]; + eq->equipment[r].Unknown1 = 0; + eq->equipment[r].EliteMaterial = 0; //eq->colors[r].color = emu->colors[r].color; } for (r = 0; r < 7; r++) { - OUT(item_tint[r].color); + OUT(item_tint[r].Color); } // OUT(unknown00224[48]); //NOTE: new client supports 300 AAs, our internal rep/PP @@ -1579,11 +1579,11 @@ namespace SoF int char_count; int namelen = 0; for (char_count = 0; char_count < 10; char_count++) { - if (emu->name[char_count][0] == '\0') + if (emu->Name[char_count][0] == '\0') break; - if (strcmp(emu->name[char_count], "") == 0) + if (strcmp(emu->Name[char_count], "") == 0) break; - namelen += strlen(emu->name[char_count]); + namelen += strlen(emu->Name[char_count]); } int total_length = sizeof(structs::CharacterSelect_Struct) @@ -1595,49 +1595,49 @@ namespace SoF //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; + eq->CharCount = char_count; + eq->TotalChars = 10; - unsigned char *bufptr = (unsigned char *)eq->entries; + unsigned char *bufptr = (unsigned char *)eq->Entries; int r; for (r = 0; r < char_count; r++) { { //pre-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->level = emu->level[r]; - eq2->hairstyle = emu->hairstyle[r]; - eq2->gender = emu->gender[r]; - memcpy(eq2->name, emu->name[r], strlen(emu->name[r]) + 1); + eq2->Level = emu->Level[r]; + eq2->HairStyle = emu->HairStyle[r]; + eq2->Gender = emu->Gender[r]; + memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); } //adjust for name. - bufptr += strlen(emu->name[r]); + bufptr += strlen(emu->Name[r]); { //post-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->beard = emu->beard[r]; - eq2->haircolor = emu->haircolor[r]; - eq2->face = emu->face[r]; + eq2->Beard = emu->Beard[r]; + eq2->HairColor = emu->HairColor[r]; + eq2->Face = emu->Face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].material = emu->equip[r][k].material; - eq2->equip[k].unknown1 = emu->equip[r][k].unknown1; - eq2->equip[k].elitematerial = emu->equip[r][k].elitematerial; - eq2->equip[k].color.color = emu->equip[r][k].color.color; + eq2->Equip[k].Material = emu->Equip[r][k].Material; + eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; + eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; + eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; } - eq2->primary = emu->primary[r]; - eq2->secondary = emu->secondary[r]; - eq2->tutorial = emu->tutorial[r]; // was u15 - eq2->u15 = 0xff; - eq2->deity = emu->deity[r]; - eq2->zone = emu->zone[r]; - eq2->u19 = 0xFF; - eq2->race = emu->race[r]; - eq2->gohome = emu->gohome[r]; - eq2->class_ = emu->class_[r]; - eq2->eyecolor1 = emu->eyecolor1[r]; - eq2->beardcolor = emu->beardcolor[r]; - eq2->eyecolor2 = emu->eyecolor2[r]; - eq2->drakkin_heritage = emu->drakkin_heritage[r]; - eq2->drakkin_tattoo = emu->drakkin_tattoo[r]; - eq2->drakkin_details = emu->drakkin_details[r]; + eq2->Primary = emu->Primary[r]; + eq2->Secondary = emu->Secondary[r]; + eq2->Tutorial = emu->Tutorial[r]; // was u15 + eq2->Unknown15 = 0xff; + eq2->Deity = emu->Deity[r]; + eq2->Zone = emu->Zone[r]; + eq2->Unknown19 = 0xFF; + eq2->Race = emu->Race[r]; + eq2->GoHome = emu->GoHome[r]; + eq2->Class_ = emu->Class_[r]; + eq2->EyeColor1 = emu->EyeColor1[r]; + eq2->BeardColor = emu->BeardColor[r]; + eq2->EyeColor2 = emu->EyeColor2[r]; + eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; + eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; + eq2->DrakkinDetails = emu->DrakkinDetails[r]; } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } @@ -1961,7 +1961,7 @@ namespace SoF OUT(material); OUT(unknown06); OUT(elite_material); - OUT(color.color); + OUT(color.Color); OUT(wear_slot_id); FINISH_ENCODE(); @@ -2045,10 +2045,10 @@ namespace SoF eq->drakkin_heritage = emu->drakkin_heritage; eq->gender = emu->gender; for (k = 0; k < 9; k++) { - eq->equipment[k].material = emu->equipment[k].material; - eq->equipment[k].unknown1 = emu->equipment[k].unknown1; - eq->equipment[k].elitematerial = emu->equipment[k].elitematerial; - eq->colors[k].color = emu->colors[k].color; + eq->equipment[k].Material = emu->equipment[k].Material; + eq->equipment[k].Unknown1 = emu->equipment[k].Unknown1; + eq->equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial; + eq->colors[k].Color = emu->colors[k].Color; } eq->StandState = emu->StandState; eq->guildID = emu->guildID; @@ -2110,7 +2110,7 @@ namespace SoF eq->petOwnerId = emu->petOwnerId; eq->pvp = 0; // 0 = non-pvp colored name, 1 = red pvp name for (k = 0; k < 9; k++) { - eq->colors[k].color = emu->colors[k].color; + eq->colors[k].Color = emu->colors[k].Color; } eq->anon = emu->anon; eq->face = emu->face; @@ -2809,7 +2809,7 @@ namespace SoF IN(material); IN(unknown06); IN(elite_material); - IN(color.color); + IN(color.Color); IN(wear_slot_id); emu->hero_forge_model = 0; emu->unknown18 = 0; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 1510ded59..e66ace468 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -103,72 +103,74 @@ struct AdventureInfo { */ struct Color_Struct { - union - { - struct - { - uint8 blue; - uint8 green; - uint8 red; - uint8 use_tint; // if there's a tint this is FF - } rgb; - uint32 color; + union { + struct { + uint8 Blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint this is FF + } RGB; + uint32 Color; }; }; -struct CharSelectEquip { - uint32 material; - uint32 unknown1; - uint32 elitematerial; - Color_Struct color; +struct CharSelectEquip +{ + uint32 Material; + uint32 Unknown1; + uint32 EliteMaterial; + Color_Struct Color; }; -struct CharacterSelectEntry_Struct { -/*0000*/ uint8 level; // -/*0000*/ uint8 hairstyle; // -/*0002*/ uint8 gender; // -/*0003*/ char name[1]; //variable length, edi+0 -/*0000*/ uint8 beard; // -/*0001*/ uint8 haircolor; // -/*0000*/ uint8 face; // -/*0000*/ CharSelectEquip equip[9]; -/*0000*/ uint32 primary; // -/*0000*/ uint32 secondary; // -/*0000*/ uint8 u15; // 0xff -/*0000*/ uint32 deity; // -/*0000*/ uint16 zone; // -/*0000*/ uint16 instance; -/*0000*/ uint8 gohome; // -/*0000*/ uint8 u19; // 0xff -/*0000*/ uint32 race; // -/*0000*/ uint8 tutorial; // -/*0000*/ uint8 class_; // -/*0000*/ uint8 eyecolor1; // -/*0000*/ uint8 beardcolor; // -/*0000*/ uint8 eyecolor2; // -/*0000*/ uint32 drakkin_heritage; // Drakkin Heritage -/*0000*/ uint32 drakkin_tattoo; // Drakkin Tattoo -/*0000*/ uint32 drakkin_details; // Drakkin Details (Facial Spikes) +struct CharacterSelectEntry_Struct +{ +/*0000*/ uint8 Level; // +/*0000*/ uint8 HairStyle; // +/*0002*/ uint8 Gender; // +/*0003*/ char Name[1]; // variable length, edi+0 +/*0000*/ uint8 Beard; // +/*0001*/ uint8 HairColor; // +/*0000*/ uint8 Face; // +/*0000*/ CharSelectEquip Equip[9]; +/*0000*/ uint32 Primary; // +/*0000*/ uint32 Secondary; // +/*0000*/ uint8 Unknown15; // 0xff +/*0000*/ uint32 Deity; // +/*0000*/ uint16 Zone; // +/*0000*/ uint16 Instance; +/*0000*/ uint8 GoHome; // +/*0000*/ uint8 Unknown19; // 0xff +/*0000*/ uint32 Race; // +/*0000*/ uint8 Tutorial; // +/*0000*/ uint8 Class_; // +/*0000*/ uint8 EyeColor1; // +/*0000*/ uint8 BeardColor; // +/*0000*/ uint8 EyeColor2; // +/*0000*/ uint32 DrakkinHeritage; // Drakkin Heritage +/*0000*/ uint32 DrakkinTattoo; // Drakkin Tattoo +/*0000*/ uint32 DrakkinDetails; // Drakkin Details (Facial Spikes) }; /* ** Character Selection Struct ** */ -struct CharacterSelect_Struct { -/*0000*/ uint32 char_count; //number of chars in this packet -/*0004*/ uint32 total_chars; //total number of chars allowed? -/*0008*/ CharacterSelectEntry_Struct entries[0]; +struct CharacterSelect_Struct +{ +/*0000*/ uint32 CharCount; //number of chars in this packet +/*0004*/ uint32 TotalChars; //total number of chars allowed? +/*0008*/ CharacterSelectEntry_Struct Entries[0]; }; /* * Visible equiptment. * Size: 12 Octets */ -struct EquipStruct { -/*00*/ uint32 material; -/*04*/ uint32 unknown1; -/*08*/ uint32 elitematerial; +struct EquipStruct +{ +/*00*/ uint32 Material; +/*04*/ uint32 Unknown1; +/*08*/ uint32 EliteMaterial; /*12*/ }; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index d048f0e5d..e636b6a9c 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -865,7 +865,7 @@ namespace Titanium // OUT(unknown00178[10]); for (r = 0; r < 9; r++) { OUT(item_material[r]); - OUT(item_tint[r].color); + OUT(item_tint[r].Color); } // OUT(unknown00224[48]); for (r = 0; r < structs::MAX_PP_AA_ARRAY; r++) { @@ -1160,34 +1160,34 @@ namespace Titanium int r; for (r = 0; r < 10; r++) { - OUT(zone[r]); - OUT(eyecolor1[r]); - OUT(eyecolor2[r]); - OUT(hairstyle[r]); - OUT(primary[r]); - if (emu->race[r] > 473) - eq->race[r] = 1; + OUT(Zone[r]); + OUT(EyeColor1[r]); + OUT(EyeColor2[r]); + OUT(HairStyle[r]); + OUT(Primary[r]); + if (emu->Race[r] > 473) + eq->Race[r] = 1; else - eq->race[r] = emu->race[r]; - OUT(class_[r]); - OUT_str(name[r]); - OUT(gender[r]); - OUT(level[r]); - OUT(secondary[r]); - OUT(face[r]); - OUT(beard[r]); + eq->Race[r] = emu->Race[r]; + OUT(Class_[r]); + OUT_str(Name[r]); + OUT(Gender[r]); + OUT(Level[r]); + OUT(Secondary[r]); + OUT(Face[r]); + OUT(Beard[r]); int k; for (k = 0; k < 9; k++) { - eq->equip[r][k] = emu->equip[r][k].material; - eq->cs_colors[r][k].color = emu->equip[r][k].color.color; + eq->Equip[r][k] = emu->Equip[r][k].Material; + eq->CS_Colors[r][k].Color = emu->Equip[r][k].Color.Color; } - OUT(haircolor[r]); - OUT(gohome[r]); - OUT(tutorial[r]); - OUT(deity[r]); - OUT(beardcolor[r]); - eq->unknown820[r] = 0xFF; - eq->unknown902[r] = 0xFF; + OUT(HairColor[r]); + OUT(GoHome[r]); + OUT(Tutorial[r]); + OUT(Deity[r]); + OUT(BeardColor[r]); + eq->Unknown820[r] = 0xFF; + eq->Unknown902[r] = 0xFF; } FINISH_ENCODE(); @@ -1405,7 +1405,7 @@ namespace Titanium OUT(spawn_id); OUT(material); - OUT(color.color); + OUT(color.Color); OUT(wear_slot_id); FINISH_ENCODE(); @@ -1497,8 +1497,8 @@ namespace Titanium eq->guildrank = emu->guildrank; // eq->unknown0194[3] = emu->unknown0194[3]; for (k = 0; k < 9; k++) { - eq->equipment[k] = emu->equipment[k].material; - eq->colors[k].color = emu->colors[k].color; + eq->equipment[k] = emu->equipment[k].Material; + eq->colors[k].Color = emu->colors[k].Color; } for (k = 0; k < 8; k++) { eq->set_to_0xFF[k] = 0xFF; @@ -1974,7 +1974,7 @@ namespace Titanium IN(spawn_id); IN(material); - IN(color.color); + IN(color.Color); IN(wear_slot_id); emu->unknown06 = 0; emu->elite_material = 0; diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 9a165a33d..a61b96a94 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -99,16 +99,14 @@ struct AdventureInfo { */ struct Color_Struct { - union - { - struct - { - uint8 blue; - uint8 green; - uint8 red; - uint8 use_tint; // if there's a tint this is FF - } rgb; - uint32 color; + union { + struct { + uint8 Blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint this is FF + } RGB; + uint32 Color; }; }; @@ -117,31 +115,32 @@ struct Color_Struct ** Length: 1704 Bytes ** */ -struct CharacterSelect_Struct { -/*0000*/ uint32 race[10]; // Characters Race -/*0040*/ Color_Struct cs_colors[10][9]; // Characters Equipment Colors -/*0400*/ uint8 beardcolor[10]; // Characters beard Color -/*0410*/ uint8 hairstyle[10]; // Characters hair style -/*0420*/ uint32 equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be) -/*0780*/ uint32 secondary[10]; // Characters secondary IDFile number -/*0820*/ uint8 unknown820[10]; // 10x ff -/*0830*/ uint8 unknown830[2]; // 2x 00 -/*0832*/ uint32 deity[10]; // Characters Deity -/*0872*/ uint8 gohome[10]; // 1=Go Home available, 0=not -/*0882*/ uint8 tutorial[10]; // 1=Tutorial available, 0=not -/*0892*/ uint8 beard[10]; // Characters Beard Type -/*0902*/ uint8 unknown902[10]; // 10x ff -/*0912*/ uint32 primary[10]; // Characters primary IDFile number -/*0952*/ uint8 haircolor[10]; // Characters Hair Color -/*0962*/ uint8 unknown0962[2]; // 2x 00 -/*0964*/ uint32 zone[10]; // Characters Current Zone -/*1004*/ uint8 class_[10]; // Characters Classes -/*1014*/ uint8 face[10]; // Characters Face Type -/*1024*/ char name[10][64]; // Characters Names -/*1664*/ uint8 gender[10]; // Characters Gender -/*1674*/ uint8 eyecolor1[10]; // Characters Eye Color -/*1684*/ uint8 eyecolor2[10]; // Characters Eye 2 Color -/*1694*/ uint8 level[10]; // Characters Levels +struct CharacterSelect_Struct +{ +/*0000*/ uint32 Race[10]; // Characters Race +/*0040*/ Color_Struct CS_Colors[10][9]; // Characters Equipment Colors +/*0400*/ uint8 BeardColor[10]; // Characters beard Color +/*0410*/ uint8 HairStyle[10]; // Characters hair style +/*0420*/ uint32 Equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be) +/*0780*/ uint32 Secondary[10]; // Characters secondary IDFile number +/*0820*/ uint8 Unknown820[10]; // 10x ff +/*0830*/ uint8 Unknown830[2]; // 2x 00 +/*0832*/ uint32 Deity[10]; // Characters Deity +/*0872*/ uint8 GoHome[10]; // 1=Go Home available, 0=not +/*0882*/ uint8 Tutorial[10]; // 1=Tutorial available, 0=not +/*0892*/ uint8 Beard[10]; // Characters Beard Type +/*0902*/ uint8 Unknown902[10]; // 10x ff +/*0912*/ uint32 Primary[10]; // Characters primary IDFile number +/*0952*/ uint8 HairColor[10]; // Characters Hair Color +/*0962*/ uint8 Unknown0962[2]; // 2x 00 +/*0964*/ uint32 Zone[10]; // Characters Current Zone +/*1004*/ uint8 Class_[10]; // Characters Classes +/*1014*/ uint8 Face[10]; // Characters Face Type +/*1024*/ char Name[10][64]; // Characters Names +/*1664*/ uint8 Gender[10]; // Characters Gender +/*1674*/ uint8 EyeColor1[10]; // Characters Eye Color +/*1684*/ uint8 EyeColor2[10]; // Characters Eye 2 Color +/*1694*/ uint8 Level[10]; // Characters Levels /*1704*/ }; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 991b35aa4..18ea67af0 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1791,13 +1791,13 @@ namespace UF OUT(beard); // OUT(unknown00178[10]); for (r = 0; r < 9; r++) { - eq->equipment[r].material = emu->item_material[r]; - eq->equipment[r].unknown1 = 0; - eq->equipment[r].elitematerial = 0; + eq->equipment[r].Material = emu->item_material[r]; + eq->equipment[r].Unknown1 = 0; + eq->equipment[r].EliteMaterial = 0; //eq->colors[r].color = emu->colors[r].color; } for (r = 0; r < 7; r++) { - OUT(item_tint[r].color); + OUT(item_tint[r].Color); } // OUT(unknown00224[48]); //NOTE: new client supports 300 AAs, our internal rep/PP @@ -2203,11 +2203,11 @@ namespace UF int char_count; int namelen = 0; for (char_count = 0; char_count < 10; char_count++) { - if (emu->name[char_count][0] == '\0') + if (emu->Name[char_count][0] == '\0') break; - if (strcmp(emu->name[char_count], "") == 0) + if (strcmp(emu->Name[char_count], "") == 0) break; - namelen += strlen(emu->name[char_count]); + namelen += strlen(emu->Name[char_count]); } int total_length = sizeof(structs::CharacterSelect_Struct) @@ -2219,49 +2219,49 @@ namespace UF //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; + eq->CharCount = char_count; + eq->TotalChars = 10; - unsigned char *bufptr = (unsigned char *)eq->entries; + unsigned char *bufptr = (unsigned char *)eq->Entries; int r; for (r = 0; r < char_count; r++) { { //pre-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->level = emu->level[r]; - eq2->hairstyle = emu->hairstyle[r]; - eq2->gender = emu->gender[r]; - memcpy(eq2->name, emu->name[r], strlen(emu->name[r]) + 1); + eq2->Level = emu->Level[r]; + eq2->HairStyle = emu->HairStyle[r]; + eq2->Gender = emu->Gender[r]; + memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); } //adjust for name. - bufptr += strlen(emu->name[r]); + bufptr += strlen(emu->Name[r]); { //post-name section... structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->beard = emu->beard[r]; - eq2->haircolor = emu->haircolor[r]; - eq2->face = emu->face[r]; + eq2->Beard = emu->Beard[r]; + eq2->HairColor = emu->HairColor[r]; + eq2->Face = emu->Face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].material = emu->equip[r][k].material; - eq2->equip[k].unknown1 = emu->equip[r][k].unknown1; - eq2->equip[k].elitematerial = emu->equip[r][k].elitematerial; - eq2->equip[k].color.color = emu->equip[r][k].color.color; + eq2->Equip[k].Material = emu->Equip[r][k].Material; + eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; + eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; + eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; } - eq2->primary = emu->primary[r]; - eq2->secondary = emu->secondary[r]; - eq2->tutorial = emu->tutorial[r]; // was u15 - eq2->u15 = 0xff; - eq2->deity = emu->deity[r]; - eq2->zone = emu->zone[r]; - eq2->u19 = 0xFF; - eq2->race = emu->race[r]; - eq2->gohome = emu->gohome[r]; - eq2->class_ = emu->class_[r]; - eq2->eyecolor1 = emu->eyecolor1[r]; - eq2->beardcolor = emu->beardcolor[r]; - eq2->eyecolor2 = emu->eyecolor2[r]; - eq2->drakkin_heritage = emu->drakkin_heritage[r]; - eq2->drakkin_tattoo = emu->drakkin_tattoo[r]; - eq2->drakkin_details = emu->drakkin_details[r]; + eq2->Primary = emu->Primary[r]; + eq2->Secondary = emu->Secondary[r]; + eq2->Tutorial = emu->Tutorial[r]; // was u15 + eq2->Unknown15 = 0xFF; + eq2->Deity = emu->Deity[r]; + eq2->Zone = emu->Zone[r]; + eq2->Unknown19 = 0xFF; + eq2->Race = emu->Race[r]; + eq2->GoHome = emu->GoHome[r]; + eq2->Class_ = emu->Class_[r]; + eq2->EyeColor1 = emu->EyeColor1[r]; + eq2->BeardColor = emu->BeardColor[r]; + eq2->EyeColor2 = emu->EyeColor2[r]; + eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; + eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; + eq2->DrakkinDetails = emu->DrakkinDetails[r]; } bufptr += sizeof(structs::CharacterSelectEntry_Struct); @@ -2641,7 +2641,7 @@ namespace UF OUT(material); OUT(unknown06); OUT(elite_material); - OUT(color.color); + OUT(color.Color); OUT(wear_slot_id); FINISH_ENCODE(); @@ -3003,7 +3003,7 @@ namespace UF for (k = 0; k < 9; ++k) { { - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].color); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color); } } } @@ -3013,11 +3013,11 @@ namespace UF VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].material); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].Material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); } @@ -3027,9 +3027,9 @@ namespace UF structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].material = emu->equipment[k].material; - Equipment[k].unknown1 = emu->equipment[k].unknown1; - Equipment[k].elitematerial = emu->equipment[k].elitematerial; + Equipment[k].Material = emu->equipment[k].Material; + Equipment[k].Unknown1 = emu->equipment[k].Unknown1; + Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -3729,7 +3729,7 @@ namespace UF IN(material); IN(unknown06); IN(elite_material); - IN(color.color); + IN(color.Color); IN(wear_slot_id); emu->hero_forge_model = 0; emu->unknown18 = 0; diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index f33ab7b4c..ec912b681 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -103,53 +103,53 @@ struct AdventureInfo { */ struct Color_Struct { - union - { - struct - { - uint8 blue; - uint8 green; - uint8 red; - uint8 use_tint; // if there's a tint this is FF - } rgb; - uint32 color; + union { + struct { + uint8 blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint this is FF + } RGB; + uint32 Color; }; }; -struct CharSelectEquip { - uint32 material; - uint32 unknown1; - uint32 elitematerial; - Color_Struct color; +struct CharSelectEquip +{ + uint32 Material; + uint32 Unknown1; + uint32 EliteMaterial; + Color_Struct Color; }; -struct CharacterSelectEntry_Struct { -/*0000*/ uint8 level; // -/*0000*/ uint8 hairstyle; // -/*0002*/ uint8 gender; // -/*0003*/ char name[1]; //variable length, edi+0 -/*0000*/ uint8 beard; // -/*0001*/ uint8 haircolor; // -/*0000*/ uint8 face; // -/*0000*/ CharSelectEquip equip[9]; -/*0000*/ uint32 primary; // -/*0000*/ uint32 secondary; // -/*0000*/ uint8 u15; // 0xff -/*0000*/ uint32 deity; // -/*0000*/ uint16 zone; // -/*0000*/ uint16 instance; -/*0000*/ uint8 gohome; // -/*0000*/ uint8 u19; // 0xff -/*0000*/ uint32 race; // -/*0000*/ uint8 tutorial; // -/*0000*/ uint8 class_; // -/*0000*/ uint8 eyecolor1; // -/*0000*/ uint8 beardcolor; // -/*0000*/ uint8 eyecolor2; // -/*0000*/ uint32 drakkin_heritage; // Drakkin Heritage -/*0000*/ uint32 drakkin_tattoo; // Drakkin Tattoo -/*0000*/ uint32 drakkin_details; // Drakkin Details (Facial Spikes) -/*0000*/ uint8 unknown; // New field to Underfoot +struct CharacterSelectEntry_Struct +{ +/*0000*/ uint8 Level; // +/*0000*/ uint8 HairStyle; // +/*0002*/ uint8 Gender; // +/*0003*/ char Name[1]; // variable length, edi+0 +/*0000*/ uint8 Beard; // +/*0001*/ uint8 HairColor; // +/*0000*/ uint8 Face; // +/*0000*/ CharSelectEquip Equip[9]; +/*0000*/ uint32 Primary; // +/*0000*/ uint32 Secondary; // +/*0000*/ uint8 Unknown15; // 0xff +/*0000*/ uint32 Deity; // +/*0000*/ uint16 Zone; // +/*0000*/ uint16 Instance; +/*0000*/ uint8 GoHome; // +/*0000*/ uint8 Unknown19; // 0xff +/*0000*/ uint32 Race; // +/*0000*/ uint8 Tutorial; // +/*0000*/ uint8 Class_; // +/*0000*/ uint8 EyeColor1; // +/*0000*/ uint8 BeardColor; // +/*0000*/ uint8 EyeColor2; // +/*0000*/ uint32 DrakkinHeritage; // Drakkin Heritage +/*0000*/ uint32 DrakkinTattoo; // Drakkin Tattoo +/*0000*/ uint32 DrakkinDetails; // Drakkin Details (Facial Spikes) +/*0000*/ uint8 Unknown; // New field to Underfoot }; @@ -157,20 +157,22 @@ struct CharacterSelectEntry_Struct { ** Character Selection Struct ** */ -struct CharacterSelect_Struct { -/*0000*/ uint32 char_count; //number of chars in this packet -/*0004*/ uint32 total_chars; //total number of chars allowed? -/*0008*/ CharacterSelectEntry_Struct entries[0]; +struct CharacterSelect_Struct +{ +/*0000*/ uint32 CharCount; //number of chars in this packet +/*0004*/ uint32 TotalChars; //total number of chars allowed? +/*0008*/ CharacterSelectEntry_Struct Entries[0]; }; /* * Visible equiptment. * Size: 12 Octets */ -struct EquipStruct { -/*00*/ uint32 material; -/*04*/ uint32 unknown1; -/*08*/ uint32 elitematerial; +struct EquipStruct +{ +/*00*/ uint32 Material; +/*04*/ uint32 Unknown1; +/*08*/ uint32 EliteMaterial; /*12*/ }; diff --git a/world/client.cpp b/world/client.cpp index f26328e12..55ca440cc 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -724,9 +724,9 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { for(int x = 0; x < 10; ++x) { - if(strcasecmp(cs->name[x], char_name) == 0) + if(strcasecmp(cs->Name[x], char_name) == 0) { - if(cs->gohome[x] == 1) + if(cs->GoHome[x] == 1) { home_enabled = true; break; @@ -754,9 +754,9 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { for(int x = 0; x < 10; ++x) { - if(strcasecmp(cs->name[x], char_name) == 0) + if(strcasecmp(cs->Name[x], char_name) == 0) { - if(cs->tutorial[x] == 1) + if(cs->Tutorial[x] == 1) { tutorial_enabled = true; break; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 3409a1e17..e47d9d54a 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -41,11 +41,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* /* Initialize Variables */ for (int i=0; i<10; i++) { - strcpy(cs->name[i], ""); - cs->zone[i] = 0; - cs->level[i] = 0; - cs->tutorial[i] = 0; - cs->gohome[i] = 0; + strcpy(cs->Name[i], ""); + cs->Zone[i] = 0; + cs->Level[i] = 0; + cs->Tutorial[i] = 0; + cs->GoHome[i] = 0; } /* Get Character Info */ @@ -80,32 +80,32 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* memset(&pp, 0, sizeof(PlayerProfile_Struct)); uint32 character_id = atoi(row[0]); - strcpy(cs->name[char_num], row[1]); + strcpy(cs->Name[char_num], row[1]); uint8 lvl = atoi(row[5]); - cs->level[char_num] = lvl; - cs->class_[char_num] = atoi(row[4]); - cs->race[char_num] = atoi(row[3]); - cs->gender[char_num] = atoi(row[2]); - cs->deity[char_num] = atoi(row[6]); - cs->zone[char_num] = atoi(row[19]); - cs->face[char_num] = atoi(row[15]); - cs->haircolor[char_num] = atoi(row[9]); - cs->beardcolor[char_num] = atoi(row[10]); - cs->eyecolor2[char_num] = atoi(row[12]); - cs->eyecolor1[char_num] = atoi(row[11]); - cs->hairstyle[char_num] = atoi(row[13]); - cs->beard[char_num] = atoi(row[14]); - cs->drakkin_heritage[char_num] = atoi(row[16]); - cs->drakkin_tattoo[char_num] = atoi(row[17]); - cs->drakkin_details[char_num] = atoi(row[18]); + cs->Level[char_num] = lvl; + cs->Class_[char_num] = atoi(row[4]); + cs->Race[char_num] = atoi(row[3]); + cs->Gender[char_num] = atoi(row[2]); + cs->Deity[char_num] = atoi(row[6]); + cs->Zone[char_num] = atoi(row[19]); + cs->Face[char_num] = atoi(row[15]); + cs->HairColor[char_num] = atoi(row[9]); + cs->BeardColor[char_num] = atoi(row[10]); + cs->EyeColor2[char_num] = atoi(row[12]); + cs->EyeColor1[char_num] = atoi(row[11]); + cs->HairStyle[char_num] = atoi(row[13]); + cs->Beard[char_num] = atoi(row[14]); + cs->DrakkinHeritage[char_num] = atoi(row[16]); + cs->DrakkinTattoo[char_num] = atoi(row[17]); + cs->DrakkinDetails[char_num] = atoi(row[18]); if (RuleB(World, EnableTutorialButton) && (lvl <= RuleI(World, MaxLevelForTutorial))) - cs->tutorial[char_num] = 1; + cs->Tutorial[char_num] = 1; if (RuleB(World, EnableReturnHomeButton)) { int now = time(nullptr); if ((now - atoi(row[7])) >= RuleI(World, MinOfflineTimeToReturnHome)) - cs->gohome[char_num] = 1; + cs->GoHome[char_num] = 1; } /* Set Bind Point Data for any character that may possibly be missing it for any reason */ @@ -118,7 +118,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* if (has_home == 0 || has_bind == 0){ cquery = StringFormat("SELECT `zone_id`, `bind_id`, `x`, `y`, `z` FROM `start_zones` WHERE `player_class` = %i AND `player_deity` = %i AND `player_race` = %i", - cs->class_[char_num], cs->deity[char_num], cs->race[char_num]); + cs->Class_[char_num], cs->Deity[char_num], cs->Race[char_num]); auto results_bind = database.QueryDatabase(cquery); for (auto row_d = results_bind.begin(); row_d != results_bind.end(); ++row_d) { /* If a bind_id is specified, make them start there */ @@ -161,16 +161,16 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) { slot = atoi(row_b[0]); - pp.item_tint[slot].rgb.red = atoi(row_b[1]); - pp.item_tint[slot].rgb.green = atoi(row_b[2]); - pp.item_tint[slot].rgb.blue = atoi(row_b[3]); - pp.item_tint[slot].rgb.use_tint = atoi(row_b[4]); + pp.item_tint[slot].RGB.Red = atoi(row_b[1]); + pp.item_tint[slot].RGB.Green = atoi(row_b[2]); + pp.item_tint[slot].RGB.Blue = atoi(row_b[3]); + pp.item_tint[slot].RGB.UseTint = atoi(row_b[4]); } /* Load Inventory */ // If we ensure that the material data is updated appropriately, we can do away with inventory loads inv = new Inventory; - if (GetInventory(account_id, cs->name[char_num], inv)) + if (GetInventory(account_id, cs->Name[char_num], inv)) { const Item_Struct* item = nullptr; const ItemInst* inst = nullptr; @@ -194,31 +194,31 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* if (inst->GetOrnamentationIDFile() != 0) { idfile = inst->GetOrnamentationIDFile(); - cs->equip[char_num][matslot].material = idfile; + cs->Equip[char_num][matslot].Material = idfile; } else { if (strlen(item->IDFile) > 2) { idfile = atoi(&item->IDFile[2]); - cs->equip[char_num][matslot].material = idfile; + cs->Equip[char_num][matslot].Material = idfile; } } if (matslot == MaterialPrimary) { - cs->primary[char_num] = idfile; + cs->Primary[char_num] = idfile; } else { - cs->secondary[char_num] = idfile; + cs->Secondary[char_num] = idfile; } } else { uint32 color = 0; - if (pp.item_tint[matslot].rgb.use_tint) + if (pp.item_tint[matslot].RGB.UseTint) { - color = pp.item_tint[matslot].color; + color = pp.item_tint[matslot].Color; } else { @@ -226,16 +226,16 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* } // Armor Materials/Models - cs->equip[char_num][matslot].material = item->Material; - cs->equip[char_num][matslot].elitematerial = item->EliteMaterial; - cs->equip[char_num][matslot].heroforgemodel = inst->GetOrnamentHeroModel(matslot); - cs->equip[char_num][matslot].color.color = color; + cs->Equip[char_num][matslot].Material = item->Material; + cs->Equip[char_num][matslot].EliteMaterial = item->EliteMaterial; + cs->Equip[char_num][matslot].HeroForgeModel = inst->GetOrnamentHeroModel(matslot); + cs->Equip[char_num][matslot].Color.Color = color; } } } else { - printf("Error loading inventory for %s\n", cs->name[char_num]); + printf("Error loading inventory for %s\n", cs->Name[char_num]); } safe_delete(inv); diff --git a/zone/bot.cpp b/zone/bot.cpp index 4b42fac37..6eb90551f 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4395,24 +4395,24 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { item = inst->GetItem(); if (item != 0) { - ns->spawn.equipment[i].material = item->Material; - ns->spawn.equipment[i].elitematerial = item->EliteMaterial; - ns->spawn.equipment[i].heroforgemodel = item->HerosForgeModel; + ns->spawn.equipment[i].Material = item->Material; + ns->spawn.equipment[i].EliteMaterial = item->EliteMaterial; + ns->spawn.equipment[i].HeroForgeModel = item->HerosForgeModel; if (armor_tint[i]) { - ns->spawn.colors[i].color = armor_tint[i]; + ns->spawn.colors[i].Color = armor_tint[i]; } else { - ns->spawn.colors[i].color = item->Color; + ns->spawn.colors[i].Color = item->Color; } } else { if (armor_tint[i]) { - ns->spawn.colors[i].color = armor_tint[i]; + ns->spawn.colors[i].Color = armor_tint[i]; } } } @@ -4426,9 +4426,9 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { { if(strlen(item->IDFile) > 2) { - ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]); + ns->spawn.equipment[MaterialPrimary].Material = atoi(&item->IDFile[2]); } - ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary); + ns->spawn.colors[MaterialPrimary].Color = GetEquipmentColor(MaterialPrimary); } } @@ -4440,9 +4440,9 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { { if(strlen(item->IDFile) > 2) { - ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]); + ns->spawn.equipment[MaterialSecondary].Material = atoi(&item->IDFile[2]); } - ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary); + ns->spawn.colors[MaterialSecondary].Color = GetEquipmentColor(MaterialSecondary); } } } @@ -5061,7 +5061,7 @@ void Bot::SendBotArcheryWearChange(uint8 material_slot, uint32 material, uint32 wc->spawn_id = GetID(); wc->material = material; - wc->color.color = color; + wc->color.Color = color; wc->wear_slot_id = material_slot; entity_list.QueueClients(this, outapp); diff --git a/zone/client.cpp b/zone/client.cpp index 816b21e15..227bb4083 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3039,7 +3039,7 @@ void Client::Tell_StringID(uint32 string_id, const char *who, const char *messag void Client::SetTint(int16 in_slot, uint32 color) { Color_Struct new_color; - new_color.color = color; + new_color.Color = color; SetTint(in_slot, new_color); database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color); } @@ -3050,8 +3050,8 @@ void Client::SetTint(int16 in_slot, Color_Struct& color) { uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); if (matslot != _MaterialInvalid) { - m_pp.item_tint[matslot].color = color.color; - database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.color); + m_pp.item_tint[matslot].Color = color.Color; + database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.Color); } } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 1b866073b..789071848 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1306,9 +1306,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) /* Set item material tint */ for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) { - if (m_pp.item_tint[i].rgb.use_tint == 1 || m_pp.item_tint[i].rgb.use_tint == 255) + if (m_pp.item_tint[i].RGB.UseTint == 1 || m_pp.item_tint[i].RGB.UseTint == 255) { - m_pp.item_tint[i].rgb.use_tint = 0xFF; + m_pp.item_tint[i].RGB.UseTint = 0xFF; } } diff --git a/zone/command.cpp b/zone/command.cpp index ff81e73ed..612228fde 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -7020,7 +7020,7 @@ void Client::Undye() { database.SaveInventory(CharacterID(), inst, slot2); } - m_pp.item_tint[cur_slot].color = 0; + m_pp.item_tint[cur_slot].Color = 0; SendWearChange(cur_slot); } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 767159ce7..236128048 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -113,15 +113,15 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std: pc->Lock(); /* Load Item Tints */ - pc->item_tint[0].color = pcs->item_tint[0].color; - pc->item_tint[1].color = pcs->item_tint[1].color; - pc->item_tint[2].color = pcs->item_tint[2].color; - pc->item_tint[3].color = pcs->item_tint[3].color; - pc->item_tint[4].color = pcs->item_tint[4].color; - pc->item_tint[5].color = pcs->item_tint[5].color; - pc->item_tint[6].color = pcs->item_tint[6].color; - pc->item_tint[7].color = pcs->item_tint[7].color; - pc->item_tint[8].color = pcs->item_tint[8].color; + pc->item_tint[0].Color = pcs->item_tint[0].Color; + pc->item_tint[1].Color = pcs->item_tint[1].Color; + pc->item_tint[2].Color = pcs->item_tint[2].Color; + pc->item_tint[3].Color = pcs->item_tint[3].Color; + pc->item_tint[4].Color = pcs->item_tint[4].Color; + pc->item_tint[5].Color = pcs->item_tint[5].Color; + pc->item_tint[6].Color = pcs->item_tint[6].Color; + pc->item_tint[7].Color = pcs->item_tint[7].Color; + pc->item_tint[8].Color = pcs->item_tint[8].Color; /* Load Physical Appearance */ pc->haircolor = pcs->haircolor; @@ -1413,8 +1413,8 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { item = database.GetItem(GetEquipment(material_slot)); if(item != NO_ITEM) { - return item_tint[material_slot].rgb.use_tint ? - item_tint[material_slot].color : + return item_tint[material_slot].RGB.UseTint ? + item_tint[material_slot].Color : item->Color; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 7f2fa0173..35053731c 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1984,9 +1984,9 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { void Client::DyeArmor(DyeStruct* dye){ int16 slot=0; for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_TINT_END; i++) { - if (m_pp.item_tint[i].rgb.blue != dye->dye[i].rgb.blue || - m_pp.item_tint[i].rgb.red != dye->dye[i].rgb.red || - m_pp.item_tint[i].rgb.green != dye->dye[i].rgb.green + if (m_pp.item_tint[i].RGB.Blue != dye->dye[i].RGB.Blue || + m_pp.item_tint[i].RGB.Red != dye->dye[i].RGB.Red || + m_pp.item_tint[i].RGB.Green != dye->dye[i].RGB.Green ) { slot = m_inv.HasItem(32557, 1, invWherePersonal); if (slot != INVALID_INDEX){ @@ -1994,18 +1994,18 @@ void Client::DyeArmor(DyeStruct* dye){ uint8 slot2=SlotConvert(i); ItemInst* inst = this->m_inv.GetItem(slot2); if(inst){ - uint32 armor_color = ((uint32)dye->dye[i].rgb.red << 16) | ((uint32)dye->dye[i].rgb.green << 8) | ((uint32)dye->dye[i].rgb.blue); + uint32 armor_color = ((uint32)dye->dye[i].RGB.Red << 16) | ((uint32)dye->dye[i].RGB.Green << 8) | ((uint32)dye->dye[i].RGB.Blue); inst->SetColor(armor_color); database.SaveCharacterMaterialColor(this->CharacterID(), i, armor_color); database.SaveInventory(CharacterID(),inst,slot2); - if(dye->dye[i].rgb.use_tint) - m_pp.item_tint[i].rgb.use_tint = 0xFF; + if(dye->dye[i].RGB.UseTint) + m_pp.item_tint[i].RGB.UseTint = 0xFF; else - m_pp.item_tint[i].rgb.use_tint=0x00; + m_pp.item_tint[i].RGB.UseTint=0x00; } - m_pp.item_tint[i].rgb.blue=dye->dye[i].rgb.blue; - m_pp.item_tint[i].rgb.red=dye->dye[i].rgb.red; - m_pp.item_tint[i].rgb.green=dye->dye[i].rgb.green; + m_pp.item_tint[i].RGB.Blue=dye->dye[i].RGB.Blue; + m_pp.item_tint[i].RGB.Red=dye->dye[i].RGB.Red; + m_pp.item_tint[i].RGB.Green=dye->dye[i].RGB.Green; SendWearChange(i); } else{ @@ -2420,7 +2420,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const const Item_Struct *item = database.GetItem(GetEquipment(material_slot)); if(item != nullptr) - return ((m_pp.item_tint[material_slot].rgb.use_tint) ? m_pp.item_tint[material_slot].color : item->Color); + return ((m_pp.item_tint[material_slot].RGB.UseTint) ? m_pp.item_tint[material_slot].Color : item->Color); return 0; } diff --git a/zone/mob.cpp b/zone/mob.cpp index ea86ff4dc..57d04f344 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -961,10 +961,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) // Only Player Races Wear Armor if (Mob::IsPlayerRace(race) || i > 6) { - ns->spawn.equipment[i].material = GetEquipmentMaterial(i); - ns->spawn.equipment[i].elitematerial = IsEliteMaterialItem(i); - ns->spawn.equipment[i].heroforgemodel = GetHerosForgeModel(i); - ns->spawn.colors[i].color = GetEquipmentColor(i); + ns->spawn.equipment[i].Material = GetEquipmentMaterial(i); + ns->spawn.equipment[i].EliteMaterial = IsEliteMaterialItem(i); + ns->spawn.equipment[i].HeroForgeModel = GetHerosForgeModel(i); + ns->spawn.colors[i].Color = GetEquipmentColor(i); } } @@ -2562,7 +2562,7 @@ void Mob::SendWearChange(uint8 material_slot) wc->material = GetEquipmentMaterial(material_slot); wc->elite_material = IsEliteMaterialItem(material_slot); wc->hero_forge_model = GetHerosForgeModel(material_slot); - wc->color.color = GetEquipmentColor(material_slot); + wc->color.Color = GetEquipmentColor(material_slot); wc->wear_slot_id = material_slot; entity_list.QueueClients(this, outapp); @@ -2577,9 +2577,9 @@ void Mob::SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model, uin wc->spawn_id = this->GetID(); wc->material = texture; if (this->IsClient()) - wc->color.color = GetEquipmentColor(slot); + wc->color.Color = GetEquipmentColor(slot); else - wc->color.color = this->GetArmorTint(slot); + wc->color.Color = this->GetArmorTint(slot); wc->wear_slot_id = slot; wc->unknown06 = unknown06; @@ -2607,7 +2607,7 @@ void Mob::SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uin wc->spawn_id = this->GetID(); wc->material = GetEquipmentMaterial(material_slot); wc->hero_forge_model = GetHerosForgeModel(material_slot); - wc->color.color = color; + wc->color.Color = color; wc->wear_slot_id = material_slot; entity_list.QueueClients(this, outapp); @@ -2624,7 +2624,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 h wc->spawn_id = this->GetID(); wc->material = texture; wc->hero_forge_model = hero_forge_model; - wc->color.color = color; + wc->color.Color = color; wc->wear_slot_id = material_slot; entity_list.QueueClients(this, outapp); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index d9e564e29..07a3df930 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1167,10 +1167,10 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile for (auto row = results.begin(); row != results.end(); ++row) { r = 0; i = atoi(row[r]); /* Slot */ r++; - pp->item_tint[i].rgb.blue = atoi(row[r]); r++; - pp->item_tint[i].rgb.green = atoi(row[r]); r++; - pp->item_tint[i].rgb.red = atoi(row[r]); r++; - pp->item_tint[i].rgb.use_tint = atoi(row[r]); + pp->item_tint[i].RGB.Blue = atoi(row[r]); r++; + pp->item_tint[i].RGB.Green = atoi(row[r]); r++; + pp->item_tint[i].RGB.Red = atoi(row[r]); r++; + pp->item_tint[i].RGB.UseTint = atoi(row[r]); } return true; } @@ -3546,9 +3546,9 @@ uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const c dbpc->plat, dbpc->haircolor, dbpc->beardcolor, dbpc->eyecolor1, dbpc->eyecolor2, dbpc->hairstyle, dbpc->face, dbpc->beard, dbpc->drakkin_heritage, dbpc->drakkin_tattoo, dbpc->drakkin_details, - dbpc->item_tint[0].color, dbpc->item_tint[1].color, dbpc->item_tint[2].color, - dbpc->item_tint[3].color, dbpc->item_tint[4].color, dbpc->item_tint[5].color, - dbpc->item_tint[6].color, dbpc->item_tint[7].color, dbpc->item_tint[8].color, + dbpc->item_tint[0].Color, dbpc->item_tint[1].Color, dbpc->item_tint[2].Color, + dbpc->item_tint[3].Color, dbpc->item_tint[4].Color, dbpc->item_tint[5].Color, + dbpc->item_tint[6].Color, dbpc->item_tint[7].Color, dbpc->item_tint[8].Color, db_id); auto results = QueryDatabase(query); @@ -3639,15 +3639,15 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui dbpc->drakkin_heritage, dbpc->drakkin_tattoo, dbpc->drakkin_details, - dbpc->item_tint[0].color, - dbpc->item_tint[1].color, - dbpc->item_tint[2].color, - dbpc->item_tint[3].color, - dbpc->item_tint[4].color, - dbpc->item_tint[5].color, - dbpc->item_tint[6].color, - dbpc->item_tint[7].color, - dbpc->item_tint[8].color + dbpc->item_tint[0].Color, + dbpc->item_tint[1].Color, + dbpc->item_tint[2].Color, + dbpc->item_tint[3].Color, + dbpc->item_tint[4].Color, + dbpc->item_tint[5].Color, + dbpc->item_tint[6].Color, + dbpc->item_tint[7].Color, + dbpc->item_tint[8].Color ); auto results = QueryDatabase(query); uint32 last_insert_id = results.LastInsertedID(); @@ -3819,15 +3819,15 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->drakkin_heritage = atoul(row[i++]); // drakkin_heritage, pcs->drakkin_tattoo = atoul(row[i++]); // drakkin_tattoo, pcs->drakkin_details = atoul(row[i++]); // drakkin_details, - pcs->item_tint[0].color = atoul(row[i++]); // wc_1, - pcs->item_tint[1].color = atoul(row[i++]); // wc_2, - pcs->item_tint[2].color = atoul(row[i++]); // wc_3, - pcs->item_tint[3].color = atoul(row[i++]); // wc_4, - pcs->item_tint[4].color = atoul(row[i++]); // wc_5, - pcs->item_tint[5].color = atoul(row[i++]); // wc_6, - pcs->item_tint[6].color = atoul(row[i++]); // wc_7, - pcs->item_tint[7].color = atoul(row[i++]); // wc_8, - pcs->item_tint[8].color = atoul(row[i++]); // wc_9 + pcs->item_tint[0].Color = atoul(row[i++]); // wc_1, + pcs->item_tint[1].Color = atoul(row[i++]); // wc_2, + pcs->item_tint[2].Color = atoul(row[i++]); // wc_3, + pcs->item_tint[3].Color = atoul(row[i++]); // wc_4, + pcs->item_tint[4].Color = atoul(row[i++]); // wc_5, + pcs->item_tint[5].Color = atoul(row[i++]); // wc_6, + pcs->item_tint[6].Color = atoul(row[i++]); // wc_7, + pcs->item_tint[7].Color = atoul(row[i++]); // wc_8, + pcs->item_tint[8].Color = atoul(row[i++]); // wc_9 } query = StringFormat( "SELECT \n" From 766641cd15fbe20e6eba51445036a28f071c1a1f Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 17 Feb 2015 13:56:58 -0500 Subject: [PATCH 7/8] Implemented per-client character creation limits --- common/eq_dictionary.h | 1 - common/eq_packet_structs.h | 62 ++++--- common/patches/rof.cpp | 150 +++++++++------- common/patches/rof2.cpp | 150 +++++++++------- common/patches/rof2_constants.h | 2 +- common/patches/rof2_structs.h | 12 +- common/patches/rof_constants.h | 2 +- common/patches/rof_structs.h | 26 +-- common/patches/sod.cpp | 137 ++++++++------ common/patches/sod_constants.h | 2 +- common/patches/sod_structs.h | 6 +- common/patches/sof.cpp | 137 ++++++++------ common/patches/sof_constants.h | 2 +- common/patches/sof_structs.h | 10 +- common/patches/titanium.cpp | 117 ++++++++---- common/patches/titanium_constants.h | 2 +- common/patches/titanium_structs.h | 6 +- common/patches/uf.cpp | 144 +++++++++------ common/patches/uf_constants.h | 2 +- common/patches/uf_structs.h | 6 +- world/client.cpp | 138 +++++++------- world/client.h | 2 +- world/worlddb.cpp | 268 +++++++++++++++------------- world/worlddb.h | 3 +- 24 files changed, 790 insertions(+), 597 deletions(-) diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 84da53f63..7828dd5cc 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -49,7 +49,6 @@ public: // database static const ClientVersion CHARACTER_CREATION_CLIENT = ClientVersion::RoF2; // adjust according to starting item placement and target client - // This value should be at least 8 or Titanium will have issues (tested at 6) static const size_t CHARACTER_CREATION_LIMIT = RoF2::consts::CHARACTER_CREATION_LIMIT; // inventory diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 0f1b63136..188214dad 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -158,32 +158,46 @@ struct CharSelectEquip Color_Struct Color; }; +struct CharacterSelectEntry_Struct +{ + char Name[64]; + uint8 Class; + uint32 Race; + uint8 Level; + uint8 ShroudClass; + uint32 ShroudRace; + uint16 Zone; + uint16 Instance; + uint8 Gender; + uint8 Face; + CharSelectEquip Equip[9]; + uint8 Unknown15; // Seen FF + uint8 Unknown19; // Seen FF + uint32 DrakkinTattoo; + uint32 DrakkinDetails; + uint32 Deity; + uint32 PrimaryIDFile; + uint32 SecondaryIDFile; + uint8 HairColor; + uint8 BeardColor; + uint8 EyeColor1; + uint8 EyeColor2; + uint8 HairStyle; + uint8 Beard; + uint8 Enabled; + uint8 Tutorial; // Seen 1 for new char or 0 for existing + uint32 DrakkinHeritage; + uint8 Unknown1; // Seen 0 + uint8 GoHome; // Seen 0 for new char and 1 for existing + uint32 LastLogin; + uint8 Unknown2; // Seen 0 +}; + struct CharacterSelect_Struct { - uint32 Race[10]; // Characters Race - uint8 BeardColor[10]; // Characters beard Color - uint8 HairStyle[10]; // Characters hair style - CharSelectEquip Equip[10][9]; - uint32 Secondary[10]; // Characters secondary IDFile number - uint32 DrakkinHeritage[10]; // added for SoF - uint32 DrakkinTattoo[10]; // added for SoF - uint32 DrakkinDetails[10]; // added for SoF - uint32 Deity[10]; // Characters Deity - uint8 GoHome[10]; // 1=Go Home available, 0=not - uint8 Tutorial[10]; // 1=Tutorial available, 0=not - uint8 Beard[10]; // Characters Beard Type - uint8 Unknown902[10]; // 10x ff - uint32 Primary[10]; // Characters primary IDFile number - uint8 HairColor[10]; // Characters Hair Color - uint8 Unknown0962[2]; // 2x 00 - uint32 Zone[10]; // Characters Current Zone - uint8 Class_[10]; // Characters Classes - uint8 Face[10]; // Characters Face Type - char Name[10][64]; // Characters Names - uint8 Gender[10]; // Characters Gender - uint8 EyeColor1[10]; // Characters Eye Color - uint8 EyeColor2[10]; // Characters Eye 2 Color - uint8 Level[10]; // Characters Levels + uint32 CharCount; //number of chars in this packet + uint32 TotalChars; //total number of chars allowed? + CharacterSelectEntry_Struct Entries[0]; }; /* diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 6e89f7d39..485dc4118 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2897,85 +2897,99 @@ namespace RoF ENCODE(OP_SendCharInfo) { - ENCODE_LENGTH_EXACT(CharacterSelect_Struct); + ENCODE_LENGTH_ATLEAST(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - //EQApplicationPacket *packet = *p; - //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; + // Zero-character count shunt + if (emu->CharCount == 0) { + ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, sizeof(structs::CharacterSelect_Struct)); + eq->CharCount = emu->CharCount; - int char_count; - int namelen = 0; - for (char_count = 0; char_count < 10; char_count++) { - if (emu->Name[char_count][0] == '\0') - break; - if (strcmp(emu->Name[char_count], "") == 0) - break; - namelen += strlen(emu->Name[char_count]); + FINISH_ENCODE(); + return; } - int total_length = sizeof(structs::CharacterSelect_Struct) - + char_count * sizeof(structs::CharacterSelectEntry_Struct) - + namelen; + unsigned char *emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr; + + size_t names_length = 0; + size_t character_count = 0; + for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + names_length += strlen(emu_cse->Name); + emu_ptr += sizeof(CharacterSelectEntry_Struct); + } + + size_t total_length = sizeof(structs::CharacterSelect_Struct) + + character_count * sizeof(structs::CharacterSelectEntry_Struct) + + names_length; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); + structs::CharacterSelectEntry_Struct *eq_cse = (structs::CharacterSelectEntry_Struct *)nullptr; - //unsigned char *eq_buffer = new unsigned char[total_length]; - //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; + eq->CharCount = character_count; + //eq->TotalChars = emu->TotalChars; - eq->CharCount = char_count; - //eq->total_chars = 10; + //if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + // eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; - unsigned char *bufptr = (unsigned char *)eq->Entries; - int r; - for (r = 0; r < char_count; r++) { - { //pre-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); + emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + + unsigned char *eq_ptr = __packet->pBuffer; + eq_ptr += sizeof(structs::CharacterSelect_Struct); + + for (int counter = 0; counter < character_count; ++counter) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + strcpy(eq_cse->Name, emu_cse->Name); + eq_ptr += strlen(eq_cse->Name); + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Class = emu_cse->Class; + eq_cse->Race = emu_cse->Race; + eq_cse->Level = emu_cse->Level; + eq_cse->ShroudClass = emu_cse->ShroudClass; + eq_cse->ShroudRace = emu_cse->ShroudRace; + eq_cse->Zone = emu_cse->Zone; + eq_cse->Instance = emu_cse->Instance; + eq_cse->Gender = emu_cse->Gender; + eq_cse->Face = emu_cse->Face; + + for (int equip_index = 0; equip_index < _MaterialCount; equip_index++) { + eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; + eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel; + eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2; + eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color; } - //adjust for name. - bufptr += strlen(emu->Name[r]); - { //post-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Class_ = emu->Class_[r]; - eq2->Race = emu->Race[r]; - eq2->Level = emu->Level[r]; - eq2->Class_2 = emu->Class_[r]; - eq2->Race2 = emu->Race[r]; - eq2->Zone = emu->Zone[r]; - eq2->Instance = 0; - eq2->Gender = emu->Gender[r]; - eq2->Face = emu->Face[r]; - int k; - for (k = 0; k < _MaterialCount; k++) { - eq2->Equip[k].Material = emu->Equip[r][k].Material; - eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; - eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; - eq2->Equip[k].HeroForgeModel = emu->Equip[r][k].HeroForgeModel; - eq2->Equip[k].Material2 = emu->Equip[r][k].Material2; - eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; - } - eq2->Unknown15 = 0xFF; - eq2->Uknown19 = 0xFF; - eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; - eq2->DrakkinDetails = emu->DrakkinDetails[r]; - eq2->Deity = emu->Deity[r]; - eq2->Primary = emu->Primary[r]; - eq2->Secondary = emu->Secondary[r]; - eq2->HairColor = emu->HairColor[r]; - eq2->BeardColor = emu->BeardColor[r]; - eq2->EyeColor1 = emu->EyeColor1[r]; - eq2->EyeColor2 = emu->EyeColor2[r]; - eq2->HairStyle = emu->HairStyle[r]; - eq2->Beard = emu->Beard[r]; - eq2->CharEnabled = 1; - eq2->Tutorial = emu->Tutorial[r]; - eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; - eq2->Unknown1 = 0; - eq2->GoHome = emu->GoHome[r]; - eq2->LastLogin = 1212696584; - eq2->Unknown2 = 0; - } - bufptr += sizeof(structs::CharacterSelectEntry_Struct); + + eq_cse->Unknown15 = emu_cse->Unknown15; + eq_cse->Unknown19 = emu_cse->Unknown19; + eq_cse->DrakkinTattoo = emu_cse->DrakkinTattoo; + eq_cse->DrakkinDetails = emu_cse->DrakkinDetails; + eq_cse->Deity = emu_cse->Deity; + eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile; + eq_cse->SecondaryIDFile = emu_cse->SecondaryIDFile; + eq_cse->HairColor = emu_cse->HairColor; + eq_cse->BeardColor = emu_cse->BeardColor; + eq_cse->EyeColor1 = emu_cse->EyeColor1; + eq_cse->EyeColor2 = emu_cse->EyeColor2; + eq_cse->HairStyle = emu_cse->HairStyle; + eq_cse->Beard = emu_cse->Beard; + eq_cse->Enabled = emu_cse->Enabled; + eq_cse->Tutorial = emu_cse->Tutorial; + eq_cse->DrakkinHeritage = emu_cse->DrakkinHeritage; + eq_cse->Unknown1 = emu_cse->Unknown1; + eq_cse->GoHome = emu_cse->GoHome; + eq_cse->LastLogin = emu_cse->LastLogin; + eq_cse->Unknown2 = emu_cse->Unknown2; + + emu_ptr += sizeof(CharacterSelectEntry_Struct); + eq_ptr += sizeof(structs::CharacterSelectEntry_Struct); } FINISH_ENCODE(); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 0215911e6..0ad31517e 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2981,85 +2981,99 @@ namespace RoF2 ENCODE(OP_SendCharInfo) { - ENCODE_LENGTH_EXACT(CharacterSelect_Struct); + ENCODE_LENGTH_ATLEAST(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - //EQApplicationPacket *packet = *p; - //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; + // Zero-character count shunt + if (emu->CharCount == 0) { + ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, sizeof(structs::CharacterSelect_Struct)); + eq->CharCount = emu->CharCount; - int char_count; - int namelen = 0; - for (char_count = 0; char_count < 10; char_count++) { - if (emu->Name[char_count][0] == '\0') - break; - if (strcmp(emu->Name[char_count], "") == 0) - break; - namelen += strlen(emu->Name[char_count]); + FINISH_ENCODE(); + return; } - int total_length = sizeof(structs::CharacterSelect_Struct) - + char_count * sizeof(structs::CharacterSelectEntry_Struct) - + namelen; + unsigned char *emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr; + + size_t names_length = 0; + size_t character_count = 0; + for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + names_length += strlen(emu_cse->Name); + emu_ptr += sizeof(CharacterSelectEntry_Struct); + } + + size_t total_length = sizeof(structs::CharacterSelect_Struct) + + character_count * sizeof(structs::CharacterSelectEntry_Struct) + + names_length; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); + structs::CharacterSelectEntry_Struct *eq_cse = (structs::CharacterSelectEntry_Struct *)nullptr; - //unsigned char *eq_buffer = new unsigned char[total_length]; - //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; + eq->CharCount = character_count; + //eq->TotalChars = emu->TotalChars; - eq->CharCount = char_count; - //eq->total_chars = 10; + //if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + // eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; - unsigned char *bufptr = (unsigned char *)eq->Entries; - int r; - for (r = 0; r < char_count; r++) { - { //pre-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); + emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + + unsigned char *eq_ptr = __packet->pBuffer; + eq_ptr += sizeof(structs::CharacterSelect_Struct); + + for (int counter = 0; counter < character_count; ++counter) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + strcpy(eq_cse->Name, emu_cse->Name); + eq_ptr += strlen(eq_cse->Name); + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Class = emu_cse->Class; + eq_cse->Race = emu_cse->Race; + eq_cse->Level = emu_cse->Level; + eq_cse->ShroudClass = emu_cse->ShroudClass; + eq_cse->ShroudRace = emu_cse->ShroudRace; + eq_cse->Zone = emu_cse->Zone; + eq_cse->Instance = emu_cse->Instance; + eq_cse->Gender = emu_cse->Gender; + eq_cse->Face = emu_cse->Face; + + for (int equip_index = 0; equip_index < _MaterialCount; equip_index++) { + eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; + eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel; + eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2; + eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color; } - //adjust for name. - bufptr += strlen(emu->Name[r]); - { //post-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Class_ = emu->Class_[r]; - eq2->Race = emu->Race[r]; - eq2->Level = emu->Level[r]; - eq2->Class_2 = emu->Class_[r]; - eq2->Race2 = emu->Race[r]; - eq2->Zone = emu->Zone[r]; - eq2->Instance = 0; - eq2->Gender = emu->Gender[r]; - eq2->Face = emu->Face[r]; - int k; - for (k = 0; k < _MaterialCount; k++) { - eq2->Equip[k].Material = emu->Equip[r][k].Material; - eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; - eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; - eq2->Equip[k].HeroForgeModel = emu->Equip[r][k].HeroForgeModel; - eq2->Equip[k].Material2 = emu->Equip[r][k].Material2; - eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; - } - eq2->Unknown15 = 0xFF; - eq2->Unknown19 = 0xFF; - eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; - eq2->DrakkinDetails = emu->DrakkinDetails[r]; - eq2->Deity = emu->Deity[r]; - eq2->Primary = emu->Primary[r]; - eq2->Secondary = emu->Secondary[r]; - eq2->HairColor = emu->HairColor[r]; - eq2->BeardColor = emu->BeardColor[r]; - eq2->EyeColor1 = emu->EyeColor1[r]; - eq2->EyeColor2 = emu->EyeColor2[r]; - eq2->HairStyle = emu->HairStyle[r]; - eq2->Beard = emu->Beard[r]; - eq2->CharEnabled = 1; - eq2->Tutorial = emu->Tutorial[r]; - eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; - eq2->Unknown1 = 0; - eq2->GoHome = emu->GoHome[r]; - eq2->LastLogin = 1212696584; - eq2->Unknown2 = 0; - } - bufptr += sizeof(structs::CharacterSelectEntry_Struct); + + eq_cse->Unknown15 = emu_cse->Unknown15; + eq_cse->Unknown19 = emu_cse->Unknown19; + eq_cse->DrakkinTattoo = emu_cse->DrakkinTattoo; + eq_cse->DrakkinDetails = emu_cse->DrakkinDetails; + eq_cse->Deity = emu_cse->Deity; + eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile; + eq_cse->SecondaryIDFile = emu_cse->SecondaryIDFile; + eq_cse->HairColor = emu_cse->HairColor; + eq_cse->BeardColor = emu_cse->BeardColor; + eq_cse->EyeColor1 = emu_cse->EyeColor1; + eq_cse->EyeColor2 = emu_cse->EyeColor2; + eq_cse->HairStyle = emu_cse->HairStyle; + eq_cse->Beard = emu_cse->Beard; + eq_cse->Enabled = emu_cse->Enabled; + eq_cse->Tutorial = emu_cse->Tutorial; + eq_cse->DrakkinHeritage = emu_cse->DrakkinHeritage; + eq_cse->Unknown1 = emu_cse->Unknown1; + eq_cse->GoHome = emu_cse->GoHome; + eq_cse->LastLogin = emu_cse->LastLogin; + eq_cse->Unknown2 = emu_cse->Unknown2; + + emu_ptr += sizeof(CharacterSelectEntry_Struct); + eq_ptr += sizeof(structs::CharacterSelectEntry_Struct); } FINISH_ENCODE(); diff --git a/common/patches/rof2_constants.h b/common/patches/rof2_constants.h index 750a6fb3e..4c8245737 100644 --- a/common/patches/rof2_constants.h +++ b/common/patches/rof2_constants.h @@ -103,7 +103,7 @@ namespace RoF2 { } namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 10; + static const size_t CHARACTER_CREATION_LIMIT = 12; static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 7f8fc6978..fd6f0b2ea 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -166,11 +166,11 @@ struct CharSelectEquip struct CharacterSelectEntry_Struct { /*0000*/ char Name[1]; // Name null terminated -/*0000*/ uint8 Class_; +/*0000*/ uint8 Class; /*0000*/ uint32 Race; /*0000*/ uint8 Level; -/*0000*/ uint8 Class_2; -/*0000*/ uint32 Race2; +/*0000*/ uint8 ShroudClass; +/*0000*/ uint32 ShroudRace; /*0000*/ uint16 Zone; /*0000*/ uint16 Instance; /*0000*/ uint8 Gender; @@ -181,15 +181,15 @@ struct CharacterSelectEntry_Struct /*0000*/ uint32 DrakkinTattoo; /*0000*/ uint32 DrakkinDetails; /*0000*/ uint32 Deity; -/*0000*/ uint32 Primary; -/*0000*/ uint32 Secondary; +/*0000*/ uint32 PrimaryIDFile; +/*0000*/ uint32 SecondaryIDFile; /*0000*/ uint8 HairColor; /*0000*/ uint8 BeardColor; /*0000*/ uint8 EyeColor1; /*0000*/ uint8 EyeColor2; /*0000*/ uint8 HairStyle; /*0000*/ uint8 Beard; -/*0000*/ uint8 CharEnabled; +/*0000*/ uint8 Enabled; /*0000*/ uint8 Tutorial; // Seen 1 for new char or 0 for existing /*0000*/ uint32 DrakkinHeritage; /*0000*/ uint8 Unknown1; // Seen 0 diff --git a/common/patches/rof_constants.h b/common/patches/rof_constants.h index 86367b3d9..8b5fadbf2 100644 --- a/common/patches/rof_constants.h +++ b/common/patches/rof_constants.h @@ -102,7 +102,7 @@ namespace RoF { } namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 10; + static const size_t CHARACTER_CREATION_LIMIT = 12; static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index a1260fe72..4b8fe3b01 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -165,37 +165,37 @@ struct CharSelectEquip struct CharacterSelectEntry_Struct { -/*0000*/ char Name[1]; // Name null terminated -/*0000*/ uint8 Class_; +/*0000*/ char Name[1]; // Name null terminated +/*0000*/ uint8 Class; /*0000*/ uint32 Race; /*0000*/ uint8 Level; -/*0000*/ uint8 Class_2; -/*0000*/ uint32 Race2; +/*0000*/ uint8 ShroudClass; +/*0000*/ uint32 ShroudRace; /*0000*/ uint16 Zone; /*0000*/ uint16 Instance; /*0000*/ uint8 Gender; /*0000*/ uint8 Face; /*0000*/ CharSelectEquip Equip[9]; -/*0000*/ uint8 Unknown15; // Seen FF -/*0000*/ uint8 Uknown19; // Seen FF +/*0000*/ uint8 Unknown15; // Seen FF +/*0000*/ uint8 Unknown19; // Seen FF /*0000*/ uint32 DrakkinTattoo; /*0000*/ uint32 DrakkinDetails; /*0000*/ uint32 Deity; -/*0000*/ uint32 Primary; -/*0000*/ uint32 Secondary; +/*0000*/ uint32 PrimaryIDFile; +/*0000*/ uint32 SecondaryIDFile; /*0000*/ uint8 HairColor; /*0000*/ uint8 BeardColor; /*0000*/ uint8 EyeColor1; /*0000*/ uint8 EyeColor2; /*0000*/ uint8 HairStyle; /*0000*/ uint8 Beard; -/*0000*/ uint8 CharEnabled; -/*0000*/ uint8 Tutorial; // Seen 1 for new char or 0 for existing +/*0000*/ uint8 Enabled; +/*0000*/ uint8 Tutorial; // Seen 1 for new char or 0 for existing /*0000*/ uint32 DrakkinHeritage; -/*0000*/ uint8 Unknown1; // Seen 0 -/*0000*/ uint8 GoHome; // Seen 0 for new char and 1 for existing +/*0000*/ uint8 Unknown1; // Seen 0 +/*0000*/ uint8 GoHome; // Seen 0 for new char and 1 for existing /*0000*/ uint32 LastLogin; -/*0000*/ uint8 Unknown2; // Seen 0 +/*0000*/ uint8 Unknown2; // Seen 0 }; /* diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index c2ac79d7d..a8b69556a 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1911,76 +1911,95 @@ namespace SoD ENCODE(OP_SendCharInfo) { - ENCODE_LENGTH_EXACT(CharacterSelect_Struct); + ENCODE_LENGTH_ATLEAST(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - //EQApplicationPacket *packet = *p; - //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; + // Zero-character count shunt + if (emu->CharCount == 0) { + ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, sizeof(structs::CharacterSelect_Struct)); + eq->CharCount = emu->CharCount; + eq->TotalChars = eq->TotalChars; - int char_count; - int namelen = 0; - for (char_count = 0; char_count < 10; char_count++) { - if (emu->Name[char_count][0] == '\0') - break; - if (strcmp(emu->Name[char_count], "") == 0) - break; - namelen += strlen(emu->Name[char_count]); + if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + + FINISH_ENCODE(); + return; } - int total_length = sizeof(structs::CharacterSelect_Struct) - + char_count * sizeof(structs::CharacterSelectEntry_Struct) - + namelen; + unsigned char *emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr; + + size_t names_length = 0; + size_t character_count = 0; + for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + names_length += strlen(emu_cse->Name); + emu_ptr += sizeof(CharacterSelectEntry_Struct); + } + + size_t total_length = sizeof(structs::CharacterSelect_Struct) + + character_count * sizeof(structs::CharacterSelectEntry_Struct) + + names_length; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); + structs::CharacterSelectEntry_Struct *eq_cse = (structs::CharacterSelectEntry_Struct *)nullptr; - //unsigned char *eq_buffer = new unsigned char[total_length]; - //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; + eq->CharCount = character_count; + eq->TotalChars = emu->TotalChars; - eq->CharCount = char_count; - eq->TotalChars = 10; + if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; - unsigned char *bufptr = (unsigned char *)eq->Entries; - int r; - for (r = 0; r < char_count; r++) { - { //pre-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Level = emu->Level[r]; - eq2->HairStyle = emu->HairStyle[r]; - eq2->Gender = emu->Gender[r]; - memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); + emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + + unsigned char *eq_ptr = __packet->pBuffer; + eq_ptr += sizeof(structs::CharacterSelect_Struct); + + for (int counter = 0; counter < character_count; ++counter) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Level = emu_cse->Level; + eq_cse->HairStyle = emu_cse->HairStyle; + eq_cse->Gender = emu_cse->Gender; + + strcpy(eq_cse->Name, emu_cse->Name); + eq_ptr += strlen(eq_cse->Name); + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Beard = emu_cse->Beard; + eq_cse->HairColor = emu_cse->HairColor; + eq_cse->Face = emu_cse->Face; + + for (int equip_index = 0; equip_index < _MaterialCount; equip_index++) { + eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; + eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color; } - //adjust for name. - bufptr += strlen(emu->Name[r]); - { //post-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Beard = emu->Beard[r]; - eq2->HairColor = emu->HairColor[r]; - eq2->Face = emu->Face[r]; - int k; - for (k = 0; k < _MaterialCount; k++) { - eq2->Equip[k].Material = emu->Equip[r][k].Material; - eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; - eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; - eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; - } - eq2->Primary = emu->Primary[r]; - eq2->Secondary = emu->Secondary[r]; - eq2->Tutorial = emu->Tutorial[r]; // was u15 - eq2->Unknown15 = 0xFF; - eq2->Deity = emu->Deity[r]; - eq2->Zone = emu->Zone[r]; - eq2->Unknown19 = 0xFF; - eq2->Race = emu->Race[r]; - eq2->GoHome = emu->GoHome[r]; - eq2->Class_ = emu->Class_[r]; - eq2->EyeColor1 = emu->EyeColor1[r]; - eq2->BeardColor = emu->BeardColor[r]; - eq2->EyeColor2 = emu->EyeColor2[r]; - eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; - eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; - eq2->DrakkinDetails = emu->DrakkinDetails[r]; - } - bufptr += sizeof(structs::CharacterSelectEntry_Struct); + + eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile; + eq_cse->SecondaryIDFile = emu_cse->SecondaryIDFile; + eq_cse->Tutorial = emu_cse->Tutorial; + eq_cse->Unknown15 = emu_cse->Unknown15; + eq_cse->Deity = emu_cse->Deity; + eq_cse->Zone = emu_cse->Zone; + eq_cse->Unknown19 = emu_cse->Unknown19; + eq_cse->Race = emu_cse->Race; + eq_cse->GoHome = emu_cse->GoHome; + eq_cse->Class = emu_cse->Class; + eq_cse->EyeColor1 = emu_cse->EyeColor1; + eq_cse->BeardColor = emu_cse->BeardColor; + eq_cse->EyeColor2 = emu_cse->EyeColor2; + eq_cse->DrakkinHeritage = emu_cse->DrakkinHeritage; + eq_cse->DrakkinTattoo = emu_cse->DrakkinTattoo; + eq_cse->DrakkinDetails = emu_cse->DrakkinDetails; + + emu_ptr += sizeof(CharacterSelectEntry_Struct); + eq_ptr += sizeof(structs::CharacterSelectEntry_Struct); } FINISH_ENCODE(); diff --git a/common/patches/sod_constants.h b/common/patches/sod_constants.h index 5fdb89578..5dad9bb09 100644 --- a/common/patches/sod_constants.h +++ b/common/patches/sod_constants.h @@ -101,7 +101,7 @@ namespace SoD { } namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 10; + static const size_t CHARACTER_CREATION_LIMIT = 12; static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index f18e3d2f6..274cfe876 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -132,8 +132,8 @@ struct CharacterSelectEntry_Struct /*0001*/ uint8 HairColor; // /*0000*/ uint8 Face; // /*0000*/ CharSelectEquip Equip[9]; -/*0000*/ uint32 Primary; // -/*0000*/ uint32 Secondary; // +/*0000*/ uint32 PrimaryIDFile; // +/*0000*/ uint32 SecondaryIDFile; // /*0000*/ uint8 Unknown15; // 0xff /*0000*/ uint32 Deity; // /*0000*/ uint16 Zone; // @@ -142,7 +142,7 @@ struct CharacterSelectEntry_Struct /*0000*/ uint8 Unknown19; // 0xff /*0000*/ uint32 Race; // /*0000*/ uint8 Tutorial; // -/*0000*/ uint8 Class_; // +/*0000*/ uint8 Class; // /*0000*/ uint8 EyeColor1; // /*0000*/ uint8 BeardColor; // /*0000*/ uint8 EyeColor2; // diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 5220a0a6e..e0b24b393 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1570,76 +1570,95 @@ namespace SoF ENCODE(OP_SendCharInfo) { - ENCODE_LENGTH_EXACT(CharacterSelect_Struct); + ENCODE_LENGTH_ATLEAST(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - //EQApplicationPacket *packet = *p; - //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; + // Zero-character count shunt + if (emu->CharCount == 0) { + ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, sizeof(structs::CharacterSelect_Struct)); + eq->CharCount = emu->CharCount; + eq->TotalChars = eq->TotalChars; - int char_count; - int namelen = 0; - for (char_count = 0; char_count < 10; char_count++) { - if (emu->Name[char_count][0] == '\0') - break; - if (strcmp(emu->Name[char_count], "") == 0) - break; - namelen += strlen(emu->Name[char_count]); + if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + + FINISH_ENCODE(); + return; } - int total_length = sizeof(structs::CharacterSelect_Struct) - + char_count * sizeof(structs::CharacterSelectEntry_Struct) - + namelen; + unsigned char *emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr; + + size_t names_length = 0; + size_t character_count = 0; + for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + names_length += strlen(emu_cse->Name); + emu_ptr += sizeof(CharacterSelectEntry_Struct); + } + + size_t total_length = sizeof(structs::CharacterSelect_Struct) + + character_count * sizeof(structs::CharacterSelectEntry_Struct) + + names_length; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); + structs::CharacterSelectEntry_Struct *eq_cse = (structs::CharacterSelectEntry_Struct *)nullptr; - //unsigned char *eq_buffer = new unsigned char[total_length]; - //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; + eq->CharCount = character_count; + eq->TotalChars = emu->TotalChars; - eq->CharCount = char_count; - eq->TotalChars = 10; + if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; - unsigned char *bufptr = (unsigned char *)eq->Entries; - int r; - for (r = 0; r < char_count; r++) { - { //pre-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Level = emu->Level[r]; - eq2->HairStyle = emu->HairStyle[r]; - eq2->Gender = emu->Gender[r]; - memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); + emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + + unsigned char *eq_ptr = __packet->pBuffer; + eq_ptr += sizeof(structs::CharacterSelect_Struct); + + for (int counter = 0; counter < character_count; ++counter) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Level = emu_cse->Level; + eq_cse->HairStyle = emu_cse->HairStyle; + eq_cse->Gender = emu_cse->Gender; + + strcpy(eq_cse->Name, emu_cse->Name); + eq_ptr += strlen(eq_cse->Name); + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Beard = emu_cse->Beard; + eq_cse->HairColor = emu_cse->HairColor; + eq_cse->Face = emu_cse->Face; + + for (int equip_index = 0; equip_index < _MaterialCount; equip_index++) { + eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; + eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color; } - //adjust for name. - bufptr += strlen(emu->Name[r]); - { //post-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Beard = emu->Beard[r]; - eq2->HairColor = emu->HairColor[r]; - eq2->Face = emu->Face[r]; - int k; - for (k = 0; k < _MaterialCount; k++) { - eq2->Equip[k].Material = emu->Equip[r][k].Material; - eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; - eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; - eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; - } - eq2->Primary = emu->Primary[r]; - eq2->Secondary = emu->Secondary[r]; - eq2->Tutorial = emu->Tutorial[r]; // was u15 - eq2->Unknown15 = 0xff; - eq2->Deity = emu->Deity[r]; - eq2->Zone = emu->Zone[r]; - eq2->Unknown19 = 0xFF; - eq2->Race = emu->Race[r]; - eq2->GoHome = emu->GoHome[r]; - eq2->Class_ = emu->Class_[r]; - eq2->EyeColor1 = emu->EyeColor1[r]; - eq2->BeardColor = emu->BeardColor[r]; - eq2->EyeColor2 = emu->EyeColor2[r]; - eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; - eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; - eq2->DrakkinDetails = emu->DrakkinDetails[r]; - } - bufptr += sizeof(structs::CharacterSelectEntry_Struct); + + eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile; + eq_cse->SecondaryIDFile = emu_cse->SecondaryIDFile; + eq_cse->Tutorial = emu_cse->Tutorial; + eq_cse->Unknown15 = emu_cse->Unknown15; + eq_cse->Deity = emu_cse->Deity; + eq_cse->Zone = emu_cse->Zone; + eq_cse->Unknown19 = emu_cse->Unknown19; + eq_cse->Race = emu_cse->Race; + eq_cse->GoHome = emu_cse->GoHome; + eq_cse->Class = emu_cse->Class; + eq_cse->EyeColor1 = emu_cse->EyeColor1; + eq_cse->BeardColor = emu_cse->BeardColor; + eq_cse->EyeColor2 = emu_cse->EyeColor2; + eq_cse->DrakkinHeritage = emu_cse->DrakkinHeritage; + eq_cse->DrakkinTattoo = emu_cse->DrakkinTattoo; + eq_cse->DrakkinDetails = emu_cse->DrakkinDetails; + + emu_ptr += sizeof(CharacterSelectEntry_Struct); + eq_ptr += sizeof(structs::CharacterSelectEntry_Struct); } FINISH_ENCODE(); diff --git a/common/patches/sof_constants.h b/common/patches/sof_constants.h index 4729eb436..260722f00 100644 --- a/common/patches/sof_constants.h +++ b/common/patches/sof_constants.h @@ -101,7 +101,7 @@ namespace SoF { } namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 10; + static const size_t CHARACTER_CREATION_LIMIT = 12; static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index e66ace468..23b080f0c 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -132,17 +132,17 @@ struct CharacterSelectEntry_Struct /*0001*/ uint8 HairColor; // /*0000*/ uint8 Face; // /*0000*/ CharSelectEquip Equip[9]; -/*0000*/ uint32 Primary; // -/*0000*/ uint32 Secondary; // -/*0000*/ uint8 Unknown15; // 0xff +/*0000*/ uint32 PrimaryIDFile; // +/*0000*/ uint32 SecondaryIDFile; // +/*0000*/ uint8 Unknown15; // 0xff /*0000*/ uint32 Deity; // /*0000*/ uint16 Zone; // /*0000*/ uint16 Instance; /*0000*/ uint8 GoHome; // -/*0000*/ uint8 Unknown19; // 0xff +/*0000*/ uint8 Unknown19; // 0xff /*0000*/ uint32 Race; // /*0000*/ uint8 Tutorial; // -/*0000*/ uint8 Class_; // +/*0000*/ uint8 Class; // /*0000*/ uint8 EyeColor1; // /*0000*/ uint8 BeardColor; // /*0000*/ uint8 EyeColor2; // diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index e636b6a9c..efacfe980 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1155,39 +1155,96 @@ namespace Titanium ENCODE(OP_SendCharInfo) { - ENCODE_LENGTH_EXACT(CharacterSelect_Struct); + ENCODE_LENGTH_ATLEAST(CharacterSelect_Struct); SETUP_DIRECT_ENCODE(CharacterSelect_Struct, structs::CharacterSelect_Struct); - int r; - for (r = 0; r < 10; r++) { - OUT(Zone[r]); - OUT(EyeColor1[r]); - OUT(EyeColor2[r]); - OUT(HairStyle[r]); - OUT(Primary[r]); - if (emu->Race[r] > 473) - eq->Race[r] = 1; - else - eq->Race[r] = emu->Race[r]; - OUT(Class_[r]); - OUT_str(Name[r]); - OUT(Gender[r]); - OUT(Level[r]); - OUT(Secondary[r]); - OUT(Face[r]); - OUT(Beard[r]); - int k; - for (k = 0; k < 9; k++) { - eq->Equip[r][k] = emu->Equip[r][k].Material; - eq->CS_Colors[r][k].Color = emu->Equip[r][k].Color.Color; + unsigned char *emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr; + + for (size_t index = 0; index < 10; ++index) { + memset(eq->Name[index], 0, 64); + } + + // Non character-indexed packet fields + eq->Unknown830[0] = 0; + eq->Unknown830[1] = 0; + eq->Unknown0962[0] = 0; + eq->Unknown0962[1] = 0; + + size_t char_index = 0; + for (; char_index < emu->CharCount && char_index < 8; ++char_index) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + + eq->Race[char_index] = emu_cse->Race; + if (eq->Race[char_index] > 473) + eq->Race[char_index] = 1; + + for (int index = 0; index < _MaterialCount; ++index) { + eq->CS_Colors[char_index][index].Color = emu_cse->Equip[index].Color.Color; } - OUT(HairColor[r]); - OUT(GoHome[r]); - OUT(Tutorial[r]); - OUT(Deity[r]); - OUT(BeardColor[r]); - eq->Unknown820[r] = 0xFF; - eq->Unknown902[r] = 0xFF; + + eq->BeardColor[char_index] = emu_cse->BeardColor; + eq->HairStyle[char_index] = emu_cse->HairStyle; + + for (int index = 0; index < _MaterialCount; ++index) { + eq->Equip[char_index][index] = emu_cse->Equip[index].Material; + } + + eq->SecondaryIDFile[char_index] = emu_cse->SecondaryIDFile; + eq->Unknown820[char_index] = 0xFF; + eq->Deity[char_index] = emu_cse->Deity; + eq->GoHome[char_index] = emu_cse->GoHome; + eq->Tutorial[char_index] = emu_cse->Tutorial; + eq->Beard[char_index] = emu_cse->Beard; + eq->Unknown902[char_index] = 0xFF; + eq->PrimaryIDFile[char_index] = emu_cse->PrimaryIDFile; + eq->HairColor[char_index] = emu_cse->HairColor; + eq->Zone[char_index] = emu_cse->Zone; + eq->Class[char_index] = emu_cse->Class; + eq->Face[char_index] = emu_cse->Face; + + memcpy(eq->Name[char_index], emu_cse->Name, 64); + + eq->Gender[char_index] = emu_cse->Gender; + eq->EyeColor1[char_index] = emu_cse->EyeColor1; + eq->EyeColor2[char_index] = emu_cse->EyeColor2; + eq->Level[char_index] = emu_cse->Level; + + emu_ptr += sizeof(CharacterSelectEntry_Struct); + } + + for (; char_index < 10; ++char_index) { + eq->Race[char_index] = 0; + + for (int index = 0; index < _MaterialCount; ++index) { + eq->CS_Colors[char_index][index].Color = 0; + } + + eq->BeardColor[char_index] = 0; + eq->HairStyle[char_index] = 0; + + for (int index = 0; index < _MaterialCount; ++index) { + eq->Equip[char_index][index] = 0; + } + + eq->SecondaryIDFile[char_index] = 0; + eq->Unknown820[char_index] = 0xFF; + eq->Deity[char_index] = 0; + eq->GoHome[char_index] = 0; + eq->Tutorial[char_index] = 0; + eq->Beard[char_index] = 0; + eq->Unknown902[char_index] = 0xFF; + eq->PrimaryIDFile[char_index] = 0; + eq->HairColor[char_index] = 0; + eq->Zone[char_index] = 0; + eq->Class[char_index] = 0; + eq->Face[char_index] = 0; + //eq->Name[char_index][0] = '\0'; // Cleared above + eq->Gender[char_index] = 0; + eq->EyeColor1[char_index] = 0; + eq->EyeColor2[char_index] = 0; + eq->Level[char_index] = 0; } FINISH_ENCODE(); diff --git a/common/patches/titanium_constants.h b/common/patches/titanium_constants.h index c93de7666..d7e2a4964 100644 --- a/common/patches/titanium_constants.h +++ b/common/patches/titanium_constants.h @@ -100,7 +100,7 @@ namespace Titanium { } namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 8; + static const size_t CHARACTER_CREATION_LIMIT = 8; // Hard-coded in client - DO NOT ALTER static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 16; diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index a61b96a94..60b764dfe 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -122,7 +122,7 @@ struct CharacterSelect_Struct /*0400*/ uint8 BeardColor[10]; // Characters beard Color /*0410*/ uint8 HairStyle[10]; // Characters hair style /*0420*/ uint32 Equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be) -/*0780*/ uint32 Secondary[10]; // Characters secondary IDFile number +/*0780*/ uint32 SecondaryIDFile[10]; // Characters secondary IDFile number /*0820*/ uint8 Unknown820[10]; // 10x ff /*0830*/ uint8 Unknown830[2]; // 2x 00 /*0832*/ uint32 Deity[10]; // Characters Deity @@ -130,11 +130,11 @@ struct CharacterSelect_Struct /*0882*/ uint8 Tutorial[10]; // 1=Tutorial available, 0=not /*0892*/ uint8 Beard[10]; // Characters Beard Type /*0902*/ uint8 Unknown902[10]; // 10x ff -/*0912*/ uint32 Primary[10]; // Characters primary IDFile number +/*0912*/ uint32 PrimaryIDFile[10]; // Characters primary IDFile number /*0952*/ uint8 HairColor[10]; // Characters Hair Color /*0962*/ uint8 Unknown0962[2]; // 2x 00 /*0964*/ uint32 Zone[10]; // Characters Current Zone -/*1004*/ uint8 Class_[10]; // Characters Classes +/*1004*/ uint8 Class[10]; // Characters Classes /*1014*/ uint8 Face[10]; // Characters Face Type /*1024*/ char Name[10][64]; // Characters Names /*1664*/ uint8 Gender[10]; // Characters Gender diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 18ea67af0..d8635485c 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -2194,77 +2194,103 @@ namespace UF ENCODE(OP_SendCharInfo) { - ENCODE_LENGTH_EXACT(CharacterSelect_Struct); + ENCODE_LENGTH_ATLEAST(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - //EQApplicationPacket *packet = *p; - //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; + // Zero-character count shunt + if (emu->CharCount == 0) { + ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, sizeof(structs::CharacterSelect_Struct)); + eq->CharCount = emu->CharCount; + eq->TotalChars = eq->TotalChars; - int char_count; - int namelen = 0; - for (char_count = 0; char_count < 10; char_count++) { - if (emu->Name[char_count][0] == '\0') - break; - if (strcmp(emu->Name[char_count], "") == 0) - break; - namelen += strlen(emu->Name[char_count]); + if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + + // Special Underfoot adjustment - field should really be 'AdditionalChars' or 'BonusChars' + uint32 adjusted_total = eq->TotalChars - 8; // Yes, it rolls under for '< 8' - probably an int32 field + eq->TotalChars = adjusted_total; + + FINISH_ENCODE(); + return; + } + + unsigned char *emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr; + + size_t names_length = 0; + size_t character_count = 0; + for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + names_length += strlen(emu_cse->Name); + emu_ptr += sizeof(CharacterSelectEntry_Struct); } - int total_length = sizeof(structs::CharacterSelect_Struct) - + char_count * sizeof(structs::CharacterSelectEntry_Struct) - + namelen; + size_t total_length = sizeof(structs::CharacterSelect_Struct) + + character_count * sizeof(structs::CharacterSelectEntry_Struct) + + names_length; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); + structs::CharacterSelectEntry_Struct *eq_cse = (structs::CharacterSelectEntry_Struct *)nullptr; - //unsigned char *eq_buffer = new unsigned char[total_length]; - //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; + eq->CharCount = character_count; + eq->TotalChars = emu->TotalChars; - eq->CharCount = char_count; - eq->TotalChars = 10; + if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) + eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; - unsigned char *bufptr = (unsigned char *)eq->Entries; - int r; - for (r = 0; r < char_count; r++) { - { //pre-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Level = emu->Level[r]; - eq2->HairStyle = emu->HairStyle[r]; - eq2->Gender = emu->Gender[r]; - memcpy(eq2->Name, emu->Name[r], strlen(emu->Name[r]) + 1); - } - //adjust for name. - bufptr += strlen(emu->Name[r]); - { //post-name section... - structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr; - eq2->Beard = emu->Beard[r]; - eq2->HairColor = emu->HairColor[r]; - eq2->Face = emu->Face[r]; - int k; - for (k = 0; k < _MaterialCount; k++) { - eq2->Equip[k].Material = emu->Equip[r][k].Material; - eq2->Equip[k].Unknown1 = emu->Equip[r][k].Unknown1; - eq2->Equip[k].EliteMaterial = emu->Equip[r][k].EliteMaterial; - eq2->Equip[k].Color.Color = emu->Equip[r][k].Color.Color; - } - eq2->Primary = emu->Primary[r]; - eq2->Secondary = emu->Secondary[r]; - eq2->Tutorial = emu->Tutorial[r]; // was u15 - eq2->Unknown15 = 0xFF; - eq2->Deity = emu->Deity[r]; - eq2->Zone = emu->Zone[r]; - eq2->Unknown19 = 0xFF; - eq2->Race = emu->Race[r]; - eq2->GoHome = emu->GoHome[r]; - eq2->Class_ = emu->Class_[r]; - eq2->EyeColor1 = emu->EyeColor1[r]; - eq2->BeardColor = emu->BeardColor[r]; - eq2->EyeColor2 = emu->EyeColor2[r]; - eq2->DrakkinHeritage = emu->DrakkinHeritage[r]; - eq2->DrakkinTattoo = emu->DrakkinTattoo[r]; - eq2->DrakkinDetails = emu->DrakkinDetails[r]; + // Special Underfoot adjustment - field should really be 'AdditionalChars' or 'BonusChars' in this client + uint32 adjusted_total = eq->TotalChars - 8; // Yes, it rolls under for '< 8' - probably an int32 field + eq->TotalChars = adjusted_total; + + emu_ptr = __emu_buffer; + emu_ptr += sizeof(CharacterSelect_Struct); + + unsigned char *eq_ptr = __packet->pBuffer; + eq_ptr += sizeof(structs::CharacterSelect_Struct); + + for (int counter = 0; counter < character_count; ++counter) { + emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Level = emu_cse->Level; + eq_cse->HairStyle = emu_cse->HairStyle; + eq_cse->Gender = emu_cse->Gender; + + strcpy(eq_cse->Name, emu_cse->Name); + eq_ptr += strlen(eq_cse->Name); + eq_cse = (structs::CharacterSelectEntry_Struct *)eq_ptr; + + eq_cse->Beard = emu_cse->Beard; + eq_cse->HairColor = emu_cse->HairColor; + eq_cse->Face = emu_cse->Face; + + for (int equip_index = 0; equip_index < _MaterialCount; equip_index++) { + eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; + eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color; } - bufptr += sizeof(structs::CharacterSelectEntry_Struct); + eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile; + eq_cse->SecondaryIDFile = emu_cse->SecondaryIDFile; + eq_cse->Tutorial = emu_cse->Tutorial; + eq_cse->Unknown15 = emu_cse->Unknown15; + eq_cse->Deity = emu_cse->Deity; + eq_cse->Zone = emu_cse->Zone; + eq_cse->Unknown19 = emu_cse->Unknown19; + eq_cse->Race = emu_cse->Race; + eq_cse->GoHome = emu_cse->GoHome; + eq_cse->Class = emu_cse->Class; + eq_cse->EyeColor1 = emu_cse->EyeColor1; + eq_cse->BeardColor = emu_cse->BeardColor; + eq_cse->EyeColor2 = emu_cse->EyeColor2; + eq_cse->DrakkinHeritage = emu_cse->DrakkinHeritage; + eq_cse->DrakkinTattoo = emu_cse->DrakkinTattoo; + eq_cse->DrakkinDetails = emu_cse->DrakkinDetails; + + emu_ptr += sizeof(CharacterSelectEntry_Struct); + eq_ptr += sizeof(structs::CharacterSelectEntry_Struct); } FINISH_ENCODE(); diff --git a/common/patches/uf_constants.h b/common/patches/uf_constants.h index 3320fee76..1a5a4cc44 100644 --- a/common/patches/uf_constants.h +++ b/common/patches/uf_constants.h @@ -101,7 +101,7 @@ namespace UF { } namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 10; + static const size_t CHARACTER_CREATION_LIMIT = 12; static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; static const uint16 MAP_BANK_SIZE = 24; diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index ec912b681..2f5aa95b3 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -132,8 +132,8 @@ struct CharacterSelectEntry_Struct /*0001*/ uint8 HairColor; // /*0000*/ uint8 Face; // /*0000*/ CharSelectEquip Equip[9]; -/*0000*/ uint32 Primary; // -/*0000*/ uint32 Secondary; // +/*0000*/ uint32 PrimaryIDFile; // +/*0000*/ uint32 SecondaryIDFile; // /*0000*/ uint8 Unknown15; // 0xff /*0000*/ uint32 Deity; // /*0000*/ uint16 Zone; // @@ -142,7 +142,7 @@ struct CharacterSelectEntry_Struct /*0000*/ uint8 Unknown19; // 0xff /*0000*/ uint32 Race; // /*0000*/ uint8 Tutorial; // -/*0000*/ uint8 Class_; // +/*0000*/ uint8 Class; // /*0000*/ uint8 EyeColor1; // /*0000*/ uint8 BeardColor; // /*0000*/ uint8 EyeColor2; // diff --git a/world/client.cpp b/world/client.cpp index 55ca440cc..0393f0f65 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -16,6 +16,7 @@ #include "../common/string_util.h" #include "../common/clientversions.h" #include "../common/random.h" +#include "../common/shareddb.h" #include "client.h" #include "worlddb.h" @@ -161,32 +162,34 @@ void Client::SendCharInfo() { cle->SetOnline(CLE_Status_CharSelect); } - if (m_ClientVersionBit & BIT_RoFAndLater) - { - // Can make max char per account into a rule - New to VoA - SendMaxCharCreate(10); + if (m_ClientVersionBit & BIT_RoFAndLater) { + SendMaxCharCreate(); SendMembership(); SendMembershipSettings(); } seencharsel = true; - // Send OP_SendCharInfo - auto outapp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct)); - CharacterSelect_Struct* cs = (CharacterSelect_Struct*)outapp->pBuffer; + EQApplicationPacket *outapp = nullptr; + database.GetCharSelectInfo(GetAccountID(), &outapp, m_ClientVersionBit); - database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit); - - QueuePacket(outapp); + if (outapp) { + QueuePacket(outapp); + } + else { + Log.Out(Logs::General, Logs::World_Server, "[Error] Database did not return an OP_SendCharInfo packet for account %u", GetAccountID()); + } safe_delete(outapp); } -void Client::SendMaxCharCreate(int max_chars) { +void Client::SendMaxCharCreate() { auto outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct)); MaxCharacters_Struct* mc = (MaxCharacters_Struct*)outapp->pBuffer; - mc->max_chars = max_chars; + mc->max_chars = EQLimits::CharacterCreationLimit(m_ClientVersion); + if (mc->max_chars > EmuConstants::CHARACTER_CREATION_LIMIT) + mc->max_chars = EmuConstants::CHARACTER_CREATION_LIMIT; QueuePacket(outapp); safe_delete(outapp); @@ -716,66 +719,71 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { return true; } - if(!pZoning && ew->return_home && !ew->tutorial) { - auto cs = new CharacterSelect_Struct; - memset(cs, 0, sizeof(CharacterSelect_Struct)); - database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit); - bool home_enabled = false; + // This can probably be moved outside and have another method return requested info (don't forget to remove the #include "../common/shareddb.h" above) + if (!pZoning) { + size_t character_limit = EQLimits::CharacterCreationLimit(eqs->GetClientVersion()); + if (character_limit > EmuConstants::CHARACTER_CREATION_LIMIT) { character_limit = EmuConstants::CHARACTER_CREATION_LIMIT; } + if (eqs->GetClientVersion() == ClientVersion::Titanium) { character_limit = 8; } - for(int x = 0; x < 10; ++x) - { - if(strcasecmp(cs->Name[x], char_name) == 0) - { - if(cs->GoHome[x] == 1) - { - home_enabled = true; - break; + std::string tgh_query = StringFormat( + "SELECT " + "`id`, " + "name, " + "`level`, " + "last_login, " + "FROM " + "character_data " + "WHERE `account_id` = %i ORDER BY `name` LIMIT %u", GetAccountID(), character_limit); + auto tgh_results = database.QueryDatabase(tgh_query); + + /* Check GoHome */ + if (ew->return_home && !ew->tutorial) { + bool home_enabled = false; + for (auto row = tgh_results.begin(); row != tgh_results.end(); ++row) { + if (strcasecmp(row[1], char_name) == 0) { + if (RuleB(World, EnableTutorialButton) && ((uint8)atoi(row[2]) <= RuleI(World, MaxLevelForTutorial))) { + home_enabled = true; + break; + } } } - } - safe_delete(cs); - if(home_enabled) { - zoneID = database.MoveCharacterToBind(charid,4); - } - else { - Log.Out(Logs::Detail, Logs::World_Server,"'%s' is trying to go home before they're able...",char_name); - database.SetHackerFlag(GetAccountName(), char_name, "MQGoHome: player tried to go home before they were able."); - eqs->Close(); - return true; - } - } - - if(!pZoning && (RuleB(World, EnableTutorialButton) && (ew->tutorial || StartInTutorial))) { - auto cs = new CharacterSelect_Struct; - memset(cs, 0, sizeof(CharacterSelect_Struct)); - database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit); - bool tutorial_enabled = false; - - for(int x = 0; x < 10; ++x) - { - if(strcasecmp(cs->Name[x], char_name) == 0) - { - if(cs->Tutorial[x] == 1) - { - tutorial_enabled = true; - break; - } + if (home_enabled) { + zoneID = database.MoveCharacterToBind(charid, 4); + } + else { + Log.Out(Logs::Detail, Logs::World_Server, "'%s' is trying to go home before they're able...", char_name); + database.SetHackerFlag(GetAccountName(), char_name, "MQGoHome: player tried to go home before they were able."); + eqs->Close(); + return true; } } - safe_delete(cs); - if(tutorial_enabled) - { - zoneID = RuleI(World, TutorialZoneID); - database.MoveCharacterToZone(charid, database.GetZoneName(zoneID)); - } - else - { - Log.Out(Logs::Detail, Logs::World_Server,"'%s' is trying to go to tutorial but are not allowed...",char_name); - database.SetHackerFlag(GetAccountName(), char_name, "MQTutorial: player tried to enter the tutorial without having tutorial enabled for this character."); - eqs->Close(); - return true; + /* Check Tutorial*/ + if (RuleB(World, EnableTutorialButton) && (ew->tutorial || StartInTutorial)) { + bool tutorial_enabled = false; + for (auto row = tgh_results.begin(); row != tgh_results.end(); ++row) { + if (strcasecmp(row[1], char_name) == 0) { + if (RuleB(World, EnableReturnHomeButton)) { + int now = time(nullptr); + if ((now - atoi(row[3])) >= RuleI(World, MinOfflineTimeToReturnHome)) { + tutorial_enabled = true; + break; + } + } + } + } + + if (tutorial_enabled) { + zoneID = RuleI(World, TutorialZoneID); + database.MoveCharacterToZone(charid, database.GetZoneName(zoneID)); + } + else { + Log.Out(Logs::Detail, Logs::World_Server, "'%s' is trying to go to tutorial but are not allowed...", char_name); + database.SetHackerFlag(GetAccountName(), char_name, "MQTutorial: player tried to enter the tutorial without having tutorial enabled for this character."); + eqs->Close(); + return true; + } } } diff --git a/world/client.h b/world/client.h index ea1df42ba..d7a42ab28 100644 --- a/world/client.h +++ b/world/client.h @@ -41,7 +41,7 @@ public: bool Process(); void ReceiveData(uchar* buf, int len); void SendCharInfo(); - void SendMaxCharCreate(int max_chars); + void SendMaxCharCreate(); void SendMembership(); void SendMembershipSettings(); void EnterWorld(bool TryBootup = true); diff --git a/world/worlddb.cpp b/world/worlddb.cpp index e47d9d54a..4ba21101c 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -33,21 +33,20 @@ extern std::vector character_create_race_class_combos; // the current stuff is at the bottom of this function -void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) +void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **outApp, uint32 clientVersionBit) { - Inventory *inv = nullptr; - uint8 has_home = 0; - uint8 has_bind = 0; - - /* Initialize Variables */ - for (int i=0; i<10; i++) { - strcpy(cs->Name[i], ""); - cs->Zone[i] = 0; - cs->Level[i] = 0; - cs->Tutorial[i] = 0; - cs->GoHome[i] = 0; - } + /* Set Character Creation Limit */ + ClientVersion client_version = ClientVersionFromBit(clientVersionBit); + size_t character_limit = EQLimits::CharacterCreationLimit(client_version); + + // Validate against absolute server max + if (character_limit > EmuConstants::CHARACTER_CREATION_LIMIT) + character_limit = EmuConstants::CHARACTER_CREATION_LIMIT; + // Force Titanium clients to use '8' + if (client_version == ClientVersion::Titanium) + character_limit = 8; + /* Get Character Info */ std::string cquery = StringFormat( "SELECT " @@ -73,52 +72,93 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* "zone_id " // 19 "FROM " "character_data " - "WHERE `account_id` = %i ORDER BY `name` LIMIT 10 ", account_id); - auto results = database.QueryDatabase(cquery); int char_num = 0; - for (auto row = results.begin(); row != results.end() && char_num < 10; ++row, ++char_num) { + "WHERE `account_id` = %i ORDER BY `name` LIMIT %u", accountID, character_limit); + auto results = database.QueryDatabase(cquery); + + size_t character_count = results.RowCount(); + if (character_count == 0) { + *outApp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct)); + CharacterSelect_Struct *cs = (CharacterSelect_Struct *)(*outApp)->pBuffer; + cs->CharCount = 0; + cs->TotalChars = character_limit; + return; + } + + size_t packet_size = sizeof(CharacterSelect_Struct) + (sizeof(CharacterSelectEntry_Struct) * character_count); + *outApp = new EQApplicationPacket(OP_SendCharInfo, packet_size); + + unsigned char *buff_ptr = (*outApp)->pBuffer; + CharacterSelect_Struct *cs = (CharacterSelect_Struct *)buff_ptr; + + cs->CharCount = character_count; + cs->TotalChars = character_limit; + + buff_ptr += sizeof(CharacterSelect_Struct); + for (auto row = results.begin(); row != results.end(); ++row) { + CharacterSelectEntry_Struct *cse = (CharacterSelectEntry_Struct *)buff_ptr; PlayerProfile_Struct pp; + Inventory inv; + uint32 character_id = (uint32)atoi(row[0]); + uint8 has_home = 0; + uint8 has_bind = 0; + memset(&pp, 0, sizeof(PlayerProfile_Struct)); + + /* Fill CharacterSelectEntry_Struct */ + strcpy(cse->Name, row[1]); + cse->Class = (uint8)atoi(row[4]); + cse->Race = (uint32)atoi(row[3]); + cse->Level = (uint8)atoi(row[5]); + cse->ShroudClass = cse->Class; + cse->ShroudRace = cse->Race; + cse->Zone = (uint16)atoi(row[19]); + cse->Instance = 0; + cse->Gender = (uint8)atoi(row[2]); + cse->Face = (uint8)atoi(row[15]); + cse->Equip[0] = { 0 }; // Processed below + cse->Unknown15 = 0xFF; + cse->Unknown19 = 0xFF; + cse->DrakkinTattoo = (uint32)atoi(row[17]); + cse->DrakkinDetails = (uint32)atoi(row[18]); + cse->Deity = (uint32)atoi(row[6]); + cse->PrimaryIDFile = 0; // Processed Below + cse->SecondaryIDFile = 0; // Processed Below + cse->HairColor = (uint8)atoi(row[9]); + cse->BeardColor = (uint8)atoi(row[10]); + cse->EyeColor1 = (uint8)atoi(row[11]); + cse->EyeColor2 = (uint8)atoi(row[12]); + cse->HairStyle = (uint8)atoi(row[13]); + cse->Beard = (uint8)atoi(row[14]); + cse->Enabled = 1; + cse->Tutorial = 0; // Processed Below + cse->DrakkinHeritage = (uint32)atoi(row[16]); + cse->Unknown1 = 0; + cse->GoHome = 0; // Processed Below + cse->LastLogin = (uint32)atoi(row[7]); // RoF2 value: 1212696584 + cse->Unknown2 = 0; + /* Fill End */ - uint32 character_id = atoi(row[0]); - strcpy(cs->Name[char_num], row[1]); - uint8 lvl = atoi(row[5]); - cs->Level[char_num] = lvl; - cs->Class_[char_num] = atoi(row[4]); - cs->Race[char_num] = atoi(row[3]); - cs->Gender[char_num] = atoi(row[2]); - cs->Deity[char_num] = atoi(row[6]); - cs->Zone[char_num] = atoi(row[19]); - cs->Face[char_num] = atoi(row[15]); - cs->HairColor[char_num] = atoi(row[9]); - cs->BeardColor[char_num] = atoi(row[10]); - cs->EyeColor2[char_num] = atoi(row[12]); - cs->EyeColor1[char_num] = atoi(row[11]); - cs->HairStyle[char_num] = atoi(row[13]); - cs->Beard[char_num] = atoi(row[14]); - cs->DrakkinHeritage[char_num] = atoi(row[16]); - cs->DrakkinTattoo[char_num] = atoi(row[17]); - cs->DrakkinDetails[char_num] = atoi(row[18]); - - if (RuleB(World, EnableTutorialButton) && (lvl <= RuleI(World, MaxLevelForTutorial))) - cs->Tutorial[char_num] = 1; + if (RuleB(World, EnableTutorialButton) && (cse->Level <= RuleI(World, MaxLevelForTutorial))) { + cse->Tutorial = 1; + } if (RuleB(World, EnableReturnHomeButton)) { int now = time(nullptr); if ((now - atoi(row[7])) >= RuleI(World, MinOfflineTimeToReturnHome)) - cs->GoHome[char_num] = 1; + cse->GoHome = 1; } /* Set Bind Point Data for any character that may possibly be missing it for any reason */ cquery = StringFormat("SELECT `zone_id`, `instance_id`, `x`, `y`, `z`, `heading`, `is_home` FROM `character_bind` WHERE `id` = %i LIMIT 2", character_id); - auto results_bind = database.QueryDatabase(cquery); has_home = 0; has_bind = 0; + auto results_bind = database.QueryDatabase(cquery); for (auto row_b = results_bind.begin(); row_b != results_bind.end(); ++row_b) { if (row_b[6] && atoi(row_b[6]) == 1){ has_home = 1; } if (row_b[6] && atoi(row_b[6]) == 0){ has_bind = 1; } } - if (has_home == 0 || has_bind == 0){ + if (has_home == 0 || has_bind == 0) { cquery = StringFormat("SELECT `zone_id`, `bind_id`, `x`, `y`, `z` FROM `start_zones` WHERE `player_class` = %i AND `player_deity` = %i AND `player_race` = %i", - cs->Class_[char_num], cs->Deity[char_num], cs->Race[char_num]); + cse->Class, cse->Deity, cse->Race); auto results_bind = database.QueryDatabase(cquery); for (auto row_d = results_bind.begin(); row_d != results_bind.end(); ++row_d) { /* If a bind_id is specified, make them start there */ @@ -134,32 +174,87 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* float z = atof(row_d[4]); if (x == 0 && y == 0 && z == 0){ GetSafePoints(pp.binds[4].zoneId, 0, &x, &y, &z); } pp.binds[4].x = x; pp.binds[4].y = y; pp.binds[4].z = z; - } } pp.binds[0] = pp.binds[4]; /* If no home bind set, set it */ - if (has_home == 0){ + if (has_home == 0) { std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" " VALUES (%u, %u, %u, %f, %f, %f, %f, %i)", character_id, pp.binds[4].zoneId, 0, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z, pp.binds[4].heading, 1); - auto results_bset = QueryDatabase(query); + auto results_bset = QueryDatabase(query); } /* If no regular bind set, set it */ - if (has_bind == 0){ + if (has_bind == 0) { std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" " VALUES (%u, %u, %u, %f, %f, %f, %f, %i)", character_id, pp.binds[0].zoneId, 0, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z, pp.binds[0].heading, 0); - auto results_bset = QueryDatabase(query); + auto results_bset = QueryDatabase(query); } } /* Bind End */ + /* Load Inventory */ + // If we ensure that the material data is updated appropriately, we can do away with inventory loads + if (GetInventory(accountID, cse->Name, &inv)) { + const Item_Struct* item = nullptr; + const ItemInst* inst = nullptr; + int16 invslot = 0; + + for (uint32 matslot = 0; matslot < _MaterialCount; matslot++) { + invslot = Inventory::CalcSlotFromMaterial(matslot); + if (invslot == INVALID_INDEX) { continue; } + inst = inv.GetItem(invslot); + if (inst == nullptr) { continue; } + item = inst->GetItem(); + if (item == nullptr) { continue; } + + if (matslot > 6) { + uint32 idfile = 0; + // Weapon Models + if (inst->GetOrnamentationIDFile() != 0) { + idfile = inst->GetOrnamentationIDFile(); + cse->Equip[matslot].Material = idfile; + } + else { + if (strlen(item->IDFile) > 2) { + idfile = atoi(&item->IDFile[2]); + cse->Equip[matslot].Material = idfile; + } + } + if (matslot == MaterialPrimary) { + cse->PrimaryIDFile = idfile; + } + else { + cse->SecondaryIDFile = idfile; + } + } + else { + uint32 color = 0; + if (pp.item_tint[matslot].RGB.UseTint) { + color = pp.item_tint[matslot].Color; + } + else { + color = inst->GetColor(); + } + + // Armor Materials/Models + cse->Equip[matslot].Material = item->Material; + cse->Equip[matslot].EliteMaterial = item->EliteMaterial; + cse->Equip[matslot].HeroForgeModel = inst->GetOrnamentHeroModel(matslot); + cse->Equip[matslot].Color.Color = color; + } + } + } + else { + printf("Error loading inventory for %s\n", cse->Name); + } + /* Load Inventory End */ + /* Load Character Material Data for Char Select */ cquery = StringFormat("SELECT slot, red, green, blue, use_tint, color FROM `character_material` WHERE `id` = %u", character_id); auto results_b = database.QueryDatabase(cquery); uint8 slot = 0; - for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) - { + for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) { slot = atoi(row_b[0]); pp.item_tint[slot].RGB.Red = atoi(row_b[1]); pp.item_tint[slot].RGB.Green = atoi(row_b[2]); @@ -167,81 +262,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* pp.item_tint[slot].RGB.UseTint = atoi(row_b[4]); } - /* Load Inventory */ - // If we ensure that the material data is updated appropriately, we can do away with inventory loads - inv = new Inventory; - if (GetInventory(account_id, cs->Name[char_num], inv)) - { - const Item_Struct* item = nullptr; - const ItemInst* inst = nullptr; - int16 invslot = 0; - - for (uint32 matslot = 0; matslot < _MaterialCount; matslot++) - { - invslot = Inventory::CalcSlotFromMaterial(matslot); - if (invslot == INVALID_INDEX) { continue; } - - inst = inv->GetItem(invslot); - if (inst == nullptr) { continue; } - - item = inst->GetItem(); - if (item == nullptr) { continue; } - - if (matslot > 6) - { - uint32 idfile = 0; - // Weapon Models - if (inst->GetOrnamentationIDFile() != 0) - { - idfile = inst->GetOrnamentationIDFile(); - cs->Equip[char_num][matslot].Material = idfile; - } - else - { - if (strlen(item->IDFile) > 2) - { - idfile = atoi(&item->IDFile[2]); - cs->Equip[char_num][matslot].Material = idfile; - } - } - if (matslot == MaterialPrimary) - { - cs->Primary[char_num] = idfile; - } - else - { - cs->Secondary[char_num] = idfile; - } - } - else - { - uint32 color = 0; - if (pp.item_tint[matslot].RGB.UseTint) - { - color = pp.item_tint[matslot].Color; - } - else - { - color = inst->GetColor(); - } - - // Armor Materials/Models - cs->Equip[char_num][matslot].Material = item->Material; - cs->Equip[char_num][matslot].EliteMaterial = item->EliteMaterial; - cs->Equip[char_num][matslot].HeroForgeModel = inst->GetOrnamentHeroModel(matslot); - cs->Equip[char_num][matslot].Color.Color = color; - } - } - } - else - { - printf("Error loading inventory for %s\n", cs->Name[char_num]); - } - - safe_delete(inv); + buff_ptr += sizeof(CharacterSelectEntry_Struct); } - - return; } int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { diff --git a/world/worlddb.h b/world/worlddb.h index 166248e72..b0c2ff221 100644 --- a/world/worlddb.h +++ b/world/worlddb.h @@ -20,6 +20,7 @@ #include "../common/shareddb.h" #include "../common/zone_numbers.h" +#include "../common/eq_packet.h" struct PlayerProfile_Struct; struct CharCreate_Struct; @@ -29,7 +30,7 @@ struct CharacterSelect_Struct; class WorldDatabase : public SharedDatabase { public: bool GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc, bool isTitanium); - void GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*, uint32 ClientVersion); + void GetCharSelectInfo(uint32 accountID, EQApplicationPacket **outApp, uint32 clientVersionBit); int MoveCharacterToBind(int CharID, uint8 bindnum = 0); void GetLauncherList(std::vector &result); From e7fc6420f2b60168ab2675d1bc88a6b1185379a4 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 17 Feb 2015 19:35:50 -0500 Subject: [PATCH 8/8] Added changelog entry for character limit --- changelog.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/changelog.txt b/changelog.txt index c04647bbc..393a954c8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,16 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 02/17/2015 == +Uleat: Implemented per-client character creation limiting. Caps are unknown atm..so, don't get over-zealous! +Notes: + - Titanium is hard-coded to min/max of 8 in both the server and client translator code (client doesn't support variations in available character count) + - SoF thru RoF2 have had their max characters raised to 12 from 10 + - Changing the number of characters per account is accomplished by: + 1) Setting consts::CHARACTER_CREATION_LIMIT to the desired count in the client's constants file in ../common/patches/ + 2) Ensuring that eq_dictionary's EmuConstants::CHARACTER_CREATION_LIMIT is equal-greater than the client's new value..referencing is good + 3) Recompiling the server code + - A rules-based qualifier may be added at some point + == 02/16/2015 == Trevius: (RoF2) Bazaar Trading (Buying/Selling) is now fully functional. Bazaar (/bazaar) search is not yet functional. demonstar55: (RoF2) Send the bard focus effects, note custom servers will need to fix their items, server side we still use the old system, but RoF2 wasn't showing anything with not sending focus, so send them